* bug#18548: Emacs whitespace mode
@ 2014-09-24 12:13 Kip Coul
2014-11-14 16:49 ` bug#18548: Jack Morrison
2019-09-30 2:43 ` bug#18548: Emacs whitespace mode Stefan Kangas
0 siblings, 2 replies; 14+ messages in thread
From: Kip Coul @ 2014-09-24 12:13 UTC (permalink / raw)
To: 18548
Hi all,
I am a fan of Emacs, and I'd like to bring a minor change but that I
find actually useful.
I'd like to modify the way tabs are displayed in whitespace mode.
Basically what I want to do is the following: display a tab as a
customizable sequence of characters instead of a character followed by
spaces.
So, if a tab takes five spaces, I'd like the user to be able to customize
this, for example to display "<--->" or "---->". You can have a look
here at how they represent tabs, it's very close to what I want to do:
http://www.emacswiki.org/TabsAreEvil#SmartTabs
The user will be able to specify the following characters:
- char #1, that will be displayed at the beginning
- char #2, that will be repeated
- char #3 (optional) that will be put at the end of the tab
So, for a tab to display as "---->", you'd set char #1 = char #2 = '-'
and char #3 = '>', and for a tab to display as "<--->", you'd set char
#1 = '<', char #2 = '-' and char #3 = '>'
So, could you confirm that the file whitespace.el is the one I have to
modify? Could you give me some insight about how to do?
Thanks and regards,
Kip
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#18548:
2014-09-24 12:13 bug#18548: Emacs whitespace mode Kip Coul
@ 2014-11-14 16:49 ` Jack Morrison
2019-09-30 2:43 ` bug#18548: Emacs whitespace mode Stefan Kangas
1 sibling, 0 replies; 14+ messages in thread
From: Jack Morrison @ 2014-11-14 16:49 UTC (permalink / raw)
To: 18548
[-- Attachment #1: Type: text/plain, Size: 536 bytes --]
Hi Kip,
I think the feature you're looking for can be accomplished quickly by
customizing the `whitespace-display-mappings` customization option in
whitespace.el.
If your tab size is fixed at 4, you can just go ahead and customize it with
`M-x customize-variable whitespace-display-mappings` and change the TAB
character mapping vector to be "---->" or your preferred output. If your
tab size is variable, then perhaps you could add a hook to modify the
"tab-mark" vector list when loading a new file.
Hope that helps.
Cheers,
Jack
[-- Attachment #2: Type: text/html, Size: 1165 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#18548: Emacs whitespace mode
2014-09-24 12:13 bug#18548: Emacs whitespace mode Kip Coul
2014-11-14 16:49 ` bug#18548: Jack Morrison
@ 2019-09-30 2:43 ` Stefan Kangas
2019-10-03 9:34 ` Nathaniel Braun
1 sibling, 1 reply; 14+ messages in thread
From: Stefan Kangas @ 2019-09-30 2:43 UTC (permalink / raw)
To: Jack Morrison, Kip Coul; +Cc: 18548
Jack Morrison <JackMorrison1@gmail.com> writes:
> Hi Kip,
>
> I think the feature you're looking for can be accomplished quickly by customizing the `whitespace-display-mappings` customization option in whitespace.el.
>
> If your tab size is fixed at 4, you can just go ahead and customize it with `M-x customize-variable whitespace-display-mappings` and change the TAB character mapping vector to be "---->" or your preferred output. If your tab size is variable, then
> perhaps you could add a hook to modify the "tab-mark" vector list when loading a new file.
>
> Hope that helps.
>
> Cheers,
> Jack
Hi Kip,
It seems like the capabilities you were asking for are already there.
Did the above resolve the issue for you?
Best regards,
Stefan Kangas
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#18548: Emacs whitespace mode
2019-09-30 2:43 ` bug#18548: Emacs whitespace mode Stefan Kangas
@ 2019-10-03 9:34 ` Nathaniel Braun
2019-10-30 20:43 ` Stefan Kangas
2022-01-25 14:21 ` Lars Ingebrigtsen
0 siblings, 2 replies; 14+ messages in thread
From: Nathaniel Braun @ 2019-10-03 9:34 UTC (permalink / raw)
To: Stefan Kangas; +Cc: Kip Coul, Jack Morrison, 18548
Hello,
Thanks for your e-mail. However, no, it does not fix my problem.
Please see https://www.emacswiki.org/emacs/WhiteSpace#toc9
There you can read the following:
;; WARNING: the mapping below has a problem.
;; When a TAB occupies exactly one column, it will display
the character
;; ?\xBB at that column followed by a TAB which goes to the next TAB
;; column.
;; If this is a problem for you, please, comment the line below.
;;(tab-mark ?\t [?\xBB ?\t] [?\\ ?\t]) ; tab
This is exactly my issue! When a tab is one character, I need it to
occupy one character, not one character plus a tab.
Thanks!
On Mon, Sep 30, 2019 at 5:43 AM Stefan Kangas <stefan@marxist.se> wrote:
>
> Jack Morrison <JackMorrison1@gmail.com> writes:
>
> > Hi Kip,
> >
> > I think the feature you're looking for can be accomplished quickly by customizing the `whitespace-display-mappings` customization option in whitespace.el.
> >
> > If your tab size is fixed at 4, you can just go ahead and customize it with `M-x customize-variable whitespace-display-mappings` and change the TAB character mapping vector to be "---->" or your preferred output. If your tab size is variable, then
> > perhaps you could add a hook to modify the "tab-mark" vector list when loading a new file.
> >
> > Hope that helps.
> >
> > Cheers,
> > Jack
>
> Hi Kip,
>
> It seems like the capabilities you were asking for are already there.
> Did the above resolve the issue for you?
>
> Best regards,
> Stefan Kangas
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#18548: Emacs whitespace mode
2019-10-03 9:34 ` Nathaniel Braun
@ 2019-10-30 20:43 ` Stefan Kangas
2019-10-31 9:24 ` Nathaniel Braun
2022-01-25 14:21 ` Lars Ingebrigtsen
1 sibling, 1 reply; 14+ messages in thread
From: Stefan Kangas @ 2019-10-30 20:43 UTC (permalink / raw)
To: Nathaniel Braun; +Cc: Kip Coul, 18548, Jack Morrison
Hi Nathaniel,
Nathaniel Braun <nathaniel.braun@gmail.com> writes:
> Thanks for your e-mail. However, no, it does not fix my problem.
> Please see https://www.emacswiki.org/emacs/WhiteSpace#toc9
>
> There you can read the following:
>
> ;; WARNING: the mapping below has a problem.
> ;; When a TAB occupies exactly one column, it will display
> the character
> ;; ?\xBB at that column followed by a TAB which goes to the next TAB
> ;; column.
> ;; If this is a problem for you, please, comment the line below.
> ;;(tab-mark ?\t [?\xBB ?\t] [?\\ ?\t]) ; tab
>
> This is exactly my issue! When a tab is one character, I need it to
> occupy one character, not one character plus a tab.
Did any of the workarounds described on the linked page work for you?
Best regards,
Stefan Kangas
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#18548: Emacs whitespace mode
2019-10-30 20:43 ` Stefan Kangas
@ 2019-10-31 9:24 ` Nathaniel Braun
2019-10-31 16:15 ` Stefan Kangas
0 siblings, 1 reply; 14+ messages in thread
From: Nathaniel Braun @ 2019-10-31 9:24 UTC (permalink / raw)
To: Stefan Kangas; +Cc: Kip Coul, 18548, Jack Morrison
Thank you.
The workaround mentioned here simply deletes the tab visualization, it
does not actually fix the issue.
How can I help fix this?
Thank you
On Wed, Oct 30, 2019 at 10:43 PM Stefan Kangas <stefan@marxist.se> wrote:
>
> Hi Nathaniel,
>
> Nathaniel Braun <nathaniel.braun@gmail.com> writes:
>
> > Thanks for your e-mail. However, no, it does not fix my problem.
> > Please see https://www.emacswiki.org/emacs/WhiteSpace#toc9
> >
> > There you can read the following:
> >
> > ;; WARNING: the mapping below has a problem.
> > ;; When a TAB occupies exactly one column, it will display
> > the character
> > ;; ?\xBB at that column followed by a TAB which goes to the next TAB
> > ;; column.
> > ;; If this is a problem for you, please, comment the line below.
> > ;;(tab-mark ?\t [?\xBB ?\t] [?\\ ?\t]) ; tab
> >
> > This is exactly my issue! When a tab is one character, I need it to
> > occupy one character, not one character plus a tab.
>
> Did any of the workarounds described on the linked page work for you?
>
> Best regards,
> Stefan Kangas
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#18548: Emacs whitespace mode
2019-10-03 9:34 ` Nathaniel Braun
2019-10-30 20:43 ` Stefan Kangas
@ 2022-01-25 14:21 ` Lars Ingebrigtsen
2022-02-23 13:18 ` Lars Ingebrigtsen
1 sibling, 1 reply; 14+ messages in thread
From: Lars Ingebrigtsen @ 2022-01-25 14:21 UTC (permalink / raw)
To: Nathaniel Braun; +Cc: 18548, Kip Coul, Stefan Kangas, Jack Morrison
[-- Attachment #1: Type: text/plain, Size: 365 bytes --]
Nathaniel Braun <nathaniel.braun@gmail.com> writes:
> This is exactly my issue! When a tab is one character, I need it to
> occupy one character, not one character plus a tab.
(I'm going through old bug reports that unfortunately weren't resolved
at the time.)
This problem is still present in Emacs 29. Here's a text mode buffer
with tabs before Foo and Bar:
[-- Attachment #2: Type: image/png, Size: 3051 bytes --]
[-- Attachment #3: Type: text/plain, Size: 25 bytes --]
`M-x whitespace-mode':
[-- Attachment #4: Type: image/png, Size: 5467 bytes --]
[-- Attachment #5: Type: text/plain, Size: 391 bytes --]
So switching on whitespace-mode messes up the display if there's only
room for a single character in the TAB? This seems like such a general
problem that it's odd that this hasn't been fixed yet. But I think I
remember somebody doing work in this area... does anybody else
remember?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#18548: Emacs whitespace mode
2022-01-25 14:21 ` Lars Ingebrigtsen
@ 2022-02-23 13:18 ` Lars Ingebrigtsen
2022-02-23 13:58 ` Eli Zaretskii
0 siblings, 1 reply; 14+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-23 13:18 UTC (permalink / raw)
To: Nathaniel Braun; +Cc: Kip Coul, Stefan Kangas, Jack Morrison, 18548
Lars Ingebrigtsen <larsi@gnus.org> writes:
> So switching on whitespace-mode messes up the display if there's only
> room for a single character in the TAB? This seems like such a general
> problem that it's odd that this hasn't been fixed yet. But I think I
> remember somebody doing work in this area... does anybody else
> remember?
Ah, right -- I was probably misremembering, and I was just thinking of
this:
;; WARNING: the mapping below has a problem.
;; When a TAB occupies exactly one column, it will display the
;; character ?\xBB at that column followed by a TAB which goes to
;; the next TAB column.
;; If this is a problem for you, please, comment the line below.
(tab-mark ?\t [?» ?\t] [?\\ ?\t]) ; tab - right guillemet
This is used to set up a display table that maps tabs into [?» ?\t]:
(aset buffer-display-table (cadr entry) vec)))))))
And that does indeed lead to the messed up display described in this bug
report.
And the reason that this is rarely a problem in practice is that
normally you only have TAB characters at the start of a line (in the
modes where you typically use whitespace-mode), I think?
So I don't know whether anything can or should be done in this case. I
think that (perhaps) a reasonable default would be to remove that
mapping -- whitespace-mode (by default) marks TAB characters anyway with
a face, so having a » in addition is somewhat superfluous. On the other
hand, it's been like this forever, so perhaps we should just document
the quirk instead. Or add a defcustom to allow for easier toggling, and
the defcustom would then also act as documentation for this.
Any opinions?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#18548: Emacs whitespace mode
2022-02-23 13:18 ` Lars Ingebrigtsen
@ 2022-02-23 13:58 ` Eli Zaretskii
2022-02-23 16:28 ` Nathaniel Braun
2022-02-24 9:05 ` Lars Ingebrigtsen
0 siblings, 2 replies; 14+ messages in thread
From: Eli Zaretskii @ 2022-02-23 13:58 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: nathaniel.braun, kipcoul, stefan, JackMorrison1, 18548
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Wed, 23 Feb 2022 14:18:46 +0100
> Cc: Kip Coul <kipcoul@gmail.com>, Stefan Kangas <stefan@marxist.se>,
> Jack Morrison <JackMorrison1@gmail.com>, 18548@debbugs.gnu.org
>
> So I don't know whether anything can or should be done in this case. I
> think that (perhaps) a reasonable default would be to remove that
> mapping -- whitespace-mode (by default) marks TAB characters anyway with
> a face, so having a » in addition is somewhat superfluous. On the other
> hand, it's been like this forever, so perhaps we should just document
> the quirk instead. Or add a defcustom to allow for easier toggling, and
> the defcustom would then also act as documentation for this.
>
> Any opinions?
I think the only way to fix this (and I agree that it's a marginal use
case) is to introduce some special syntax into display-table notation,
and then teach the display engine to ignore the TAB when whatever is
before it in the display-table entry already ends at a tab stop, and
the display-table entry has that special syntax.
Not sure if it's worth the hassle.
In any case, most of the implementation should be in the display
engine, because that's where the TAB display is implemented in Emacs.
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#18548: Emacs whitespace mode
2022-02-23 13:58 ` Eli Zaretskii
@ 2022-02-23 16:28 ` Nathaniel Braun
2022-02-23 17:01 ` Eli Zaretskii
2022-02-24 9:05 ` Lars Ingebrigtsen
1 sibling, 1 reply; 14+ messages in thread
From: Nathaniel Braun @ 2022-02-23 16:28 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Lars Ingebrigtsen, Jack Morrison, Stefan Kangas, 18548
[-- Attachment #1: Type: text/plain, Size: 1428 bytes --]
Where is the display engine code?
On Wed, Feb 23, 2022 at 3:58 PM Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Lars Ingebrigtsen <larsi@gnus.org>
> > Date: Wed, 23 Feb 2022 14:18:46 +0100
> > Cc: Kip Coul <kipcoul@gmail.com>, Stefan Kangas <stefan@marxist.se>,
> > Jack Morrison <JackMorrison1@gmail.com>, 18548@debbugs.gnu.org
> >
> > So I don't know whether anything can or should be done in this case. I
> > think that (perhaps) a reasonable default would be to remove that
> > mapping -- whitespace-mode (by default) marks TAB characters anyway with
> > a face, so having a » in addition is somewhat superfluous. On the other
> > hand, it's been like this forever, so perhaps we should just document
> > the quirk instead. Or add a defcustom to allow for easier toggling, and
> > the defcustom would then also act as documentation for this.
> >
> > Any opinions?
>
> I think the only way to fix this (and I agree that it's a marginal use
> case) is to introduce some special syntax into display-table notation,
> and then teach the display engine to ignore the TAB when whatever is
> before it in the display-table entry already ends at a tab stop, and
> the display-table entry has that special syntax.
>
> Not sure if it's worth the hassle.
>
> In any case, most of the implementation should be in the display
> engine, because that's where the TAB display is implemented in Emacs.
>
[-- Attachment #2: Type: text/html, Size: 2120 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#18548: Emacs whitespace mode
2022-02-23 16:28 ` Nathaniel Braun
@ 2022-02-23 17:01 ` Eli Zaretskii
2022-02-23 17:10 ` Nathaniel Braun
0 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2022-02-23 17:01 UTC (permalink / raw)
To: Nathaniel Braun; +Cc: larsi, JackMorrison1, stefan, 18548
> From: Nathaniel Braun <nathaniel.braun@gmail.com>
> Date: Wed, 23 Feb 2022 18:28:11 +0200
> Cc: Lars Ingebrigtsen <larsi@gnus.org>, Stefan Kangas <stefan@marxist.se>,
> Jack Morrison <JackMorrison1@gmail.com>, 18548@debbugs.gnu.org
>
> Where is the display engine code?
src/xdisp.c
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#18548: Emacs whitespace mode
2022-02-23 17:01 ` Eli Zaretskii
@ 2022-02-23 17:10 ` Nathaniel Braun
0 siblings, 0 replies; 14+ messages in thread
From: Nathaniel Braun @ 2022-02-23 17:10 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Lars Ingebrigtsen, Jack Morrison, Stefan Kangas, 18548
[-- Attachment #1: Type: text/plain, Size: 405 bytes --]
Thanks! I'll have a look
On Wed, Feb 23, 2022 at 7:01 PM Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Nathaniel Braun <nathaniel.braun@gmail.com>
> > Date: Wed, 23 Feb 2022 18:28:11 +0200
> > Cc: Lars Ingebrigtsen <larsi@gnus.org>, Stefan Kangas <stefan@marxist.se>,
>
> > Jack Morrison <JackMorrison1@gmail.com>, 18548@debbugs.gnu.org
> >
> > Where is the display engine code?
>
> src/xdisp.c
>
[-- Attachment #2: Type: text/html, Size: 1040 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* bug#18548: Emacs whitespace mode
2022-02-23 13:58 ` Eli Zaretskii
2022-02-23 16:28 ` Nathaniel Braun
@ 2022-02-24 9:05 ` Lars Ingebrigtsen
1 sibling, 0 replies; 14+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-24 9:05 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: nathaniel.braun, kipcoul, stefan, JackMorrison1, 18548
Eli Zaretskii <eliz@gnu.org> writes:
> I think the only way to fix this (and I agree that it's a marginal use
> case) is to introduce some special syntax into display-table notation,
> and then teach the display engine to ignore the TAB when whatever is
> before it in the display-table entry already ends at a tab stop, and
> the display-table entry has that special syntax.
Yes, that would be nice.
> Not sure if it's worth the hassle.
No, me neither.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2022-02-24 9:05 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-24 12:13 bug#18548: Emacs whitespace mode Kip Coul
2014-11-14 16:49 ` bug#18548: Jack Morrison
2019-09-30 2:43 ` bug#18548: Emacs whitespace mode Stefan Kangas
2019-10-03 9:34 ` Nathaniel Braun
2019-10-30 20:43 ` Stefan Kangas
2019-10-31 9:24 ` Nathaniel Braun
2019-10-31 16:15 ` Stefan Kangas
2022-01-25 14:21 ` Lars Ingebrigtsen
2022-02-23 13:18 ` Lars Ingebrigtsen
2022-02-23 13:58 ` Eli Zaretskii
2022-02-23 16:28 ` Nathaniel Braun
2022-02-23 17:01 ` Eli Zaretskii
2022-02-23 17:10 ` Nathaniel Braun
2022-02-24 9:05 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).