From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Cl=C3=A9ment?= Pit--Claudel Newsgroups: gmane.emacs.bugs Subject: bug#22761: Surprising interaction between font-lock, invisible text, and point (self-insert-command and insert behave differently) Date: Sun, 21 Feb 2016 19:19:17 -0500 Message-ID: <56CA5405.10304@live.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="t6wVlQPXTI9bMIrhjwfNESbokniVLmdoD" X-Trace: ger.gmane.org 1456100432 30282 80.91.229.3 (22 Feb 2016 00:20:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 22 Feb 2016 00:20:32 +0000 (UTC) To: 22761@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Feb 22 01:20:19 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aXeEZ-0000IP-TA for geb-bug-gnu-emacs@m.gmane.org; Mon, 22 Feb 2016 01:20:16 +0100 Original-Received: from localhost ([::1]:45256 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXeEU-0002uP-2K for geb-bug-gnu-emacs@m.gmane.org; Sun, 21 Feb 2016 19:20:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34122) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXeEP-0002tt-Vu for bug-gnu-emacs@gnu.org; Sun, 21 Feb 2016 19:20:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXeEM-0004A5-NK for bug-gnu-emacs@gnu.org; Sun, 21 Feb 2016 19:20:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39587) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXeEM-0004A0-Kc for bug-gnu-emacs@gnu.org; Sun, 21 Feb 2016 19:20:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aXeEM-0001xB-F2 for bug-gnu-emacs@gnu.org; Sun, 21 Feb 2016 19:20:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Cl=C3=A9ment?= Pit--Claudel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 Feb 2016 00:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 22761 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14561003757467 (code B ref -1); Mon, 22 Feb 2016 00:20:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 Feb 2016 00:19:35 +0000 Original-Received: from localhost ([127.0.0.1]:36714 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aXeDv-0001wM-0V for submit@debbugs.gnu.org; Sun, 21 Feb 2016 19:19:35 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:43062) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aXeDs-0001w9-NW for submit@debbugs.gnu.org; Sun, 21 Feb 2016 19:19:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXeDm-00044t-CG for submit@debbugs.gnu.org; Sun, 21 Feb 2016 19:19:27 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:57226) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXeDm-00044p-8p for submit@debbugs.gnu.org; Sun, 21 Feb 2016 19:19:26 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34023) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXeDl-0002M6-AG for bug-gnu-emacs@gnu.org; Sun, 21 Feb 2016 19:19:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXeDh-00044O-Az for bug-gnu-emacs@gnu.org; Sun, 21 Feb 2016 19:19:25 -0500 Original-Received: from mout.kundenserver.de ([212.227.126.131]:52319) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXeDh-00044K-16 for bug-gnu-emacs@gnu.org; Sun, 21 Feb 2016 19:19:21 -0500 Original-Received: from [18.189.69.235] ([18.189.69.235]) by mrelayeu.kundenserver.de (mreue005) with ESMTPSA (Nemesis) id 0MXTda-1aTkES442A-00WYXG for ; Mon, 22 Feb 2016 01:19:19 +0100 X-Enigmail-Draft-Status: N1110 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 X-Provags-ID: V03:K0:SdmB+Ol20gPeN66Q6+aFL8lUPLY1jwUByEZT/Va/VvRdK1kN9Hu 4LXunBpalyeHAIoq15WK+Ug4ury/mCN9cBCDnQU89KlP3+AA2s6MEWtqXYnJM/37gO+3aUr Ltd0uyfwjxrWpqIW8VieZIW1NOvRP1rbEGMVZgREpWlyK/ZDzUh6YPa8TY6JnQqqgEDi784 1n9//8JkBjJInWN5oMitA== X-UI-Out-Filterresults: notjunk:1;V01:K0:lwKawhM0KsM=:7fVOpYlo4riUcg84lFAcow DZOytFu8c2ZkRvLKHcxu2hRcYaZx6wlqRm2vZBW7peqCzfSI8bDj8i/ZIXh56gi1Zc1o31vIv JBa9ybpvMfhexCUEaUhvnMAJNuPnswN4wHsXNV5hI5fydFsXvDBYL88B4joLU1vOPvNk0ZsNq io2P1keEmAV5hu1hPSSC27Q9zrzV3DE85ieThloJW5FoU9qSa1iTAhS+MC6r6tnyFIVC9tRak aiROeEWC0fzwwL4HHN1ZXeCb1K3zxWPbjtRWtJuMEuJAZtRxib0CpgacglmD41SKUCUq2aKjU nc2nw8ctrKNFhiE7DG+aUNK7fqyhW02pk9DFIz7V6vAC9XDw7hADN3A7KLymSlpc7dxZ8lEDs x4sK2heUHyVvD5y9Kkqou7nAfOrrG55uiJgmmgZ/yrETDnrBQeuHGH7ol/zr0wzM5vbbEhH8p KpVIhjiZAJMLbCBLa1sC76BZiGf3LBOrMYIJfW+86vHCt3rzfpqxH0G//h6zez0B3aAMeet9k 5wqPXy20SrCUDeiMaPn2YILuxeU9xs4MjmUjYPSgKn5i8ucHKyYeHzGdDI3m/SIC8mK4hxm0q vro9qYUKAie6O05ybYzzyiuexLVxrJeoMRicKrXRK3kAlU+WOfcX1VAdO56SlJP2F0jLrxKVY MghL1heim9qOvRLR9Ik5ADashBCiz46VHmEOk3Uf/Tw2ZRUfqAeoobawiL0PgouoB4Ak= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:113437 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --t6wVlQPXTI9bMIrhjwfNESbokniVLmdoD Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, I'm running into problems using font-lock to display certain strings as s= ubscripts. The basic goal is to display =E2=80=98a__b=E2=80=99 as =E2=80=98= ab=E2=80=99 with =E2=80=98b=E2=80=99 vertically offset. Using font-lock t= o make =E2=80=98__=E2=80=99 invisible and to add (display (raise -0.15)) = to =E2=80=98b=E2=80=99 works fine. There is a strange interaction between= self-insert-command and font-lock, however, and the problem does not hap= pen if using =E2=80=98insert=E2=80=99 instead of =E2=80=98self-insert-com= mand=E2=80=99. The problem happens when editing =E2=80=98a_foo_b=E2=80=99 to replace =E2= =80=98foo=E2=80=99 by =E2=80=98bar=E2=80=99 (to get =E2=80=98a_bar_b=E2=80= =99). Removing =E2=80=98foo=E2=80=99 leaves =E2=80=98__=E2=80=99 in the b= uffer, which font-lock recognizes: the whole string gets displayed as =E2= =80=98ab=E2=80=99. Even then, the point is still between the two undersco= res (it hasn't moved after font-lock added the invisible property to the = underscores). Pressing =E2=80=98b=E2=80=99 to start inserting =E2=80=98ba= r=E2=80=99 works fine (I end up with =E2=80=98a_b_c=E2=80=99), except for= one thing: the point gets moved after the second underscore. Thus, press= ing =E2=80=98ar=E2=80=99 to complete =E2=80=98bar=E2=80=99 ends up insert= ing =E2=80=98a_b_arb=E2=80=99. On the other hand, using =E2=80=98M-: (insert ?b)=E2=80=99 to insert the = =E2=80=98b=E2=80=99 of =E2=80=98bar=E2=80=99 leaves the point in the righ= t place. To reproduce: 1. Open a buffer in fundamental-mode 2. Evaluate the following setup code: (progn (setq font-lock-defaults '(nil)) (font-lock-add-keywords nil `((,(concat "[a-z]+\\(__\\)\\([a-z]+\\)= ") (1 '(face nil invisible 'subscript))= (2 '(face nil display (raise -0.25))= )))) (add-to-invisibility-spec 'subscript) (make-local-variable 'font-lock-extra-managed-props) (add-to-list 'font-lock-extra-managed-props 'display) (add-to-list 'font-lock-extra-managed-props 'invisible) (font-lock-mode)) 3. Insert the following text: before_between_after 4. Place the point after =E2=80=98between=E2=80=99; press 7 t= imes, to remove =E2=80=98between=E2=80=99 entirely. 5. Type =E2=80=98between=E2=80=99 (using the key sequence b e t w e e n) Expected result: buffer contains before_between_after Actual result: buffer contains before_b_etweenafter On the other hand, the following protocol works fine: 1-4. Same as before 5. =E2=80=98M-: (insert ?b)=E2=80=99 6. Type =E2=80=98etween=E2=80=99 (using the key sequence e t w e e n) Expected result: buffer contains before_between_after Actual result: buffer contains before_between_after Cheers, Cl=C3=A9ment. --t6wVlQPXTI9bMIrhjwfNESbokniVLmdoD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJWylQFAAoJEPqg+cTm90wj+AwP/jzzaJVZJykcacf1o5hczIR1 MIIC8UwvMMRdfJbNhAlg19pksWPkLY9p3osMP38SjU2SbF+iKDajEfq936FiKtgB 8S9deAipfh4Zih58ejOwueCTH8X4tRHFjotoPhqWey05c3kb9AZz9H9C65qMVU4N 0OV9iD8DuoxGfjJ/04luPOOEtGlW4xXYfAV9072F5F199OWeqyZ69XK+QeUci2gd 6PQC41DvGuiWWNedlDgf5ia1EXBfyNKW9Oc4OL4sxDi3bQTu3IcqLuKEAG2Ey2km vJ0sSMIqW8DGQSoBMhZA4/4lAlwQwSZQdz+Fzk4+wr3T8Peq+aoU41DXKe6pSKSm BTS+XLaUjwSHCLtsqlTbY/9fDBHu/v/tUSi9j0gPYi9GhMv5SEkEVRc2P+l6VOLN uuQRyCuc6ZsyAhSIBWAYTnc98n/JWKT2lfYjKk04l+F5i8Mg0cCe5KPQmvL8uKS1 TpbrLDhFeu+xngrvR9KYxg+x2kcJtLenUrquPQrpe1lyyRVs4opJ8XYOsW1ozTqp 8JSe3tYUpO5fuSZK0yAuOmmfkY3ifINMyQCcHS8BKLkM+8xZOE/+DLEvZMAh0wEq Z3usbiy+LDzp7/zH3DV0pEcagJ8V/Dp1Y1rUqq6jLgOBg1qVBNWcSaXQrhnBtgDn uGGsRMXl9ik4YdRtJvbz =dFQ2 -----END PGP SIGNATURE----- --t6wVlQPXTI9bMIrhjwfNESbokniVLmdoD--