Fix decoding 'display' properties with SVG images in Enriched mode

* lisp/textmodes/enriched.el (enriched-next-annotation): Reject
matches of 'enriched-annotation-regexp' inside strings.  Reported
by Christopher Howard <christopher@librehacker.com> in
https://lists.gnu.org/archive/html/help-gnu-emacs/2024-06/msg00178.html.
This commit is contained in:
Eli Zaretskii 2024-07-14 09:06:55 +03:00
parent 174a0b7642
commit 33ba72f52f

View file

@ -453,7 +453,12 @@ Any \"<<\" strings encountered are converted to \"<\".
Return value is \(begin end name positive-p), or nil if none was found."
(while (and (search-forward "<" nil 1)
(progn (goto-char (match-beginning 0))
(not (looking-at enriched-annotation-regexp))))
;; Make sure we are not inside a string, where any
;; matches for 'enriched-annotation-regexp' are
;; false positives. This happens, for example, in
;; display properties that specify SVG images.
(or (nth 3 (syntax-ppss))
(not (looking-at enriched-annotation-regexp)))))
(forward-char 1)
(if (eq ?< (char-after (point)))
(delete-char 1)