unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / Atom feed
* bug#46590: 27.1.91; abnormal whitespace-mode behavior
@ 2021-02-17 14:06 Frédéric Baldit
  2021-02-17 18:12 ` Bhavin Gandhi
  2021-02-20  9:27 ` Eli Zaretskii
  0 siblings, 2 replies; 5+ messages in thread
From: Frédéric Baldit @ 2021-02-17 14:06 UTC (permalink / raw)
  To: 46590


--text follows this line--

Recipe to reproduce the bug:

1) I'm using emacs version 27.1.91 built from git sources in my /home
   directory (same bug is experimented with emacs version 26.1 installed
   from debian stable package). Command used to run emacs:

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.

Rq1: what is curious (to me) is that deactivating whitespace-mode
removes abnormally inserted tab character (8 spaces) and everything is
OK.

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!

Rq3: as I'm not an emacs expert, I first posted on help-gnu-emacs list
in order to see if someone could explain me what I was missing:

https://lists.gnu.org/archive/html/help-gnu-emacs/2021-02/msg00321.html

Nobody explained me why I see this behavior (of whitespace-mode), thus I
came to the conclusion it might be a bug (both answers are from persons
using emacs 28.0.50). I must say that I followed as precisely as I could
the advices found to submit a bug, in particular I read and followed
«52-Reporting bugs» of emacs manual.

--end of bug description--

In GNU Emacs 27.1.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)
 of 2021-02-04 built on Cornafion
Repository revision: 89f1634afcca318def07151424a21b81c70acd76
Repository branch: emacs-27
Windowing system distributor 'The X.Org Foundation', version
11.0.12004000 System Description: Debian GNU/Linux 10 (buster)

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Whitespace mode enabled in current buffer
You can run the command ‘whitespace-mode’ with M-x whit-m RET
Whitespace mode enabled in current buffer
Auto-saving...done
Auto-saving...done
Making completion list...

Configured using:
 'configure --prefix=/home/fred/emacs-03022021/'

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD PDUMPER
LCMS2 GMP

Important settings:
  value of $LC_MONETARY: fr_FR.UTF-8
  value of $LC_NUMERIC: fr_FR.UTF-8
  value of $LC_TIME: fr_FR.UTF-8
  value of $LANG: fr_FR.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Text

Minor modes in effect:
  whitespace-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs text-property-search seq
byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date subr-x
cl-loaddefs cl-lib disp-table whitespace tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 49999 5008)
 (symbols 48 6166 1)
 (strings 32 16282 1605)
 (string-bytes 1 538103)
 (vectors 16 10378)
 (vector-slots 8 138289 8918)
 (floats 8 20 41)
 (intervals 56 535 0)
 (buffers 1000 14))

--
  Frédéric Baldit





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#46590: 27.1.91; abnormal whitespace-mode behavior
  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
  1 sibling, 0 replies; 5+ messages in thread
From: Bhavin Gandhi @ 2021-02-17 18:12 UTC (permalink / raw)
  To: Frédéric Baldit; +Cc: 46590

On Wed, 17 Feb 2021 at 20:55, Frédéric Baldit <frederic.baldit@free.fr> wrote:
>
> 3) type the following text («.» for spacebar key):
>

I was able to reproduce the behavior by following the steps above, thought of
replying to clarify that I used SPC at the places where the given text
has « or » character.

-- 
Warm Regards,
Bhavin Gandhi (bhavin192) | https://geeksocket.in





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#46590: 27.1.91; abnormal whitespace-mode behavior
  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
  1 sibling, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2021-02-20  9:27 UTC (permalink / raw)
  To: Frédéric Baldit; +Cc: 46590

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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#46590: 27.1.91; abnormal whitespace-mode behavior
  2021-02-20  9:27 ` Eli Zaretskii
@ 2021-02-23 14:05   ` Frédéric Baldit
  2021-02-23 15:54     ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Frédéric Baldit @ 2021-02-23 14:05 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 46590


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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#46590: 27.1.91; abnormal whitespace-mode behavior
  2021-02-23 14:05   ` Frédéric Baldit
@ 2021-02-23 15:54     ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2021-02-23 15:54 UTC (permalink / raw)
  To: Frédéric Baldit; +Cc: 46590

> Date: Tue, 23 Feb 2021 15:05:47 +0100
> From: Frédéric Baldit <frederic.baldit@free.fr>
> Cc: 46590@debbugs.gnu.org
> 
> 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 don't think this can be fixed without a complete redesign how a TAB
is displayed under this mode.  display-tables simply cannot deal with
such situations.  But I didn't think about this too long, so maybe I'm
missing something.

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

I don't know, but what do you have to lose?





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-02-23 15:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2021-02-23 15:54     ` Eli Zaretskii

unofficial mirror of bug-gnu-emacs@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/emacs-bugs/0 emacs-bugs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 emacs-bugs emacs-bugs/ https://yhetil.org/emacs-bugs \
		bug-gnu-emacs@gnu.org
	public-inbox-index emacs-bugs

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.bugs
	nntp://news.gmane.io/gmane.emacs.bugs


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git