From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Fr=C3=A9d=C3=A9ric?= Baldit Newsgroups: gmane.emacs.bugs Subject: bug#46590: 27.1.91; abnormal whitespace-mode behavior Date: Tue, 23 Feb 2021 15:05:47 +0100 Message-ID: <20210223150547.45f58520@Cornafion.lan> References: <20210217150614.1eaecfdd@Cornafion.lan> <837dn3143m.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32511"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 46590@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 23 15:06:14 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lEYKM-0008M3-P2 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 23 Feb 2021 15:06:14 +0100 Original-Received: from localhost ([::1]:40270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lEYKL-0004Wb-3y for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 23 Feb 2021 09:06:13 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60430) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lEYKA-0004W2-R7 for bug-gnu-emacs@gnu.org; Tue, 23 Feb 2021 09:06:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47024) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lEYKA-0008Vl-JM for bug-gnu-emacs@gnu.org; Tue, 23 Feb 2021 09:06:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lEYKA-0004PQ-Bd for bug-gnu-emacs@gnu.org; Tue, 23 Feb 2021 09:06:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Fr=C3=A9d=C3=A9ric?= Baldit Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 23 Feb 2021 14:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46590 X-GNU-PR-Package: emacs Original-Received: via spool by 46590-submit@debbugs.gnu.org id=B46590.161408916016939 (code B ref 46590); Tue, 23 Feb 2021 14:06:02 +0000 Original-Received: (at 46590) by debbugs.gnu.org; 23 Feb 2021 14:06:00 +0000 Original-Received: from localhost ([127.0.0.1]:58570 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lEYK7-0004P9-L0 for submit@debbugs.gnu.org; Tue, 23 Feb 2021 09:05:59 -0500 Original-Received: from smtp3-g21.free.fr ([212.27.42.3]:25169) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lEYK5-0004P0-4C for 46590@debbugs.gnu.org; Tue, 23 Feb 2021 09:05:57 -0500 Original-Received: from Cornafion.lan (unknown [IPv6:2a01:cb14:4d4:ee00:f88b:12fe:4bcc:8956]) (Authenticated sender: frederic.baldit@free.fr) by smtp3-g21.free.fr (Postfix) with ESMTPA id D905C13F866; Tue, 23 Feb 2021 15:05:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=free.fr; s=smtp-20201208; t=1614089156; bh=r+AilELWXciWS+FhzlhUPlL0Zss8vSSCmBSs7ypnbS0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=tm0EfSsG22VWspVJzmJCG0wPfTEHnMklIFQ23sXdt9vsBQd5sMqrAsfVT0wVCuqTz pnLsy9eEs9roWg8B+7J/pxWnsqsra7lIZ1ORvjWqysGRvLvI8/pe2kLJUKhZni2Mb3 hsn49/ltWWdIPKFC+syISZZeflK7826X96FCC6lJWAFULdTzC37oAdziuqQSKo5Xck kbb5foKHlBktjklxzoWQ2CgyXkae3vbFZGgrQv+a+k8WZHuFD4Lq/R5COnACPxUJgQ GHw6ReOXbp9+CQqPL1Jpi+Td+xaDq+UK+AlmK4QNBZpsbEenhferNb+kmhWvy6yoOw XFIuDb/E/2wvQ== In-Reply-To: <837dn3143m.fsf@gnu.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:200654 Archived-At: 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 '=C2=BB', \xBB) followed by eight grouped spaces (1 TAB), whereas only one '=C2=BB' 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 =C2=ABflat=C2=BB (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=C3=A9d=C3=A9ric Baldit Le sam. 20 f=C3=A9vr. 2021 =C3=A0 11:27:25 +0200 Eli Zaretskii a =C3=A9crit: > > Date: Wed, 17 Feb 2021 15:06:14 +0100 > > From: Fr=C3=A9d=C3=A9ric Baldit > >=20 > > emacs -Q test.txt & > >=20 > > 2) M-x whitespace-mode RET > >=20 > > 3) type the following text (=C2=AB.=C2=BB for spacebar key): > >=20 > > =C2=AB....First line of text in emacs=C2=BB, then type RET > >=20 > > 4) DEL DEL to suppress backward two spaces on line 2, then type text > > =C2=ABSecond one=C2=BB > >=20 > > 5) M-2 M-b > >=20 > > 6) TAB TAB TAB TAB: point should be at line 2, column 18, vertically > > aligned with fourth word of line 1 (=C2=ABtext=C2=BB), but it is at col= umn 26: > > that's the bug. =20 >=20 > It's a known misfeature of whitespace-mode. There's a comment in > whitespace.el to that effect: >=20 > ;; 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 [?=C2=BB ?\t] [?\\ ?\t]) ; tab - right > guillemet >=20 > You could customize whitespace-display-mappings to remove tab-mark > from it, if you want to avoid this issue. >=20 > > Rq1: what is curious (to me) is that deactivating whitespace-mode > > removes abnormally inserted tab character (8 spaces) and everything > > is OK. =20 >=20 > That's because disabling whitespace-mode deactivates the display-table > mappings, which include the above mapping. >=20 > > 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: > >=20 > > =C2=AB....This.is.a.first.line.of.text.with.a.few.words=C2=BB, > >=20 > > then the result of typing TAB multiple times is as expected, with or > > without whitespace-mode activated! =20 >=20 > Most probably because the "TAB occupies exactly one column" condition > doesn't happen there. >=20 > Thanks.