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: Mon, 22 Feb 2016 12:36:42 -0500 Message-ID: <56CB472A.2000608@live.com> References: <56CA5405.10304@live.com> <8337skn3l8.fsf@gnu.org> <56CB3137.1010300@live.com> <83lh6clmy6.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="VKe883qL4SAGMa96QbBod2HeEtPmAtL7P" X-Trace: ger.gmane.org 1456162645 3187 80.91.229.3 (22 Feb 2016 17:37:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 22 Feb 2016 17:37:25 +0000 (UTC) Cc: 22761@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Feb 22 18:37:14 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 1aXuQ1-0004Yr-Eq for geb-bug-gnu-emacs@m.gmane.org; Mon, 22 Feb 2016 18:37:09 +0100 Original-Received: from localhost ([::1]:50753 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXuQ0-0003WB-Nv for geb-bug-gnu-emacs@m.gmane.org; Mon, 22 Feb 2016 12:37:08 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXuPv-0003SQ-FE for bug-gnu-emacs@gnu.org; Mon, 22 Feb 2016 12:37:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXuPu-0007NE-BP for bug-gnu-emacs@gnu.org; Mon, 22 Feb 2016 12:37:03 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:41194) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXuPu-0007NA-8b for bug-gnu-emacs@gnu.org; Mon, 22 Feb 2016 12:37:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aXuPu-0008FR-4i for bug-gnu-emacs@gnu.org; Mon, 22 Feb 2016 12:37: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 17:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22761 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22761-submit@debbugs.gnu.org id=B22761.145616261331691 (code B ref 22761); Mon, 22 Feb 2016 17:37:02 +0000 Original-Received: (at 22761) by debbugs.gnu.org; 22 Feb 2016 17:36:53 +0000 Original-Received: from localhost ([127.0.0.1]:38321 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aXuPk-0008F5-UA for submit@debbugs.gnu.org; Mon, 22 Feb 2016 12:36:53 -0500 Original-Received: from mout.kundenserver.de ([212.227.126.131]:51007) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aXuPj-0008Es-Gh for 22761@debbugs.gnu.org; Mon, 22 Feb 2016 12:36:52 -0500 Original-Received: from [18.189.69.235] ([18.189.69.235]) by mrelayeu.kundenserver.de (mreue002) with ESMTPSA (Nemesis) id 0M16aW-1ZezTQ1kGu-00tDu5; Mon, 22 Feb 2016 18:36:44 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 In-Reply-To: <83lh6clmy6.fsf@gnu.org> X-Provags-ID: V03:K0:1SWSIAGYFoJJK+lgTrPcOBbaeDtfPfMsJaD+1Abys0c2Rz0tMSO GtTOhdjqdpxc0apd1URS8FMOfplQbvuxGQR+KRC+FS8JOrSu7Sd1brQcn5eIgHTg4puxZj7 IJTYZLty0RBPS4Ee8nTWMli202uoszLESKnTeEaJb8zfc8W6LCuAi9tRzoafdQyYg2ly92p 3cKJ+1+ShDaSbmR6VOL/A== X-UI-Out-Filterresults: notjunk:1;V01:K0:Qo1X9pHfKJ4=:Rw5qxepgWnIo4IzN8n0BcU oACU2w2hdiYq4iw3SwESOBk78arrss4tdc6mdMD7HrfHvEiTor34pDJQScie6iJJsrvQqBhWr e2rMoTREsTRjfZA3d8zXQ5GfWBmkBi60txxOCXid3IhvlW9ue1IpqqCgWryuJBIHLzwS3J1UA oTx4sdm04sls5Di3krW1IleceCWPzodOt8Issep115LH8QfWsF7oM9l+qSB6Vpt94cNYC4efi acOsivopyC7er9NjUPv7ZqGhJM3uOf1meWS+gvMQlwBy7EvJOm7UfLr3MYlFW2YFVu9E1VfEQ oUCtUO/fT4rNz02hcazITnYS94HuG8fcQmJu6sglroHx8K8DY0pEeOslNITmJOsCqn2Jhc4Jk +CsemzvO5e3PQWSIgwYfZtM1WSpSGznmIs+YPsdlRrb9uDop7exZW1/OQl8/7IpWW7GFZvEnu WRKXf8RDNGieWgh9AUtAFUgnEPkqPCzO7EgKdRHSpVEhSuX+Sm1GvQ1Y+GUfFd5glZ8j5Cqqh lh+JUuVPtbPNCtLNy+vb3kjOHorPJhd751NUbAWIy+ozLnt1xjo2lMCI54G4AK11HAMxfzm1O N2SIGnWxNzyIQeTI3JtaUi3pbSw7l1RoHj6aWFjgXv6Ox7Dyl1JeJ7wMpD2uJr+UMmVUlLvw2 wMv/uoGpL5W3azvAAMhJgcZdbHR3ipXY1ALhowewQ+2K8DYM1Rvsau4RMrRjKTENhNuA= 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:113468 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --VKe883qL4SAGMa96QbBod2HeEtPmAtL7P Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 02/22/2016 11:38 AM, Eli Zaretskii wrote: >> Cc: 22761@debbugs.gnu.org From: Cl=C3=A9ment Pit--Claudel >> Date: Mon, 22 Feb 2016 11:03:03 >> -0500 >>=20 >> On 02/22/2016 10:53 AM, Eli Zaretskii wrote: >>>> From: Cl=C3=A9ment Pit--Claudel Date: >>>> Sun, 21 Feb 2016 19:19:17 -0500 >>>>=20 >>>> The problem happens when editing =E2=80=98a_foo_b=E2=80=99 to replac= e =E2=80=98foo=E2=80=99 by=20 >>>> =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 >>>> buffer, which font-lock recognizes: the whole string gets >>>> displayed as =E2=80=98ab=E2=80=99. Even then, the point is still bet= ween the >>>> two underscores (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=98bar=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, pressing =E2=80=98ar=E2=80=99 to complete =E2=80=98bar=E2=80=99= ends up inserting >>>> =E2=80=98a_b_arb=E2=80=99. >>>=20 >>> Did you try binding global-disable-point-adjustment to a non-nil >>> value? >>=20 >> I imagine that it would work, but wouldn't it break other parts of >> Emacs? The mode to which I'm adding this subscripts feature also >> uses hideshow, for example, and I do want the point to be moved out >> of invisible sections then. >=20 > If it works, perhaps you could bind disable-point-adjustment (not > the global variable) in the insertion commands. >=20 > In general, insertion in the middle of invisible text is tricky at=20 > best. So perhaps you should rethink how you handle this situation > -- you could, for example, temporarily remove the entire invisible=20 > portion, until the insertion is complete. Thanks, this is a good idea. It will also be more intuitive for users, pr= obably. I tried to follow the strategy that prettify-symbols-unprettify-at-point = uses, but I kept running into issues; using an overlay seems to work bett= er. The issue described in my OP is still there (when the buffer text is = =E2=80=98__=E2=80=99 and an =E2=80=98a=E2=80=99 is added in the middle (y= ielding =E2=80=98_a_=E2=80=99) the overlay is removed, and Emacs moves th= e point after the second underscore (probably before fontification kicks = in and removes the invisible property?). Still I'm better off, because I = can detect that case and protect against it using disable-point-adjustmen= t. Cheers, Cl=C3=A9ment. --VKe883qL4SAGMa96QbBod2HeEtPmAtL7P 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) iQIcBAEBAgAGBQJWy0cqAAoJEPqg+cTm90wjFAkP/3CCVTQZA6TiTwaXKjqZDG5o ZXRv2yPh1wVo8v1dYfSsbgbL3WxagT/o3DO0hDI7TIrp5eh4swMk3FJtzcgmiCDQ mKid4+TwUsTYfO3zI6DeCoT5D4LNLOVwUKnrmupupgIkIDAMzNZNE7pzyI//b6X/ saDn2YcAx/1KJ1Sj7OwXi9dP4PJAPXttylgWHPuIF5V84B5X6piLy60iLJ6eM0hJ gm4JRU1Ey5xlCWYuHIFWF3zAvQc0E/iOqoRYFAnFOQcLf5jUCZ9gksznzIY1SO4o Y15U9CJkCcznOSQTPZjGwfGz38JgRAXGeN/1HhAmtrZycOd0vtzQ8C+8jq6F3ZKq Z1fOXxi9Qy+O0X5e2oZgTWXg5HD24W1X0xmphnK7Y2Pg5HsFRUghzjyE6lU3Hx6L NaVviZjCvzoAsDu0trpTlJvOjGpBq6FlC8D1pJp9elYdnEiParVV5HUyQ/EE2kWY dKziVZzx7j26YXVfU2al61dbqgmA9O1F6uSQyQCguAyfKNdoMkRbPZhF2EcHXrJv xwR+c++YeiVketDjm165ZWIapWdUgkLWek9UuJ+sggOzkZlH+pO24Vkrpcf8mJ4b kS781G99M7Y8SNtpFyuQ4yFByHL2wE1NmNrD4h+DGsJ8kCXFfZ7p/08J/DHAjrhY lwium2WhJbprexrCZAc8 =BaqF -----END PGP SIGNATURE----- --VKe883qL4SAGMa96QbBod2HeEtPmAtL7P--