From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#66464: Vc mode-line Date: Sun, 12 Nov 2023 10:07:49 +0200 Organization: LINKOV.NET Message-ID: <86r0kvwg16.fsf@mail.linkov.net> References: <86a5spm8be.fsf@mail.linkov.net> <86v8antf36.fsf@mail.linkov.net> <86ttpu98wd.fsf@mail.linkov.net> <5c8d51aa-8625-9b2c-3c15-037b5d10de08@gutov.dev> <868r76p16h.fsf@mail.linkov.net> <86r0kw3z67.fsf@mail.linkov.net> <9b794172-efaa-85d3-ff56-fcd4ecd9e46c@gutov.dev> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1199"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: 66464@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 12 09:33:46 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r25ub-0000CA-Ks for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Nov 2023 09:33:45 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r25uF-00019I-L2; Sun, 12 Nov 2023 03:33:23 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r25uD-000148-TG for bug-gnu-emacs@gnu.org; Sun, 12 Nov 2023 03:33:21 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r25uD-0002Hx-Jg for bug-gnu-emacs@gnu.org; Sun, 12 Nov 2023 03:33:21 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r25us-0000mB-9M for bug-gnu-emacs@gnu.org; Sun, 12 Nov 2023 03:34:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Nov 2023 08:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66464 X-GNU-PR-Package: emacs Original-Received: via spool by 66464-submit@debbugs.gnu.org id=B66464.16997780192934 (code B ref 66464); Sun, 12 Nov 2023 08:34:02 +0000 Original-Received: (at 66464) by debbugs.gnu.org; 12 Nov 2023 08:33:39 +0000 Original-Received: from localhost ([127.0.0.1]:55082 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r25uU-0000lF-Sr for submit@debbugs.gnu.org; Sun, 12 Nov 2023 03:33:39 -0500 Original-Received: from relay7-d.mail.gandi.net ([2001:4b98:dc4:8::227]:47103) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r25uT-0000l0-9W for 66464@debbugs.gnu.org; Sun, 12 Nov 2023 03:33:37 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 0982E20002; Sun, 12 Nov 2023 08:32:48 +0000 (UTC) In-Reply-To: <9b794172-efaa-85d3-ff56-fcd4ecd9e46c@gutov.dev> (Dmitry Gutov's message of "Sun, 12 Nov 2023 00:05:32 +0200") X-GND-Sasl: juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:274190 Archived-At: --=-=-= Content-Type: text/plain >> PS: Probably we could also add another option `no-backend' >> that will show only an indicator and the branch name. >> But the dangling indicator such as "-" or "*" before the branch name >> doesn't look nice when there is a space that separates it >> from the project name, e.g. "project -branch". > > It would probably make more sense to me, but having both might be overkill. > > FWIW, with the custom mode-line that I use (smart-mode-line) the results of > these two options would look the same -- space-separated anyway. Oh, this means that removing a space is useless for such mode-lines. Ok, then let's add a much cleaner option `no-backend'. Then anyone who doesn't like that space could customize the mode line with something like (define-advice vc-mode-line (:after (&rest _args) remove-space) (setq vc-mode (string-trim-left vc-mode))) --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=vc-display-status-no-backend.patch diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index c16fb63b2ff..f65ee150603 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -152,8 +152,12 @@ 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, 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 +769,9 @@ vc-default-mode-line-string (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")))) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 707fc7cfc07..27eebe79148 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -423,7 +423,9 @@ 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 (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 @@ vc-hg-mode-line-string (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")))) --=-=-=--