1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-05-31 01:32:00 -07:00

Fix 'sgml-parse-tag-backward' to handle tags in comments

* lisp/textmodes/sgml-mode.el (sgml--find-<>-backward): Ignore
SGML tags that happen to occur within comments.  This also means
that the contents of comments are not indented, but also do not
affect the indentation of tags following the comments as well.

(Bug#80841)
This commit is contained in:
Philip Kaludercic 2026-05-11 23:43:27 +02:00
parent 09dc864b0b
commit 7eab6ef3ce
No known key found for this signature in database

View file

@ -1397,7 +1397,13 @@ Returns t if found, nil otherwise."
(while (re-search-backward "[<>]" limit 'move)
;; If this character has "open" or "close" syntax, then we've
;; found the one we want.
(when (memq (syntax-class (syntax-after (point))) '(4 5))
(when (and (memq (syntax-class (syntax-after (point))) '(4 5))
;; We want to ignore tags in comments. We could also
;; check `syntax-ppss', but that can become expensive
;; in a busy loop, so we re-use the face instead.
(not (memq (get-text-property (point) 'face)
'(font-lock-comment-delimiter-face
font-lock-comment-face))))
(throw 'found t)))))
(defun sgml-parse-tag-backward (&optional limit)