[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/iedit 3c7159a107 298/301: Avoid calling `iedit-lib-cleanup
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/iedit 3c7159a107 298/301: Avoid calling `iedit-lib-cleanup` twice |
Date: |
Mon, 10 Jan 2022 22:59:12 -0500 (EST) |
branch: elpa/iedit
commit 3c7159a107b01b8f740ced72f10351b10bb69784
Author: Victor Ren <victorhge@gmail.com>
Commit: Victor Ren <victorhge@gmail.com>
Avoid calling `iedit-lib-cleanup` twice
---
iedit-lib.el | 32 +++++++++++++++++++++-----------
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/iedit-lib.el b/iedit-lib.el
index c792a110fe..bd4b472ea8 100644
--- a/iedit-lib.el
+++ b/iedit-lib.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2010 - 2019, 2020, 2021 Victor Ren
-;; Time-stamp: <2021-12-23 19:28:21 Victor Ren>
+;; Time-stamp: <2021-12-28 12:46:19 Victor Ren>
;; Author: Victor Ren <victorhge@gmail.com>
;; Keywords: occurrence region simultaneous rectangle refactoring
;; Version: 0.9.9.9
@@ -331,6 +331,7 @@ It should be set before occurrence overlay is created.")
"Quit the current mode by calling mode exit function."
(interactive)
(when iedit-buffering
+ ;; keep the content and quit iedit only
(setq iedit-buffering nil)
(when defining-kbd-macro
(kmacro-keyboard-quit)
@@ -473,7 +474,10 @@ there are."
"Clean up occurrence overlay, invisible overlay and local variables."
(when iedit-buffering
(if defining-kbd-macro
- (iedit-end-and-call-kmacro nil)
+ (progn
+ (kmacro-end-macro nil)
+ (setq iedit-buffering nil)
+ (iedit--apply-kmacro))
(iedit-stop-buffering)))
(iedit-cleanup-occurrences-overlays)
(remove-hook 'post-command-hook 'iedit-update-occurrences t)
@@ -1024,20 +1028,26 @@ before calling the last keyboard macro."
;; (and defining-kbd-macro iedit-buffering-overlay)
iedit-start-kmacro was called
(kmacro-end-macro nil)
(setq iedit-buffering nil))
- (let ((iedit-updating t))
- (save-excursion
- (when iedit-buffering-overlay (iedit-move-conjoined-overlays
iedit-buffering-overlay))
- (dolist (another-occurrence iedit-occurrences-overlays)
- (when (not (eq another-occurrence
iedit-buffering-overlay))
- (goto-char (+ (overlay-start another-occurrence)
iedit-start-kmacro-offset))
- (kmacro-call-macro nil t)
- (iedit-move-conjoined-overlays another-occurrence)))))
+ (iedit--apply-kmacro)
(setq iedit-buffering-overlay nil)
(if (iedit-same-length)
- (message "Keyboard macro applied to the occurrences.")
+ nil
(iedit--quit)
(message "Abort Iedit mode due to different change made to
occurrences.")))))
+(defun iedit--apply-kmacro ()
+ "Apply last keyboard macro on all the occurrences."
+ (let ((iedit-updating t))
+ (save-excursion
+ (when iedit-buffering-overlay (iedit-move-conjoined-overlays
iedit-buffering-overlay))
+ (dolist (another-occurrence iedit-occurrences-overlays)
+ (when (not (eq another-occurrence iedit-buffering-overlay))
+ (goto-char (+ (overlay-start another-occurrence)
iedit-start-kmacro-offset))
+ (kmacro-call-macro nil t)
+ (iedit-move-conjoined-overlays another-occurrence)))
+ )
+ (message "Keyboard macro applied to the occurrences.")))
+
(defun iedit-case-pattern (beg end)
"Distinguish the case pattern of the text between `beg' and `end'.
- [nongnu] elpa/iedit a7f5ed7cf9 257/301: Turn off iedit-mode at running `iedit-mode-toggle-on-function` twice, (continued)
- [nongnu] elpa/iedit a7f5ed7cf9 257/301: Turn off iedit-mode at running `iedit-mode-toggle-on-function` twice, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 5050b7e88e 260/301: Fix a failed test case when Emacs is compiled without GUI, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit afca4e6bbf 213/301: Rename hook functions, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 7ab2509231 225/301: Expand iedit-regexp-quote with passthrough, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit efe98b2015 248/301: fix `iedit-mode-on-fuction problem, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 01fa1e5925 217/301: Fix error if sgml-electric-tag-pair-mode not bound, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit d7db0e5d19 279/301: Replace `iedit-lib-aborting-hook' with a callback function, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit dbf3f9a0e3 290/301: Add iedit-update-key-bindings, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 351bee5e0d 292/301: New iedit-record-changes, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 070775fb85 296/301: New feature: apply kmacro on occurrences, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 3c7159a107 298/301: Avoid calling `iedit-lib-cleanup` twice,
ELPA Syncer <=