[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/iedit 90ef2d5ac9 064/301: Add digit prefix argment 0 to en
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/iedit 90ef2d5ac9 064/301: Add digit prefix argment 0 to enable restricting match in a function |
Date: |
Mon, 10 Jan 2022 22:58:51 -0500 (EST) |
branch: elpa/iedit
commit 90ef2d5ac9ca10f28f175d11867eb2ea02ef33af
Author: Victor Ren <victorhge@gmail.com>
Commit: Victor Ren <victorhge@gmail.com>
Add digit prefix argment 0 to enable restricting match in a function
---
README | 2 +-
iedit.el | 37 +++++++++++++++++++++++++------------
2 files changed, 26 insertions(+), 13 deletions(-)
diff --git a/README b/README
index a23c9bbca6..deb129685e 100644
--- a/README
+++ b/README
@@ -8,7 +8,7 @@ Most common scenario of using this package is renaming
refactoring
during programming. Several enhancements are done to make it easier:
- The symbol under point can be selected as occurrence by one key and only
complete
symbols are matched
- - Restrict symbols in current defun only by one command
+ - Restricting symbols in current function matched could be done by one command
- Remember the renaming refactoring and re-apply to other buffers later
This package also provides rectangle support with visible rectangle
diff --git a/iedit.el b/iedit.el
index f297eae436..e15842d2b4 100644
--- a/iedit.el
+++ b/iedit.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2010, 2011, 2012 Victor Ren
-;; Time-stamp: <2012-02-24 01:23:14 Victor Ren>
+;; Time-stamp: <2012-02-25 00:37:29 Victor Ren>
;; Author: Victor Ren <victorhge@gmail.com>
;; Keywords: occurrence region replace simultaneous
;; Version: 0.94
@@ -356,12 +356,13 @@ occurrences simultaneously.
If Transient Mark mode is disabled or the region is not active,
the current symbol (returns from `current-word') is used as the
-occurrence by default. The occurrences of the current
-symbol, but not include occurrences that are part of other
-symbols, are highlighted. This is good for renaming refactoring
-during programming. If you still want to match all the
-occurrences, even though they are parts of other symbols, you may
-have to select the symbol first.
+occurrence by default. The occurrences of the current symbol,
+but not include occurrences that are part of other symbols, are
+highlighted. With digit prefix argument 0, only symbols in
+current function are matched. This is good for renaming
+refactoring during programming. If you still want to match all
+the occurrences, even though they are parts of other symbols, you
+may have to select the symbol first.
You can also switch to iedit mode from isearch mode directly. The
current search string is used as occurrence. All occurrences of
@@ -402,7 +403,9 @@ Commands:
(iedit-restrict-region beg end arg)
(iedit-first-occurrence)))
(iedit-done))
- (let (occurrence complete-symbol rect-string)
+ (let (occurrence complete-symbol rect-string
+ (beg (point-min))
+ (end (point-max)))
(cond ((and arg
(or (not transient-mark-mode) (not mark-active)
(equal (mark) (point))))
@@ -414,6 +417,16 @@ Commands:
iedit-last-initial-string-global)
(setq occurrence iedit-last-initial-string-global)
(setq complete-symbol iedit-only-complete-symbol-global))
+ ((and (= 0 (prefix-numeric-value arg))
+ iedit-current-symbol-default
+ (current-word t))
+ (setq occurrence (current-word))
+ (when iedit-only-at-symbol-boundaries
+ (setq complete-symbol t))
+ (save-excursion
+ (mark-defun)
+ (setq beg (region-beginning))
+ (setq end (region-end))))
(t (error "No candidate of the occurrence, cannot enable
iedit mode."))))
((and arg
transient-mark-mode mark-active (not (equal (mark) (point))))
@@ -438,15 +451,15 @@ Commands:
(iedit-rectangle-start beg end))
(deactivate-mark)
(setq iedit-case-sensitive-local iedit-case-sensitive-default)
- (iedit-start occurrence)))))
+ (iedit-start occurrence beg end)))))
-(defun iedit-start (occurrence-exp)
+(defun iedit-start (occurrence-exp beg end)
"Start an iedit for the occurrence-exp in the current buffer."
(setq iedit-unmatched-lines-invisible
iedit-unmatched-lines-invisible-default)
(setq iedit-aborting nil)
(setq iedit-rectangle nil)
(setq iedit-current-keymap iedit-occurrence-keymap)
- (iedit-refresh occurrence-exp (point-min) (point-max))
+ (iedit-refresh occurrence-exp beg end)
(run-hooks 'iedit-mode-hook)
;; (add-hook 'mouse-leave-buffer-hook 'iedit-done)
(add-hook 'kbd-macro-termination-hook 'iedit-done))
@@ -1009,7 +1022,7 @@ Return nil if occurrence string is empty string."
(setq iedit-last-occurrence-local (iedit-current-occurrence-string))
(deactivate-mark)
(iedit-show-all)
- (iedit-cleanup-occurrences-overlays beg end arg)
+ (iedit-cleanup-occurrences-overlays beg end inclusive)
(if iedit-unmatched-lines-invisible
(iedit-hide-unmatched-lines iedit-occurrence-context-lines))
(setq iedit-mode (propertize
- [nongnu] elpa/iedit c53a885fe5 040/301: Add bufferring modification functionalities, (continued)
- [nongnu] elpa/iedit c53a885fe5 040/301: Add bufferring modification functionalities, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 9bc57d2a30 041/301: make iedit-skipped-modification-once buffer local, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit e99e65fccb 044/301: Fix current point move problem when call iedit-replace-occurrences., ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 4e31d50327 052/301: Add a prefix arg handling to iedit-toggle-unmatched-lines-visible, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 87053a3d44 054/301: Remove two buffer local variables for rectangle., ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit e568677fe4 056/301: Add new functionality: restrict iedit-mode in region, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit a9bda4db66 060/301: Refine hotkeys, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 4fa7342be9 065/301: Copy from iedit.el, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit b579dd0739 063/301: Update with new information, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit a13c4d6b56 067/301: Remove README, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 90ef2d5ac9 064/301: Add digit prefix argment 0 to enable restricting match in a function,
ELPA Syncer <=
- [nongnu] elpa/iedit 697e24c337 073/301: remove a todo item: add ert test case, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 428be4e13e 078/301: Fix iedit-kill-rectangle problem, ELPA Syncer, 2022/01/10
- [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