diff options
| author | Richard M. Stallman | 1994-05-19 21:58:38 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-05-19 21:58:38 +0000 |
| commit | 19021bfb368e5c944a36504015e7c582aecacdc2 (patch) | |
| tree | 85b775fbda37e38e78eef754b9a5f5567df467e3 | |
| parent | e89a7d771b61197e1d0a1fb70a940218fb7652d9 (diff) | |
| download | emacs-19021bfb368e5c944a36504015e7c582aecacdc2.tar.gz emacs-19021bfb368e5c944a36504015e7c582aecacdc2.zip | |
(vc-mode-line): Do nothing if FILE is nil.
| -rw-r--r-- | lisp/vc-hooks.el | 45 |
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." | |||
| 134 | The value is set in the current buffer, which should be the buffer | 134 | The value is set in the current buffer, which should be the buffer |
| 135 | visiting FILE." | 135 | visiting 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'. |