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: Mon, 31 Aug 2015 03:05:19 -0700 Message-ID: <20150831100511.GA24215@porkrind.org> References: <20150827183246.GA15564@porkrind.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MGYHOYXEY6WxJCY8" X-Trace: ger.gmane.org 1441015644 4247 80.91.229.3 (31 Aug 2015 10:07:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 31 Aug 2015 10:07:24 +0000 (UTC) Cc: 21364@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Aug 31 12:07:12 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 1ZWLza-0005Sv-VG for geb-bug-gnu-emacs@m.gmane.org; Mon, 31 Aug 2015 12:07:11 +0200 Original-Received: from localhost ([::1]:35505 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWLzZ-000094-W3 for geb-bug-gnu-emacs@m.gmane.org; Mon, 31 Aug 2015 06:07:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60603) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWLzV-00008f-NV for bug-gnu-emacs@gnu.org; Mon, 31 Aug 2015 06:07:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZWLzS-0006gY-H6 for bug-gnu-emacs@gnu.org; Mon, 31 Aug 2015 06:07:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51242) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWLzS-0006ec-67 for bug-gnu-emacs@gnu.org; Mon, 31 Aug 2015 06:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZWLzR-0001T4-K6 for bug-gnu-emacs@gnu.org; Mon, 31 Aug 2015 06:07:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: David Caldwell Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 31 Aug 2015 10:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21364 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 21364-submit@debbugs.gnu.org id=B21364.14410155695579 (code B ref 21364); Mon, 31 Aug 2015 10:07:01 +0000 Original-Received: (at 21364) by debbugs.gnu.org; 31 Aug 2015 10:06:09 +0000 Original-Received: from localhost ([127.0.0.1]:43452 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZWLya-0001Ru-9e for submit@debbugs.gnu.org; Mon, 31 Aug 2015 06:06:08 -0400 Original-Received: from sa38.galvanix.net ([98.126.48.38]:57753 helo=kill.porkrind.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZWLyW-0001Rk-QT for 21364@debbugs.gnu.org; Mon, 31 Aug 2015 06:06:06 -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 3C9A55F390; Mon, 31 Aug 2015 03:05:25 -0700 (PDT) Authentication-Results: kill.porkrind.org; dkim=pass (1536-bit key; unprotected) header.d=porkrind.org header.i=@porkrind.org header.b=jcb2t5BY; 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 t7VA5J76024779 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 31 Aug 2015 03:05:19 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=porkrind.org; s=apoptygma; t=1441015520; bh=8uq2a6YvVNampDStqu7HWTVn1P+8fBThOxmN9iThJZI=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=jcb2t5BYRySLNWmEg/RsVdZYIczWRwKpuwHJPtR82y1i4Iu6KP1iZ97bD/3MgnZXq P6yqct85EatvZAtjIWBzEf5+KfKV5jSB10ewMypNEy1FdRimnAfd/LPrNc/1aSEmgp lC3TGyafhKg5SotBIsq5TkIZWw8qe1O1G6R2P35YWLMXNFZjfCkjq08j0f8XbNPygL 6B5UQVCS/f65HU79w/nxWY4B6UeG+GA+3LeJ+cf3cTfFJzvdgbnPcS8Qfz/ Original-Received: (from david@localhost) by porkrind.org (8.14.9/8.14.9/Submit) id t7VA5JhS024778; Mon, 31 Aug 2015 03:05:19 -0700 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) 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:106003 Archived-At: --MGYHOYXEY6WxJCY8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline > > -(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) > > I think vc-find-file-hook is called from various other places, so please > add an obsolete alias for the old name. 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. The old one didn't, but I'm not sure it's worth the effort to change it. If you think it is, I'll give it a shot. -David --MGYHOYXEY6WxJCY8 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Rename-vc-find-file-hook-to-vc-refresh-state-and-obsolete.patch" >From 6cf0d2ad94666ffc14134541b6e7300f9d04ce67 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 alias. --- lisp/vc/vc-hooks.el | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index bae9919..18cdbdd 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,20 @@ 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) +(define-obsolete-function-alias '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 --MGYHOYXEY6WxJCY8--