From c02a45346ed3dd83f24545e5cee0edc12f304c29 Mon Sep 17 00:00:00 2001 From: David Caldwell Date: Sun, 30 Aug 2015 02:59:56 -0700 Subject: [PATCH] Rename vc-find-file-hook to vc-refresh-state and make it interactive. This is so one can `M-x vc-refresh state' if the file is added to or removed from version control behind Emacs's back. * lisp/vc/vc-hooks.el (vc-refresh-state): Rename from vc-find-file-hook and make interactive, retaining an obsolete wrapper.. --- lisp/vc/vc-hooks.el | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index bae9919..edf20ae 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -790,8 +790,9 @@ current, and kill the buffer that visits the link." (defun vc-default-find-file-hook (_backend) nil) -(defun vc-find-file-hook () - "Function for `find-file-hook' activating VC mode if appropriate." +(defun vc-refresh-state () + "Activate or deactivate VC mode as appropriate." + (interactive) ;; Recompute whether file is version controlled, ;; if user has killed the buffer and revisited. (when vc-mode @@ -838,18 +839,23 @@ current, and kill the buffer that visits the link." (vc-follow-link) (message "Followed link to %s" buffer-file-name) - (vc-find-file-hook)) + (vc-refresh-state)) (t (if (yes-or-no-p (format "Symbolic link to %s-controlled source file; follow link? " link-type)) (progn (vc-follow-link) (message "Followed link to %s" buffer-file-name) - (vc-find-file-hook)) + (vc-refresh-state)) (message "Warning: editing through the link bypasses version control") ))))))))) -(add-hook 'find-file-hook 'vc-find-file-hook) +(defun vc-find-file-hook () + (vc-refresh-state)) + +(make-obsolete 'vc-find-file-hook 'vc-refresh-state "25.1") + +(add-hook 'find-file-hook 'vc-refresh-state) (defun vc-kill-buffer-hook () "Discard VC info about a file when we kill its buffer." -- 2.5.0