Subject: bug#14563: Add prefix arg to more isearch commands

From: Juri Linkov <[email-masked]>
Date: Sun, 09 Jun 2013 23:35:19 +0300

> bug#10614 and bug#10638 deals with adding a prefix arg to
> `isearch-repeat-forward' and `isearch-repeat-backward'.
>
> And the following patch adds a prefix arg to
> `isearch-quote-char' (to use the same args as in `quoted-insert'),
> `isearch-printing-char' (to use the same args as in `insert-char'),
> `isearch-process-search-char' and
> `isearch-process-search-multibyte-characters':

I have no intention to add a prefix arg to all isearch commands
because for some commands a prefix arg doesn't make sense.
For instance, it makes no sense to add a prefix arg to
`isearch-delete-char' since after every DEL it requires
examination to visually confirm that the current search match
is what the user wants (because the search stack is invisible
to the user and it's difficult to keep it in mind and count items
in the stack).

Also a prefix arg for `isearch-yank-word-or-char' is useless too,
because it is too unpredictable in the exact number of characters
it will move forward (depends on the word syntax in the buffer),
so it's difficult for the user to give such a prefix arg that would
move forward the specified amount of unit (characters or words)
and stop at the exact position.

As for `isearch-yank-word' and `isearch-yank-line' it makes sense
to add a prefix arg to them only when a new feature `isearch-allow-move'
(intended to replace these commands) is not going to be added to isearch.el.
In this case a prefix arg for these commands can be added by this patch:

=== modified file 'lisp/isearch.el'
--- lisp/isearch.el	2013-06-06 06:23:19 +0000
+++ lisp/isearch.el	2013-06-09 20:34:11 +0000
@@ -1919,29 +2082,33 @@ (defun isearch-yank-word-or-char ()
 	   (forward-word 1))
        (forward-char 1)) (point))))
 
-(defun isearch-yank-word ()
+(defun isearch-yank-word (&optional arg)
   "Pull next word from buffer into search string."
-  (interactive)
-  (isearch-yank-internal (lambda () (forward-word 1) (point))))
+  (interactive "p")
+  (isearch-yank-internal (lambda () (forward-word arg) (point))))
 
-(defun isearch-yank-line ()
+(defun isearch-yank-line (&optional arg)
   "Pull rest of line from buffer into search string."
-  (interactive)
+  (interactive "p")
   (isearch-yank-internal
    (lambda () (let ((inhibit-field-text-motion t))
-		(line-end-position (if (eolp) 2 1))))))
+		(line-end-position (if (eolp) (1+ arg) arg))))))
 
(defun isearch-char-by-name ()
   "Read a character by its Unicode name and add it to the search string.