From: David Caldwell <david@porkrind.org>
To: 21364@debbugs.gnu.org
Subject: bug#21364: [PATCH] Add vc-activate (interactive) to activate VC mode on the current buffer
Date: Thu, 27 Aug 2015 11:32:56 -0700 [thread overview]
Message-ID: <20150827183246.GA15564@porkrind.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 805 bytes --]
Hello,
Attached is a patch (in git am format) to add a new interactive function
`vc-activate`, which simply calls `vc-find-file-hook` to activate VC
mode on a buffer.
The motivation comes from the fact that I don't consistently use VC for
everything. I often pop back and forth to the command line, depending on
the situation. This ends up with a lot of "git add" commands being run
behind emacs's back. I've been using `M-x revert-buffer` or `C-x C-v`,
but both of them seem too harsh for what I really want, which is for VC
to just check again real quick. I could `M-: RET (vc-find-file-hook)`
but that doesn't roll off the tongue very well.
`vc-activate` is a nicely named interactive wrapper around
vc-find-file-hook so that I can just do `M-x vc-activate RET` and I'm in
business.
Thanks,
David
[-- Attachment #2: 0001-Add-vc-activate-interactive-to-activate-VC-mode-on-t.patch --]
[-- Type: text/x-diff, Size: 1032 bytes --]
From 627c54175d9287143499ed42be91d3fcc42a74b1 Mon Sep 17 00:00:00 2001
From: David Caldwell <david@porkrind.org>
Date: Thu, 27 Aug 2015 11:04:51 -0700
Subject: [PATCH] Add vc-activate (interactive) to activate VC mode on the
current buffer
(which may have been added to revision control behind Emacs's back).
* lisp/vc/vc-hooks.el (vc-activate): New; interactive way to activate VC
mode on the current buffer.
---
lisp/vc/vc-hooks.el | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index bae9919..1c12b01 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -851,6 +851,11 @@ current, and kill the buffer that visits the link."
(add-hook 'find-file-hook 'vc-find-file-hook)
+(defun vc-activate ()
+ "Activate VC mode on current buffer if appropriate."
+ (interactive)
+ (vc-find-file-hook))
+
(defun vc-kill-buffer-hook ()
"Discard VC info about a file when we kill its buffer."
(when buffer-file-name (vc-file-clearprops buffer-file-name)))
--
2.5.0
next reply other threads:[~2015-08-27 18:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-27 18:32 David Caldwell [this message]
2015-08-28 2:23 ` bug#21364: [PATCH] Add vc-activate (interactive) to activate VC mode on the current buffer 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
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=20150827183246.GA15564@porkrind.org \
--to=david@porkrind.org \
--cc=21364@debbugs.gnu.org \
/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.