unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Allen Li <darkfeline@felesatra.moe>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Lars Ingebrigtsen <larsi@gnus.org>,
	49629@debbugs.gnu.org, Noam Postavsky <npostavs@gmail.com>
Subject: bug#49629: 27.2; electric-pair-mode doesn't work for angle brackets in HTML file
Date: Sun, 26 Jun 2022 17:33:37 -0700	[thread overview]
Message-ID: <CADbSrJzN=cmmpQeVGSDgW7iOYourk0L8-ju6SggVPFaEZBrYzQ@mail.gmail.com> (raw)
In-Reply-To: <jwvk093bpk0.fsf-monnier+emacs@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2222 bytes --]

On Sun, Jun 26, 2022 at 5:17 AM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

> > I *think* I've fixed this, but it's complicated.  Also I could be
> > completely wrong.  For what it's worth, I can reproduce the bug without
> the
> > patch and cannot with the patch, which see attached.
>
> AFAICT you've indeed found the origin of the problem.
>
> > If this sounds sensible, then a slightly different patch is needed,
> because
> > `electric-pair--with-uncached-syntax` is used in some contexts where
> hiding
> > `syntax-propertize-function` is the correct behavior.
>
> I think the code deserves a comment when/where it overrides
> `syntax-propertize-function` to explain why it's needed.
> AFAICT it was introduced in commit
> 89cfdbf729bc731331358e0efc69547547aa3ca2 but that commit doesn't explain
> why it bound it to nil (which I later changed to `ignore`).
>
> Furthermore, the cache could be filled with entries before `start` while
> the syntax-table  (and/or `syntax-propertize-function`) is temporarily
> changed, so the flush doesn't seem sufficient.  [ It's unlikely, because
> usually the cache will have been pre-filled via font-lock and friends,
> but it can still occur in corner cases.  ]
>
> IIUC we use `with-syntax-table` there specifically when we want to
> provide text-mode style paren matching within comments and strings.
> Maybe a good way to avoid problem with syntax-ppss/properties is to
> narrow the buffer to the comment/string at the same time as we
> `with-syntax-table` and let-bind `syntax-propertize-function`.
>

Thanks.  Two observations:

FIrst, changing `syntax-propertize-function` from nil to `ignore` was wrong
IIUC.  If the function is set, then it is wholly responsible for applying
syntax table.  When set to nil the default behavior is used, but when set
to `ignore`, that should mean that no syntax is applied at all.  In
practice, I don't know what behavior that causes.

Second, since `electric-pair--with-uncached-syntax` appears to be used for
doing text-mode matching (as you've also observed), maybe we should
de-generalize it to do only that.  I think that allows us to make some
simplifying assumptions about the state of the world.

>
>
>         Stefan
>
>

[-- Attachment #2: Type: text/html, Size: 2851 bytes --]

  reply	other threads:[~2022-06-27  0:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-18 23:52 bug#49629: 27.2; electric-pair-mode doesn't work for angle brackets in HTML file Allen Li
2021-07-22  7:03 ` bug#49629: Acknowledgement (27.2; electric-pair-mode doesn't work for angle brackets in HTML file) Allen Li
2021-07-22 23:34   ` bug#49629: 27.2; electric-pair-mode doesn't work for angle brackets in HTML file Lars Ingebrigtsen
2021-07-25 10:08     ` Allen Li
2021-07-28 15:42       ` Lars Ingebrigtsen
2021-08-01  5:06         ` Allen Li
2021-08-01 10:41           ` Lars Ingebrigtsen
2021-12-09 10:31             ` Allen Li
2021-12-09 13:30               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-24 10:07                 ` Allen Li
2021-12-24 14:23                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-26  8:41               ` Allen Li
2022-06-26  9:38                 ` Allen Li
2022-06-26 12:17                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-27  0:33                     ` Allen Li [this message]
2022-06-27 12:39                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-02 10:48                         ` Allen Li
2022-07-03 10:32                           ` 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='CADbSrJzN=cmmpQeVGSDgW7iOYourk0L8-ju6SggVPFaEZBrYzQ@mail.gmail.com' \
    --to=darkfeline@felesatra.moe \
    --cc=49629@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=npostavs@gmail.com \
    /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).