emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 11d40d3: Handle vc-mtn error more gently


From: Stephen Leake
Subject: [Emacs-diffs] master 11d40d3: Handle vc-mtn error more gently
Date: Wed, 29 Jul 2015 23:23:39 +0000

branch: master
commit 11d40d38c809df93956b4dbad7a3be0722d066ff
Author: Stephen Leake <address@hidden>
Commit: Stephen Leake <address@hidden>

    Handle vc-mtn error more gently
    
    * lisp/vc/vc-mtn.el (vc-mtn-mode-line-string): return "" when branch is nil
---
 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 93bd1f6..944a83e 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"))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]