unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#10638: [PATCH] Prefix Arg support for 'isearch-repeat-forward' and 'isearch-repeat-backward'
@ 2012-01-29 15:59 Gideon Stupp
  2012-04-10 23:59 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Gideon Stupp @ 2012-01-29 15:59 UTC (permalink / raw)
  To: 10638


[-- Attachment #1.1: Type: text/plain, Size: 333 bytes --]

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.

[-- Attachment #1.2: Type: text/html, Size: 469 bytes --]

[-- Attachment #2: isearch_repeat_prefix_arg_support.patch --]
[-- Type: text/x-patch, Size: 1400 bytes --]

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."

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#10638: [PATCH] Prefix Arg support for 'isearch-repeat-forward' and 'isearch-repeat-backward'
  2012-01-29 15:59 bug#10638: [PATCH] Prefix Arg support for 'isearch-repeat-forward' and 'isearch-repeat-backward' Gideon Stupp
@ 2012-04-10 23:59 ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Magne Ingebrigtsen @ 2012-04-10 23:59 UTC (permalink / raw)
  To: Gideon Stupp; +Cc: 10638-close

Gideon Stupp <gideon.stupp@gmail.com> 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/





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-10 23:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-29 15:59 bug#10638: [PATCH] Prefix Arg support for 'isearch-repeat-forward' and 'isearch-repeat-backward' Gideon Stupp
2012-04-10 23:59 ` Lars Magne Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).