bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#49629: 27.2; electric-pair-mode doesn't work for angle brackets in H


From: Stefan Monnier
Subject: bug#49629: 27.2; electric-pair-mode doesn't work for angle brackets in HTML file
Date: Sun, 26 Jun 2022 08:17:43 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

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


        Stefan






reply via email to

[Prev in Thread] Current Thread [Next in Thread]