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

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

[nongnu] elpa/iedit f566ade5e4 264/301: Workaround for slow `c-before-ch


From: ELPA Syncer
Subject: [nongnu] elpa/iedit f566ade5e4 264/301: Workaround for slow `c-before-change'
Date: Mon, 10 Jan 2022 22:59:09 -0500 (EST)

branch: elpa/iedit
commit f566ade5e44fcc3ec50ef93c679ba698b43d16ba
Author: Victor Ren <yren@sonicwall.com>
Commit: Victor <victorhge@gmail.com>

    Workaround for slow `c-before-change'
---
 iedit-lib.el | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/iedit-lib.el b/iedit-lib.el
index f5a6100846..2f88fc71ff 100644
--- a/iedit-lib.el
+++ b/iedit-lib.el
@@ -552,7 +552,10 @@ part to apply it to all the other occurrences."
 Apply the change to all the other occurrences. "
   (let ((iedit-updating t)
         (offset (- beg (overlay-start occurrence)))
-        (value (buffer-substring-no-properties beg end)))
+        (value (buffer-substring-no-properties beg end))
+               ;; c-before-change is really slow. It is safe to skip change 
functions
+               ;; for all the other occurrences
+               (inhibit-modification-hooks (memq #'c-before-change 
before-change-functions)))
     (save-excursion
       (dolist (another-occurrence iedit-occurrences-overlays)
             (let* ((beginning (+ (overlay-start another-occurrence) offset))
@@ -562,7 +565,10 @@ Apply the change to all the other occurrences. "
                                (when (/= beg end) ;; insert
                                  (goto-char beginning)
                                  (insert-and-inherit value)))
-              (iedit-move-conjoined-overlays another-occurrence))))))
+              (iedit-move-conjoined-overlays another-occurrence))))
+       (when inhibit-modification-hooks
+         ;; run the after change functions only once. It seems OK for c-mode
+         (run-hook-with-args 'after-change-functions beg end change))))
 
 (defun iedit-next-occurrence ()
   "Move forward to the next occurrence in the `iedit'.



reply via email to

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