From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Caldwell Newsgroups: gmane.emacs.bugs 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 Message-ID: <20150827183246.GA15564@porkrind.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="qMm9M+Fa2AknHoGS" X-Trace: ger.gmane.org 1440700477 5281 80.91.229.3 (27 Aug 2015 18:34:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 27 Aug 2015 18:34:37 +0000 (UTC) To: 21364@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Aug 27 20:34:26 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZV203-0006MQ-8f for geb-bug-gnu-emacs@m.gmane.org; Thu, 27 Aug 2015 20:34:11 +0200 Original-Received: from localhost ([::1]:44099 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZV202-0006cA-AC for geb-bug-gnu-emacs@m.gmane.org; Thu, 27 Aug 2015 14:34:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50703) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZV1zy-0006bh-HF for bug-gnu-emacs@gnu.org; Thu, 27 Aug 2015 14:34:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZV1zu-0008RO-GY for bug-gnu-emacs@gnu.org; Thu, 27 Aug 2015 14:34:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48324) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZV1zu-0008RD-DZ for bug-gnu-emacs@gnu.org; Thu, 27 Aug 2015 14:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZV1zu-00082C-9J for bug-gnu-emacs@gnu.org; Thu, 27 Aug 2015 14:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: David Caldwell Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 27 Aug 2015 18:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 21364 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.144070040330838 (code B ref -1); Thu, 27 Aug 2015 18:34:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Aug 2015 18:33:23 +0000 Original-Received: from localhost ([127.0.0.1]:40534 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZV1zG-00081J-C8 for submit@debbugs.gnu.org; Thu, 27 Aug 2015 14:33:22 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:40312) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZV1zD-00081A-5f for submit@debbugs.gnu.org; Thu, 27 Aug 2015 14:33:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZV1zC-000863-0U for submit@debbugs.gnu.org; Thu, 27 Aug 2015 14:33:18 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:44738) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZV1zB-00085z-Te for submit@debbugs.gnu.org; Thu, 27 Aug 2015 14:33:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50311) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZV1zA-0006Xz-Tv for bug-gnu-emacs@gnu.org; Thu, 27 Aug 2015 14:33:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZV1z6-000838-Ss for bug-gnu-emacs@gnu.org; Thu, 27 Aug 2015 14:33:16 -0400 Original-Received: from sa38.galvanix.net ([98.126.48.38]:51911 helo=kill.porkrind.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZV1z6-0007uV-Lf for bug-gnu-emacs@gnu.org; Thu, 27 Aug 2015 14:33:12 -0400 Original-Received: from porkrind.org (cpe-76-170-36-134.socal.res.rr.com [76.170.36.134]) by kill.porkrind.org (Postfix) with ESMTPS id E8C345F6CB for ; Thu, 27 Aug 2015 11:32:57 -0700 (PDT) Authentication-Results: kill.porkrind.org; dkim=pass (1536-bit key; unprotected) header.d=porkrind.org header.i=@porkrind.org header.b=qNfU/3R5; dkim-atps=neutral Original-Received: from porkrind.org (localhost [127.0.0.1]) by porkrind.org (8.14.9/8.14.9/Debian-4) with ESMTP id t7RIWuvp015841 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Aug 2015 11:32:56 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=porkrind.org; s=apoptygma; t=1440700377; bh=uB7ZJ9rK+PLwP7vxWQ0JSbuqs/ntmw+a0kNatK1873c=; h=From:Date:To:Subject:From; b=qNfU/3R58T6boLAXDJgHnJKuvtWefov3ERb1sr0zYdHjmNvLisoChqtUgg3TSzVO0 XIALTRFPatEN+0VclRAzZ/yOE61bpnXEqO2AOO445qIeqtzPawYPzZ4S6Eie0oSMB+ 1QAEHdnOjMJTQ+mtUq2zw7u7up2sQzJqtvaHejGDH0kvhG4zf/5RmgAjDjewAKCx+S 2oFcW97piShFnXjtY0rlrOzfHEaiZIr4HvtLYfGzA+OhRZilJzRv/YRE1g5 Original-Received: (from david@localhost) by porkrind.org (8.14.9/8.14.9/Submit) id t7RIWuhU015840; Thu, 27 Aug 2015 11:32:56 -0700 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:105887 Archived-At: --qMm9M+Fa2AknHoGS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --qMm9M+Fa2AknHoGS Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Add-vc-activate-interactive-to-activate-VC-mode-on-t.patch" >From 627c54175d9287143499ed42be91d3fcc42a74b1 Mon Sep 17 00:00:00 2001 From: David Caldwell 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 --qMm9M+Fa2AknHoGS--