emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/iedit 668ea99c51 195/301: Allow prefix for expand function


From: ELPA Syncer
Subject: [nongnu] elpa/iedit 668ea99c51 195/301: Allow prefix for expand functions
Date: Mon, 10 Jan 2022 22:59:02 -0500 (EST)

branch: elpa/iedit
commit 668ea99c5124074ac1abb4aefe0a204d50042379
Author: Victor Ren <victorhge@gmail.com>
Commit: Victor Ren <victorhge@gmail.com>

    Allow prefix for expand functions
    
    iedit-expand-down-to-occurrence
    iedit-expand-up-to-occurrence
---
 iedit.el | 36 ++++++++++++++++++++++++------------
 1 file changed, 24 insertions(+), 12 deletions(-)

diff --git a/iedit.el b/iedit.el
index f990d223e1..58ed5d9613 100644
--- a/iedit.el
+++ b/iedit.el
@@ -2,7 +2,7 @@
 
 ;; Copyright (C) 2010, 2011, 2012 Victor Ren
 
-;; Time-stamp: <2016-05-29 14:57:51 Victor Ren>
+;; Time-stamp: <2016-05-29 23:52:05 Victor Ren>
 ;; Author: Victor Ren <victorhge@gmail.com>
 ;; Keywords: occurrence region simultaneous refactoring
 ;; Version: 0.97
@@ -572,7 +572,7 @@ region by `amount' lines."
 (defun iedit-expand-up-a-line (&optional arg)
   "After restricting iedit to the current line with
 `iedit-restrict-current-line', this function expands the search
-region upwards by one line. With a prefix, bring the top of the
+region upwards by one line.  With a prefix, bring the top of the
 region back down one line."
   (interactive "P")
   (iedit-expand-by-a-line 'top
@@ -581,23 +581,35 @@ region back down one line."
 (defun iedit-expand-down-a-line (&optional arg)
   "After restricting iedit to the current line with
 `iedit-restrict-current-line', this function expands the search
-region downwards by one line. With a prefix, bring the bottom of
+region downwards by one line.  With a prefix, bring the bottom of
 the region back up one line."
   (interactive "P")
   (iedit-expand-by-a-line 'bottom
                           (if arg -1 1)))
 
-(defun iedit-expand-down-to-occurrence ()
+(defun iedit-expand-down-to-occurrence (&optional arg)
   "Expand the search region downwards until reaching a new occurrence.
-If no such occurrence can be found, throw an error."
-  (interactive)
-  (iedit-expand-to-occurrence t))
-
-(defun iedit-expand-up-to-occurrence ()
+If no such occurrence can be found, throw an error.  With a
+prefix, bring the bottom of the region back up one occurrence."
+  (interactive "P")
+  (if arg
+      (progn (iedit-restrict-region
+              (iedit-first-occurrence)
+              (1- (iedit-last-occurrence)))
+             (goto-char (iedit-last-occurrence)))
+  (iedit-expand-to-occurrence t)))
+
+(defun iedit-expand-up-to-occurrence (&optional arg)
   "Expand the search region upwards until reaching a new occurrence.
-If no such occurrence can be found, throw an error."
-  (interactive)
-  (iedit-expand-to-occurrence nil))
+If no such occurrence can be found, throw an error.  With a
+prefix, bring the top of the region back down one occurrence."
+  (interactive "P")
+  (if arg
+      (progn (iedit-restrict-region
+              (1+ (iedit-first-occurrence))
+              (+ (iedit-occurrence-string-length) (iedit-last-occurrence)))
+             (goto-char (iedit-first-occurrence)))
+    (iedit-expand-to-occurrence nil)))
 
 (defun iedit-expand-to-occurrence (forward)
   "Expand to next or previous occurrence."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]