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

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

[elpa] externals/jinx 21a299c843 1/2: Run all jit-lock operations in the


From: ELPA Syncer
Subject: [elpa] externals/jinx 21a299c843 1/2: Run all jit-lock operations in the base buffer (Fix #68)
Date: Tue, 9 May 2023 12:58:26 -0400 (EDT)

branch: externals/jinx
commit 21a299c843e11a5726e6306d9cb34ae2c011e97c
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Run all jit-lock operations in the base buffer (Fix #68)
---
 jinx.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/jinx.el b/jinx.el
index 23af865630..b0c7584eb9 100644
--- a/jinx.el
+++ b/jinx.el
@@ -349,6 +349,11 @@ Predicate may return a position to skip forward.")
 
 ;;;; Internal functions
 
+(defun jinx--in-base-buffer (&rest app)
+  "Apply APP in `buffer-base-buffer', as required by `jit-lock' functions."
+  (with-current-buffer (or (buffer-base-buffer) (current-buffer))
+    (apply app)))
+
 (defun jinx--overlay-modified (overlay &rest _)
   "Delete modified OVERLAY.
 This function is a modification hook for the overlay."
@@ -461,8 +466,7 @@ If CHECK is non-nil, always check first."
         ;; FIXME `with-delayed-message' is broken in combination with
         ;; `inhibit-message'. Report this as a bug.
         (progn ;; with-delayed-message (1 "Fontifying...")
-          (with-current-buffer (or (buffer-base-buffer) (current-buffer))
-            (jit-lock-fontify-now)))
+          (jinx--in-base-buffer #'jit-lock-fontify-now))
         (progn ;; with-delayed-message (1 "Checking...")
           (jinx--check-region start end))
         (jinx--get-overlays start end visible))
@@ -482,7 +486,7 @@ If CHECK is non-nil, always check first."
       (widen)
       (jinx--delete-overlays (point-min) (point-max))
       (remove-list-of-text-properties (point-min) (point-max) '(jinx--pending))
-      (jit-lock-refontify))))
+      (jinx--in-base-buffer #'jit-lock-refontify))))
 
 (defun jinx--mark-pending (start end)
   "Mark region between START and END as pending."
@@ -836,7 +840,7 @@ If prefix argument ALL non-nil correct all misspellings."
                         ((integerp skip) (setq idx (mod (+ idx skip) count)))
                         ((or all deleted) (cl-incf idx)))))))
       (when old-point (goto-char old-point))
-      (jit-lock-refontify))))
+      (jinx--in-base-buffer #'jit-lock-refontify))))
 
 (defun jinx-correct-select ()
   "Quick selection key for corrections."



reply via email to

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