unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Frédéric Baldit" <frederic.baldit@free.fr>
Cc: 46590@debbugs.gnu.org
Subject: bug#46590: 27.1.91; abnormal whitespace-mode behavior
Date: Sat, 20 Feb 2021 11:27:25 +0200	[thread overview]
Message-ID: <837dn3143m.fsf@gnu.org> (raw)
In-Reply-To: <20210217150614.1eaecfdd@Cornafion.lan> (message from Frédéric Baldit on Wed, 17 Feb 2021 15:06:14 +0100)

> 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.





  parent reply	other threads:[~2021-02-20  9:27 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 [this message]
2021-02-23 14:05   ` Frédéric Baldit
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=837dn3143m.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=46590@debbugs.gnu.org \
    --cc=frederic.baldit@free.fr \
    /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).