comparison lisp/vc-dispatcher.el @ 108943:04a1a4b18129

* lisp/vc-dispatcher.el: Rename mode-line-hook to vc-mode-line-hook; declare it, make it buffer-local, and permanent-local. (vc-resynch-window): Adjust name. * lisp/vc-hooks.el (vc-find-file-hook): Adjust name.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 08 Jun 2010 21:12:53 -0400
parents 6427b60ed4f2
children d418516def73 8027e412df98
comparison
equal deleted inserted replaced
108942:b11cb747f0d1 108943:04a1a4b18129
99 ;; buffer or the singleton set consisting of the file visited by the current 99 ;; buffer or the singleton set consisting of the file visited by the current
100 ;; buffer (when that is appropriate). It also does what is needed to ensure 100 ;; buffer (when that is appropriate). It also does what is needed to ensure
101 ;; that on-disk files and the contents of their visiting Emacs buffers 101 ;; that on-disk files and the contents of their visiting Emacs buffers
102 ;; coincide. 102 ;; coincide.
103 ;; 103 ;;
104 ;; When the client mode adds a local mode-line-hook to a buffer, it 104 ;; When the client mode adds a local vc-mode-line-hook to a buffer, it
105 ;; will be called with the buffer file name as argument whenever the 105 ;; will be called with the buffer file name as argument whenever the
106 ;; dispatcher resynchs the buffer. 106 ;; dispatcher resynchs the buffer.
107 107
108 ;; To do: 108 ;; To do:
109 ;; 109 ;;
452 ;; t means don't call normal-mode; 452 ;; t means don't call normal-mode;
453 ;; that's to preserve various minor modes. 453 ;; that's to preserve various minor modes.
454 (revert-buffer arg no-confirm t)) 454 (revert-buffer arg no-confirm t))
455 (vc-restore-buffer-context context))) 455 (vc-restore-buffer-context context)))
456 456
457 (defvar vc-mode-line-hook nil)
458 (make-variable-buffer-local 'vc-mode-line-hook)
459 (put 'vc-mode-line-hook 'permanent-local t)
460
457 (defun vc-resynch-window (file &optional keep noquery) 461 (defun vc-resynch-window (file &optional keep noquery)
458 "If FILE is in the current buffer, either revert or unvisit it. 462 "If FILE is in the current buffer, either revert or unvisit it.
459 The choice between revert (to see expanded keywords) and unvisit 463 The choice between revert (to see expanded keywords) and unvisit
460 depends on KEEP. NOQUERY if non-nil inhibits confirmation for 464 depends on KEEP. NOQUERY if non-nil inhibits confirmation for
461 reverting. NOQUERY should be t *only* if it is known the only 465 reverting. NOQUERY should be t *only* if it is known the only
477 (view-mode-exit))) 481 (view-mode-exit)))
478 (and (not view-mode) 482 (and (not view-mode)
479 (not (eq (get major-mode 'mode-class) 'special)) 483 (not (eq (get major-mode 'mode-class) 'special))
480 (view-mode-enter)))) 484 (view-mode-enter))))
481 485
482 (run-hook-with-args 'mode-line-hook buffer-file-name)) 486 ;; FIXME: Why use a hook? Why pass it buffer-file-name?
487 (run-hook-with-args 'vc-mode-line-hook buffer-file-name))
483 (kill-buffer (current-buffer))))) 488 (kill-buffer (current-buffer)))))
484 489
485 (declare-function vc-dir-resynch-file "vc-dir" (&optional fname)) 490 (declare-function vc-dir-resynch-file "vc-dir" (&optional fname))
486 (declare-function vc-string-prefix-p "vc" (prefix string)) 491 (declare-function vc-string-prefix-p "vc" (prefix string))
487 492