[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/iedit d4b9fd53ce 019/301: don't call hooks when there is o
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/iedit d4b9fd53ce 019/301: don't call hooks when there is only text properites change |
Date: |
Mon, 10 Jan 2022 22:58:46 -0500 (EST) |
branch: elpa/iedit
commit d4b9fd53ce68c4d1a269eac98677398653980f3f
Author: Victor Ren <victorhge@gmail.com>
Commit: Victor Ren <victorhge@gmail.com>
don't call hooks when there is only text properites change
---
iedit.el | 39 +++++++++++++++++++++++++--------------
1 file changed, 25 insertions(+), 14 deletions(-)
diff --git a/iedit.el b/iedit.el
index ab1c194dee..70bb2f7fe6 100644
--- a/iedit.el
+++ b/iedit.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2010, 2011, 2012 Victor Ren
-;; Time-stamp: <2012-01-19 16:21:18 Victor Ren>
+;; Time-stamp: <2012-01-20 11:33:43 Victor Ren>
;; Author: Victor Ren <victorhge@gmail.com>
;; Keywords: occurrence region replace simultaneous
;; Version: 0.91
@@ -145,11 +145,16 @@ iedit mode is turned off last time.")
"This is buffer local variable which indicate the moving
forward or backward successful")
+(defvar iedit-before-modification-end 0
+ "This is buffer local variable which is the argment `end' of hook function
+before a change is made.")
+
(make-variable-buffer-local 'iedit-occurrences-overlays)
(make-variable-buffer-local 'iedit-unmatched-lines-invisible)
(make-variable-buffer-local 'iedit-case-sensitive)
(make-variable-buffer-local 'iedit-last-occurrence-in-history)
(make-variable-buffer-local 'iedit-forward-success)
+(make-variable-buffer-local 'iedit-before-modification-end)
(defconst iedit-occurrence-overlay-name 'iedit-occurrence-overlay-name)
(defconst iedit-invisible-overlay-name 'iedit-invisible-overlay-name)
@@ -372,20 +377,26 @@ occurrences if the user starts typing."
This modification hook is triggered when a user edits any
occurrence and is responsible for updating all other
occurrences."
- (when (and after (not undo-in-progress)) ; undo will do all the work
- (let ((inhibit-modification-hooks t)
- (offset (- beg (overlay-start occurrence))))
- (save-excursion
- (if (eq 0 change) ; insertion
- (let ((value (buffer-substring beg end)))
+ (when (not undo-in-progress) ; undo will do all the work
+ (if (null after) ; before modification
+ (setq iedit-before-modification-end end)
+ ;; exclude text properites change, only continue for insertion or
deletion
+ (when (or (not (eq iedit-before-modification-end end)))
+ (let ((inhibit-modification-hooks t)
+ (offset (- beg (overlay-start occurrence))))
+ (save-excursion
+ ;; insertion
+ (if (eq 0 change)
+ (let ((value (buffer-substring beg end)))
+ (dolist (like-occurrence (remove occurrence
iedit-occurrences-overlays))
+ (progn
+ (goto-char (+ (overlay-start like-occurrence) offset))
+ (insert value))))
+ ;; deletion
(dolist (like-occurrence (remove occurrence
iedit-occurrences-overlays))
- (progn
- (goto-char (+ (overlay-start like-occurrence) offset))
- (insert value))))
- (dolist (like-occurrence (remove occurrence
iedit-occurrences-overlays))
- (let* ((beginning (+ (overlay-start like-occurrence) offset))
- (ending (+ beginning change)))
- (delete-region beginning ending))))))))
+ (let* ((beginning (+ (overlay-start like-occurrence) offset))
+ (ending (+ beginning change)))
+ (delete-region beginning ending))))))))))
(defun iedit-next-occurrence ()
"Move forward to the next occurrence in the `iedit'.
- [nongnu] elpa/iedit f348f2d8fb 004/301: updates, (continued)
- [nongnu] elpa/iedit f348f2d8fb 004/301: updates, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit da0a24701b 005/301: Add option to match only complete words, not inside words, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 1b3672d28a 069/301: Init, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 8e87f353fe 006/301: add me as a contributor, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 59ce7fa759 091/301: Merge branch 'master' of github.com:victorhge/iedit, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 307262b25a 093/301: (add-hook 'change-major-mode-hook 'iedit-done nil t), ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit d2a6e16977 055/301: Update commentary with rectangle support, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 76eeb87b95 102/301: Add feekback message for iedit-restrict-function, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 29869ebed0 118/301: Add buffer local variable iedit-occurrence-keymap, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit ec765ee0c4 018/301: implement interactive string-rectangle mode with universal argument and region selected, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit d4b9fd53ce 019/301: don't call hooks when there is only text properites change,
ELPA Syncer <=
- [nongnu] elpa/iedit 7ed8e04557 021/301: Optmize iedit-hide-unmatched-lines, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit e6f558539e 025/301: fix org-mode text-property compatibility (use insert-and-inherit), ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 039c0e23ab 023/301: Postpone iedit-done after commands are excuted., ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit c5a0d4de84 028/301: fix zero-width rectangle insertion, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 13ecba138a 026/301: Merge branch 'upstream-master', ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 1d070b7d36 029/301: move init code for iedit-mode-map inside defvar, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit a75c44645a 031/301: fix bug with autopair and iedit-rect, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 20c1075948 032/301: remove conditions on setting `iedit-before-modification-string'., ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit c4091203ea 033/301: Merge pull request #3 from lewang/master, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit b81b9d6025 034/301: Clean code., ELPA Syncer, 2022/01/10