GNU bug report logs -
#36006
electric-pair-mode fails to balance in certain cases
Previous Next
Full log
Message #37 received at 36006 <at> debbugs.gnu.org (full text, mbox):
Gregory Heytings <ghe <at> 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
This bug report was last modified 3 years and 129 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.