From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Nicolaescu Newsgroups: gmane.emacs.bugs Subject: bug#2652: 23.0.91; wacky behavior of "v" command in *vc-dir* buffer Date: Mon, 23 Mar 2009 09:37:48 -0700 (PDT) Message-ID: <200903231637.n2NGbmvo010899@godzilla.ics.uci.edu> References: <87iqmemgyi.fsf@catnip.gol.com> <200903130038.n2D0cuTj018433@godzilla.ics.uci.edu> <200903130134.n2D1YCFF018782@godzilla.ics.uci.edu> <200903130727.n2D7RHBI020896@godzilla.ics.uci.edu> <200903131622.n2DGMAZG024224@godzilla.ics.uci.edu> <200903141603.n2EG327C002787@godzilla.ics.uci.edu> Reply-To: Dan Nicolaescu , 2652@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1237826662 22697 80.91.229.12 (23 Mar 2009 16:44:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 23 Mar 2009 16:44:22 +0000 (UTC) Cc: 2652@emacsbugs.donarmstrong.com, Miles Bader To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Mar 23 17:45:38 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LlnHM-0006OH-IC for geb-bug-gnu-emacs@m.gmane.org; Mon, 23 Mar 2009 17:45:37 +0100 Original-Received: from localhost ([127.0.0.1]:50246 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LlnFz-0005eZ-JS for geb-bug-gnu-emacs@m.gmane.org; Mon, 23 Mar 2009 12:44:11 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LlnFi-0005VB-AR for bug-gnu-emacs@gnu.org; Mon, 23 Mar 2009 12:43:54 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LlnFd-0005SJ-FP for bug-gnu-emacs@gnu.org; Mon, 23 Mar 2009 12:43:52 -0400 Original-Received: from [199.232.76.173] (port=33774 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LlnFc-0005Rs-2B for bug-gnu-emacs@gnu.org; Mon, 23 Mar 2009 12:43:48 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:56709) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LlnFb-0000Hp-HK for bug-gnu-emacs@gnu.org; Mon, 23 Mar 2009 12:43:47 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n2NGhiSW008843; Mon, 23 Mar 2009 09:43:45 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n2NGe4x9007753; Mon, 23 Mar 2009 09:40:04 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Dan Nicolaescu Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs , owner@emacsbugs.donarmstrong.com Resent-Date: Mon, 23 Mar 2009 16:40:04 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 2652 X-Emacs-PR-Package: emacs,vc X-Emacs-PR-Keywords: Original-Received: via spool by 2652-submit@emacsbugs.donarmstrong.com id=B2652.12378262837572 (code B ref 2652); Mon, 23 Mar 2009 16:40:04 +0000 Original-Received: (at 2652) by emacsbugs.donarmstrong.com; 23 Mar 2009 16:38:03 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from sallyv2.ics.uci.edu (sallyv2.ics.uci.edu [128.195.1.120]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n2NGc0IF007565 for <2652@emacsbugs.donarmstrong.com>; Mon, 23 Mar 2009 09:38:01 -0700 Original-Received: from godzilla.ics.uci.edu (godzilla.ics.uci.edu [128.195.10.101]) by sallyv2.ics.uci.edu (8.13.7+Sun/8.13.7) with ESMTP id n2NGbn8N027687; Mon, 23 Mar 2009 09:37:49 -0700 (PDT) Original-Received: (from dann@localhost) by godzilla.ics.uci.edu (8.13.8+Sun/8.13.6/Submit) id n2NGbmvo010899; Mon, 23 Mar 2009 09:37:48 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Sat, 14 Mar 2009 22:09:39 -0400") Original-Lines: 62 X-ICS-MailScanner-Information: Please contact the ISP for more information X-ICS-MailScanner-ID: n2NGbn8N027687 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam, SpamAssassin (score=-1.44, required 5, autolearn=disabled, ALL_TRUSTED -1.44) X-ICS-MailScanner-From: dann@godzilla.ics.uci.edu X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Mon, 23 Mar 2009 12:43:52 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:26574 Archived-At: Stefan Monnier writes: > > But I don't really want to check it in at this point without an explicit > > request from Stefan. > > Removing calls to determine the backend (and replace them with backend > info propagated from elsewhere) is generally a good thing. How about this one? It removes an extra vc-backend call for each VC managed file. And another one could be eliminated, but I am not 100% sure what this comment means: ;; Let the backend setup any buffer-local things he needs. (vc-call-backend (vc-backend buffer-file-name) 'find-file-hook)) --- vc-hooks.el.~1.276.~ Fri Jan 30 15:35:05 2009 +++ vc-hooks.el Sun Mar 22 21:05:25 2009 @@ -761,12 +761,12 @@ (define-key map [mode-line down-mouse-1] vc-menu-entry) map)) -(defun vc-mode-line (file) +(defun vc-mode-line (file &optional backend-arg) "Set `vc-mode' to display type of version control for FILE. The value is set in the current buffer, which should be the buffer visiting FILE." (interactive (list buffer-file-name)) - (let ((backend (vc-backend file))) + (let ((backend (or backend-arg (vc-backend file)))) (if (not backend) (setq vc-mode nil) (let* ((ml-string (vc-call-backend backend 'mode-line-string file)) @@ -868,15 +868,16 @@ "Function for `find-file-hook' activating VC mode if appropriate." ;; Recompute whether file is version controlled, ;; if user has killed the buffer and revisited. - (if vc-mode - (setq vc-mode nil)) + (when vc-mode + (setq vc-mode nil)) + (let (bk) (when buffer-file-name (vc-file-clearprops buffer-file-name) (add-hook 'mode-line-hook 'vc-mode-line nil t) (cond - ((with-demoted-errors (vc-backend buffer-file-name)) + ((setq bk (with-demoted-errors (vc-backend buffer-file-name))) ;; Compute the state and put it in the modeline. - (vc-mode-line buffer-file-name) + (vc-mode-line buffer-file-name bk) (unless vc-make-backup-files ;; Use this variable, not make-backup-files, ;; because this is for things that depend on the file name. @@ -909,7 +910,7 @@ (vc-find-file-hook)) (message "Warning: editing through the link bypasses version control") - )))))))) + ))))))))) (add-hook 'find-file-hook 'vc-find-file-hook)