From: Lars Ingebrigtsen <larsi@gnus.org>
To: Gregory Heytings <ghe@sdf.org>
Cc: 36006@debbugs.gnu.org
Subject: bug#36006: electric-pair-mode fails to balance in certain cases
Date: Thu, 10 Feb 2022 08:50:04 +0100 [thread overview]
Message-ID: <87ee4bcg9f.fsf@gnus.org> (raw)
In-Reply-To: <alpine.NEB.2.22.394.2008280955470453.3746@sdf.lonestar.org> (Gregory Heytings's message of "Fri, 28 Aug 2020 08:00:05 +0000")
Gregory Heytings <ghe@sdf.org> writes:
> A more specific note: removing `(put-text-property
> ... (string-to-syntax "."))' in `sgml--syntax-propertize-ppss' also
> fixes the bug. So this bug is indeed specific to html-mode/sgml-mode.
This problem is still present in Emacs 29.
I guess the issue here is that electric-pair-mode works by letting the
user insert the '>' before the final <div>, and then fixes things up (by
removing the extra '>' and moving point), but this defeats that:
(defun sgml--syntax-propertize-ppss (pos)
"Return PPSS at POS, fixing the syntax of any lone `>' along the way."
(cl-assert (>= pos (car sgml--syntax-propertize-ppss)))
(let ((ppss (parse-partial-sexp (car sgml--syntax-propertize-ppss) pos -1
nil (cdr sgml--syntax-propertize-ppss))))
(while (eq -1 (car ppss))
(put-text-property (1- (point)) (point)
'syntax-table (string-to-syntax "."))
;; Hack attack: rather than recompute the ppss from
;; (car sgml--syntax-propertize-ppss), we manually "fix it".
(setcar ppss 0)
(setq ppss (parse-partial-sexp (point) pos -1 nil ppss)))
(setcdr sgml--syntax-propertize-ppss ppss)
(setcar sgml--syntax-propertize-ppss pos)
ppss))
Because it's marking the extra '>' as punctuation?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
prev parent reply other threads:[~2022-02-10 7:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-30 15:11 bug#36006: electric-pair-mode fails to balance in certain cases Dario Gjorgjevski
2019-05-30 17:36 ` npostavs
2019-05-30 21:51 ` Dario Gjorgjevski
2019-06-06 23:39 ` Noam Postavsky
2019-11-22 12:28 ` Dario Gjorgjevski
2020-08-27 19:08 ` Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-27 21:38 ` Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-28 8:00 ` Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-10 7:50 ` Lars Ingebrigtsen [this message]
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=87ee4bcg9f.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=36006@debbugs.gnu.org \
--cc=ghe@sdf.org \
/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).