Subject: Re: bug#49629: 27.2; electric-pair-mode doesn't work for angle brackets in HTML file

From: Allen Li <[email-masked]>
Date: Fri, 24 Dec 2021 02:07:54 -0800

Stefan Monnier <[email-masked]> writes:

>> I have bisected this regression to 7fff418edf56244a1fcf54718523aa9b5cb3a854
>>
>> I will cc Stefan on the miniscule chance he still remembers anything about
>> this and can save me time.
>> Otherwise, I will see if I can pinpoint the regression (or if I messed up
>> the bisect).
>
> Hmm... I do vaguely remember the change.  I don't see the immediate
> connection, but...

Stefan, I think I found an unrelated regression in your commit and I'd
like to double-check with you (or anyone else reading).

    modified   lisp/textmodes/sgml-mode.el
    @@ -395,16 +395,19 @@ sgml--syntax-propertize-ppss
                             (car (sgml--syntax-propertize-ppss
                                   (match-beginning 0)))))
                    (string-to-syntax ".")))))
    -     )))
    +     )
    +    "Syntax-propertize rules for sgml text.
    +These have to be run via `sgml-syntax-propertize'"))

    -(defun sgml-syntax-propertize (start end)
    +(defconst sgml--syntax-propertize
    +  (syntax-propertize-rules sgml-syntax-propertize-rules))
    +
    +(defun sgml-syntax-propertize (start end &optional rules-function)
       "Syntactic keywords for `sgml-mode'."
       (setq sgml--syntax-propertize-ppss (cons start (syntax-ppss start)))
       (cl-assert (>= (cadr sgml--syntax-propertize-ppss) 0))
       (sgml-syntax-propertize-inside end)
    -  (funcall
    -   (syntax-propertize-rules sgml-syntax-propertize-rules)
    -   start end)
    +  (funcall (or rules-function sgml--syntax-propertize) (point) end)
       ;; Catch any '>' after the last quote.
       (sgml--syntax-propertize-ppss end))

In the final `funcall`, the `start` argument was changed to `(point)`.
Looking at the overall commit, this seems unintentional to me.

Unless this was intentional, I will upload a patch to fix it (this still
exists in master).  Unfortunately, this does not fix the bug I am
interested in, but may as well fix it while I'm here.