unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: 66464@debbugs.gnu.org
Subject: bug#66464: Vc mode-line
Date: Thu, 09 Nov 2023 18:41:22 +0200	[thread overview]
Message-ID: <86ttpu98wd.fsf@mail.linkov.net> (raw)
In-Reply-To: <86v8antf36.fsf@mail.linkov.net> (Juri Linkov's message of "Tue,  31 Oct 2023 09:40:13 +0200")

[-- Attachment #1: Type: text/plain, Size: 537 bytes --]

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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: vc-display-status-with-project.patch --]
[-- Type: text/x-diff, Size: 1763 bytes --]

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	other threads:[~2023-11-09 16:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-11 16:29 bug#66464: Vc mode-line Juri Linkov
2023-10-16  1:11 ` Dmitry Gutov
2023-10-16 17:14   ` Juri Linkov
2023-10-31  7:40 ` Juri Linkov
2023-11-09 16:41   ` Juri Linkov [this message]
2023-11-10  2:04     ` Dmitry Gutov
2023-11-10  7:33       ` Juri Linkov
2023-11-10 23:54         ` Dmitry Gutov
2023-11-11 18:50           ` Juri Linkov
2023-11-11 22:05             ` Dmitry Gutov
2023-11-12  8:07               ` Juri Linkov
2023-11-12 10:59                 ` Dmitry Gutov
2023-11-13  7:11                   ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86ttpu98wd.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=66464@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).