From bbe420c8063e26dc877b4b5a6fe1becf491197b6 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 14 Jul 2024 09:06:55 +0300 Subject: [PATCH] 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 in https://lists.gnu.org/archive/html/help-gnu-emacs/2024-06/msg00178.html. (cherry picked from commit 33ba72f52fd2138a7c2d6c065236fd459b8c659d) --- lisp/textmodes/enriched.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/textmodes/enriched.el b/lisp/textmodes/enriched.el index 385674f5b1a..bd4ced78efd 100644 --- a/lisp/textmodes/enriched.el +++ b/lisp/textmodes/enriched.el @@ -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) -- 2.39.5