branch: externals/org
commit 7235abfaec242d03ef8aaa7d2bbb8c27b99614b5
Author: Ihor Radchenko <[email protected]>
Commit: Ihor Radchenko <[email protected]>

    org-do-latex-and-related: Do not fontify trailing whitespace
    
    * lisp/org.el (org-do-latex-and-related): Avoid fontifying trailing
    whitespace after latex fragments and entities.
    
    Reported-by: Rudolf Adamkovič <[email protected]>
    Link: https://orgmode.org/list/[email protected]
---
 lisp/org.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index ed0cfb81a4..6b8d02b874 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5912,7 +5912,10 @@ highlighting was done, nil otherwise."
                               1
                             0))
                   (start (+ offset (match-beginning 0)))
-                  (end (match-end 0)))
+                  (end (save-excursion
+                          (goto-char (match-end 0))
+                          ;; Do not fontify trailing whitespace.
+                          (skip-chars-backward " \t") (point))))
              (if (memq 'native org-highlight-latex-and-related)
                  (org-src-font-lock-fontify-block "latex" start end)
                (font-lock-prepend-text-property start end

Reply via email to