[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/iedit e5b51ac0af 278/301: Move hooks setup to iedit-lib to
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/iedit e5b51ac0af 278/301: Move hooks setup to iedit-lib to reduce code duplication |
Date: |
Mon, 10 Jan 2022 22:59:10 -0500 (EST) |
branch: elpa/iedit
commit e5b51ac0afd58a4de6e83ab3ed7308764c75db92
Author: Victor Ren <victorhge@gmail.com>
Commit: Victor <victorhge@gmail.com>
Move hooks setup to iedit-lib to reduce code duplication
---
README.org | 1 +
iedit-lib.el | 21 ++++++++++++++-------
iedit-rect.el | 14 ++++----------
iedit.el | 13 ++++---------
4 files changed, 23 insertions(+), 26 deletions(-)
diff --git a/README.org b/README.org
index 5a54abca9a..7b66083f53 100644
--- a/README.org
+++ b/README.org
@@ -14,6 +14,7 @@ other occurrences changed in the same way, with visual
feedback as you type.
- A more intuitive way to alter all the occurrences at once
- Visual feedback
- Less keystrokes in most cases
+ - Preserve case optionally
Normal work flow of Iedit mode is like:
diff --git a/iedit-lib.el b/iedit-lib.el
index c2b41cae1e..7d8b45a208 100755
--- a/iedit-lib.el
+++ b/iedit-lib.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2010 - 2019, 2020 Victor Ren
-;; Time-stamp: <2020-11-23 15:50:37 Victor Ren>
+;; Time-stamp: <2021-01-04 14:07:43 Victor Ren>
;; Author: Victor Ren <victorhge@gmail.com>
;; Keywords: occurrence region simultaneous rectangle refactoring
;; Version: 0.9.9.9
@@ -160,7 +160,7 @@ insertion against a zero-width occurrence.")
(defvar iedit-aborting nil
"This is buffer local variable which indicates Iedit mode is aborting.")
-(defvar iedit-aborting-hook nil
+(defvar iedit-lib-aborting-hook nil
"Functions to call before iedit-abort. Normally it should be mode exit
function.")
(defvar iedit-post-undo-hook-installed nil
@@ -206,6 +206,7 @@ It replaces `inhibit-modification-hooks' which prevents
calling
(make-variable-buffer-local 'iedit-post-undo-hook-installed)
(make-variable-buffer-local 'iedit-occurrence-context-lines)
(make-variable-buffer-local 'iedit-occurrence-index)
+(make-variable-buffer-local 'iedit-lib-aborting-hook)
(defconst iedit-occurrence-overlay-name 'iedit-occurrence-overlay-name)
(defconst iedit-invisible-overlay-name 'iedit-invisible-overlay-name)
@@ -267,7 +268,7 @@ cursors."
(goto-char (+ (overlay-start occurrence) offset))
(unless (= master (point))
(mc/create-fake-cursor-at-point))))
- (run-hooks 'iedit-aborting-hook)
+ (run-hooks 'iedit-lib-aborting-hook)
(multiple-cursors-mode 1)))
;; `multiple-cursors-mode' runs `post-command-hook' function on all the
;; cursors for updating them . `iedit-switch-to-mc-mode' is not supposed to
@@ -297,7 +298,7 @@ It should be set before occurrence overlay is created.")
(defun iedit-quit ()
"Quit the current mode."
(interactive)
- (run-hooks 'iedit-aborting-hook))
+ (run-hooks 'iedit-lib-aborting-hook))
(defun iedit-make-markers-overlays (markers)
"Create occurrence overlays on a list of markers."
@@ -408,6 +409,9 @@ there are."
(defun iedit-lib-start ()
"Initialize the hooks."
(add-hook 'post-command-hook 'iedit-update-occurrences-2 nil t)
+ (add-hook 'before-revert-hook 'iedit-quit nil t)
+ (add-hook 'kbd-macro-termination-hook 'iedit-quit nil t)
+ (add-hook 'change-major-mode-hook 'iedit-quit nil t)
(setq iedit-after-change-list nil))
(defun iedit-lib-cleanup ()
@@ -415,6 +419,9 @@ there are."
(remove-hook 'post-command-hook 'iedit-update-occurrences-2 t)
(remove-overlays nil nil iedit-occurrence-overlay-name t)
(iedit-show-all)
+ (remove-hook 'before-revert-hook 'iedit-quit t)
+ (remove-hook 'kbd-macro-termination-hook 'iedit-quit t)
+ (remove-hook 'change-major-mode-hook 'iedit-quit t)
(setq iedit-occurrences-overlays nil)
(setq iedit-read-only-occurrences-overlays nil)
(setq iedit-aborting nil)
@@ -463,7 +470,7 @@ This is added to `post-command-hook' when undo command is
executed
in occurrences."
(if (iedit-same-length)
nil
- (run-hooks 'iedit-aborting-hook))
+ (run-hooks 'iedit-lib-aborting-hook))
(remove-hook 'post-command-hook 'iedit-post-undo t)
(setq iedit-post-undo-hook-installed nil))
@@ -471,10 +478,10 @@ in occurrences."
"Turning Iedit mode off and reset `iedit-aborting'.
This is added to `post-command-hook' when aborting Iedit mode is
-decided. `iedit-aborting-hook' is postponed after the current
+decided. `iedit-lib-aborting-hook' is postponed after the current
command is executed for avoiding `iedit-update-occurrences'
is called for a removed overlay."
- (run-hooks 'iedit-aborting-hook)
+ (run-hooks 'iedit-lib-aborting-hook)
(remove-hook 'post-command-hook 'iedit-reset-aborting t)
(setq iedit-aborting nil))
diff --git a/iedit-rect.el b/iedit-rect.el
index c5e81b0c35..28be7c71f8 100644
--- a/iedit-rect.el
+++ b/iedit-rect.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2010 - 2019, 2020 Victor Ren
-;; Time-stamp: <2020-11-21 21:09:14 Victor Ren>
+;; Time-stamp: <2021-01-04 14:10:02 Victor Ren>
;; Author: Victor Ren <victorhge@gmail.com>
;; Keywords: occurrence region simultaneous rectangle refactoring
;; Version: 0.9.9.9
@@ -146,12 +146,9 @@ Commands:
(number-to-string (length iedit-occurrences-overlays)))
'face
'font-lock-warning-face))
+ (add-hook 'iedit-aborting-hook 'iedit-rectangle-done nil t)
(iedit-lib-start)
- (force-mode-line-update)
- (add-hook 'before-revert-hook 'iedit-rectangle-done nil t)
- (add-hook 'kbd-macro-termination-hook 'iedit-rectangle-done nil t)
- (add-hook 'change-major-mode-hook 'iedit-rectangle-done nil t)
- (add-hook 'iedit-aborting-hook 'iedit-rectangle-done nil t))
+ (force-mode-line-update))
(defun iedit-rectangle-done ()
"Exit Iedit mode.
@@ -162,10 +159,7 @@ the initial string globally."
(iedit-lib-cleanup)
(setq iedit-rectangle-mode nil)
(force-mode-line-update)
- (remove-hook 'before-revert-hook 'iedit-rectangle-done t)
- (remove-hook 'kbd-macro-termination-hook 'iedit-rectangle-done t)
- (remove-hook 'change-major-mode-hook 'iedit-rectangle-done t)
- (remove-hook 'iedit-aborting-hook 'iedit-rectangle-done t))
+ (remove-hook 'iedit-lib-aborting-hook 'iedit-rectangle-done t))
(defun iedit-kill-rectangle(&optional fill)
"Kill the rectangle.
diff --git a/iedit.el b/iedit.el
index e5efccc2d7..fd1a410850 100644
--- a/iedit.el
+++ b/iedit.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2010 - 2019, 2020 Victor Ren
-;; Time-stamp: <2020-11-23 15:18:05 Victor Ren>
+;; Time-stamp: <2021-01-04 13:52:50 Victor Ren>
;; Author: Victor Ren <victorhge@gmail.com>
;; Keywords: occurrence region simultaneous refactoring
;; Version: 0.9.9.9
@@ -483,12 +483,10 @@ Keymap used within overlays:
(setq iedit-mode t))
(when iedit-auto-buffering
(iedit-start-buffering))
+ (add-hook 'iedit-lib-aborting-hook 'iedit-done nil t)
(iedit-lib-start)
(run-hooks 'iedit-mode-hook)
- (add-hook 'before-revert-hook 'iedit-done nil t)
- (add-hook 'kbd-macro-termination-hook 'iedit-done nil t)
- (add-hook 'change-major-mode-hook 'iedit-done nil t)
- (add-hook 'iedit-aborting-hook 'iedit-done nil t))
+ )
(defun iedit-default-occurrence()
"This function returns a string as occurrence candidate.
@@ -592,10 +590,7 @@ the initial string globally."
(setq iedit-initial-string-local nil)
(setq iedit-mode nil)
(force-mode-line-update)
- (remove-hook 'before-revert-hook 'iedit-done t)
- (remove-hook 'kbd-macro-termination-hook 'iedit-done t)
- (remove-hook 'change-major-mode-hook 'iedit-done t)
- (remove-hook 'iedit-aborting-hook 'iedit-done t)
+ (remove-hook 'iedit-lib-aborting-hook 'iedit-done t)
(run-hooks 'iedit-mode-end-hook))
(defun iedit-mode-on-action (&optional arg)
- [nongnu] elpa/iedit 06e600aae2 222/301: Fix: use return value of iedit-default-occurrence-mode-local, (continued)
- [nongnu] elpa/iedit 06e600aae2 222/301: Fix: use return value of iedit-default-occurrence-mode-local, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit abcc27a9f0 231/301: Add Installation instruction, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 8b620efacb 262/301: Replace `inhibit-modification-hooks' with `iedit-updating', ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 6d2694356c 253/301: Move "declare-function" invocations outside of "when" statement., ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit f6682186f0 242/301: Replace eval-after-load with require check, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 14376a97e0 223/301: Ignore error in `iedit-mark-sgml-pair', ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 9fd1b43170 229/301: Fix failed test cases for Emacs 25.1, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 658c10a249 244/301: fix issue of iedit-restrict-function doesn't update mode-line text correctly, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 06f1f50939 224/301: Merge pull request #65 from pstray/master, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit c11ecd9080 273/301: Update copyright notice, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit e5b51ac0af 278/301: Move hooks setup to iedit-lib to reduce code duplication,
ELPA Syncer <=
- [nongnu] elpa/iedit c00a8ba805 272/301: Add a new feature - preserve case, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 4ef9bf6323 287/301: prefix-arg for `iedit-next-occurrence` and `iedit-prev-occurrence`, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 3d71392852 276/301: Fix as well issue #118, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit f7184f81d6 284/301: Clean up some lines of unnecessary code, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 2e1fd5b1b2 295/301: fix a byte compile issue, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 012de2e8d8 293/301: A few rephase in doc, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 6bb8d63a97 297/301: Fix several typo errors, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 345431294a 294/301: Unify prefix augument handling, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 61689f6ba4 057/301: Add arg handle for iedit-mode to exclude some occurrences., ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 7479d4c947 079/301: Merge branch 'topic/multi-interface', ELPA Syncer, 2022/01/10