>From 2dcff538fdebc012aac03ab37105e5374a415641 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. --- lisp/vc/vc-hooks.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index bae9919..f5e9eb4 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,18 @@ 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) +(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