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: Tue, 1 Sep 2015 07:56:56 -0700 Message-ID: <20150901145649.GA27344@porkrind.org> References: <20150827183246.GA15564@porkrind.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="+HP7ph2BbKc20aGI" X-Trace: ger.gmane.org 1441119502 25710 80.91.229.3 (1 Sep 2015 14:58:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 1 Sep 2015 14:58:22 +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 Tue Sep 01 16:58:11 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 1ZWn0k-0004vF-EN for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Sep 2015 16:58:10 +0200 Original-Received: from localhost ([::1]:54865 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWn0j-0001By-VW for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Sep 2015 10:58:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56334) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWn0g-0001Bn-ST for bug-gnu-emacs@gnu.org; Tue, 01 Sep 2015 10:58:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZWn0c-0007xt-Lh for bug-gnu-emacs@gnu.org; Tue, 01 Sep 2015 10:58:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53000) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWn0c-0007xo-HJ for bug-gnu-emacs@gnu.org; Tue, 01 Sep 2015 10:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZWn0c-0005iY-6V for bug-gnu-emacs@gnu.org; Tue, 01 Sep 2015 10:58: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: Tue, 01 Sep 2015 14:58:02 +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.144111945921947 (code B ref 21364); Tue, 01 Sep 2015 14:58:02 +0000 Original-Received: (at 21364) by debbugs.gnu.org; 1 Sep 2015 14:57:39 +0000 Original-Received: from localhost ([127.0.0.1]:45209 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZWn0E-0005hr-Mp for submit@debbugs.gnu.org; Tue, 01 Sep 2015 10:57:39 -0400 Original-Received: from sa38.galvanix.net ([98.126.48.38]:45011 helo=kill.porkrind.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZWn0B-0005hi-BL for 21364@debbugs.gnu.org; Tue, 01 Sep 2015 10:57:36 -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 E8FD45F139; Tue, 1 Sep 2015 07:56:59 -0700 (PDT) Authentication-Results: kill.porkrind.org; dkim=pass (1536-bit key; unprotected) header.d=porkrind.org header.i=@porkrind.org header.b=LP+WNeb7; 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 t81EuuoW027889 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 1 Sep 2015 07:56:56 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=porkrind.org; s=apoptygma; t=1441119417; bh=qXycUqYpSxb1RVfSQt8jviiZGFAX+Mxm/BYPQnm2lNc=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=LP+WNeb7aQcvWeSHFjRkd1G8Lcwhdg+c4OMlluDvi0Vmh80tDhg3FNgjnY840lV7H lcy8ZU+Qsah1lj53Gfaa2U64oztx7lxoQUEBy2deVjHS7fSA6azEIOpOgEdYzw3o7q B7HHrF6Cz//ygPEPFOI+ui0lzDGeI1UMwd+wx4vF3izdliMAQkuX00Lr5tKsaDxlYr FAxV5HP2BNE/rMPk6YGB5FyRytymuEjrdjIacHvx9JEJWyna/t0zB8yCFgr Original-Received: (from david@localhost) by porkrind.org (8.14.9/8.14.9/Submit) id t81Euu84027888; Tue, 1 Sep 2015 07:56:56 -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:106042 Archived-At: --+HP7ph2BbKc20aGI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline > > 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 --+HP7ph2BbKc20aGI Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Rename-vc-find-file-hook-to-vc-refresh-state-and-obsolete-wrapper.patch" >From c02a45346ed3dd83f24545e5cee0edc12f304c29 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 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 --+HP7ph2BbKc20aGI--