GNU bug report logs - #61340
29.0.60; Extra space in xref buffer

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Tue, 7 Feb 2023 07:46:02 UTC

Severity: normal

Found in version 29.0.60

Fixed in version 30.0.50

Done: Juri Linkov <juri <at> linkov.net>

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 61340 in the body.
You can then email your comments to 61340 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#61340; Package emacs. (Tue, 07 Feb 2023 07:46:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> linkov.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 07 Feb 2023 07:46:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.60; Extra space in xref buffer
Date: Tue, 07 Feb 2023 09:40:35 +0200
This is a small problem and I didn't notice it until now when
there was an important distinction whether there is a space
character at the beginning of the line, and it was misleading
to see that xref wrongly says there is a leading space.
This is because currently xref output differs from grep and occur
where there is no space between colon and the text from file.
Here is the fix:

```
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index f01b8a1af18..6160f217afb 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -1108,7 +1108,7 @@ xref--insert-xrefs
                                    maximize (xref-location-line
                                              (xref-item-location xref)))
            for line-format = (and max-line
-                                  (format "%%%dd: " (1+ (floor (log max-line 10)))))
+                                  (format "%%%dd:" (1+ (floor (log max-line 10)))))
            with item-text-props = (list 'mouse-face 'highlight
                                         'keymap xref--button-map
                                         'help-echo
```




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61340; Package emacs. (Wed, 08 Feb 2023 00:59:01 GMT) Full text and rfc822 format available.

Message #8 received at 61340 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Juri Linkov <juri <at> linkov.net>, 61340 <at> debbugs.gnu.org
Subject: Re: bug#61340: 29.0.60; Extra space in xref buffer
Date: Wed, 8 Feb 2023 02:58:02 +0200
Hi!

On 07/02/2023 09:40, Juri Linkov wrote:
> This is a small problem and I didn't notice it until now when
> there was an important distinction whether there is a space
> character at the beginning of the line, and it was misleading
> to see that xref wrongly says there is a leading space.
> This is because currently xref output differs from grep and occur
> where there is no space between colon and the text from file.
> Here is the fix:
> 
> ```
> diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
> index f01b8a1af18..6160f217afb 100644
> --- a/lisp/progmodes/xref.el
> +++ b/lisp/progmodes/xref.el
> @@ -1108,7 +1108,7 @@ xref--insert-xrefs
>                                      maximize (xref-location-line
>                                                (xref-item-location xref)))
>              for line-format = (and max-line
> -                                  (format "%%%dd: " (1+ (floor (log max-line 10)))))
> +                                  (format "%%%dd:" (1+ (floor (log max-line 10)))))
>              with item-text-props = (list 'mouse-face 'highlight
>                                           'keymap xref--button-map
>                                           'help-echo
> ```

This was originally an effort to give the outputted text some "breathing 
room", and I think it looks a little better.

But if it can cause problems sometimes, I don't mind the proposed 
change. After all, both Grep and Occur don't have this space, and 
consistency is good.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61340; Package emacs. (Wed, 08 Feb 2023 07:37:03 GMT) Full text and rfc822 format available.

Message #11 received at 61340 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 61340 <at> debbugs.gnu.org
Subject: Re: bug#61340: 29.0.60; Extra space in xref buffer
Date: Wed, 08 Feb 2023 09:35:31 +0200
close 61340 30.0.50
thanks

