GNU bug report logs - #2652
23.0.91; wacky behavior of "v" command in *vc-dir* buffer

Previous Next

Package: emacs;

Reported by: Miles Bader <miles <at> gnu.org>

Date: Fri, 13 Mar 2009 00:05:05 UTC

Severity: normal

Done: Dan Nicolaescu <dann <at> ics.uci.edu>

Bug is archived. No further changes may be made.

Full log


Message #76 received at 2652 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 2652 <at> debbugs.gnu.org, Miles Bader <miles <at> gnu.org>
Subject: Re: bug#2652: 23.0.91; wacky behavior of "v" command in *vc-dir*  buffer
Date: Mon, 23 Mar 2009 09:37:48 -0700 (PDT)
Stefan Monnier <monnier <at> iro.umontreal.ca> 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)
 




This bug report was last modified 16 years and 101 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.