[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/lisp ChangeLog vc-hooks.el
From: |
Dan Nicolaescu |
Subject: |
[Emacs-diffs] emacs/lisp ChangeLog vc-hooks.el |
Date: |
Wed, 01 Apr 2009 15:42:13 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Dan Nicolaescu <dann> 09/04/01 15:42:12
Modified files:
lisp : ChangeLog vc-hooks.el
Log message:
(vc-name): Avoid calling vc-backend twice.
(vc-mode-line): Accept and use an optional argument for the
backend.
(vc-find-file-hook): Use when instead of if. Avoid calling
vc-backend multiple times, pass down the value computed the first
time.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.15537&r2=1.15538
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/vc-hooks.el?cvsroot=emacs&r1=1.276&r2=1.277
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.15537
retrieving revision 1.15538
diff -u -b -r1.15537 -r1.15538
--- ChangeLog 30 Mar 2009 15:35:52 -0000 1.15537
+++ ChangeLog 1 Apr 2009 15:42:09 -0000 1.15538
@@ -1,3 +1,12 @@
+2009-04-01 Dan Nicolaescu <address@hidden>
+
+ * vc-hooks.el (vc-name): Avoid calling vc-backend twice.
+ (vc-mode-line): Accept and use an optional argument for the
+ backend.
+ (vc-find-file-hook): Use when instead of if. Avoid calling
+ vc-backend multiple times, pass down the value computed the first
+ time.
+
2009-03-30 Andreas Schwab <address@hidden>
* ansi-color.el (ansi-color-get-face): Use
Index: vc-hooks.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc-hooks.el,v
retrieving revision 1.276
retrieving revision 1.277
diff -u -b -r1.276 -r1.277
--- vc-hooks.el 30 Jan 2009 08:35:50 -0000 1.276
+++ vc-hooks.el 1 Apr 2009 15:42:12 -0000 1.277
@@ -409,9 +409,10 @@
(or (vc-file-getprop file 'vc-name)
;; force computation of the property by calling
;; vc-BACKEND-registered explicitly
- (if (and (vc-backend file)
- (vc-call-backend (vc-backend file) 'registered file))
- (vc-file-getprop file 'vc-name))))
+ (let ((backend (vc-backend file)))
+ (if (and backend
+ (vc-call-backend backend 'registered file))
+ (vc-file-getprop file 'vc-name)))))
(defun vc-checkout-model (backend files)
"Indicate how FILES are checked out.
@@ -761,12 +762,13 @@
(define-key map [mode-line down-mouse-1] vc-menu-entry)
map))
-(defun vc-mode-line (file)
+(defun vc-mode-line (file &optional backend)
"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."
+visiting FILE.
+If BACKEND is passed use it as the VC backend when computing the result."
(interactive (list buffer-file-name))
- (let ((backend (vc-backend file)))
+ (setq backend (or backend (vc-backend file)))
(if (not backend)
(setq vc-mode nil)
(let* ((ml-string (vc-call-backend backend 'mode-line-string file))
@@ -801,7 +803,7 @@
(zerop (logand (file-modes buffer-file-name) 128))
(setq buffer-read-only t)))
(force-mode-line-update)
- backend))
+ backend)
(defun vc-default-mode-line-string (backend file)
"Return string for placement in modeline by `vc-mode-line' for FILE.
@@ -868,21 +870,22 @@
"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
+ (when vc-mode
(setq vc-mode nil))
(when buffer-file-name
(vc-file-clearprops buffer-file-name)
(add-hook 'mode-line-hook 'vc-mode-line nil t)
+ (let (backend)
(cond
- ((with-demoted-errors (vc-backend buffer-file-name))
+ ((setq backend (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 backend)
(unless vc-make-backup-files
;; Use this variable, not make-backup-files,
;; because this is for things that depend on the file name.
(set (make-local-variable 'backup-inhibited) t))
;; Let the backend setup any buffer-local things he needs.
- (vc-call-backend (vc-backend buffer-file-name) 'find-file-hook))
+ (vc-call-backend backend 'find-file-hook))
((let ((link-type (and (not (equal buffer-file-name buffer-file-truename))
(vc-backend buffer-file-truename))))
(cond ((not link-type) nil) ;Nothing to do.
@@ -909,7 +912,7 @@
(vc-find-file-hook))
(message
"Warning: editing through the link bypasses version control")
- ))))))))
+ )))))))))
(add-hook 'find-file-hook 'vc-find-file-hook)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs/lisp ChangeLog vc-hooks.el,
Dan Nicolaescu <=