(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"))