unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Frédéric Baldit" <frederic.baldit@free.fr>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 46590@debbugs.gnu.org
Subject: bug#46590: 27.1.91; abnormal whitespace-mode behavior
Date: Tue, 23 Feb 2021 15:05:47 +0100	[thread overview]
Message-ID: <20210223150547.45f58520@Cornafion.lan> (raw)
In-Reply-To: <837dn3143m.fsf@gnu.org>


Thank you for your message and for pointing out the warning in
whitespace.el code.
Now I can better understand what is triggering this bad display. For
example, the following text yields the same result:
........First line of text in emacs
.......
(eight spaces at beginning of line 1, 7 at beginning of line 2, point
at end of line 2). Then typing TAB inserts 1 TAB symbol (character
'»', \xBB) followed by eight grouped spaces (1 TAB), whereas only one
'»' should be indeed be displayed.

I'm quite surprised by this, because to me it's not so marginal and
unused. Also whitespace.el is now builtin with emacs. And emacs is
such a long-time proven editor, I think it can be quite disappointing to
see such a «flat» (I mean trivial) bug in it.

I just began reading whitespace.el, in particular the use of the
display table, which seems to be crucial here. But I'm just
learning emacs (and emacs lisp), so there could be a long way
before I can truly  (and deeply) understand whitespace.el code and see
how to fix the bug.

I asked myself: should I contact the maintainer of whitespace.el
(Vinicius Jose Latorre) to get some help?

--
  Frédéric Baldit

Le sam. 20 févr. 2021 à 11:27:25 +0200
Eli Zaretskii <eliz@gnu.org> a écrit:

> > Date: Wed, 17 Feb 2021 15:06:14 +0100
> > From: Frédéric Baldit <frederic.baldit@free.fr>
> > 
> > emacs -Q test.txt &
> > 
> > 2) M-x whitespace-mode RET
> > 
> > 3) type the following text («.» for spacebar key):
> > 
> > «....First line of text in emacs», then type RET
> > 
> > 4) DEL DEL to suppress backward two spaces on line 2, then type text
> > «Second one»
> > 
> > 5) M-2 M-b
> > 
> > 6) TAB TAB TAB TAB: point should be at line 2, column 18, vertically
> > aligned with fourth word of line 1 («text»), but it is at column 26:
> > that's the bug.  
> 
> It's a known misfeature of whitespace-mode.  There's a comment in
> whitespace.el to that effect:
> 
>     ;; 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
> 
> You could customize whitespace-display-mappings to remove tab-mark
> from it, if you want to avoid this issue.
> 
> > Rq1: what is curious (to me) is that deactivating whitespace-mode
> > removes abnormally inserted tab character (8 spaces) and everything
> > is OK.  
> 
> That's because disabling whitespace-mode deactivates the display-table
> mappings, which include the above mapping.
> 
> > Rq2: I noted that with a different text, this behavior of
> > whitespace-mode disappears. For example, if one uses the following
> > first line of text:
> > 
> > «....This.is.a.first.line.of.text.with.a.few.words»,
> > 
> > then the result of typing TAB multiple times is as expected, with or
> > without whitespace-mode activated!  
> 
> Most probably because the "TAB occupies exactly one column" condition
> doesn't happen there.
> 
> Thanks.





  reply	other threads:[~2021-02-23 14:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-17 14:06 bug#46590: 27.1.91; abnormal whitespace-mode behavior Frédéric Baldit
2021-02-17 18:12 ` Bhavin Gandhi
2021-02-20  9:27 ` Eli Zaretskii
2021-02-23 14:05   ` Frédéric Baldit [this message]
2021-02-23 15:54     ` Eli Zaretskii
2022-06-17 15:37 ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210223150547.45f58520@Cornafion.lan \
    --to=frederic.baldit@free.fr \
    --cc=46590@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).