Mercurial > emacs
changeset 93108:695900050c0b
(vc-status-mark-buffer-changed): New function to implement
updating of the *vc-status* buffer when a buffer is saved.
(vc-status-mode): Use it for after-change-hook.
(vc-add-to-vc-status-buffer): Rename to ...
(vc-status-add-entry): ... this.
(Todo): Add new entry.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Thu, 20 Mar 2008 15:51:45 +0000 |
parents | 3bf6293f3041 |
children | 7316c5c792f4 |
files | lisp/ChangeLog lisp/vc.el |
diffstat | 2 files changed, 84 insertions(+), 42 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Thu Mar 20 15:49:10 2008 +0000 +++ b/lisp/ChangeLog Thu Mar 20 15:51:45 2008 +0000 @@ -1,3 +1,12 @@ +2008-03-20 Dan Nicolaescu <dann@ics.uci.edu> + + * vc.el (vc-status-mark-buffer-changed): New function to implement + updating of the *vc-status* buffer when a buffer is saved. + (vc-status-mode): Use it for after-change-hook. + (vc-add-to-vc-status-buffer): Rename to ... + (vc-status-add-entry): ... this. + (Todo): Add new entry. + 2008-03-20 Stefan Monnier <monnier@iro.umontreal.ca> * sort.el (sort-reorder-buffer): Preserve the buffer's multibyteness. @@ -9552,7 +9561,7 @@ * progmodes/python.el (top-level): Don't require cl when compiling. -2007-12-02 Agust,Am(Bn Mart,Am(Bn <agustin.martin@hispalinux.es> +2007-12-02 Agust$(Q)c(Bn Mart$(Q)c(Bn <agustin.martin@hispalinux.es> * textmodes/flyspell.el (flyspell-large-region): Explicitly set encoding for aspell process and for communication with it. @@ -10296,7 +10305,7 @@ (x-send-client-message): * emulation/cua-base.el (x-clipboard-yank): Declare as functions. -2007-11-22 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> +2007-11-22 Jan Dj$(Q)Z(Brv <jan.h.d@swipnet.se> * term/x-win.el (x-gtk-map-stock): Check if FILE is a string. @@ -11215,7 +11224,7 @@ * emulation/tpu-mapper.el (tpu-map-key): Remove un-needed cond branch. -2007-11-07 Johan Bockg,Ae(Brd <bojohan@gnu.org> +2007-11-07 Johan Bockg$(Q)[(Brd <bojohan@gnu.org> * eshell/esh-mode.el (eshell-output-filter): * eshell/esh-proc.el (eshell-insertion-filter, eshell-sentinel): @@ -12913,7 +12922,7 @@ * help-fns.el (describe-function-1): Don't use the advice origname if it has no function definition. -2007-10-18 Johan Bockg,Ae(Brd <bojohan@gnu.org> +2007-10-18 Johan Bockg$(Q)[(Brd <bojohan@gnu.org> * net/tramp.el (tramp-rfn-eshadow-update-overlay): Save excursion. Use `save-restriction' rather than `widen'. @@ -13627,7 +13636,7 @@ (bs--get-mode-name, bs-mode): Fix typos in docstrings. (bs--format-aux): Doc fix. -2007-10-08 Micha,Ak(Bl Cadilhac <michael@cadilhac.name> +2007-10-08 Micha$(Q)a(Bl Cadilhac <michael@cadilhac.name> * progmodes/gud.el (gud-gud-gdb-command-name): Fix typo in docstring. @@ -13673,11 +13682,11 @@ * progmodes/gud.el (gud-display-line): Find source buffer even when GUD buffer has its own frame. -2007-10-08 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> +2007-10-08 Jan Dj$(Q)Z(Brv <jan.h.d@swipnet.se> * term/x-win.el (icon-map-list): Set to nil for 22.1 compatibility. -2007-10-08 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> +2007-10-08 Jan Dj$(Q)Z(Brv <jan.h.d@swipnet.se> * term/x-win.el (x-gtk-stock-map): Version is 22.2. @@ -14055,7 +14064,7 @@ * emacs-lisp/copyright.el (copyright-update): Don't update if the file already uses a more recent copyright version than the "current" one. -2007-10-03 Micha,Ak(Bl Cadilhac <michael@cadilhac.name> +2007-10-03 Micha$(Q)a(Bl Cadilhac <michael@cadilhac.name> * doc-view.el (doc-view-dvi->pdf-sentinel, doc-view-reset-slice) (doc-view-insert-image): Minor aesthetical docstring changes. @@ -14160,7 +14169,7 @@ * play/zone.el (zone-hiding-modeline): Use mode-line-format. -2007-09-29 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> +2007-09-29 Jan Dj$(Q)Z(Brv <jan.h.d@swipnet.se> * term/x-win.el (x-gtk-stock-map): Version is 22.2. @@ -14430,7 +14439,7 @@ * indent.el (indent-for-tab-command): First check if the region is active. -2007-09-24 Micha,Ak(Bl Cadilhac <michael@cadilhac.name> +2007-09-24 Micha$(Q)a(Bl Cadilhac <michael@cadilhac.name> * whitespace.el (whitespace-tickle-timer): Don't install the timer if whitespace-rescan-timer-time is 0. @@ -14550,7 +14559,7 @@ * indent.el (indent-for-tab-command): Indent the region if transient-mark-mode and the region is active. -2007-09-21 Francesco Potort,Al(B <pot@gnu.org> +2007-09-21 Francesco Potort$(Q)b(B <pot@gnu.org> * progmodes/octave-inf.el (inferior-octave-mode): Use add-hook to add inferior-octave-directory-tracker to the buffer-local value @@ -14714,7 +14723,7 @@ (browse-url-elinks-sentinel): Use browse-url-elinks-new-window. Improve error message. -2007-09-19 Micha,Ak(Bl Cadilhac <michael@cadilhac.name> +2007-09-19 Micha$(Q)a(Bl Cadilhac <michael@cadilhac.name> * net/browse-url.el (browse-url-url-encode-chars): Use the right parameter name in the function body. @@ -14750,7 +14759,7 @@ * newcomment.el (comment-add): New arg EXTRA. (comment-region-default): Pass EXTRA if not indenting lines. -2007-09-17 Micha,Ak(Bl Cadilhac <michael@cadilhac.name> +2007-09-17 Micha$(Q)a(Bl Cadilhac <michael@cadilhac.name> * net/browse-url.el (browse-url-url-encode-chars): New function. URL-encode some chars in a string. @@ -14799,7 +14808,7 @@ (move-beginning-of-line): Remove unused var `start'. (blink-matching-open): Restructure in a more functional style. -2007-09-16 Micha,Ak(Bl Cadilhac <michael@cadilhac.name> +2007-09-16 Micha$(Q)a(Bl Cadilhac <michael@cadilhac.name> * calendar/holidays.el (list-holidays): Remove the cyclic alias. @@ -14957,7 +14966,7 @@ * term/rxvt.el (rxvt-function-map): Initialize in the declaration. -2007-09-12 Micha,Ak(Bl Cadilhac <michael@cadilhac.name> +2007-09-12 Micha$(Q)a(Bl Cadilhac <michael@cadilhac.name> * net/browse-url.el (browse-url-encode-url): Fix an infinite loop. New argument `filename-p' to use one set of confusing chars or another. @@ -15000,7 +15009,7 @@ 2007-09-10 Thien-Thi Nguyen <ttn@gnuvola.org> * net/browse-url.el (browse-url-encode-url): Use copy-sequence. - Reported by Jan Dj,Ad(Brv <jan.h.d@swipnet.se>. + Reported by Jan Dj$(Q)Z(Brv <jan.h.d@swipnet.se>. 2007-09-10 Dave Love <fx@gnu.org> @@ -15008,7 +15017,7 @@ Move font-lock-builtin-face down from 4 to 7 to better keep the progression of color brightness, and to better match Org-mode's faces. -2007-09-10 Micha,Ak(Bl Cadilhac <michael@cadilhac.name> +2007-09-10 Micha$(Q)a(Bl Cadilhac <michael@cadilhac.name> * progmodes/meta-mode.el (meta-font-lock-keywords) (font-lock-match-meta-declaration-item-and-skip-to-next) @@ -15176,7 +15185,7 @@ * vc-arch.el (vc-arch-checkin): Fix typo. -2007-09-07 Johan Bockg,Ae(Brd <bojohan@gnu.org> +2007-09-07 Johan Bockg$(Q)[(Brd <bojohan@gnu.org> * cus-face.el (custom-theme-set-faces): Set face attributes locally for each frame. @@ -15245,7 +15254,7 @@ * complete.el (PC-do-completion): Don't try to treat empty string as an abbreviation. -2007-09-06 Johan Bockg,Ae(Brd <bojohan@dd.chalmers.se> +2007-09-06 Johan Bockg$(Q)[(Brd <bojohan@dd.chalmers.se> * help-fns.el (describe-variable): Keep doc's text properties. @@ -15272,7 +15281,7 @@ (normal-no-mouse-startup-screen): New fn, broken out. (normal-about-screen): New function, contents all new. -2007-09-05 Micha,Ak(Bl Cadilhac <michael@cadilhac.name> +2007-09-05 Micha$(Q)a(Bl Cadilhac <michael@cadilhac.name> * emacs-lisp/rx.el (rx): Fix typo in docstring. @@ -15281,7 +15290,7 @@ * cus-edit.el (custom-buffer-create-internal): Check tool-bar-mode is bound. -2007-09-05 Johan Bockg,Ae(Brd <bojohan@dd.chalmers.se> +2007-09-05 Johan Bockg$(Q)[(Brd <bojohan@dd.chalmers.se> * emacs-lisp/advice.el (ad-make-advised-docstring): Highlight note in doc string. @@ -15353,7 +15362,7 @@ (terminal-init-xterm): Use it. Deal with delete-frame hook. Add the selected frame to xterm-modify-other-keys-terminal-list. -2007-09-02 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> +2007-09-02 Jan Dj$(Q)Z(Brv <jan.h.d@swipnet.se> * term/x-win.el (x-gtk-stock-map): Map diropen to system-file-manager. (icon-map-list): New variable. @@ -15399,7 +15408,7 @@ * vc-svn.el (vc-svn-diff-tree): Pass a list to vc-svn-diff. -2007-08-31 Micha,Ak(Bl Cadilhac <michael@cadilhac.name> +2007-08-31 Micha$(Q)a(Bl Cadilhac <michael@cadilhac.name> * textmodes/flyspell.el (flyspell-mark-duplications-exceptions): New variable. List of exceptions for the duplicated word rule. @@ -15409,7 +15418,7 @@ * files.el (create-file-buffer): If the filename sans directory starts with spaces, remove them. -2007-08-31 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> +2007-08-31 Jan Dj$(Q)Z(Brv <jan.h.d@swipnet.se> * term/x-win.el (x-gtk-stock-map): Add etc/images to keys. (x-gtk-map-stock): Use two directory elements when matching @@ -15516,7 +15525,7 @@ * version.el (emacs-version): Increase to 23.0.50. -2007-08-29 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> +2007-08-29 Jan Dj$(Q)Z(Brv <jan.h.d@swipnet.se> * term/x-win.el (x-gtk-stock-map): :version changed to 23.1. @@ -15572,7 +15581,7 @@ * env.el (getenv): Pass frame to getenv-internal. -2007-08-29 K,Aa(Broly L$,1 q(Brentey <lorentey@elte.hu> +2007-08-29 K$(Q)W(Broly L$(Q*S(Brentey <lorentey@elte.hu> * version.el (emacs-version): Show if multi-tty is present. @@ -15873,7 +15882,7 @@ (display-time-world-timer-second, display-time-world-mode-map): New variables. -2007-08-28 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> +2007-08-28 Jan Dj$(Q)Z(Brv <jan.h.d@swipnet.se> * term/x-win.el (x-gtk-stock-map): New variable. (x-gtk-map-stock): New function. @@ -15881,7 +15890,7 @@ * info.el (info-tool-bar-map): Add :rtl keyword to right/left-arrow and prev/next-node. -2007-08-28 Johan Bockg,Ae(Brd <bojohan@dd.chalmers.se> (tiny change) +2007-08-28 Johan Bockg$(Q)[(Brd <bojohan@dd.chalmers.se> (tiny change) * play/gamegrid.el (gamegrid-init): Set line-spacing to 0. @@ -15981,7 +15990,7 @@ * vc.el (vc-annotate-warp-version): Don't use previous-line. -2007-08-27 Johan Bockg,Ae(Brd <bojohan@dd.chalmers.se> +2007-08-27 Johan Bockg$(Q)[(Brd <bojohan@dd.chalmers.se> * net/browse-url.el (browse-url-emacs): New function. @@ -15989,7 +15998,7 @@ * emacs-lisp/avl-tree.el: New file. -2007-08-26 Micha,Ak(Bl Cadilhac <michael@cadilhac.name> +2007-08-26 Micha$(Q)a(Bl Cadilhac <michael@cadilhac.name> * hi-lock.el (hi-lock-unface-buffer): Show a x-menu only if the mouse was used. @@ -16437,7 +16446,7 @@ undo-list when setting syntax-table properties. (ada-after-change-function): Use ada-set-syntax-table-properties. -2007-08-18 Micha,Ak(Bl Cadilhac <michael@cadilhac.name> +2007-08-18 Micha$(Q)a(Bl Cadilhac <michael@cadilhac.name> * progmodes/meta-mode.el (meta-indent-calculate-last): Remove. (meta-indent-current-nesting): Use a computation of the nesting @@ -16490,7 +16499,7 @@ (cperl-find-pods-heres): Fix an error when typing expressions like `s{a}{b}'. -2007-08-17 Micha,Ak(Bl Cadilhac <michael@cadilhac.name> +2007-08-17 Micha$(Q)a(Bl Cadilhac <michael@cadilhac.name> * mail/emacsbug.el (report-emacs-bug): Remove the last number of `emacs-version', use the topic prefix ``version; ''. Make MS-DOS @@ -16581,7 +16590,7 @@ sloppier, for the sake of GNU Mailman. (rmail-digest-rfc1153): Initialize `result' correctly. -2007-08-15 Micha,Ak(Bl Cadilhac <michael@cadilhac.name> +2007-08-15 Micha$(Q)a(Bl Cadilhac <michael@cadilhac.name> * mail/emacsbug.el (report-emacs-bug): Put `Bug: emacs-version; ' in the mail title. Suggested by Reiner Steib. @@ -17733,7 +17742,7 @@ * net/trampver.el: Update release number. -2007-07-22 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> +2007-07-22 Jan Dj$(Q)Z(Brv <jan.h.d@swipnet.se> * startup.el (command-line-x-option-alist): Use x-handle-no-bitmap-icon. @@ -18378,7 +18387,7 @@ * isearch.el (isearch-edit-string): Call to isearch-push-state after the search. -2007-07-09 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> +2007-07-09 Jan Dj$(Q)Z(Brv <jan.h.d@swipnet.se> * window.el (fit-window-to-buffer): Remove setting of window-min-height to 1 as enlarge-window uses the value to resize/shrink windows other @@ -18761,7 +18770,7 @@ * font-lock.el (lisp-font-lock-keywords-2): Recognize the new \(?1:..\) syntax as well. Reported by Juri Linkov <juri@jurta.org>. -2007-06-28 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> +2007-06-28 Jan Dj$(Q)Z(Brv <jan.h.d@swipnet.se> * dnd.el (dnd-get-local-file-name): Set fixcase to t in call to replace-regexp-in-string. @@ -19374,7 +19383,7 @@ * diff-mode.el (diff-font-lock-keywords): Fix M. Kifer's last change. -2007-06-13 Johan Bockg,Ae(Brd <bojohan@dd.chalmers.se> (tiny change) +2007-06-13 Johan Bockg$(Q)[(Brd <bojohan@dd.chalmers.se> (tiny change) * term/xterm.el (terminal-init-xterm): Escape parens in character constants. @@ -19553,7 +19562,7 @@ * emacs-lisp/bytecomp.el (byte-compile-find-cl-functions): Match against file-name-nondirectory. Fix text on user customization variables. - Reported by Johan Bockg,Ae(Brd <bojohan@dd.chalmers.se>. + Reported by Johan Bockg$(Q)[(Brd <bojohan@dd.chalmers.se>. 2007-06-09 Alfred M. Szmidt <ams@gnu.org> (tiny change) @@ -19961,7 +19970,7 @@ * files.el (set-auto-mode): Doc fix. -2007-05-22 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> +2007-05-22 Jan Dj$(Q)Z(Brv <jan.h.d@swipnet.se> * help-fns.el (find-source-lisp-file): New function. (describe-function-1): Use find-source-lisp-file to find source @@ -20195,7 +20204,7 @@ * dabbrev.el (dabbrev-eliminate-newlines): Renamed from dabbrev--eliminate-newlines. All uses changed. -2007-05-10 Micha,Ak(Bl Cadilhac <michael@cadilhac.name> +2007-05-10 Micha$(Q)a(Bl Cadilhac <michael@cadilhac.name> * man.el (Man-next-section): Don't consider the last line of the page as being part of any section. @@ -20378,7 +20387,7 @@ * image-dired.el (image-dired-display-image): Derive image-type from filename rather than assuming jpeg, in case no resizing was needed. -2007-04-25 Johan Bockg,Ae(Brd <bojohan@dd.chalmers.se> +2007-04-25 Johan Bockg$(Q)[(Brd <bojohan@dd.chalmers.se> * custom.el (defface): Doc fix.
--- a/lisp/vc.el Thu Mar 20 15:49:10 2008 +0000 +++ b/lisp/vc.el Thu Mar 20 15:51:45 2008 +0000 @@ -553,6 +553,8 @@ ;;; Todo: +;; - vc-state needs a new state for `added'. +;; ;; - vc-update/vc-merge should deal with VC systems that don't ;; update/merge on a file basis, but on a whole repository basis. ;; @@ -2869,6 +2871,7 @@ (set (make-local-variable 'vc-status) (ewoc-create #'vc-status-printer (vc-status-headers backend default-directory))) + (add-hook 'after-save-hook 'vc-status-mark-buffer-changed) (vc-status-refresh))) (put 'vc-status-mode 'mode-class 'special) @@ -2892,7 +2895,7 @@ ;; We are done, turn of the in progress message in the mode-line. (setq mode-line-process nil))) -(defun vc-add-to-vc-status-buffer (entry buffer) +(defun vc-status-add-entry (entry buffer) ;; Add one ENTRY to the vc-status buffer BUFFER. ;; This will be used to automatically add files with the "modified" ;; state when saving them. @@ -3115,6 +3118,36 @@ vc-status (lambda (crt) (vc-status-fileinfo->marked crt))))) +(defun vc-status-mark-buffer-changed () + (let* ((file (expand-file-name buffer-file-name)) + (version (and (vc-backend file) (vc-working-revision file))) + (found-vc-status-buf nil)) + (save-excursion + (dolist (status-buf (buffer-list)) + (set-buffer status-buf) + ;; look for a vc-status buffer that might show this file. + (when (eq major-mode 'vc-status-mode) + (setq found-vc-status-buf t) + (let ((def-dir (expand-file-name default-directory))) + ;; This test is cvs-string-prefix-p + (when (eq t (compare-strings file nil (length def-dir) def-dir nil nil)) + (let* ((file-short + (substring file (length def-dir))) + (entry + (cons + file-short + (if version + ;; This it not the correct test to check if + ;; the files is "added" for all backends. + ;; It does not work for git for example. + ;; vc-state needs a new state: `added'. + (if (string= "0" version) 'added 'modified) + 'unregistered)))) + (vc-status-add-entry entry status-buf)))))) + ;; We didn't find any vc-status buffers, remove the hook, it is + ;; not needed. + (unless found-vc-status-buf (remove-hook 'after-save-hook 'vc-status-mark-buffer-changed))))) + ;;; End experimental code. ;; Named-configuration entry points