]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix decoding 'display' properties with SVG images in Enriched mode
authorEli Zaretskii <eliz@gnu.org>
Sun, 14 Jul 2024 06:06:55 +0000 (09:06 +0300)
committerEshel Yaron <me@eshelyaron.com>
Wed, 17 Jul 2024 17:39:22 +0000 (19:39 +0200)
* 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.

(cherry picked from commit 33ba72f52fd2138a7c2d6c065236fd459b8c659d)

lisp/textmodes/enriched.el

index 385674f5b1a0c404d38148eb177c9ac6ff9680cf..bd4ced78efd5ccda99ea497dcce2745beb0f7e06 100644 (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)