summaryrefslogtreecommitdiff
path: root/lisp/vc-hooks.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-05-19 21:58:38 +0000
committerRichard M. Stallman <rms@gnu.org>1994-05-19 21:58:38 +0000
commitf8f95135be8bb2e3bba3d98703b1dabb86c06822 (patch)
tree74b27f94011b2edd1fbfb882243f3a40a52d4987 /lisp/vc-hooks.el
parentcfc62931a9ef3b3e9bfaa887cf4dc7537e7e4316 (diff)
downloademacs-f8f95135be8bb2e3bba3d98703b1dabb86c06822.tar.gz
(vc-mode-line): Do nothing if FILE is nil.
Diffstat (limited to 'lisp/vc-hooks.el')
-rw-r--r--lisp/vc-hooks.el45
1 files changed, 23 insertions, 22 deletions
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el
index 8d7c1acdf69..dd19ac4a0d9 100644
--- a/lisp/vc-hooks.el
+++ b/lisp/vc-hooks.el
@@ -134,28 +134,29 @@ of the buffer."
The value is set in the current buffer, which should be the buffer
visiting FILE."
(interactive (list buffer-file-name nil))
- (let ((vc-type (vc-backend-deduce file)))
- (setq vc-mode
- (and vc-type
- (concat " " (or label (symbol-name vc-type))
- (if (and vc-rcs-status (eq vc-type 'RCS))
- (vc-rcs-status file)))))
- ;; Even root shouldn't modify a registered file without locking it first.
- (and vc-type
- (not buffer-read-only)
- (zerop (user-uid))
- (require 'vc)
- (not (string-equal (user-login-name) (vc-locking-user file)))
- (setq buffer-read-only t))
- (and (null vc-type)
- (file-symlink-p file)
- (let ((link-type (vc-backend-deduce (file-symlink-p file))))
- (if link-type
- (message "Warning: symbolic link to %s-controlled source file"
- link-type))))
- (force-mode-line-update)
- ;;(set-buffer-modified-p (buffer-modified-p)) ;;use this if Emacs 18
- vc-type))
+ (if file
+ (let ((vc-type (vc-backend-deduce file)))
+ (setq vc-mode
+ (and vc-type
+ (concat " " (or label (symbol-name vc-type))
+ (if (and vc-rcs-status (eq vc-type 'RCS))
+ (vc-rcs-status file)))))
+ ;; Even root shouldn't modify a registered file without locking it first.
+ (and vc-type
+ (not buffer-read-only)
+ (zerop (user-uid))
+ (require 'vc)
+ (not (string-equal (user-login-name) (vc-locking-user file)))
+ (setq buffer-read-only t))
+ (and (null vc-type)
+ (file-symlink-p file)
+ (let ((link-type (vc-backend-deduce (file-symlink-p file))))
+ (if link-type
+ (message "Warning: symbolic link to %s-controlled source file"
+ link-type))))
+ (force-mode-line-update)
+ ;;(set-buffer-modified-p (buffer-modified-p)) ;;use this if Emacs 18
+ vc-type)))
(defun vc-rcs-status (file)
;; Return string for placement in modeline by `vc-mode-line'.