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: Sun, 30 Aug 2015 03:22:07 -0700 Message-ID: <20150830102159.GA5832@porkrind.org> References: <20150827183246.GA15564@porkrind.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="lrZ03NoBR/3+SXJZ" X-Trace: ger.gmane.org 1440930207 29550 80.91.229.3 (30 Aug 2015 10:23:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 30 Aug 2015 10:23:27 +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 Sun Aug 30 12:23:15 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 1ZVzlb-0006SI-9x for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 Aug 2015 12:23:15 +0200 Original-Received: from localhost ([::1]:58071 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZVzlb-0000Ns-7y for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 Aug 2015 06:23:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58962) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZVzlT-0000Fd-HU for bug-gnu-emacs@gnu.org; Sun, 30 Aug 2015 06:23:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZVzlO-0007VL-JM for bug-gnu-emacs@gnu.org; Sun, 30 Aug 2015 06:23:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:50287) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZVzlO-0007VG-Ds for bug-gnu-emacs@gnu.org; Sun, 30 Aug 2015 06:23:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZVzlO-0004Us-0q for bug-gnu-emacs@gnu.org; Sun, 30 Aug 2015 06:23: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: Sun, 30 Aug 2015 10:23: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.144093014117198 (code B ref 21364); Sun, 30 Aug 2015 10:23:01 +0000 Original-Received: (at 21364) by debbugs.gnu.org; 30 Aug 2015 10:22:21 +0000 Original-Received: from localhost ([127.0.0.1]:42497 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZVzki-0004TI-Of for submit@debbugs.gnu.org; Sun, 30 Aug 2015 06:22:21 -0400 Original-Received: from sa38.galvanix.net ([98.126.48.38]:44959 helo=kill.porkrind.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZVzke-0004T4-TT for 21364@debbugs.gnu.org; Sun, 30 Aug 2015 06:22:18 -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 A454D5F357; Sun, 30 Aug 2015 03:22:09 -0700 (PDT) Authentication-Results: kill.porkrind.org; dkim=pass (1536-bit key; unprotected) header.d=porkrind.org header.i=@porkrind.org header.b=ADsA3tXd; 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 t7UAM7af007996 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 30 Aug 2015 03:22:07 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=porkrind.org; s=apoptygma; t=1440930127; bh=WDbu/lkRCr6LR+ZjJaqVZrH8b7vKNK/8EcMEIgeVL9w=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=ADsA3tXdx8FHg6ELymCVKGivvB4QyU/DqmTIOHc97Tb9MtSKkn+RwRp59mh3AlKrv ZN16Bo4Dke8Xl5ISJUPh/P/s/i+mdEBO3pR3yxcQIeeeUAm2To3I91Zu55mD+Z3dNC +5pW7ISMF0wt9HySpFZWA0mjbqoO1CLPR2+NnixyCDAJ+5PZRh5KgMOqJ1M9RWgzr7 kuoVeE97vAB+h2kBmjoX8lTSFELzYm7J+j+S/XhCNMnFejJprBHeDAXJeym Original-Received: (from david@localhost) by porkrind.org (8.14.9/8.14.9/Submit) id t7UAM7xM007995; Sun, 30 Aug 2015 03:22:07 -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:105973 Archived-At: --lrZ03NoBR/3+SXJZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline > How 'bout `vc-refresh-state'? That sounds good to me. > > Also, I was thinking maybe it would make more sense to rename > > vc-find-file-hook to vc-buffer-refresh (making it interactive along the > > way) and then doing: > > > (add-hook 'find-file-hook 'vc-buffer-refresh) > > If the two are really identical, then yes, it makes sense to just rename > the existing function and make it interactive. Attached is a new patch that does just that (but calling the function vc-refresh-state. -David --lrZ03NoBR/3+SXJZ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Rename-vc-find-file-hook-to-vc-refresh-state.patch" >From 2dcff538fdebc012aac03ab37105e5374a415641 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. --- lisp/vc/vc-hooks.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index bae9919..f5e9eb4 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,18 @@ 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) +(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 --lrZ03NoBR/3+SXJZ--