[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/iedit 67ad83f7fc 192/301: Rewrite iedit-expand-by-a-line
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/iedit 67ad83f7fc 192/301: Rewrite iedit-expand-by-a-line |
Date: |
Mon, 10 Jan 2022 22:59:02 -0500 (EST) |
branch: elpa/iedit
commit 67ad83f7fc03af97e26475e3e758aae152cf2ad7
Author: Victor Ren <victorhge@gmail.com>
Commit: Victor Ren <victorhge@gmail.com>
Rewrite iedit-expand-by-a-line
---
README.org | 4 ++--
iedit-lib.el | 10 +++++-----
iedit.el | 35 ++++++++++++++---------------------
3 files changed, 21 insertions(+), 28 deletions(-)
diff --git a/README.org b/README.org
index eec2121bc1..208518bc61 100644
--- a/README.org
+++ b/README.org
@@ -8,7 +8,7 @@ feedback as you type.
Normal scenario of Iedit mode is like:
- - Highlight certain contents - by press C-;
+ - Highlight certain contents - by press C-; (The default key binding)
All occurrences of a symbol, string or a rectangle in the buffer or a region
may be highlighted corresponding to current mark, point and prefix
argument. Refer to the document of `iedit-mode' for details.
@@ -40,7 +40,7 @@ Renaming refactoring is convinient in Iedit mode
- Restricting the search area to the lines near the current line can
be done by pressing M-{ and M-}. These will expand the search
- region one line at a time from the top and bottom. Add a prefix
+ region one line at a time from the top and bottom. Add a prefix
argument to go the opposite direction.
Iedit-rectangle-mode provides rectangle support with *visible rectangle*
diff --git a/iedit-lib.el b/iedit-lib.el
index d401b7d025..70b34ff869 100644
--- a/iedit-lib.el
+++ b/iedit-lib.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2010, 2011, 2012 Victor Ren
-;; Time-stamp: <2016-05-17 12:40:05 Victor Ren>
+;; Time-stamp: <2016-05-24 10:36:51 Victor Ren>
;; Author: Victor Ren <victorhge@gmail.com>
;; Keywords: occurrence region simultaneous rectangle refactoring
;; Version: 0.97
@@ -234,7 +234,7 @@ Return the number of occurrences."
"Create previous occurrence overlay for `occurrence-exp'."
(iedit-add-occurrence-overlay occurrence-exp point nil))
-(defun iedit-add-occurrence-overlay (occurrence-exp point forward)
+(defun iedit-add-occurrence-overlay (occurrence-exp point forward &optional
bound)
"Create next or previous occurrence overlay for `occurrence-exp'.
Return the start position of the new occurrence if successful."
(or point
@@ -244,9 +244,9 @@ Return the start position of the new occurrence if
successful."
(save-excursion
(goto-char point)
(if (not (if forward
- (re-search-forward occurrence-exp nil t)
- (re-search-backward occurrence-exp nil t)))
- (message "No more match.")
+ (re-search-forward occurrence-exp bound t)
+ (re-search-backward occurrence-exp bound t)))
+ (message "No more matches.")
(setq pos (match-beginning 0))
(if (or (iedit-find-overlay-at-point (match-beginning 0)
'iedit-occurrence-overlay-name)
(iedit-find-overlay-at-point (match-end 0)
'iedit-occurrence-overlay-name))
diff --git a/iedit.el b/iedit.el
index 120731cc27..f990d223e1 100644
--- a/iedit.el
+++ b/iedit.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2010, 2011, 2012 Victor Ren
-;; Time-stamp: <2016-05-25 03:06:11 Victor Ren>
+;; Time-stamp: <2016-05-29 14:57:51 Victor Ren>
;; Author: Victor Ren <victorhge@gmail.com>
;; Keywords: occurrence region simultaneous refactoring
;; Version: 0.97
@@ -33,7 +33,7 @@
;;
;; Normal scenario of iedit-mode is like:
;;
-;; - Highlight certain contents - by press C-; (The default binding)
+;; - Highlight certain contents - by press C-; (The default key binding)
;; All occurrences of a symbol, string in the buffer or a region may be
;; highlighted corresponding to current mark, point and prefix argument.
;; Refer to the document of `iedit-mode' for details.
@@ -220,7 +220,7 @@ This is like `describe-bindings', but displays only Iedit
keys."
;;; Default key bindings:
(when iedit-toggle-key-default
(let ((key-def (lookup-key (current-global-map) iedit-toggle-key-default)))
- (if (and key-def (not (eq key-def 'iedit-mode)))
+ (if key-def
(display-warning 'iedit (format "Iedit default key %S is occupied by
%s."
(key-description
iedit-toggle-key-default)
key-def)
@@ -245,8 +245,8 @@ This is like `describe-bindings', but displays only Iedit
keys."
(define-key map (kbd "M-I") 'iedit-restrict-current-line)
(define-key map (kbd "M-{") 'iedit-expand-up-a-line)
(define-key map (kbd "M-}") 'iedit-expand-down-a-line)
- (define-key map (kbd "M-n") 'iedit-expand-up-to-occurrence)
- (define-key map (kbd "M-p") 'iedit-expand-down-to-occurrence)
+ (define-key map (kbd "M-p") 'iedit-expand-up-to-occurrence)
+ (define-key map (kbd "M-n") 'iedit-expand-down-to-occurrence)
(define-key map (kbd "M-G") 'iedit-apply-global-modification)
(define-key map (kbd "M-C") 'iedit-toggle-case-sensitive)
map)
@@ -553,23 +553,16 @@ lines. The region being acted upon is controlled with
bottom). With a prefix, collapses the top or bottom of the search
region by `amount' lines."
(interactive "P")
- ;; Since iedit-done resets iedit-num-lines-to-expand-{down,up}, we
- ;; have to hang on to them in tmp variables
- (let ((tmp-up iedit-num-lines-to-expand-up)
- (tmp-down iedit-num-lines-to-expand-down)
- ;; we want to call iedit-mode with a universal prefix arg
- (current-prefix-arg '(4)))
- (iedit-done)
- (call-interactively 'iedit-mode)
- (setq iedit-num-lines-to-expand-up tmp-up)
- (setq iedit-num-lines-to-expand-down tmp-down)
+ (let ((occurrence (iedit-current-occurrence-string)))
+ (iedit-cleanup)
(if (eq where 'top)
- (setq iedit-num-lines-to-expand-up (max 0
- (+ amount
iedit-num-lines-to-expand-up)))
- (setq iedit-num-lines-to-expand-down (max 0
- (+ amount
iedit-num-lines-to-expand-down))))
- (iedit-restrict-region (iedit-char-at-bol (- iedit-num-lines-to-expand-up))
- (iedit-char-at-eol iedit-num-lines-to-expand-down))
+ (setq iedit-num-lines-to-expand-up
+ (max 0 (+ amount iedit-num-lines-to-expand-up)))
+ (setq iedit-num-lines-to-expand-down
+ (max 0 (+ amount iedit-num-lines-to-expand-down))))
+ (iedit-start (iedit-regexp-quote occurrence)
+ (iedit-char-at-bol (- iedit-num-lines-to-expand-up))
+ (iedit-char-at-eol iedit-num-lines-to-expand-down))
(message "Now looking -%d/+%d lines around current line, %d match%s."
iedit-num-lines-to-expand-up
iedit-num-lines-to-expand-down
- [nongnu] elpa/iedit 6300ca95d0 084/301: Update document with "narrowing" information, (continued)
- [nongnu] elpa/iedit 6300ca95d0 084/301: Update document with "narrowing" information, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 641d062b1b 081/301: Update documents, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit ab4a3857e7 085/301: Adds a .gitignore file to avoid dirty submodules., ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit b9d97fa50e 095/301: Fix iedit-blank-occurrences broken with rectangles problem, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit e35530f45d 097/301: Fix conjointed overlays overlapped problem after modification, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 2bf67ff6c7 100/301: Merge changes in master and, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 84c02ea4b6 049/301: Fix toggle case-sensitive problem when occurrence is empty string., ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit b58ba728ef 059/301: Add global variables and functions to make it possible to reapply last iedit modification, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit f334da3f57 098/301: Split iedit into three files: iedit.el, iedit-lib.el, iedit-rect.el, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit d2684ee774 099/301: Remove duplicate definations, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 67ad83f7fc 192/301: Rewrite iedit-expand-by-a-line,
ELPA Syncer <=
- [nongnu] elpa/iedit d1326bdef1 136/301: release.sh: New file., ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit d6c99fa91a 130/301: set `iedit-rectangle` to the actual rectangle corners, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit f36e6fcf0d 143/301: Move iedit-apply-global-modification to iedit, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 8d58171240 145/301: bugfix for iedit-hide-unmatched-lines, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit a55fcae6d0 175/301: Bind <tab> to iedit-next-occurrence, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 232cd0e5ec 146/301: tweak to use isearch case sensitivity, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 5883f9af54 211/301: Avoid overriding user's key bindings, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 95e7731a91 147/301: bugfix for when there are no occurrences, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit 19abf6e871 247/301: Update URLs to emacswiki, ELPA Syncer, 2022/01/10
- [nongnu] elpa/iedit ed52608a0d 268/301: Fix conjoined occurrences issues, ELPA Syncer, 2022/01/10