diff options
| author | Paul Eggert | 1993-07-12 22:04:35 +0000 |
|---|---|---|
| committer | Paul Eggert | 1993-07-12 22:04:35 +0000 |
| commit | 45c92c0c569a9bf4e76c37adedd1c6cb51aa10ab (patch) | |
| tree | 1bae0227a94877a065a589264fb6e080968472b9 | |
| parent | 44ca409ab8d054aca63ab260f342637c2d2829a9 (diff) | |
| download | emacs-45c92c0c569a9bf4e76c37adedd1c6cb51aa10ab.tar.gz emacs-45c92c0c569a9bf4e76c37adedd1c6cb51aa10ab.zip | |
(vc-rcs-status): Include head version number in mode line if there
are no locks.
| -rw-r--r-- | lisp/vc-hooks.el | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el index 4431183aaaa..4dfec89d4ea 100644 --- a/lisp/vc-hooks.el +++ b/lisp/vc-hooks.el | |||
| @@ -152,11 +152,11 @@ visiting FILE." | |||
| 152 | vc-type)) | 152 | vc-type)) |
| 153 | 153 | ||
| 154 | (defun vc-rcs-status (file) | 154 | (defun vc-rcs-status (file) |
| 155 | ;; Return string " [LOCKER:REV]" if FILE under RCS control, otherwise nil, | 155 | ;; Return string for placement in modeline by `vc-mode-line'. |
| 156 | ;; for placement in modeline by `vc-mode-line'. | 156 | ;; If FILE is not registered under RCS, return nil. |
| 157 | 157 | ;; If FILE is registered but not locked, return " REV" if there is a head | |
| 158 | ;; If FILE is not locked then return just "". If the FILE is locked | 158 | ;; revision and " @@" otherwise. |
| 159 | ;; then return *all* the locks currently set, in a single string of the | 159 | ;; If FILE is locked then return all locks in a string of the |
| 160 | ;; form " LOCKER1:REV1 LOCKER2:REV2 ...". | 160 | ;; form " LOCKER1:REV1 LOCKER2:REV2 ...". |
| 161 | 161 | ||
| 162 | ;; Algorithm: | 162 | ;; Algorithm: |
| @@ -177,6 +177,7 @@ visiting FILE." | |||
| 177 | 177 | ||
| 178 | ;; The output doesn't show which version you are actually looking at. | 178 | ;; The output doesn't show which version you are actually looking at. |
| 179 | ;; The modeline can get quite cluttered when there are multiple locks. | 179 | ;; The modeline can get quite cluttered when there are multiple locks. |
| 180 | ;; The head revision is probably not what you want if you've used `rcs -b'. | ||
| 180 | 181 | ||
| 181 | (let ((master (vc-name file)) | 182 | (let ((master (vc-name file)) |
| 182 | found) | 183 | found) |
| @@ -205,13 +206,21 @@ visiting FILE." | |||
| 205 | 206 | ||
| 206 | (if found | 207 | (if found |
| 207 | ;; Clean control characters from text. | 208 | ;; Clean control characters from text. |
| 208 | (let ((status | 209 | (let* ((locks |
| 209 | (save-restriction | 210 | (save-restriction |
| 210 | (narrow-to-region (match-beginning 1) (match-end 1)) | 211 | (narrow-to-region (match-beginning 1) (match-end 1)) |
| 211 | (goto-char (point-min)) | 212 | (goto-char (point-min)) |
| 212 | (while (re-search-forward "[ \b\t\n\v\f\r]+" nil t) | 213 | (while (re-search-forward "[ \b\t\n\v\f\r]+" nil t) |
| 213 | (replace-match " " t t)) | 214 | (replace-match " " t t)) |
| 214 | (buffer-string)))) | 215 | (buffer-string))) |
| 216 | (status | ||
| 217 | (if (not (string-equal locks "")) | ||
| 218 | locks | ||
| 219 | (goto-char (point-min)) | ||
| 220 | (if (looking-at "head[ \b\t\n\v\f\r]+\\([.0-9]+\\)") | ||
| 221 | (concat " " (buffer-substring (match-beginning 1) | ||
| 222 | (match-end 1))) | ||
| 223 | " @@")))) | ||
| 215 | ;; Clean work buffer. | 224 | ;; Clean work buffer. |
| 216 | (erase-buffer) | 225 | (erase-buffer) |
| 217 | (set-buffer-modified-p nil) | 226 | (set-buffer-modified-p nil) |