>> @@ -1108,7 +1108,7 @@ xref--insert-xrefs
>>                                      maximize (xref-location-line
>>                                                (xref-item-location xref)))
>>              for line-format = (and max-line
>> -                                  (format "%%%dd: " (1+ (floor (log max-line 10)))))
>> +                                  (format "%%%dd:" (1+ (floor (log max-line 10)))))
>>              with item-text-props = (list 'mouse-face 'highlight
>>                                           'keymap xref--button-map
>>                                           'help-echo
>> ```
>
> This was originally an effort to give the outputted text some "breathing
> room", and I think it looks a little better.

Indeed, it looks better but unfortunately at the cost of caused ambiguity.
I guess this is the reason why Grep and Occur don't add space.

> But if it can cause problems sometimes, I don't mind the proposed
> change. After all, both Grep and Occur don't have this space, and
> consistency is good.

Thanks, so now pushed to master.




bug marked as fixed in version 30.0.50, send any further explanations to 61340 <at> debbugs.gnu.org and Juri Linkov <juri <at> linkov.net> Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Wed, 08 Feb 2023 07:37:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61340; Package emacs. (Wed, 08 Feb 2023 15:15:01 GMT) Full text and rfc822 format available.

Message #16 received at 61340 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Juri Linkov <juri <at> linkov.net>
Cc: 61340 <at> debbugs.gnu.org
Subject: Re: bug#61340: 29.0.60; Extra space in xref buffer
Date: Wed, 8 Feb 2023 17:14:05 +0200
On 08/02/2023 09:35, Juri Linkov wrote:
> close 61340 30.0.50
> thanks
> 
>>> @@ -1108,7 +1108,7 @@ xref--insert-xrefs
>>>                                       maximize (xref-location-line
>>>                                                 (xref-item-location xref)))
>>>               for line-format = (and max-line
>>> -                                  (format "%%%dd: " (1+ (floor (log max-line 10)))))
>>> +                                  (format "%%%dd:" (1+ (floor (log max-line 10)))))
>>>               with item-text-props = (list 'mouse-face 'highlight
>>>                                            'keymap xref--button-map
>>>                                            'help-echo
>>> ```
>> This was originally an effort to give the outputted text some "breathing
>> room", and I think it looks a little better.
> Indeed, it looks better but unfortunately at the cost of caused ambiguity.
> I guess this is the reason why Grep and Occur don't add space.
> 

I suppose we could try to tone down the colon. Occur uses 'shadow' for 
both the number and the colon; Grep uses the color from 'default' (with 
an underline).

If we fontify it with 'shadow' rather than 'xref-line-number', that 
might look a little better.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61340; Package emacs. (Wed, 08 Feb 2023 19:00:03 GMT) Full text and rfc822 format available.

Message #19 received at 61340 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 61340 <at> debbugs.gnu.org
Subject: Re: bug#61340: 29.0.60; Extra space in xref buffer
Date: Wed, 08 Feb 2023 20:51:12 +0200
>>> This was originally an effort to give the outputted text some "breathing
>>> room", and I think it looks a little better.
>> Indeed, it looks better but unfortunately at the cost of caused ambiguity.
>> I guess this is the reason why Grep and Occur don't add space.
>
> I suppose we could try to tone down the colon. Occur uses 'shadow' for both
> the number and the colon; Grep uses the color from 'default' (with an
> underline).
>
> If we fontify it with 'shadow' rather than 'xref-line-number', that might
> look a little better.

I already forgot that the default color is too glaring since I customized
it long ago to '(xref-line-number ((t (:inherit shadow)))).  But I also
customized other xref faces e.g. '(xref-file-header ((t (:extend t
:background "grey90")))), so these faces provide a better look.
OTOH, I'm not sure if the default of xref-line-number can be changed
because on the one hand the purple color from compilation-line-number
is needed in grep to make them more noticeable because the line numbers
are in the middle of the line unlike in occur.  But on the other hand
the current theme of xref buffers matches all colors of grep, so any
change will make their default themes different.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61340; Package emacs. (Wed, 08 Feb 2023 22:38:02 GMT) Full text and rfc822 format available.

Message #22 received at 61340 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Juri Linkov <juri <at> linkov.net>
Cc: 61340 <at> debbugs.gnu.org
Subject: Re: bug#61340: 29.0.60; Extra space in xref buffer
Date: Thu, 9 Feb 2023 00:37:07 +0200
On 08/02/2023 20:51, Juri Linkov wrote:
>>>> This was originally an effort to give the outputted text some "breathing
>>>> room", and I think it looks a little better.
>>> Indeed, it looks better but unfortunately at the cost of caused ambiguity.
>>> I guess this is the reason why Grep and Occur don't add space.
>> I suppose we could try to tone down the colon. Occur uses 'shadow' for both
>> the number and the colon; Grep uses the color from 'default' (with an
>> underline).
>>
>> If we fontify it with 'shadow' rather than 'xref-line-number', that might
>> look a little better.
> I already forgot that the default color is too glaring since I customized
> it long ago to '(xref-line-number ((t (:inherit shadow)))).  But I also
> customized other xref faces e.g. '(xref-file-header ((t (:extend t
> :background "grey90")))), so these faces provide a better look.
> OTOH, I'm not sure if the default of xref-line-number can be changed
> because on the one hand the purple color from compilation-line-number
> is needed in grep to make them more noticeable because the line numbers
> are in the middle of the line unlike in occur.  But on the other hand
> the current theme of xref buffers matches all colors of grep, so any
> change will make their default themes different.

Here's the change I was suggesting.

The difference is subtle, but seems like an improvement:

diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 63e065e696e..581eda0513e 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -1126,7 +1126,9 @@ xref--insert-xrefs
                                    maximize (xref-location-line
                                              (xref-item-location xref)))
            for line-format = (and max-line
-                                  (format "%%%dd:" (1+ (floor (log 
max-line 10)))))
+                                  (format
+                                   #("%%%dd:" 0 4 (face 
xref-line-number) 5 6 (face shadow))
+                                   (1+ (floor (log max-line 10)))))
            with item-text-props = (list 'mouse-face 'highlight
                                         'keymap xref--button-map
                                         'help-echo
@@ -1146,8 +1148,7 @@ xref--insert-xrefs
                         ((and (equal line prev-line)
                               (equal prev-group group))
                          "")
-                        (t (propertize (format line-format line)
-                                       'face 'xref-line-number)))))
+                        (t (format line-format line)))))
                  ;; Render multiple matches on the same line, together.
                  (when (and (equal prev-group group)
                             (or (null line)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61340; Package emacs. (Thu, 09 Feb 2023 17:55:03 GMT) Full text and rfc822 format available.

Message #25 received at 61340 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 61340 <at> debbugs.gnu.org
Subject: Re: bug#61340: 29.0.60; Extra space in xref buffer
Date: Thu, 09 Feb 2023 19:51:07 +0200
> Here's the change I was suggesting.
>
> The difference is subtle, but seems like an improvement:
>
> diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
> index 63e065e696e..581eda0513e 100644
> --- a/lisp/progmodes/xref.el
> +++ b/lisp/progmodes/xref.el
> @@ -1126,7 +1126,9 @@ xref--insert-xrefs
>                                     maximize (xref-location-line
>                                               (xref-item-location xref)))
>             for line-format = (and max-line
> -                                  (format "%%%dd:" (1+ (floor (log
>                                    max-line 10)))))
> +                                  (format
> +                                   #("%%%dd:" 0 4 (face xref-line-number)
> 5 6 (face shadow))

Thanks, this looks nice and closer to the grep output fontification.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61340; Package emacs. (Thu, 09 Feb 2023 19:59:02 GMT) Full text and rfc822 format available.

Message #28 received at 61340 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Juri Linkov <juri <at> linkov.net>
Cc: 61340 <at> debbugs.gnu.org
Subject: Re: bug#61340: 29.0.60; Extra space in xref buffer
Date: Thu, 9 Feb 2023 21:58:38 +0200
On 09/02/2023 19:51, Juri Linkov wrote:
>> Here's the change I was suggesting.
>>
>> The difference is subtle, but seems like an improvement:
>>
>> diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
>> index 63e065e696e..581eda0513e 100644
>> --- a/lisp/progmodes/xref.el
>> +++ b/lisp/progmodes/xref.el
>> @@ -1126,7 +1126,9 @@ xref--insert-xrefs
>>                                      maximize (xref-location-line
>>                                                (xref-item-location xref)))
>>              for line-format = (and max-line
>> -                                  (format "%%%dd:" (1+ (floor (log
>>                                     max-line 10)))))
>> +                                  (format
>> +                                   #("%%%dd:" 0 4 (face xref-line-number)
>> 5 6 (face shadow))
> Thanks, this looks nice and closer to the grep output fontification.

Thanks for testing, pushed to master.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61340; Package emacs. (Sat, 18 Feb 2023 22:05:01 GMT) Full text and rfc822 format available.

Message #31 received at 61340 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 61340 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#61340: 29.0.60; Extra space in xref buffer
Date: Sun, 19 Feb 2023 00:04:05 +0200
Hi Eli,

Should we backport this to emacs-29? The improvement is minor, but the 
risk is very small as well.

On 09/02/2023 21:58, Dmitry Gutov wrote:
> On 09/02/2023 19:51, Juri Linkov wrote:
>>> Here's the change I was suggesting.
>>>
>>> The difference is subtle, but seems like an improvement:
>>>
>>> diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
>>> index 63e065e696e..581eda0513e 100644
>>> --- a/lisp/progmodes/xref.el
>>> +++ b/lisp/progmodes/xref.el
>>> @@ -1126,7 +1126,9 @@ xref--insert-xrefs
>>>                                      maximize (xref-location-line
>>>                                                (xref-item-location 
>>> xref)))
>>>              for line-format = (and max-line
>>> -                                  (format "%%%dd:" (1+ (floor (log
>>>                                     max-line 10)))))
>>> +                                  (format
>>> +                                   #("%%%dd:" 0 4 (face 
>>> xref-line-number)
>>> 5 6 (face shadow))
>> Thanks, this looks nice and closer to the grep output fontification.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61340; Package emacs. (Sun, 19 Feb 2023 06:21:02 GMT) Full text and rfc822 format available.

Message #34 received at 61340 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 61340 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#61340: 29.0.60; Extra space in xref buffer
Date: Sun, 19 Feb 2023 08:20:17 +0200
> Date: Sun, 19 Feb 2023 00:04:05 +0200
> From: Dmitry Gutov <dgutov <at> yandex.ru>
> Cc: 61340 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
> 
> Should we backport this to emacs-29? The improvement is minor, but the 
> risk is very small as well.

Fine by me, thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61340; Package emacs. (Sun, 19 Feb 2023 12:29:02 GMT) Full text and rfc822 format available.

Message #37 received at 61340 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 61340 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#61340: 29.0.60; Extra space in xref buffer
Date: Sun, 19 Feb 2023 14:27:56 +0200
On 19/02/2023 08:20, Eli Zaretskii wrote:
>> Date: Sun, 19 Feb 2023 00:04:05 +0200
>> From: Dmitry Gutov<dgutov <at> yandex.ru>
>> Cc:61340 <at> debbugs.gnu.org, Juri Linkov<juri <at> linkov.net>
>>
>> Should we backport this to emacs-29? The improvement is minor, but the
>> risk is very small as well.
> Fine by me, thanks.

Thank you, done.





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 20 Mar 2023 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 9 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.