aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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."
134The value is set in the current buffer, which should be the buffer 134The value is set in the current buffer, which should be the buffer
135visiting FILE." 135visiting FILE."
136 (interactive (list buffer-file-name nil)) 136 (interactive (list buffer-file-name nil))
137 (let ((vc-type (vc-backend-deduce file))) 137 (if file
138 (setq vc-mode 138 (let ((vc-type (vc-backend-deduce file)))
139 (and vc-type 139 (setq vc-mode
140 (concat " " (or label (symbol-name vc-type)) 140 (and vc-type
141 (if (and vc-rcs-status (eq vc-type 'RCS)) 141 (concat " " (or label (symbol-name vc-type))
142 (vc-rcs-status file))))) 142 (if (and vc-rcs-status (eq vc-type 'RCS))
143 ;; Even root shouldn't modify a registered file without locking it first. 143 (vc-rcs-status file)))))
144 (and vc-type 144 ;; Even root shouldn't modify a registered file without locking it first.
145 (not buffer-read-only) 145 (and vc-type
146 (zerop (user-uid)) 146 (not buffer-read-only)
147 (require 'vc) 147 (zerop (user-uid))
148 (not (string-equal (user-login-name) (vc-locking-user file))) 148 (require 'vc)
149 (setq buffer-read-only t)) 149 (not (string-equal (user-login-name) (vc-locking-user file)))
150 (and (null vc-type) 150 (setq buffer-read-only t))
151 (file-symlink-p file) 151 (and (null vc-type)
152 (let ((link-type (vc-backend-deduce (file-symlink-p file)))) 152 (file-symlink-p file)
153 (if link-type 153 (let ((link-type (vc-backend-deduce (file-symlink-p file))))
154 (message "Warning: symbolic link to %s-controlled source file" 154 (if link-type
155 link-type)))) 155 (message "Warning: symbolic link to %s-controlled source file"
156 (force-mode-line-update) 156 link-type))))
157 ;;(set-buffer-modified-p (buffer-modified-p)) ;;use this if Emacs 18 157 (force-mode-line-update)
158 vc-type)) 158 ;;(set-buffer-modified-p (buffer-modified-p)) ;;use this if Emacs 18
159 vc-type)))
159 160
160(defun vc-rcs-status (file) 161(defun vc-rcs-status (file)
161 ;; Return string for placement in modeline by `vc-mode-line'. 162 ;; Return string for placement in modeline by `vc-mode-line'.