commit be6dff68be9ad15245896b0b7868369c6e3716ac (HEAD, refs/remotes/origin/master) Author: Eric S. Raymond Date: Thu Dec 11 23:29:41 2014 -0500 latest-on-branch-p is no longer a public method * vc/vc-dav.el, vc/vc-git.el, vc/vc-hg.el, vc/vc-src.el, vc/vc.el: latest-on-branch-p is no longer a public method. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5916f29..75effaa 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2014-12-12 Eric S. Raymond + * vc/vc-dav.el, vc/vc-git.el, vc/vc-hg.el, vc/vc-src.el, + vc/vc.el: latest-on-branch-p is no longer a public method. + * vc/vc.el, vc/vc-hg.el, vc/vc-git.el, vc/vc-hooks.el, vc/vc-mtn.el, vc/vc-rcs.el, vc/vc-sccs.el, vc/vc-src.el: rrollback method removed, to be replaced in the future by uncommit. diff --git a/lisp/vc/vc-dav.el b/lisp/vc/vc-dav.el index 4271cf7..4c3fe6a 100644 --- a/lisp/vc/vc-dav.el +++ b/lisp/vc/vc-dav.el @@ -147,10 +147,6 @@ It should return a status of either 0 (no differences found), or ;;; Unimplemented functions ;; -;; vc-dav-latest-on-branch-p(URL) -;; Return non-nil if the current workfile version of FILE is the -;; latest on its branch. There are no branches in webdav yet. -;; ;; vc-dav-mode-line-string(url) ;; Return a dav-specific mode line string for URL. Are there any ;; specific states that we want exposed? diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index b5e92bb..c41dde1 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -52,7 +52,6 @@ ;; * state (file) OK ;; - dir-status-files (dir files uf) OK ;; * working-revision (file) OK -;; - latest-on-branch-p (file) NOT NEEDED ;; * checkout-model (files) OK ;; - mode-line-string (file) OK ;; STATE-CHANGING FUNCTIONS diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index 9037083..0d9f9f1 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -47,7 +47,6 @@ ;; - dir-extra-headers (dir) OK ;; - dir-printer (fileinfo) OK ;; * working-revision (file) OK -;; - latest-on-branch-p (file) ?? ;; * checkout-model (files) OK ;; - mode-line-string (file) NOT NEEDED ;; STATE-CHANGING FUNCTIONS diff --git a/lisp/vc/vc-src.el b/lisp/vc/vc-src.el index 6ba8b8c..539437d 100644 --- a/lisp/vc/vc-src.el +++ b/lisp/vc/vc-src.el @@ -35,7 +35,6 @@ ;; - dir-extra-headers (dir) NOT NEEDED ;; - dir-printer (fileinfo) ?? ;; * working-revision (file) OK -;; - latest-on-branch-p (file) ?? ;; * checkout-model (files) OK ;; - mode-line-string (file) NOT NEEDED ;; STATE-CHANGING FUNCTIONS diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index c6721cb..07a3394 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -52,9 +52,9 @@ ;; This mode is fully documented in the Emacs user's manual. ;; -;; Supported version-control systems presently include CVS, RCS, SRC, GNU -;; Arch, Subversion, Bzr, Git, Mercurial, Monotone and SCCS -;; (or its free replacement, CSSC). +;; Supported version-control systems presently include CVS, RCS, SRC, +;; GNU Subversion, Bzr, Git, Mercurial, Monotone and SCCS (or its free +;; replacement, CSSC). ;; ;; If your site uses the ChangeLog convention supported by Emacs, the ;; function `log-edit-comment-to-change-log' could prove a useful checkin hook, @@ -180,13 +180,6 @@ ;; head or tip revision. Should return "0" for a file added but not yet ;; committed. ;; -;; - latest-on-branch-p (file) -;; -;; Return non-nil if the working revision of FILE is the latest revision -;; on its branch (many VCSes call this the 'tip' or 'head' revision). -;; The default implementation always returns t, which means that -;; working with non-current revisions is not supported by default. -;; ;; * checkout-model (files) ;; ;; Indicate whether FILES need to be "checked out" before they can be @@ -604,6 +597,11 @@ ;; ;; - The rollback method (implemented by RCS and SCCS only) is gone. See ;; the to-do note on uncommit. +;; +;; - latest-on-branch-p is no longer a public method. It was to be used +;; for implementing rollback. RCS keeps its implementation (the only one) +;; for internal use. + ;;; Todo: @@ -635,16 +633,6 @@ ;; ;; - Add the ability to list tags and branches. ;; -;;;; Internal cleanups: -;; -;; - Another important thing: merge all the status-like backend -;; operations. We should remove dir-status-files and state and -;; replace them with just `status' which takes a fileset and a -;; continuation (like dir-status-files) and returns a buffer in -;; which the process(es) are run (or nil if it worked -;; synchronously). Hopefully we can define the old operations in -;; term of this one. -;; ;;;; Unify two different versions of the amend capability ;; ;; - Some back ends (SCCS/RCS/SVN/SRC), have an amend capability that can @@ -1462,9 +1450,7 @@ After check-out, runs the normal hook `vc-checkout-hook'." (signal (car err) (cdr err)))) `((vc-state . ,(if (or (eq (vc-checkout-model backend (list file)) 'implicit) nil) - (if (vc-call-backend backend 'latest-on-branch-p file) - 'up-to-date - 'needs-update) + 'up-to-date 'edited)) (vc-checkout-time . ,(nth 5 (file-attributes file)))))) (vc-resynch-buffer file t t) @@ -2737,12 +2723,6 @@ log entries should be gathered." The default is to return nil always." nil) -(defun vc-default-latest-on-branch-p (_backend _file) - "Return non-nil if FILE is the latest on its branch. -This default implementation always returns non-nil, which means that -editing non-current revisions is not supported by default." - t) - (defun vc-default-find-revision (backend file rev buffer) "Provide the new `find-revision' op based on the old `checkout' op. This is only for compatibility with old backends. They should be updated commit ea8b9df12e38775600e850b8a57add2cf523bde5 Author: Eric S. Raymond Date: Thu Dec 11 22:44:32 2014 -0500 Remove VC rollback method. * vc/vc.el, vc/vc-hg.el, vc/vc-git.el, vc/vc-hooks.el, vc/vc-mtn.el, vc/vc-rcs.el, vc/vc-sccs.el, vc/vc-src.el: rrollback method removed, to be replaced in the future by uncommit. diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 5fb1551..63cd1ae 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -1018,8 +1018,6 @@ Revert the work file(s) in the current VC fileset to the last revision (@code{vc-revert}). @end table -@c `C-x v c' (vc-rollback) was removed, since it's RCS/SCCS specific. - @kindex C-x v u @findex vc-revert @vindex vc-revert-show-diff diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 452f4c3..5916f29 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2014-12-12 Eric S. Raymond + + * vc/vc.el, vc/vc-hg.el, vc/vc-git.el, vc/vc-hooks.el, + vc/vc-mtn.el, vc/vc-rcs.el, vc/vc-sccs.el, vc/vc-src.el: rrollback + method removed, to be replaced in the future by uncommit. + 2014-12-11 Michael Albinus * vc/vc-hg.el (vc-hg-state): Make FILE absolute. Handle the case diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 048857b..b5e92bb 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -65,7 +65,6 @@ ;; * find-revision (file rev buffer) OK ;; * checkout (file &optional rev) OK ;; * revert (file &optional contents-done) OK -;; - rollback (files) COULD BE SUPPORTED ;; - merge-file (file rev1 rev2) It would be possible to merge ;; changes into a single file, but ;; when committing they wouldn't diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index e049aab..9037083 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -60,7 +60,6 @@ ;; * find-revision (file rev buffer) OK ;; * checkout (file &optional rev) OK ;; * revert (file &optional contents-done) OK -;; - rollback (files) ?? PROBABLY NOT NEEDED ;; - merge (file rev1 rev2) NEEDED ;; - merge-news (file) NEEDED ;; - steal-lock (file &optional revision) NOT NEEDED diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 0ffca56..5448f38 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -868,7 +868,6 @@ current, and kill the buffer that visits the link." (let ((map (make-sparse-keymap))) (define-key map "a" 'vc-update-change-log) (define-key map "b" 'vc-switch-backend) - (define-key map "c" 'vc-rollback) (define-key map "d" 'vc-dir) (define-key map "g" 'vc-annotate) (define-key map "G" 'vc-ignore) @@ -938,13 +937,6 @@ current, and kill the buffer that visits the link." '(menu-item "Insert Header" vc-insert-headers :help "Insert headers into a file for use with a version control system. ")) - (bindings--define-key map [undo] - '(menu-item "Undo Last Check-In" vc-rollback - :enable (let ((backend (if buffer-file-name - (vc-backend buffer-file-name)))) - (or (not backend) - (vc-find-backend-function backend 'rollback))) - :help "Remove the most recent changeset committed to the repository")) (bindings--define-key map [vc-revert] '(menu-item "Revert to Base Version" vc-revert :help "Revert working copies of the selected file set to their repository contents")) diff --git a/lisp/vc/vc-mtn.el b/lisp/vc/vc-mtn.el index 57225f5..7d2f734 100644 --- a/lisp/vc/vc-mtn.el +++ b/lisp/vc/vc-mtn.el @@ -202,9 +202,6 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." (unless contents-done (vc-mtn-command nil 0 file "revert"))) -;; (defun vc-mtn-rollback (files) -;; ) - (defun vc-mtn-print-log (files buffer &optional _shortlog start-revision limit) "Print commit logs associated with FILES into specified BUFFER. _SHORTLOG is ignored. diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el index 9bb9af1..8866bdb 100644 --- a/lisp/vc/vc-rcs.el +++ b/lisp/vc/vc-rcs.el @@ -432,43 +432,6 @@ attempt the checkout for all registered files beneath it." new-version))))) (message "Checking out %s...done" file)))))) -(defun vc-rcs-rollback (files) - "Roll back, undoing the most recent checkins of FILES. Directories are -expanded to all registered subfiles in them." - (if (not files) - (error "RCS backend doesn't support directory-level rollback")) - (dolist (file (vc-expand-dirs files 'RCS)) - (let* ((discard (vc-working-revision file)) - (previous (if (vc-rcs-trunk-p discard) "" (vc-branch-part discard))) - (config (current-window-configuration)) - (done nil)) - (if (null (yes-or-no-p (format "Remove version %s from %s history? " - discard file))) - (error "Aborted")) - (message "Removing revision %s from %s." discard file) - (vc-do-command "*vc*" 0 "rcs" (vc-master-name file) (concat "-o" discard)) - ;; Check out the most recent remaining version. If it - ;; fails, because the whole branch got deleted, do a - ;; double-take and check out the version where the branch - ;; started. - (while (not done) - (condition-case err - (progn - (vc-do-command "*vc*" 0 "co" (vc-master-name file) "-f" - (concat "-u" previous)) - (setq done t)) - (error (set-buffer "*vc*") - (goto-char (point-min)) - (if (search-forward "no side branches present for" nil t) - (progn (setq previous (vc-branch-part previous)) - (vc-rcs-set-default-branch file previous) - ;; vc-do-command popped up a window with - ;; the error message. Get rid of it, by - ;; restoring the old window configuration. - (set-window-configuration config)) - ;; No, it was some other error: re-signal it. - (signal (car err) (cdr err))))))))) - (defun vc-rcs-revert (file &optional _contents-done) "Revert FILE to the version it was based on. If FILE is a directory, revert all registered files beneath it." diff --git a/lisp/vc/vc-sccs.el b/lisp/vc/vc-sccs.el index a8e122d..6362864 100644 --- a/lisp/vc/vc-sccs.el +++ b/lisp/vc/vc-sccs.el @@ -271,22 +271,6 @@ locked. REV is the revision to check out." switches)))) (message "Checking out %s...done" file)))) -(defun vc-sccs-rollback (files) - "Roll back, undoing the most recent checkins of FILES. Directories -are expanded to all version-controlled subfiles." - (setq files (vc-expand-dirs files 'SCCS)) - (if (not files) - (error "SCCS backend doesn't support directory-level rollback")) - (dolist (file files) - (let ((discard (vc-working-revision file))) - (if (null (yes-or-no-p (format "Remove version %s from %s history? " - discard file))) - (error "Aborted")) - (message "Removing revision %s from %s..." discard file) - (vc-sccs-do-command nil 0 "rmdel" - (vc-master-name file) (concat "-r" discard)) - (vc-sccs-do-command nil 0 "get" (vc-master-name file) nil)))) - (defun vc-sccs-revert (file &optional _contents-done) "Revert FILE to the version it was based on. If FILE is a directory, revert all subfiles." diff --git a/lisp/vc/vc-src.el b/lisp/vc/vc-src.el index 36d6a20..6ba8b8c 100644 --- a/lisp/vc/vc-src.el +++ b/lisp/vc/vc-src.el @@ -48,7 +48,6 @@ ;; * find-revision (file rev buffer) OK ;; * checkout (file &optional rev) OK ;; * revert (file &optional contents-done) OK -;; - rollback (files) NOT NEEDED ;; - merge (file rev1 rev2) NOT NEEDED ;; - merge-news (file) NOT NEEDED ;; - steal-lock (file &optional revision) NOT NEEDED diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 3ea4809..c6721cb 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -46,7 +46,7 @@ ;; If you maintain a client of the mode or customize it in your .emacs, ;; note that some backend functions which formerly took single file arguments ;; now take a list of files. These include: register, checkin, print-log, -;; rollback, and diff. +;; and diff. ;;; Commentary: @@ -276,15 +276,6 @@ ;; If FILE is in the `added' state it should be returned to the ;; `unregistered' state. ;; -;; - rollback (files) -;; -;; Remove the tip revision of each of FILES from the repository. If -;; this function is not provided, trying to cancel a revision is -;; caught as an error. (Most backends don't provide it.) (Also -;; note that older versions of this backend command were called -;; 'cancel-version' and took a single file arg, not a list of -;; files.) -;; ;; - merge-file (file rev1 rev2) ;; ;; Merge the changes between REV1 and REV2 into the current working @@ -599,17 +590,28 @@ ;; variable are gone. These have't made sense on anything shipped ;; since RCS, and using them was a dumb stunt even on RCS. ;; -;; workfile-unchanged-p is no longer a public back-end method. It +;; - workfile-unchanged-p is no longer a public back-end method. It ;; was redundant with vc-state and usually implemented with a trivial ;; call to it. A few older back ends retain versions for internal use in ;; their vc-state functions. ;; -;; could-register is no longer a public method. Only vc-cvs ever used it +;; - could-register is no longer a public method. Only vc-cvs ever used it +;; +;; The vc-keep-workfiles configuration variable is gone. Used only by +;; the RCS and SCCS backends, it was an invitation to shoot self in foot +;; when set to the (non-default) value nil. The original justication +;; for it (saving disk space) is long obsolete. +;; +;; - The rollback method (implemented by RCS and SCCS only) is gone. See +;; the to-do note on uncommit. ;;; Todo: ;;;; New Primitives: ;; +;; - uncommit: undo last checkin, leave changes in place in the workfile, +;; stash the commit comment for re-use. +;; ;; - deal with push operations. ;; ;;;; Primitives that need changing: @@ -2428,58 +2430,6 @@ to the working revision (except for keyword expansion)." (message "Reverting %s...done" (vc-delistify files))))) ;;;###autoload -(defun vc-rollback () - "Roll back (remove) the most recent changeset committed to the repository. -This may be either a file-level or a repository-level operation, -depending on the underlying version-control system." - (interactive) - (let* ((vc-fileset (vc-deduce-fileset)) - (backend (car vc-fileset)) - (files (cadr vc-fileset)) - (granularity (vc-call-backend backend 'revision-granularity))) - (unless (vc-find-backend-function backend 'rollback) - (error "Rollback is not supported in %s" backend)) - (when (and (not (eq granularity 'repository)) (/= (length files) 1)) - (error "Rollback requires a singleton fileset or repository versioning")) - ;; FIXME: latest-on-branch-p should take the fileset. - (when (not (vc-call-backend backend 'latest-on-branch-p (car files))) - (error "Rollback is only possible at the tip revision")) - ;; If any of the files is visited by the current buffer, make - ;; sure buffer is saved. If the user says `no', abort since - ;; we cannot show the changes and ask for confirmation to - ;; discard them. - (when (or (not files) (memq (buffer-file-name) files)) - (vc-buffer-sync nil)) - (dolist (file files) - (when (buffer-modified-p (get-file-buffer file)) - (error "Please kill or save all modified buffers before rollback")) - (when (not (vc-up-to-date-p file)) - (error "Please revert all modified workfiles before rollback"))) - ;; Accumulate changes associated with the fileset - (vc-setup-buffer "*vc-diff*") - (set-buffer-modified-p nil) - (message "Finding changes...") - (let* ((tip (vc-working-revision (car files))) - ;; FIXME: `previous-revision' should take the fileset. - (previous (vc-call-backend backend 'previous-revision - (car files) tip))) - (vc-diff-internal nil vc-fileset previous tip)) - ;; Display changes - (unless (yes-or-no-p "Discard these revisions? ") - (error "Rollback canceled")) - (quit-windows-on "*vc-diff*") - ;; Do the actual reversions - (message "Rolling back %s..." (vc-delistify files)) - (with-vc-properties - files - (vc-call-backend backend 'rollback files) - `((vc-state . ,'up-to-date) - (vc-checkout-time . , (nth 5 (file-attributes file))) - (vc-working-revision . nil))) - (dolist (f files) (vc-resynch-buffer f t t)) - (message "Rolling back %s...done" (vc-delistify files)))) - -;;;###autoload (define-obsolete-function-alias 'vc-revert-buffer 'vc-revert "23.1") ;;;###autoload commit aeeaf082e69ec088d6bbb140ddf0ce8119580a67 Author: Stefan Monnier Date: Thu Dec 11 16:07:23 2014 -0500 Fixes: debbugs:19161 * src/fileio.c: Better preserve window-points during revert. (Qget_buffer_window_list): New var. (get_window_points_and_markers, restore_window_points): New functions. (Finsert_file_contents): Use them to save and restore window-points. diff --git a/src/ChangeLog b/src/ChangeLog index 27c0858..887ca89 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2014-12-11 Stefan Monnier + + * fileio.c: Better preserve window-points during revert (bug#19161). + (Qget_buffer_window_list): New var. + (get_window_points_and_markers, restore_window_points): New functions. + (Finsert_file_contents): Use them to save and restore window-points. + 2014-12-11 Dmitry Antipov * xterm.c (x_delete_terminal): Call emacs_close for X connection @@ -13,15 +20,14 @@ its initial value. (bidi_cache_search): Handle overflown cache. Improve commentary. (bidi_cache_ensure_space): Limit allocations to the current value - of bidi_cache_max_elts. Force xpalloc not to over-allocate. If - less than a full BIDI_CACHE_CHUNK is left to the limit, decrease + of bidi_cache_max_elts. Force xpalloc not to over-allocate. + If less than a full BIDI_CACHE_CHUNK is left to the limit, decrease the increment to not exceed the limit. (bidi_cache_iterator_state): Now returns non-zero if succeeded to cache, zero otherwise (meaning the cache overflowed). In the latter case, set bidi_cache_last_idx to -1. (bidi_peek_at_next_level): Handle overflown cache. - (bidi_push_it): Increase the cache limit for iterating the new - object. + (bidi_push_it): Increase the cache limit for iterating the new object. (bidi_pop_it): Decrease the cache limit back to previous value. (bidi_shelve_cache): Shelve the current value of the cache limit. (bidi_unshelve_cache): Restore the value of cache limit. @@ -280,8 +286,8 @@ * xml.c (parse_region): Take care of new optional parameter 'discard-comments' of 'libxml-parse(html|xml)-region'. - (Flibxml_parse_html_region, Flibxml_parse_xml_region): New - optional parameter 'discard-comments'. + (Flibxml_parse_html_region, Flibxml_parse_xml_region): + New optional parameter 'discard-comments'. 2014-11-17 Paul Eggert @@ -333,8 +339,8 @@ 2014-11-16 Eli Zaretskii * window.c (window_scroll_pixel_based): Avoid truncation/rounding - errors in computing the number of pixels to scroll. Suggested by - Kelly Dean . (Bug#19060) + errors in computing the number of pixels to scroll. + Suggested by Kelly Dean . (Bug#19060) 2014-11-16 Jan Djärv @@ -444,15 +450,15 @@ * frame.h (frame): Split `official' into `can_x_set_window_size' and `can_run_window_configuration_change_hook'. * nsfns.m (Fx_create_frame): Set f->can_x_set_window_size. - * w32fns.c (Fx_create_frame, x_create_tip_frame): Set - f->can_x_set_window_size. - * window.c (run_window_configuration_change_hook): Return - immediately if either f->can_x_set_window_size or + * w32fns.c (Fx_create_frame, x_create_tip_frame): + Set f->can_x_set_window_size. + * window.c (run_window_configuration_change_hook): + Return immediately if either f->can_x_set_window_size or f->can_run_window_configuration_change_hook are false. (Fset_window_configuration): Instead of f->official set f->can_x_set_window_size. - * xfns.c (Fx_create_frame, x_create_tip_frame): Set - f->can_x_set_window_size. + * xfns.c (Fx_create_frame, x_create_tip_frame): + Set f->can_x_set_window_size. 2014-11-08 Jan Djärv diff --git a/src/fileio.c b/src/fileio.c index b8dec3a..83b4954 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -148,6 +148,7 @@ static Lisp_Object Qcopy_directory; static Lisp_Object Qdelete_directory; static Lisp_Object Qsubstitute_env_in_file_name; +static Lisp_Object Qget_buffer_window_list; Lisp_Object Qfile_error, Qfile_notify_error; static Lisp_Object Qfile_already_exists, Qfile_date_error; @@ -197,7 +198,7 @@ check_writable (const char *filename, int amode) bool res = faccessat (AT_FDCWD, filename, amode, AT_EACCESS) == 0; #ifdef CYGWIN /* faccessat may have returned failure because Cygwin couldn't - determine the file's UID or GID; if so, we return success. */ + determine the file's UID or GID; if so, we return success. */ if (!res) { int faccessat_errno = errno; @@ -3410,6 +3411,56 @@ time_error_value (int errnum) return make_timespec (0, ns); } +static Lisp_Object +get_window_points_and_markers (void) +{ + Lisp_Object pt_marker = Fpoint_marker (); + Lisp_Object windows + = call3 (Qget_buffer_window_list, Fcurrent_buffer (), Qnil, Qt); + Lisp_Object window_markers = windows; + /* Window markers (and point) are handled specially: rather than move to + just before or just after the modified text, we try to keep the + markers at the same distance (bug#19161). + In general, this is wrong, but for window-markers, this should be harmless + and is convenient for the end user when most of the file is unmodified, + except for a few minor details near the beginning and near the end. */ + for (; CONSP (windows); windows = XCDR (windows)) + if (WINDOWP (XCAR (windows))) + { + Lisp_Object window_marker = XWINDOW (XCAR (windows))->pointm; + XSETCAR (windows, + Fcons (window_marker, Fmarker_position (window_marker))); + } + return Fcons (Fcons (pt_marker, Fpoint ()), window_markers); +} + +static void +restore_window_points (Lisp_Object window_markers, ptrdiff_t inserted, + ptrdiff_t same_at_start, ptrdiff_t same_at_end) +{ + for (; CONSP (window_markers); window_markers = XCDR (window_markers)) + if (CONSP (XCAR (window_markers))) + { + Lisp_Object car = XCAR (window_markers); + Lisp_Object marker = XCAR (car); + Lisp_Object oldpos = XCDR (car); + if (MARKERP (marker) && INTEGERP (oldpos) + && XINT (oldpos) > same_at_start + && XINT (oldpos) < same_at_end) + { + ptrdiff_t oldsize = same_at_end - same_at_start; + ptrdiff_t newsize = inserted; + double growth = newsize / (double)oldsize; + ptrdiff_t newpos + = same_at_start + growth * (XINT (oldpos) - same_at_start); + Fset_marker (marker, make_number (newpos), Qnil); + } + } +} + +/* FIXME: insert-file-contents should be split with the top-level moved to + Elisp and only the core kept in C. */ + DEFUN ("insert-file-contents", Finsert_file_contents, Sinsert_file_contents, 1, 5, 0, doc: /* Insert contents of file FILENAME after point. @@ -3454,18 +3505,23 @@ by calling `format-decode', which see. */) int save_errno = 0; char read_buf[READ_BUF_SIZE]; struct coding_system coding; - bool replace_handled = 0; - bool set_coding_system = 0; + bool replace_handled = false; + bool set_coding_system = false; Lisp_Object coding_system; - bool read_quit = 0; + bool read_quit = false; /* If the undo log only contains the insertion, there's no point keeping it. It's typically when we first fill a file-buffer. */ bool empty_undo_list_p = (!NILP (visit) && NILP (BVAR (current_buffer, undo_list)) && BEG == Z); Lisp_Object old_Vdeactivate_mark = Vdeactivate_mark; - bool we_locked_file = 0; + bool we_locked_file = false; ptrdiff_t fd_index; + Lisp_Object window_markers = Qnil; + /* same_at_start and same_at_end count bytes, because file access counts + bytes and BEG and END count bytes. */ + ptrdiff_t same_at_start = BEGV_BYTE; + ptrdiff_t same_at_end = ZV_BYTE; if (current_buffer->base_buffer && ! NILP (visit)) error ("Cannot do file visiting in an indirect buffer"); @@ -3521,7 +3577,11 @@ by calling `format-decode', which see. */) /* Replacement should preserve point as it preserves markers. */ if (!NILP (replace)) - record_unwind_protect (restore_point_unwind, Fpoint_marker ()); + { + window_markers = get_window_points_and_markers (); + record_unwind_protect (restore_point_unwind, + XCAR (XCAR (window_markers))); + } if (fstat (fd, &st) != 0) report_file_error ("Input file status", orig_filename); @@ -3599,14 +3659,14 @@ by calling `format-decode', which see. */) } /* Prevent redisplay optimizations. */ - current_buffer->clip_changed = 1; + current_buffer->clip_changed = true; if (EQ (Vcoding_system_for_read, Qauto_save_coding)) { coding_system = coding_inherit_eol_type (Qutf_8_emacs, Qunix); setup_coding_system (coding_system, &coding); /* Ensure we set Vlast_coding_system_used. */ - set_coding_system = 1; + set_coding_system = true; } else if (BEG < Z) { @@ -3712,7 +3772,7 @@ by calling `format-decode', which see. */) setup_coding_system (coding_system, &coding); /* Ensure we set Vlast_coding_system_used. */ - set_coding_system = 1; + set_coding_system = true; } /* If requested, replace the accessible part of the buffer @@ -3734,16 +3794,11 @@ by calling `format-decode', which see. */) && (NILP (coding_system) || ! CODING_REQUIRE_DECODING (&coding))) { - /* same_at_start and same_at_end count bytes, - because file access counts bytes - and BEG and END count bytes. */ - ptrdiff_t same_at_start = BEGV_BYTE; - ptrdiff_t same_at_end = ZV_BYTE; ptrdiff_t overlap; /* There is still a possibility we will find the need to do code conversion. If that happens, set this variable to give up on handling REPLACE in the optimized way. */ - bool giveup_match_end = 0; + bool giveup_match_end = false; if (beg_offset != 0) { @@ -3777,7 +3832,7 @@ by calling `format-decode', which see. */) /* We found that the file should be decoded somehow. Let's give up here. */ { - giveup_match_end = 1; + giveup_match_end = true; break; } @@ -3790,7 +3845,7 @@ by calling `format-decode', which see. */) if (bufpos != nread) break; } - immediate_quit = 0; + immediate_quit = false; /* If the file matches the buffer completely, there's no need to replace anything. */ if (same_at_start - BEGV_BYTE == end_offset - beg_offset) @@ -3802,7 +3857,7 @@ by calling `format-decode', which see. */) del_range_1 (same_at_start, same_at_end, 0, 0); goto handled; } - immediate_quit = 1; + immediate_quit = true; QUIT; /* Count how many chars at the end of the file match the text at the end of the buffer. But, if we have @@ -3853,7 +3908,7 @@ by calling `format-decode', which see. */) && FETCH_BYTE (same_at_end - 1) >= 0200 && ! NILP (BVAR (current_buffer, enable_multibyte_characters)) && (CODING_MAY_REQUIRE_DECODING (&coding))) - giveup_match_end = 1; + giveup_match_end = true; break; } @@ -3906,7 +3961,7 @@ by calling `format-decode', which see. */) if (XBUFFER (XWINDOW (selected_window)->contents) == current_buffer) XWINDOW (selected_window)->start_at_line_beg = !NILP (Fbolp ()); - replace_handled = 1; + replace_handled = true; } } @@ -3921,8 +3976,6 @@ by calling `format-decode', which see. */) in a more optimized way. */ if (!NILP (replace) && ! replace_handled && BEGV < ZV) { - ptrdiff_t same_at_start = BEGV_BYTE; - ptrdiff_t same_at_end = ZV_BYTE; ptrdiff_t same_at_start_charpos; ptrdiff_t inserted_chars; ptrdiff_t overlap; @@ -3986,7 +4039,7 @@ by calling `format-decode', which see. */) } coding_system = CODING_ID_NAME (coding.id); - set_coding_system = 1; + set_coding_system = true; decoded = BUF_BEG_ADDR (XBUFFER (conversion_buffer)); inserted = (BUF_Z_BYTE (XBUFFER (conversion_buffer)) - BUF_BEG_BYTE (XBUFFER (conversion_buffer))); @@ -4111,7 +4164,7 @@ by calling `format-decode', which see. */) /* Make binding buffer-file-name to nil effective. */ && !NILP (BVAR (current_buffer, filename)) && SAVE_MODIFF >= MODIFF) - we_locked_file = 1; + we_locked_file = true; prepare_to_modify_buffer (PT, PT, NULL); } @@ -4141,7 +4194,7 @@ by calling `format-decode', which see. */) while (how_much < total) { - /* try is reserved in some compilers (Microsoft C) */ + /* `try' is reserved in some compilers (Microsoft C). */ ptrdiff_t trytry = min (total - how_much, READ_BUF_SIZE); ptrdiff_t this; @@ -4166,7 +4219,7 @@ by calling `format-decode', which see. */) if (NILP (nbytes)) { - read_quit = 1; + read_quit = true; break; } @@ -4299,7 +4352,7 @@ by calling `format-decode', which see. */) coding_system = raw_text_coding_system (coding_system); setup_coding_system (coding_system, &coding); /* Ensure we set Vlast_coding_system_used. */ - set_coding_system = 1; + set_coding_system = true; } if (!NILP (visit)) @@ -4310,7 +4363,7 @@ by calling `format-decode', which see. */) /* Can't do this if part of the buffer might be preserved. */ && NILP (replace)) /* Visiting a file with these coding system makes the buffer - unibyte. */ + unibyte. */ bset_enable_multibyte_characters (current_buffer, Qnil); } @@ -4349,6 +4402,11 @@ by calling `format-decode', which see. */) handled: + if (inserted > 0) + restore_window_points (window_markers, inserted, + BYTE_TO_CHAR (same_at_start), + BYTE_TO_CHAR (same_at_end)); + if (!NILP (visit)) { if (empty_undo_list_p) @@ -6037,6 +6095,7 @@ This includes interactive calls to `delete-file' and DEFSYM (Qcopy_directory, "copy-directory"); DEFSYM (Qdelete_directory, "delete-directory"); DEFSYM (Qsubstitute_env_in_file_name, "substitute-env-in-file-name"); + DEFSYM (Qget_buffer_window_list, "get-buffer-window-list"); defsubr (&Sfind_file_name_handler); defsubr (&Sfile_name_directory); diff --git a/src/insdel.c b/src/insdel.c index 3133ca4..7b4ee3b 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -1202,10 +1202,10 @@ adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte, /* Update various buffer positions for the new text. */ GAP_SIZE -= len_byte; - ZV += len; Z+= len; + ZV += len; Z += len; ZV_BYTE += len_byte; Z_BYTE += len_byte; GPT += len; GPT_BYTE += len_byte; - if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ + if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ if (nchars_del > 0) adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del, @@ -1228,7 +1228,7 @@ adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte, if (from < PT) adjust_point (len - nchars_del, len_byte - nbytes_del); - /* As byte combining will decrease Z, we must check this again. */ + /* As byte combining will decrease Z, we must check this again. */ if (Z - GPT < END_UNCHANGED) END_UNCHANGED = Z - GPT; @@ -1599,7 +1599,7 @@ del_range_byte (ptrdiff_t from_byte, ptrdiff_t to_byte, bool prepare) { ptrdiff_t from, to; - /* Make args be valid */ + /* Make args be valid. */ if (from_byte < BEGV_BYTE) from_byte = BEGV_BYTE; if (to_byte > ZV_BYTE) @@ -1681,7 +1681,7 @@ del_range_both (ptrdiff_t from, ptrdiff_t from_byte, /* Delete a range of text, specified both as character positions and byte positions. FROM and TO are character positions, while FROM_BYTE and TO_BYTE are byte positions. - If RET_STRING, the deleted area is returned as a string. */ + If RET_STRING, the deleted area is returned as a string. */ Lisp_Object del_range_2 (ptrdiff_t from, ptrdiff_t from_byte, commit c6f03ed03d68e52e8b18011d2c57959532b45fb5 Author: Lars Magne Ingebrigtsen Date: Thu Dec 11 16:57:33 2014 +0100 Fix a problem in url.el without GnuTLS Fixes: debbugs:19346 * lisp/url/url-http.el (url-http-parse-headers): Check that `gnutls-available-p' is defined. diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 690f699..8ff78ee 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -1,3 +1,8 @@ +2014-12-11 Lars Magne Ingebrigtsen + + * url-http.el (url-http-parse-headers): Check that + `gnutls-available-p' is defined (bug#19346). + 2014-12-09 Lars Magne Ingebrigtsen * url-http.el (url-http-parse-headers): Pass the GnuTLS status of diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index 34d325a..33e333d 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -495,7 +495,8 @@ should be shown to the user." (url-port url-current-object) url-http-process) ;; Pass the https certificate on to the caller. - (when (gnutls-available-p) + (when (and (fboundp 'gnutls-available-p) + (gnutls-available-p)) (let ((status (gnutls-peer-status url-http-process))) (when (or status (plist-get (car url-callback-arguments) :peer)) commit 3e92b9882bc5218a5b5962f9e85d0cbca719afc8 Author: Dmitry Antipov Date: Thu Dec 11 16:26:00 2014 +0300 Never pass an invalid X connection descriptor to an input reading loop Fixes: debbugs:19147 * xterm.c (x_delete_terminal): Call emacs_close for X connection descriptor if called from x_connection_closed and always delete this descriptor from keyboard waiting set (Bug#19147). diff --git a/src/ChangeLog b/src/ChangeLog index 2a6e237..27c0858 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2014-12-11 Dmitry Antipov + + * xterm.c (x_delete_terminal): Call emacs_close for X connection + descriptor if called from x_connection_closed and always delete + this descriptor from keyboard waiting set (Bug#19147). + 2014-12-10 Eli Zaretskii * bidi.c (BIDI_CACHE_MAX_ELTS_PER_SLOT): New macro. diff --git a/src/xterm.c b/src/xterm.c index 98f2a27..1ccc38c 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -11318,8 +11318,7 @@ x_delete_terminal (struct terminal *terminal) xim_close_dpy (dpyinfo); #endif - /* If called from x_connection_closed, the display may already be closed - and dpyinfo->display was set to 0 to indicate that. */ + /* Normally, the display is available... */ if (dpyinfo->display) { x_destroy_all_bitmaps (dpyinfo); @@ -11360,17 +11359,23 @@ x_delete_terminal (struct terminal *terminal) XCloseDisplay (dpyinfo->display); #endif #endif /* ! USE_GTK */ - - /* No more input on this descriptor. Do not close it because - it's already closed by X(t)CloseDisplay (Bug#18403). */ - eassert (0 <= dpyinfo->connection); - delete_keyboard_wait_descriptor (dpyinfo->connection); - - /* Mark as dead. */ + /* Do not close the connection here because it's already closed + by X(t)CloseDisplay (Bug#18403). */ dpyinfo->display = NULL; - dpyinfo->connection = -1; } + /* ...but if called from x_connection_closed, the display may already + be closed and dpyinfo->display was set to 0 to indicate that. Since + X server is most likely gone, explicit close is the only reliable + way to continue and avoid Bug#19147. */ + else if (dpyinfo->connection >= 0) + emacs_close (dpyinfo->connection); + + /* No more input on this descriptor. */ + delete_keyboard_wait_descriptor (dpyinfo->connection); + /* Mark as dead. */ + dpyinfo->connection = -1; + x_delete_display (dpyinfo); unblock_input (); } commit 9ff164ac6fb3a7a3551679f75e95b306c24fdf33 Author: Michael Albinus Date: Thu Dec 11 13:01:45 2014 +0100 * automated/vc-tests.el (vc-test--revision-granularity-function): New defun. (vc-test--create-repo-function): Rename from `vc-test--create-repo-if-not-supported'. Adapt all callees. (vc-test--create-repo): Check also for revision-granularity. (vc-test--unregister-function): Additional argument FILE. Adapt all callees. (vc-test--working-revision): New defun. (vc-test-*-working-revision): New tests. diff --git a/test/ChangeLog b/test/ChangeLog index 8b7b74d..c4ff2c7 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,15 @@ +2014-12-11 Michael Albinus + + * automated/vc-tests.el (vc-test--revision-granularity-function): + New defun. + (vc-test--create-repo-function): Rename from + `vc-test--create-repo-if-not-supported'. Adapt all callees. + (vc-test--create-repo): Check also for revision-granularity. + (vc-test--unregister-function): Additional argument FILE. Adapt + all callees. + (vc-test--working-revision): New defun. + (vc-test-*-working-revision): New tests. + 2014-12-10 Michael Albinus * automated/vc-tests.el (vc-test--register): Check, that the file diff --git a/test/automated/vc-tests.el b/test/automated/vc-tests.el index d0f2dc7..32cf0dd 100644 --- a/test/automated/vc-tests.el +++ b/test/automated/vc-tests.el @@ -115,8 +115,13 @@ "Functions for cleanup at the end of an ert test. Don't set it globally, the functions shall be let-bound.") -(defun vc-test--create-repo-if-not-supported (backend) - "Create a local repository for backends which don't support `vc-create-repo'." +(defun vc-test--revision-granularity-function (backend) + "Run the `vc-revision-granularity' backend function." + (funcall (intern (downcase (format "vc-%s-revision-granularity" backend))))) + +(defun vc-test--create-repo-function (backend) + "Run the `vc-create-repo' backend function. +For backends which dont support it, it is emulated." (cond ((eq backend 'CVS) @@ -152,7 +157,7 @@ Don't set it globally, the functions shall be let-bound.") (shell-command-to-string (format "mtn --db=%s --branch=foo setup ." archive-name)))) - (t (signal 'vc-not-supported (list 'create-repo backend))))) + (t (vc-create-repo backend)))) (defun vc-test--create-repo (backend) "Create a test repository in `default-directory', a temporary directory." @@ -171,23 +176,27 @@ Don't set it globally, the functions shall be let-bound.") 'vc-test--cleanup-hook `(lambda () (delete-directory ,default-directory 'recursive))) + ;; Check the revision granularity. + (should (memq (vc-test--revision-granularity-function backend) + '(file repository))) + ;; Create empty repository. (make-directory default-directory) (should (file-directory-p default-directory)) - (condition-case err - (vc-create-repo backend) - ;; CVS, Mtn and Arch need special handling. - (vc-not-supported (vc-test--create-repo-if-not-supported backend)))) + (vc-test--create-repo-function backend)) ;; Save exit. (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) -(defun vc-test--unregister-function (backend) - "Return the `vc-unregister' backend function." +;; Why isn't there `vc-unregister'? +(defun vc-test--unregister-function (backend file) + "Run the `vc-unregister' backend function. +For backends which dont support it, `vc-not-supported' is signalled." (let ((symbol (intern (downcase (format "vc-%s-unregister" backend))))) (if (functionp symbol) - symbol + (funcall symbol file) + ;; CVS, SVN, SCCS, SRC and Mtn are not supported. (signal 'vc-not-supported (list 'unregister backend))))) (defun vc-test--register (backend) @@ -209,10 +218,7 @@ Don't set it globally, the functions shall be let-bound.") ;; Create empty repository. (make-directory default-directory) - (condition-case err - (vc-create-repo backend) - ;; CVS, Mtn and Arch need special handling. - (vc-not-supported (vc-test--create-repo-if-not-supported backend))) + (vc-test--create-repo-function backend) (let ((tmp-name1 (expand-file-name "foo" default-directory)) (tmp-name2 "bla")) @@ -230,12 +236,12 @@ Don't set it globally, the functions shall be let-bound.") (should (file-exists-p tmp-name2)) (should (vc-registered tmp-name2)) - ;; Unregister the files. Why isn't there `vc-unregister'? + ;; Unregister the files. (condition-case err (progn - (funcall (vc-test--unregister-function backend) tmp-name1) + (vc-test--unregister-function backend tmp-name1) (should-not (vc-registered tmp-name1)) - (funcall (vc-test--unregister-function backend) tmp-name2) + (vc-test--unregister-function backend tmp-name2) (should-not (vc-registered tmp-name2))) ;; CVS, SVN, SCCS, SRC and Mtn are not supported. (vc-not-supported (message "%s" (error-message-string err)))) @@ -266,10 +272,7 @@ Don't set it globally, the functions shall be let-bound.") ;; Create empty repository. (make-directory default-directory) - (condition-case err - (vc-create-repo backend) - ;; CVS, Mtn and Arch need special handling. - (vc-not-supported (vc-test--create-repo-if-not-supported backend))) + (vc-test--create-repo-function backend) (message "%s" (vc-state default-directory backend)) ;(should (eq (vc-state default-directory backend) 'up-to-date)) @@ -293,10 +296,62 @@ Don't set it globally, the functions shall be let-bound.") ;; Unregister the file. Check for state. (condition-case nil (progn - (funcall (vc-test--unregister-function backend) tmp-name) + (vc-test--unregister-function backend tmp-name) (message "%s" (vc-state tmp-name backend)) );(should (eq (vc-state tmp-name backend) 'unregistered))) - ;; CVS, SVN, SCCS, SRC and Mtn are not supported. + (vc-not-supported (message "%s" 'unsupported))))) + + ;; Save exit. + (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) + +(defun vc-test--working-revision (backend) + "Check the working revision of a repository." + + (let ((vc-handled-backends `(,backend)) + (default-directory + (file-name-as-directory + (expand-file-name + (make-temp-name "vc-test") temporary-file-directory))) + vc-test--cleanup-hook errors) + + (unwind-protect + (progn + ;; Cleanup. + (add-hook + 'vc-test--cleanup-hook + `(lambda () (delete-directory ,default-directory 'recursive))) + + ;; Create empty repository. + (make-directory default-directory) + (vc-test--create-repo-function backend) + + (should + (member + (vc-working-revision default-directory backend) '("0" "master"))) + + (let ((tmp-name (expand-file-name "foo" default-directory))) + ;; Check for initial state. + (should + (member (vc-working-revision tmp-name backend) '("0" "master"))) + + ;; Write a new file. Check for state. + (write-region "foo" nil tmp-name nil 'nomessage) + (should + (member (vc-working-revision tmp-name backend) '("0" "master"))) + + ;; Register a file. Check for state. + (vc-register + (list backend (list (file-name-nondirectory tmp-name)))) + (should + (member (vc-working-revision tmp-name backend) '("0" "master"))) + + ;; Unregister the file. Check for working-revision. + (condition-case nil + (progn + (vc-test--unregister-function backend tmp-name) + (should + (member + (vc-working-revision tmp-name backend) '("0" "master")))) (vc-not-supported (message "%s" 'unsupported))))) ;; Save exit. @@ -383,7 +438,18 @@ Don't set it globally, the functions shall be let-bound.") (ert-get-test ',(intern (format "vc-test-%s01-register" backend-string)))))) - (vc-test--state ',backend))))))) + (vc-test--state ',backend)) + + (ert-deftest + ,(intern (format "vc-test-%s03-working-revision" backend-string)) () + ,(format "Check `vc-working-revision' for the %s backend." backend-string) + (skip-unless + (ert-test-passed-p + (ert-test-most-recent-result + (ert-get-test + ',(intern + (format "vc-test-%s01-register" backend-string)))))) + (vc-test--working-revision ',backend))))))) (provide 'vc-tests) ;;; vc-tests.el ends here commit 452921cfc11b0e0f93130e57c4aa31036d91964e Author: Michael Albinus Date: Thu Dec 11 11:12:13 2014 +0100 * vc/vc-hg.el (vc-hg-state): Make FILE absolute. Handle the case that there is empty output. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2ed1f08..452f4c3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-12-11 Michael Albinus + + * vc/vc-hg.el (vc-hg-state): Make FILE absolute. Handle the case + that there is empty output. + 2014-12-11 Stefan Monnier * emacs-lisp/eldoc.el (eldoc-documentation-function): Change default. diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index a56ed672..e049aab 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -188,6 +188,7 @@ highlighting the Log View buffer." (defun vc-hg-state (file) "Hg-specific version of `vc-state'." + (setq file (expand-file-name file)) (let* ((status nil) (default-directory (file-name-directory file)) @@ -212,19 +213,20 @@ highlighting the Log View buffer." ;; Some problem happened. E.g. We can't find an `hg' ;; executable. (error nil))))))) - (when (eq 0 status) - (when (null (string-match ".*: No such file or directory$" out)) - (let ((state (aref out 0))) - (cond - ((eq state ?=) 'up-to-date) - ((eq state ?A) 'added) - ((eq state ?M) 'edited) - ((eq state ?I) 'ignored) - ((eq state ?R) 'removed) - ((eq state ?!) 'missing) - ((eq state ??) 'unregistered) - ((eq state ?C) 'up-to-date) ;; Older mercurial versions use this. - (t 'up-to-date))))))) + (when (and (eq 0 status) + (> (length out) 0) + (null (string-match ".*: No such file or directory$" out))) + (let ((state (aref out 0))) + (cond + ((eq state ?=) 'up-to-date) + ((eq state ?A) 'added) + ((eq state ?M) 'edited) + ((eq state ?I) 'ignored) + ((eq state ?R) 'removed) + ((eq state ?!) 'missing) + ((eq state ??) 'unregistered) + ((eq state ?C) 'up-to-date) ;; Older mercurial versions use this. + (t 'up-to-date)))))) (defun vc-hg-working-revision (file) "Hg-specific version of `vc-working-revision'."