Subject: bug#10638: closed (Re: bug#10638: [PATCH] Prefix Arg support for 'isearch-repeat-forward' and 'isearch-repeat-backward')

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 11 Apr 2012 00:01:02 +0000

Your bug report

#10638: [PATCH] Prefix Arg support for 'isearch-repeat-forward' and 'isearch-repeat-backward'

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
10638: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10638
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#10638: [PATCH] Prefix Arg support for 'isearch-repeat-forward' and 'isearch-repeat-backward'
From: Lars Magne Ingebrigtsen <[email-masked]>
To: Gideon Stupp <[email-masked]>
Cc: [email-masked]
Date: Wed, 11 Apr 2012 01:59:16 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Gideon Stupp <[email-masked]> writes:

> This patch extends 'isearch-repeat-forward' and '
> isearch-repeat-backward' to support a prefix argument so that during
> search it is possible to press C-3 C-s for example to repeat the last
> search three times. Notice that you need to set `isearch-allow-scroll'
> to t for the patch to take effect.

I'm not quite sure that I see how this would be all that useful.  `C-s
C-s C-s' isn't a lot more keystrokes than `C-3 C-s', and is easier to
type.

And I can't really see why one would do `C-45 C-s'.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/

Subject: [PATCH] Prefix Arg support for 'isearch-repeat-forward' and 'isearch-repeat-backward'
From: Gideon Stupp <[email-masked]>
To: [email-masked]
Date: Sun, 29 Jan 2012 17:59:06 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Package: emacs
Tags: patch

This patch extends 'isearch-repeat-forward' and 'isearch-repeat-backward'
to support a prefix argument so that during search it is possible to press
C-3 C-s for example to repeat the last search three times.   Notice that
you need to set `isearch-allow-scroll' to t for the patch to take effect.

Gideon.
diff --git a/lisp/isearch.el b/lisp/isearch.el
index ce75911..ce12552 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -1340,15 +1340,37 @@ Use `isearch-exit' to quit without signaling."
   (isearch-push-state)
   (isearch-update))
 
-(defun isearch-repeat-forward ()
+(defun isearch-repeat-forward (&optional arg)
   "Repeat incremental search forwards."
-  (interactive)
-  (isearch-repeat 'forward))
-
-(defun isearch-repeat-backward ()
+  (interactive "p")
+  (if (< arg 0)
+      (progn
+	;; Doesn't do any search, just switches to backward search
+	(isearch-repeat 'backward)
+	(while (< arg 0)
+	  (isearch-repeat 'backward)
+	  (setq arg (1+ arg)))
+	;; Now switch back to forward search
+	(isearch-repeat 'forward))
+    (while (> arg 0)
+      (isearch-repeat 'forward)
+      (setq arg (1- arg)))))
+
+(defun isearch-repeat-backward (&optional arg)
   "Repeat incremental search backwards."
-  (interactive)
-  (isearch-repeat 'backward))
+  (interactive "p")
+  (if (< arg 0)
+      (progn
+	;; Doesn't do any search, just switches to forward search
+	(isearch-repeat 'forward)
+	(while (< arg 0)
+	  (isearch-repeat 'forward)
+	  (setq arg (1+ arg)))
+	;; Now switch back to backward search
+	(isearch-repeat 'backward))
+    (while (> arg 0)
+      (isearch-repeat 'backward)
+      (setq arg (1- arg)))))
 
 (defun isearch-toggle-regexp ()
   "Toggle regexp searching on or off."