From: David Caldwell <david@porkrind.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 21364@debbugs.gnu.org
Subject: bug#21364: [PATCH] Add vc-activate (interactive) to activate VC mode on the current buffer
Date: Tue, 1 Sep 2015 07:56:56 -0700 [thread overview]
Message-ID: <20150901145649.GA27344@porkrind.org> (raw)
In-Reply-To: <jwvd1y3e4iq.fsf-monnier+emacsbugs@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 380 bytes --]
> > Ok. The attached patch is updated to do just that. The only thing I
> > noticed was that after aliasing, vc-find-file-hook shows up in M-x since
> > the new function is interactive.
>
> Good point. So I guess we should define vc-find-file-hook as an
> obsolete function which just calls the new function.
Ok. Attached is an updated git am patch that does just that.
-David
[-- Attachment #2: 0001-Rename-vc-find-file-hook-to-vc-refresh-state-and-obsolete-wrapper.patch --]
[-- Type: text/x-diff, Size: 2039 bytes --]
From c02a45346ed3dd83f24545e5cee0edc12f304c29 Mon Sep 17 00:00:00 2001
From: David Caldwell <david@porkrind.org>
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
next prev parent reply other threads:[~2015-09-01 14:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-27 18:32 bug#21364: [PATCH] Add vc-activate (interactive) to activate VC mode on the current buffer David Caldwell
2015-08-28 2:23 ` Stefan Monnier
2015-08-28 2:43 ` David Caldwell
2015-08-29 15:26 ` Stefan Monnier
2015-08-29 17:39 ` David Caldwell
2015-08-30 2:11 ` Stefan Monnier
2015-08-30 10:22 ` David Caldwell
2015-08-31 1:39 ` Stefan Monnier
2015-08-31 10:05 ` David Caldwell
2015-08-31 17:45 ` Stefan Monnier
2015-09-01 14:56 ` David Caldwell [this message]
2015-09-02 3:45 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150901145649.GA27344@porkrind.org \
--to=david@porkrind.org \
--cc=21364@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.