From: Stephen Leake Date: Fri, 24 Jul 2015 16:01:16 +0000 (-0500) Subject: Handle vc-mtn error more gently X-Git-Tag: emacs-25.0.90~1416 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=11d40d38c809df93956b4dbad7a3be0722d066ff;p=emacs.git Handle vc-mtn error more gently * lisp/vc/vc-mtn.el (vc-mtn-mode-line-string): return "" when branch is nil --- 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." (defun vc-mtn-mode-line-string (file) "Return a string for `vc-mode-line' to put in the mode line for FILE." (let ((branch (vc-mtn-workfile-branch file))) - (dolist (rule vc-mtn-mode-line-rewrite) - (if (string-match (car rule) branch) - (setq branch (replace-match (cdr rule) t nil branch)))) - (format "Mtn%c%s" - (pcase (vc-state file) - ((or `up-to-date `needs-update) ?-) - (`added ?@) - (_ ?:)) - branch))) + (if branch + (progn + (dolist (rule vc-mtn-mode-line-rewrite) + (if (string-match (car rule) branch) + (setq branch (replace-match (cdr rule) t nil branch)))) + (format "Mtn%c%s" + (pcase (vc-state file) + ((or `up-to-date `needs-update) ?-) + (`added ?@) + (_ ?:)) + branch)) + ""))) (defun vc-mtn-register (files &optional _comment) (vc-mtn-command nil 0 files "add"))