[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master b3d57d43979: * lisp/vc/vc-hooks.el (vc-display-status): New value
From: |
Juri Linkov |
Subject: |
master b3d57d43979: * lisp/vc/vc-hooks.el (vc-display-status): New value 'no-backend' (bug#66464). |
Date: |
Mon, 13 Nov 2023 02:12:14 -0500 (EST) |
branch: master
commit b3d57d4397945e16edffe78d71fd1ce040f86967
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>
* lisp/vc/vc-hooks.el (vc-display-status): New value 'no-backend'
(bug#66464).
* lisp/vc/vc-hooks.el (vc-default-mode-line-string): Use it.
* lisp/vc/vc-git.el (vc-git-mode-line-string): Use it.
* lisp/vc/vc-hg.el (vc-hg-mode-line-string): Use it.
---
etc/NEWS | 4 ++++
lisp/vc/vc-git.el | 4 +++-
lisp/vc/vc-hg.el | 4 +++-
lisp/vc/vc-hooks.el | 12 +++++++++---
4 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 8324eb7da1e..58bb1c052f1 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -392,6 +392,10 @@ This is a string or a list of strings that specifies the
Git log
switches for shortlogs, such as the one produced by 'C-x v L'.
'vc-git-log-switches' is no longer used for shortlogs.
+---
+*** New value 'no-backend' for user option 'vc-display-status'.
+With this value only the revision number is displayed on the mode-line.
+
---
*** Obsolete command 'vc-switch-backend' re-added as 'vc-change-backend'.
The command was previously obsoleted and unbound in Emacs 28.
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 707fc7cfc07..2e057ecfaa7 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -423,7 +423,9 @@ in the order given by `git status'."
(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 (eq vc-display-status 'no-backend)
+ backend-name)
+ indicator disp-rev)))
(propertize state-string 'face face 'help-echo
(concat state-echo " under the " backend-name
" version control system"
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index 89b2814a0a3..9df517ea847 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -365,7 +365,9 @@ specific file to query."
(and vc-hg-use-file-version-for-mode-line-version
truename)))))
(rev (or rev "???"))
- (state-string (concat backend-name indicator rev)))
+ (state-string (concat (unless (eq vc-display-status 'no-backend)
+ backend-name)
+ indicator rev)))
(propertize state-string 'face face 'help-echo
(concat state-echo " under the " backend-name
" version control system"))))
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index c16fb63b2ff..8451128286b 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -152,8 +152,12 @@ visited and a warning displayed."
(defcustom vc-display-status t
"If non-nil, display revision number and lock status in mode line.
-Otherwise, not displayed."
- :type 'boolean
+If nil, only the backend name is displayed. When the value
+is `no-backend', then no backend name is displayed before the
+revision number and lock status."
+ :type '(choice (const :tag "Show only revision/status" no-backend)
+ (const :tag "Show backend and revision/status" t)
+ (const :tag "Show only backend name" nil))
:group 'vc)
@@ -766,7 +770,9 @@ This function assumes that the file is registered."
(rev (vc-working-revision file backend))
(`(,state-echo ,face ,indicator)
(vc-mode-line-state state))
- (state-string (concat backend-name indicator rev)))
+ (state-string (concat (unless (eq vc-display-status 'no-backend)
+ backend-name)
+ indicator rev)))
(propertize state-string 'face face 'help-echo
(concat state-echo " under the " backend-name
" version control system"))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master b3d57d43979: * lisp/vc/vc-hooks.el (vc-display-status): New value 'no-backend' (bug#66464).,
Juri Linkov <=