]> code.delx.au - gnu-emacs/blobdiff - lisp/vc-dispatcher.el
* lisp/erc/erc-backend.el (erc-process-sentinel): Check that buffer is alive
[gnu-emacs] / lisp / vc-dispatcher.el
index 07cf4a1ad289bec47bc0418fc1c9c861597d6f8a..0c3820bc5298c692b2449383772e76f22799324a 100644 (file)
@@ -1,6 +1,6 @@
 ;;; vc-dispatcher.el -- generic command-dispatcher facility.
 
-;; Copyright (C) 2008, 2009
+;; Copyright (C) 2008, 2009, 2010
 ;;   Free Software Foundation, Inc.
 
 ;; Author:     FSF (see below for full credits)
 ;; that on-disk files and the contents of their visiting Emacs buffers
 ;; coincide.
 ;;
-;; When the client mode adds a local mode-line-hook to a buffer, it
+;; When the client mode adds a local vc-mode-line-hook to a buffer, it
 ;; will be called with the buffer file name as argument whenever the
 ;; dispatcher resynchs the buffer.
 
@@ -320,11 +320,14 @@ case, and the process object in the asynchronous case."
          (setq squeezed (nconc squeezed files)))
        (let ((exec-path (append vc-path exec-path))
              ;; Add vc-path to PATH for the execution of this command.
+             ;; Also, since some functions need to parse the output
+             ;; from external commands, set LC_MESSAGES to C.
              (process-environment
               (cons (concat "PATH=" (getenv "PATH")
                             path-separator
                             (mapconcat 'identity vc-path path-separator))
-                    process-environment))
+                    (cons "LC_MESSAGES=C"
+                          process-environment)))
              (w32-quote-process-args t))
          (if (eq okstatus 'async)
              ;; Run asynchronously.
@@ -451,6 +454,10 @@ ARG and NO-CONFIRM are passed on to `revert-buffer'."
       (revert-buffer arg no-confirm t))
     (vc-restore-buffer-context context)))
 
+(defvar vc-mode-line-hook nil)
+(make-variable-buffer-local 'vc-mode-line-hook)
+(put 'vc-mode-line-hook 'permanent-local t)
+
 (defun vc-resynch-window (file &optional keep noquery)
   "If FILE is in the current buffer, either revert or unvisit it.
 The choice between revert (to see expanded keywords) and unvisit
@@ -461,7 +468,7 @@ modifications by the dispatcher client code, rather than user
 editing!"
   (and (string= buffer-file-name file)
        (if keep
-          (progn
+          (when (file-exists-p file)
             (vc-revert-buffer-internal t noquery)
 
             ;; VC operations might toggle the read-only state.  In
@@ -476,7 +483,8 @@ editing!"
                          (not (eq (get major-mode 'mode-class) 'special))
                          (view-mode-enter))))
 
-            (run-hook-with-args 'mode-line-hook buffer-file-name))
+             ;; FIXME: Why use a hook?  Why pass it buffer-file-name?
+            (run-hook-with-args 'vc-mode-line-hook buffer-file-name))
         (kill-buffer (current-buffer)))))
 
 (declare-function vc-dir-resynch-file "vc-dir" (&optional fname))
@@ -502,7 +510,7 @@ editing!"
            (vc-resynch-window file keep noquery))))))
   ;; Try to avoid unnecessary work, a *vc-dir* buffer is only present
   ;; if this is true.
-  (when (memq 'vc-dir-resynch-file after-save-hook)
+  (when vc-dir-buffers
     (vc-dir-resynch-file file)))
 
 (defun vc-buffer-sync (&optional not-urgent)