;;; 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.
(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.
(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
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
(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))
(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)