unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dan Nicolaescu <dann@ics.uci.edu>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 2652@emacsbugs.donarmstrong.com, Miles Bader <miles@gnu.org>
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)	[thread overview]
Message-ID: <200903231637.n2NGbmvo010899@godzilla.ics.uci.edu> (raw)
In-Reply-To: <jwvab7nedw8.fsf-monnier+emacsbugreports@gnu.org> (Stefan Monnier's message of "Sat, 14 Mar 2009 22:09:39 -0400")

Stefan Monnier <monnier@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)
 






  parent reply	other threads:[~2009-03-23 16:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-12 23:58 bug#2652: 23.0.91; wacky behavior of "v" command in *vc-dir* buffer Miles Bader
2009-03-13  0:38 ` Dan Nicolaescu
2009-03-13  1:05   ` Miles Bader
2009-03-13  1:06     ` Miles Bader
2009-03-13  1:34     ` Dan Nicolaescu
2009-03-13  1:50       ` Miles Bader
2009-03-13  2:49         ` Miles Bader
2009-03-13  2:59           ` Miles Bader
2009-03-13  7:27             ` Dan Nicolaescu
2009-03-13  7:49               ` Miles Bader
2009-03-13 15:31                 ` Dan Nicolaescu
2009-03-13 16:22                 ` Dan Nicolaescu
2009-03-14 16:03                   ` Dan Nicolaescu
2009-03-15  2:09                     ` Stefan Monnier
2009-03-15  9:07                       ` Dan Nicolaescu
2009-03-23 16:37                       ` Dan Nicolaescu [this message]
2009-03-23 17:34                         ` Stefan Monnier
2009-04-13 17:02                       ` Dan Nicolaescu
2009-04-13 18:03                         ` Stefan Monnier
2009-03-15  2:30                     ` Miles Bader
2009-03-15  9:05                 ` Dan Nicolaescu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200903231637.n2NGbmvo010899@godzilla.ics.uci.edu \
    --to=dann@ics.uci.edu \
    --cc=2652@emacsbugs.donarmstrong.com \
    --cc=miles@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).