diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index c16fb63b2ff..6e4be6414d2 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -152,8 +152,15 @@ vc-follow-symlinks (defcustom vc-display-status t "If non-nil, display revision number and lock status in mode line. -Otherwise, not displayed." - :type 'boolean +If nil, it's not displayed. +When the value is `with-project' then instead of the backend name +a project name can be displayed before the revision number and lock +status. This works only in case when you enable `project-mode-line' +and don't change the default order of `project-mode-line' and +`vc-mode' in `mode-line-format'." + :type '(choice (const :tag "Show project name and status" with-project) + (const :tag "Show backend and status" t) + (const :tag "Show only backend name" nil)) :group 'vc) @@ -683,7 +690,9 @@ vc-mode-line (ml-echo (get-text-property 0 'help-echo ml-string))) (setq vc-mode (concat - " " + (unless (and (eq vc-display-status 'with-project) + (bound-and-true-p project-mode-line)) + " ") (propertize ml-string 'mouse-face 'mode-line-highlight diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 707fc7cfc07..0313f6ec827 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -423,7 +423,10 @@ vc-git-mode-line-string (rev (vc-working-revision file 'Git)) (disp-rev (or (vc-git--symbolic-ref file) (and rev (substring rev 0 7)))) - (state-string (concat backend-name indicator disp-rev))) + (state-string (concat (unless (and (eq vc-display-status 'with-project) + (bound-and-true-p project-mode-line)) + backend-name) + indicator disp-rev))) (propertize state-string 'face face 'help-echo (concat state-echo " under the " backend-name " version control system"