bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#66464: Vc mode-line


From: Juri Linkov
Subject: bug#66464: Vc mode-line
Date: Thu, 09 Nov 2023 18:41:22 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

reopen 66464
thanks

>> In order to prepare for making the vc mode-line more customizable,
>> here is refactoring that helps to avoid code duplication in
>> vc-hg-mode-line-string, and at the same time makes
>> vc-git-mode-line-string less hackish while keeping it short.
>
> After more thinking I see no way to join project and vc
> indicators on the mode line, so I'm closing this feature request.

It would be a pity not to add this handy feature.
So here is a small patch that joins the project name and vc status
on the mode line:

diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index c16fb63b2ff..63d7036f299 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -153,7 +153,9 @@ 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
+  :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 +685,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"

reply via email to

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