emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org 09406b1c98 1/2: org-macs: Make sure that fontificat


From: ELPA Syncer
Subject: [elpa] externals/org 09406b1c98 1/2: org-macs: Make sure that fontification does not move point
Date: Thu, 1 Sep 2022 09:58:15 -0400 (EDT)

branch: externals/org
commit 09406b1c9888b6c7ca2d8adfccbcc4d8266497c6
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>

    org-macs: Make sure that fontification does not move point
    
    * lisp/org-macs.el (org-looking-at-fontified):
    (org-buffer-substring-fontified): Wrap fontification call into
    `save-excursion' for safety.
---
 lisp/org-macs.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index 326d0ae369..9609827fa3 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -1201,7 +1201,7 @@ so values can contain further %-escapes if they are 
define later in TABLE."
   "Return fontified region between BEG and END."
   (when (bound-and-true-p jit-lock-mode)
     (when (text-property-not-all beg end 'fontified t)
-      (save-match-data (font-lock-fontify-region beg end))))
+      (save-excursion (save-match-data (font-lock-fontify-region beg end)))))
   (buffer-substring beg end))
 
 (defun org-looking-at-fontified (re)
@@ -1211,9 +1211,10 @@ so values can contain further %-escapes if they are 
define later in TABLE."
       (when (text-property-not-all
              (match-beginning 0) (match-end 0)
              'fontified t)
-        (save-match-data
-          (font-lock-fontify-region (match-beginning 0)
-                            (match-end 0)))))))
+        (save-excursion
+          (save-match-data
+            (font-lock-fontify-region (match-beginning 0)
+                              (match-end 0))))))))
 
 (defsubst org-no-properties (s &optional restricted)
   "Remove all text properties from string S.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]