Skip to content
Browse files

Add parameter back to iedit-mode-from-isearch

  • Loading branch information...
1 parent d7d5931 commit 4d50a08dd6dd1343d584963029b979f182a2a892 @victorhge committed Oct 22, 2012
Showing with 17 additions and 14 deletions.
  1. +2 −2 iedit-tests.el
  2. +15 −12 iedit.el
View
4 iedit-tests.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2010, 2011, 2012 Victor Ren
-;; Time-stamp: <2012-10-15 16:12:02 Victor Ren>
+;; Time-stamp: <2012-10-22 14:01:57 Victor Ren>
;; Author: Victor Ren <victorhge@gmail.com>
;; Version: 0.97
;; X-URL: http://www.emacswiki.org/emacs/Iedit
@@ -163,7 +163,7 @@ fob")))))
(isearch-process-search-char ?f)
(isearch-process-search-char ?o)
(isearch-process-search-char ?o)
- (iedit-mode-from-isearch)
+ (call-interactively 'iedit-mode-from-isearch)
(should (string= iedit-initial-string-local "foo"))
(should (= 4 (length iedit-occurrences-overlays)))
(iedit-mode)
View
27 iedit.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2010, 2011, 2012 Victor Ren
-;; Time-stamp: <2012-10-15 15:09:14 Victor Ren>
+;; Time-stamp: <2012-10-22 13:59:18 Victor Ren>
;; Author: Victor Ren <victorhge@gmail.com>
;; Keywords: occurrence region simultaneous refactoring
;; Version: 0.97
@@ -343,22 +343,25 @@ Keymap used within overlays:
(setq iedit-initial-string-local occurrence)
(iedit-start (iedit-regexp-quote occurrence) beg end))))
-(defun iedit-mode-from-isearch ()
+(defun iedit-mode-from-isearch (regexp)
"Start Iedit mode using last search string as the regexp."
- (interactive)
- (let ((regexp (cond
+ (interactive
+ (let ((regexp (cond
+ ((functionp isearch-word)
+ (funcall isearch-word isearch-string))
(isearch-word (word-search-regexp isearch-string))
(isearch-regexp isearch-string)
(t (regexp-quote isearch-string)))))
- (if (or isearch-regexp isearch-word)
- nil
- (setq iedit-initial-string-local isearch-string))
- (isearch-exit)
- (setq mark-active nil)
- (run-hooks 'deactivate-mark-hook)
- (iedit-start regexp (point-min) (point-max))
+ (list regexp)))
+ (if (or isearch-regexp isearch-word)
+ nil
+ (setq iedit-initial-string-local isearch-string))
+ (isearch-exit)
+ (setq mark-active nil)
+ (run-hooks 'deactivate-mark-hook)
+ (iedit-start regexp (point-min) (point-max))
;; TODO: reconsider how to avoid the loop in iedit-same-length
- (if (iedit-same-length)
+ (if (iedit-same-length)
nil
(iedit-done)
(message "Matches are not the same length."))))

0 comments on commit 4d50a08

Please sign in to comment.
Something went wrong with that request. Please try again.