all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: 14563@debbugs.gnu.org
Subject: bug#14563: Add prefix arg to more isearch commands
Date: Sun, 09 Jun 2013 23:35:19 +0300	[thread overview]
Message-ID: <87ehcbkooo.fsf@mail.jurta.org> (raw)
In-Reply-To: <87obbj699r.fsf@mail.jurta.org> (Juri Linkov's message of "Thu, 06 Jun 2013 09:30:40 +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.





  reply	other threads:[~2013-06-09 20:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-06  6:30 bug#14563: Add prefix arg to more isearch commands Juri Linkov
2013-06-09 20:35 ` Juri Linkov [this message]
2013-06-13 21:12   ` Juri Linkov
2013-06-14 22:30     ` Juri Linkov
2018-11-20 23:45       ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ehcbkooo.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=14563@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.