# HG changeset patch # User Richard M. Stallman # Date 769384718 0 # Node ID 83bd6547675c28e78e0407267e9beba8960b8a96 # Parent 4d808a6268a38d37242cf7904b3ff0e9721d0b74 (vc-mode-line): Do nothing if FILE is nil. diff -r 4d808a6268a3 -r 83bd6547675c lisp/vc-hooks.el --- a/lisp/vc-hooks.el Thu May 19 21:50:30 1994 +0000 +++ b/lisp/vc-hooks.el Thu May 19 21:58:38 1994 +0000 @@ -134,28 +134,29 @@ 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'.