[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/iedit 95eb44ee30 117/301: Add new function iedit-add-next-
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/iedit 95eb44ee30 117/301: Add new function iedit-add-next-occurrence-overlay |
Date: |
Mon, 10 Jan 2022 22:58:55 -0500 (EST) |
branch: elpa/iedit
commit 95eb44ee303b45e14bdffdc55cadc772a80c0643
Author: Victor Ren <victorhge@gmail.com>
Commit: Victor Ren <victorhge@gmail.com>
Add new function iedit-add-next-occurrence-overlay
---
iedit-lib.el | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/iedit-lib.el b/iedit-lib.el
index 306b430dc1..243318d71b 100644
--- a/iedit-lib.el
+++ b/iedit-lib.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2010, 2011, 2012 Victor Ren
-;; Time-stamp: <2012-08-31 10:42:58 Victor Ren>
+;; Time-stamp: <2012-09-05 09:33:31 Victor Ren>
;; Author: Victor Ren <victorhge@gmail.com>
;; Keywords: occurrence region simultaneous rectangle refactoring
;; Version: 0.97
@@ -92,7 +92,8 @@ unmatched lines are hided.")
forward or backward successful")
(defvar iedit-before-modification-string ""
- "This is buffer local variable which is the buffer substring that is going
to be changed.")
+ "This is buffer local variable which is the buffer substring
+that is going to be changed.")
(defvar iedit-before-modification-undo-list nil
"This is buffer local variable which is the buffer undo list before
modification.")
@@ -108,7 +109,7 @@ insertion against a zero-width occurrence.")
"This is buffer local variable which indicates Iedit mode is aborting.")
(defvar iedit-aborting-hook nil
- "Functions to call before iedit-abort. Normally it should be mode exit
function.")
+ "Functions to call before iedit-abort. Normally it should be mode exit
function.")
(defvar iedit-post-undo-hook-installed nil
"This is buffer local variable which indicated if
@@ -204,6 +205,23 @@ Return the number of occurrences."
(iedit-hide-unmatched-lines iedit-occurrence-context-lines))))
counter))
+(defun iedit-add-next-occurrence-overlay (occurrence-exp &optional keymap)
+ "Create next occurrence overlay for `occurrence-exp'."
+ (unless keymap
+ (setq keymap iedit-occurrence-keymap-default))
+ (let ((case-fold-search (not iedit-case-sensitive-local)))
+ (when (re-search-forward occurrence-exp nil t)
+ (push (iedit-make-occurrence-overlay (match-beginning 0)
+ (match-end 0)
+ keymap)
+ iedit-occurrences-overlays)
+ (sort iedit-occurrences-overlays
+ (lambda (left right)
+ (< (overlay-start left) (overlay-start right))))
+ (message "Add one match for \"%s\"" (iedit-printable occurrence-exp))
+ (if iedit-unmatched-lines-invisible
+ (iedit-hide-unmatched-lines iedit-occurrence-context-lines)))))
+
(defun iedit-add-region-as-occurrence (beg end)
"Add region as an occurrence.
The length of the region must the same as other occurrences if
@@ -257,7 +275,7 @@ occurrences if the user starts typing."
unmatched-lines-overlay))
(defun iedit-post-undo-hook ()
- "Check if it is time to abort iedit.
+ "Check if it is time to abort iedit after undo command is executed.
This is added to `post-command-hook' when undo command is executed
in occurrences."
@@ -289,6 +307,8 @@ Current supported edits are insertion, yank, deletion and
replacement. If this modification is going out of the
occurrence, it will abort Iedit mode."
(if undo-in-progress
+ ;; If the "undo" change make occurrences different, it is going to mess
up
+ ;; occurrences. So a check will be done after undo command is executed.
(when (not iedit-post-undo-hook-installed)
(add-hook 'post-command-hook 'iedit-post-undo-hook nil t)
(setq iedit-post-undo-hook-installed t))
- [nongnu] elpa/iedit f7184f81d6 284/301: Clean up some lines of unnecessary code, (continued)
- [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
- [nongnu] elpa/iedit 6cc86d58e6 086/301: Merge pull request #6 from gorakhargosh/master, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 4cf803d9cb 092/301: Skip the first occurrence for occur-edit-mode, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit c5ab2c593d 094/301: Avoid to restore Iedit mode when restoring desktop, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 95eb44ee30 117/301: Add new function iedit-add-next-occurrence-overlay,
ELPA Syncer <=
- [nongnu] elpa/iedit b94c75e8c6 107/301: Move iedit-help-keymap to iedit.el, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 84896f8be0 104/301: *** empty log message ***, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 962fcdb6cd 124/301: Fix failed test cases, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 6d16d92a5a 112/301: replace iedit-occurrence-face with real face, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 57beb10db5 141/301: Remove all the dependency to the order of iedit-occurrences-overlays, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 4efe511684 128/301: allow iedit-rectangle-mode to take beg end programatically, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit e48b52e353 185/301: Merge branch 'incremental-select' of git://github.com/bmag/iedit into bmag-incremental-select, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 668ea99c51 195/301: Allow prefix for expand functions, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 007a6f9c28 206/301: check if mc present, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 7885f4beda 178/301: iedit-restrict-current-line resets expand state, ELPA Syncer, 2022/01/10