GNU bug report logs -
#59491
29.0.50; [PATCH] Mode-line elements too wide in some VC buffers
Previous Next
Reported by: Gabriel <gabriel376 <at> hotmail.com>
Date: Tue, 22 Nov 2022 20:59:02 UTC
Severity: wishlist
Found in version 29.0.50
Done: Stefan Kangas <stefankangas <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 59491 in the body.
You can then email your comments to 59491 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59491
; Package
emacs
.
(Tue, 22 Nov 2022 20:59:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Gabriel <gabriel376 <at> hotmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 22 Nov 2022 20:59:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Severity: wishlist
Description:
Some mode-line elements are too wide in some VC buffers, which affects
the information visibility.
Steps:
1) emacs -Q
2) Open some file controlled by Git VC, e.g.: C-x f ~/git/emacs/README
The buffer named "README" will be shown, the buffer name is displayed on
the left side of the mode-line.
(length (buffer-name)) => 6
3) Annotate the buffer: C-x v g
The VC-Annotate buffer named "*Annotate README (rev 1f39da3098a2a4cec9985e6db934ed14b7b522b7)*"
will be shown, the buffer name is displayed on the left side of the
mode-line. The revision number might differ.
(length (buffer-name)) => 64
4) Show log revision at line: l
The Git-Log-View buffer will be shown. The value of
`vc-parent-buffername' is " from *Annotate README (rev 1f39da3098a2a4cec9985e6db934ed14b7b522b7)*",
displayed on the right side of the mode-line. The revision number might
differ.
(length vc-parent-buffer-name) => 70
Analysis:
A short named buffer "README" with length of 6 had information displayed
in the mode-line with lengths of 64 (with `vc-annotate') and 70 (with
`vc-annotate-show-log-revision-at-line'). This excessive length affects
the visibility of information in mode-line, which was supposed to ease
the access of information to the user. A long buffer name can also
affect the display and usability in other interfaces, e.g.:
`list-buffers', `ibuffer' etc.
The problem, in this case, is the long revision string used by Git. I
am not sure how other VCs behaves in this matter (bzr, cvs, dav, hg,
rcs, sccs, src, svc etc).
Solutions:
For Git, a better option would be to use a "short revision" (by default
the first 7 characters of the "long revision"), which would reduce, for
the example above, the length from 64 to 39 (and `vc-parent-buffer-name'
from 70 to 45):
diff --git a/lisp/vc/vc-annotate.el b/lisp/vc/vc-annotate.el
index a15cf417de..63485af52e 100644
--- a/lisp/vc/vc-annotate.el
+++ b/lisp/vc/vc-annotate.el
@@ -409,7 +409,9 @@ vc-annotate
nil nil "20")))))))
(vc-ensure-vc-buffer)
(setq vc-annotate-display-mode display-mode) ;Not sure why. --Stef
- (let* ((temp-buffer-name (format "*Annotate %s (rev %s)*" (buffer-name) rev))
+ (let* ((temp-buffer-name (format "*Annotate %s (rev %s)*"
+ (buffer-name)
+ (string-limit rev 7)))
(temp-buffer-show-function 'vc-annotate-display-select)
;; If BUF is specified, we presume the caller maintains current line,
;; so we don't need to do it here. This implementation may give
Another option would be to display additional information in the
header-line.
Another option would be to allow the user to format how the VC-Annotate
buffer name is displayed (and optionally also the
`vc-parent-buffer-name'). See attached patches.
[0001-New-option-vc-annotate-buffer-name-function.patch (text/x-diff, attachment)]
[0001-New-option-vc-parent-buffer-name-format-function.patch (text/x-diff, attachment)]
[Message part 4 (text/plain, inline)]
Please share your suggestions.
---
Gabriel
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59491
; Package
emacs
.
(Wed, 23 Nov 2022 12:15:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 59491 <at> debbugs.gnu.org (full text, mbox):
> From: Gabriel <gabriel376 <at> hotmail.com>
> Date: Tue, 22 Nov 2022 17:58:25 -0300
>
> For Git, a better option would be to use a "short revision" (by default
> the first 7 characters of the "long revision")
AFAIR, just taking the first 7 characters is not safe; you need to ask Git.
But maybe for this purpose taking 7 would be enough?
> Another option would be to allow the user to format how the VC-Annotate
> buffer name is displayed (and optionally also the
> `vc-parent-buffer-name'). See attached patches.
That sounds like overkill to me.
Let's see what Dmitry thinks about this.
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59491
; Package
emacs
.
(Wed, 23 Nov 2022 18:44:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 59491 <at> debbugs.gnu.org (full text, mbox):
On 11/23/2022 4:14 AM, Eli Zaretskii wrote:
>> From: Gabriel <gabriel376 <at> hotmail.com>
>> Date: Tue, 22 Nov 2022 17:58:25 -0300
>>
>> For Git, a better option would be to use a "short revision" (by default
>> the first 7 characters of the "long revision")
>
> AFAIR, just taking the first 7 characters is not safe; you need to ask Git.
> But maybe for this purpose taking 7 would be enough?
It'd be nice to pass this through `git rev-parse --short` or maybe even
`git describe --always --all`. vc-git.el could also use something like
this when it gets the ref for the modeline (see
'vc-git-mode-line-string' and 'vc-git--symbolic-ref').
In fact, maybe there should be a generic VC function for getting a
"friendly" string describing a commit. Then code could use that function
in some/most cases instead of showing the full commit ID.
Removed tag(s) patch.
Request was from
Stefan Kangas <stefankangas <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Fri, 25 Nov 2022 08:05:02 GMT)
Full text and
rfc822 format available.
Reply sent
to
Stefan Kangas <stefankangas <at> gmail.com>
:
You have taken responsibility.
(Wed, 12 Feb 2025 15:57:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Gabriel <gabriel376 <at> hotmail.com>
:
bug acknowledged by developer.
(Wed, 12 Feb 2025 15:57:02 GMT)
Full text and
rfc822 format available.
Message #18 received at 59491-done <at> debbugs.gnu.org (full text, mbox):
Gabriel <gabriel376 <at> hotmail.com> writes:
> Severity: wishlist
>
> Description:
>
> Some mode-line elements are too wide in some VC buffers, which affects
> the information visibility.
>
> Steps:
>
> 1) emacs -Q
>
> 2) Open some file controlled by Git VC, e.g.: C-x f ~/git/emacs/README
>
> The buffer named "README" will be shown, the buffer name is displayed on
> the left side of the mode-line.
>
> (length (buffer-name)) => 6
>
> 3) Annotate the buffer: C-x v g
>
> The VC-Annotate buffer named "*Annotate README (rev 1f39da3098a2a4cec9985e6db934ed14b7b522b7)*"
> will be shown, the buffer name is displayed on the left side of the
> mode-line. The revision number might differ.
>
> (length (buffer-name)) => 64
>
> 4) Show log revision at line: l
>
> The Git-Log-View buffer will be shown. The value of
> `vc-parent-buffername' is " from *Annotate README (rev 1f39da3098a2a4cec9985e6db934ed14b7b522b7)*",
> displayed on the right side of the mode-line. The revision number might
> differ.
>
> (length vc-parent-buffer-name) => 70
This seems to have been fixed in recent versions of Emacs, so I'm
closing this bug now.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 13 Mar 2025 11:24:29 GMT)
Full text and
rfc822 format available.
This bug report was last modified today.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.