GNU bug report logs - #68441
Fix the unaligned tab in whitespace mode

Previous Next

Package: emacs;

Reported by: Young Arto <jifengsi <at> hotmail.com>

Date: Sun, 14 Jan 2024 08:01:02 UTC

Severity: normal

To reply to this bug, email your comments to 68441 AT debbugs.gnu.org.

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#68441; Package emacs. (Sun, 14 Jan 2024 08:01:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Young Arto <jifengsi <at> hotmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 14 Jan 2024 08:01:02 GMT) Full text and rfc822 format available.

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

From: Young Arto <jifengsi <at> hotmail.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: Fix the unaligned tab in whitespace mode
Date: Sat, 13 Jan 2024 12:23:27 +0000
[Message part 1 (text/plain, inline)]
As described in the commit message, this patch is meant to fix the unaligned tab when tab-mark is turned on.
[Message part 2 (text/html, inline)]
[0001-Fix-the-unaligned-tab-with-tab-mark-of-whitespace-mo.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68441; Package emacs. (Sun, 14 Jan 2024 10:16:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Young Arto <jifengsi <at> hotmail.com>
Cc: 68441 <at> debbugs.gnu.org
Subject: Re: bug#68441: Fix the unaligned tab in whitespace mode
Date: Sun, 14 Jan 2024 12:14:38 +0200
> From: Young Arto <jifengsi <at> hotmail.com>
> Date: Sat, 13 Jan 2024 12:23:27 +0000
> msip_labels: 
> 
> There is a bug in whitespace mode which used the display table to
> replace a tab with a tab-mark vector.
> 
> If we has a line like this:
> ------
> 123\t5678
> ------
> 
> If tab-width is 4 and tab-mark is [?> ?\t],
> The line will be displayed as following:
> (we use '^' to represent tab extra spaces)
> ------
> 123>^^^^5678
> ------
> 
> However, it should be displayed as:
> ------
> 123>5678
> ------

I'm not sure I agree.  We never display a TAB as nothing, no matter if
it comes from a display vector or from a buffer or from any other
source.

So this patch changes long-standing behavior in non-trivial ways, and
I'm not sure what it can break, after so many years.  I understand
that it makes certain customizations in whitespace-mode look better on
display in some cases, but display-tables are used in Emacs not just
in whitespace-mode.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68441; Package emacs. (Sun, 28 Jan 2024 10:44:01 GMT) Full text and rfc822 format available.

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

From: Young Arto <jifengsi <at> hotmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: "68441 <at> debbugs.gnu.org" <68441 <at> debbugs.gnu.org>
Subject: 回复: bug#68441: Fix the unaligned tab in whitespace mode
Date: Sun, 28 Jan 2024 10:43:16 +0000
[Message part 1 (text/plain, inline)]
So this patch changes long-standing behavior in non-trivial ways, and
I'm not sure what it can break, after so many years.  I understand
that it makes certain customizations in whitespace-mode look better on
display in some cases, but display-tables are used in Emacs not just
in whitespace-mode.
Yes, You are right. In fact, I'm not sure what it can break either. So I have
used this patch locally for about one year with self-compiled emacs29.
Fortunately, it didn't bring any side effects for me.  However, of course,
I cannot cover every function and every package for emacs.

It is really fundamental code. On the other hand, it is also annoying to
use whitespace-mode with unaligned tabs-mark. Would you be happy
if I add an option for this behavior like 'display-vector-limit-tab' which
defaults to nil? Finally, it won't change default behavior for all emacsers
and anybody like me who has trouble with this issue can turn it on in
their configuration file so they can test if it has side effects for them or
they can share this fix.

________________________________
发件人: Eli Zaretskii <eliz <at> gnu.org>
发送时间: 2024年1月14日 10:14
收件人: Young Arto <jifengsi <at> hotmail.com>
抄送: 68441 <at> debbugs.gnu.org <68441 <at> debbugs.gnu.org>
主题: Re: bug#68441: Fix the unaligned tab in whitespace mode

> From: Young Arto <jifengsi <at> hotmail.com>
> Date: Sat, 13 Jan 2024 12:23:27 +0000
> msip_labels:
>
> There is a bug in whitespace mode which used the display table to
> replace a tab with a tab-mark vector.
>
> If we has a line like this:
> ------
> 123\t5678
> ------
>
> If tab-width is 4 and tab-mark is [?> ?\t],
> The line will be displayed as following:
> (we use '^' to represent tab extra spaces)
> ------
> 123>^^^^5678
> ------
>
> However, it should be displayed as:
> ------
> 123>5678
> ------

I'm not sure I agree.  We never display a TAB as nothing, no matter if
it comes from a display vector or from a buffer or from any other
source.

So this patch changes long-standing behavior in non-trivial ways, and
I'm not sure what it can break, after so many years.  I understand
that it makes certain customizations in whitespace-mode look better on
display in some cases, but display-tables are used in Emacs not just
in whitespace-mode.

Thanks.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#68441; Package emacs. (Sun, 28 Jan 2024 11:11:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Young Arto <jifengsi <at> hotmail.com>
Cc: 68441 <at> debbugs.gnu.org
Subject: Re: 
 回复: bug#68441: Fix the unaligned tab in whitespace mode
Date: Sun, 28 Jan 2024 13:09:50 +0200
> From: Young Arto <jifengsi <at> hotmail.com>
> CC: "68441 <at> debbugs.gnu.org" <68441 <at> debbugs.gnu.org>
> Date: Sun, 28 Jan 2024 10:43:16 +0000
> 
>  So this patch changes long-standing behavior in non-trivial ways, and
>  I'm not sure what it can break, after so many years.  I understand
>  that it makes certain customizations in whitespace-mode look better on
>  display in some cases, but display-tables are used in Emacs not just
>  in whitespace-mode.
> 
> Yes, You are right. In fact, I'm not sure what it can break either. So I have
> used this patch locally for about one year with self-compiled emacs29.
> Fortunately, it didn't bring any side effects for me.  However, of course,
> I cannot cover every function and every package for emacs.
> 
> It is really fundamental code. On the other hand, it is also annoying to
> use whitespace-mode with unaligned tabs-mark. Would you be happy
> if I add an option for this behavior like 'display-vector-limit-tab' which
> defaults to nil? Finally, it won't change default behavior for all emacsers
> and anybody like me who has trouble with this issue can turn it on in
> their configuration file so they can test if it has side effects for them or
> they can share this fix.

Adding an option is better, but I'm not sure I understand in what
circumstances that option will affect the display of a TAB that comes
from a display vector.  Your changes seem to have some conditions
whose exact rationale and effect are not clear to me.  I mean the
following conditions:

   . it->current.dpvec_index > 0
   . absolute_x % it->tab_width == 0

What are the reasons for each of these conditions, and what kinds of
display-table entries they are supposed to support?

Also, did you test the results in situations like line-truncation and
display-line-numbers-mode, including the combination of the two?  And
what about visual-line-mode?  And what about line-prefix and
wrap-prefix?

See, the Emacs display engine supports a gazillion of features, so the
effect of these changes in each of these situations should be well
understood, otherwise we will be unable to document the expected
effect of the option you are suggesting to introduce.

Thanks.




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

Previous Next


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