aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2023-11-13 09:09:15 +0200
committerJuri Linkov2023-11-13 09:09:15 +0200
commitb3d57d4397945e16edffe78d71fd1ce040f86967 (patch)
tree0e5fa2286f0eb3d0465e3ef0cd96d684228b63ae
parentece62f5c1c3ab0e1ed5e71b7adb3a6bc230f23d1 (diff)
downloademacs-b3d57d4397945e16edffe78d71fd1ce040f86967.tar.gz
emacs-b3d57d4397945e16edffe78d71fd1ce040f86967.zip
* 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.
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/vc/vc-git.el4
-rw-r--r--lisp/vc/vc-hg.el4
-rw-r--r--lisp/vc/vc-hooks.el12
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
@@ -393,6 +393,10 @@ switches for shortlogs, such as the one produced by 'C-x v L'.
393'vc-git-log-switches' is no longer used for shortlogs. 393'vc-git-log-switches' is no longer used for shortlogs.
394 394
395--- 395---
396*** New value 'no-backend' for user option 'vc-display-status'.
397With this value only the revision number is displayed on the mode-line.
398
399---
396*** Obsolete command 'vc-switch-backend' re-added as 'vc-change-backend'. 400*** Obsolete command 'vc-switch-backend' re-added as 'vc-change-backend'.
397The command was previously obsoleted and unbound in Emacs 28. 401The command was previously obsoleted and unbound in Emacs 28.
398 402
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'."
423 (rev (vc-working-revision file 'Git)) 423 (rev (vc-working-revision file 'Git))
424 (disp-rev (or (vc-git--symbolic-ref file) 424 (disp-rev (or (vc-git--symbolic-ref file)
425 (and rev (substring rev 0 7)))) 425 (and rev (substring rev 0 7))))
426 (state-string (concat backend-name indicator disp-rev))) 426 (state-string (concat (unless (eq vc-display-status 'no-backend)
427 backend-name)
428 indicator disp-rev)))
427 (propertize state-string 'face face 'help-echo 429 (propertize state-string 'face face 'help-echo
428 (concat state-echo " under the " backend-name 430 (concat state-echo " under the " backend-name
429 " version control system" 431 " 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."
365 (and vc-hg-use-file-version-for-mode-line-version 365 (and vc-hg-use-file-version-for-mode-line-version
366 truename))))) 366 truename)))))
367 (rev (or rev "???")) 367 (rev (or rev "???"))
368 (state-string (concat backend-name indicator rev))) 368 (state-string (concat (unless (eq vc-display-status 'no-backend)
369 backend-name)
370 indicator rev)))
369 (propertize state-string 'face face 'help-echo 371 (propertize state-string 'face face 'help-echo
370 (concat state-echo " under the " backend-name 372 (concat state-echo " under the " backend-name
371 " version control system")))) 373 " 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."
152 152
153(defcustom vc-display-status t 153(defcustom vc-display-status t
154 "If non-nil, display revision number and lock status in mode line. 154 "If non-nil, display revision number and lock status in mode line.
155Otherwise, not displayed." 155If nil, only the backend name is displayed. When the value
156 :type 'boolean 156is `no-backend', then no backend name is displayed before the
157revision number and lock status."
158 :type '(choice (const :tag "Show only revision/status" no-backend)
159 (const :tag "Show backend and revision/status" t)
160 (const :tag "Show only backend name" nil))
157 :group 'vc) 161 :group 'vc)
158 162
159 163
@@ -766,7 +770,9 @@ This function assumes that the file is registered."
766 (rev (vc-working-revision file backend)) 770 (rev (vc-working-revision file backend))
767 (`(,state-echo ,face ,indicator) 771 (`(,state-echo ,face ,indicator)
768 (vc-mode-line-state state)) 772 (vc-mode-line-state state))
769 (state-string (concat backend-name indicator rev))) 773 (state-string (concat (unless (eq vc-display-status 'no-backend)
774 backend-name)
775 indicator rev)))
770 (propertize state-string 'face face 'help-echo 776 (propertize state-string 'face face 'help-echo
771 (concat state-echo " under the " backend-name 777 (concat state-echo " under the " backend-name
772 " version control system")))) 778 " version control system"))))