diff options
| author | Stephen Leake | 2015-07-24 11:01:16 -0500 |
|---|---|---|
| committer | Stephen Leake | 2015-07-29 18:23:14 -0500 |
| commit | 11d40d38c809df93956b4dbad7a3be0722d066ff (patch) | |
| tree | 08ae591c8f59b7d3d935a7d4cd4bf885b70b7fc1 | |
| parent | a53d1d325e0d1c0db6b407a776d6cfd3d12a90e0 (diff) | |
| download | emacs-11d40d38c809df93956b4dbad7a3be0722d066ff.tar.gz emacs-11d40d38c809df93956b4dbad7a3be0722d066ff.zip | |
Handle vc-mtn error more gently
* lisp/vc/vc-mtn.el (vc-mtn-mode-line-string): return "" when branch is nil
| -rw-r--r-- | lisp/vc/vc-mtn.el | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lisp/vc/vc-mtn.el b/lisp/vc/vc-mtn.el index 93bd1f6a83f..944a83ebc69 100644 --- a/lisp/vc/vc-mtn.el +++ b/lisp/vc/vc-mtn.el | |||
| @@ -179,15 +179,18 @@ switches." | |||
| 179 | (defun vc-mtn-mode-line-string (file) | 179 | (defun vc-mtn-mode-line-string (file) |
| 180 | "Return a string for `vc-mode-line' to put in the mode line for FILE." | 180 | "Return a string for `vc-mode-line' to put in the mode line for FILE." |
| 181 | (let ((branch (vc-mtn-workfile-branch file))) | 181 | (let ((branch (vc-mtn-workfile-branch file))) |
| 182 | (dolist (rule vc-mtn-mode-line-rewrite) | 182 | (if branch |
| 183 | (if (string-match (car rule) branch) | 183 | (progn |
| 184 | (setq branch (replace-match (cdr rule) t nil branch)))) | 184 | (dolist (rule vc-mtn-mode-line-rewrite) |
| 185 | (format "Mtn%c%s" | 185 | (if (string-match (car rule) branch) |
| 186 | (pcase (vc-state file) | 186 | (setq branch (replace-match (cdr rule) t nil branch)))) |
| 187 | ((or `up-to-date `needs-update) ?-) | 187 | (format "Mtn%c%s" |
| 188 | (`added ?@) | 188 | (pcase (vc-state file) |
| 189 | (_ ?:)) | 189 | ((or `up-to-date `needs-update) ?-) |
| 190 | branch))) | 190 | (`added ?@) |
| 191 | (_ ?:)) | ||
| 192 | branch)) | ||
| 193 | ""))) | ||
| 191 | 194 | ||
| 192 | (defun vc-mtn-register (files &optional _comment) | 195 | (defun vc-mtn-register (files &optional _comment) |
| 193 | (vc-mtn-command nil 0 files "add")) | 196 | (vc-mtn-command nil 0 files "add")) |