Subject: Re: bug#10654: 24.0.93; isearch-yank-line moved from C-y

From: Juri Linkov <[email-masked]>
Date: Sat, 04 Feb 2012 02:17:55 +0200

> That approach would be a little less onerous if additional words or characters
> could be added to the search string by additional M-f and C-f without prefixing
> each with M-s.

If `C-k' for `isearch-yank-line' is not under consideration,
then I recommend to allow `M-s C-e C-e C-e ...' in 24.1
because `M-s C-e M-s C-e M-s C-e ...' is unusable.

This can be achieved with the patch below.

Other repeating key sequences `M-s M-f M-f M-f ...' and `M-s C-f C-f C-f ...'
could be implemented as well, but there is no urgent need for them now.

=== modified file 'lisp/isearch.el'
--- lisp/isearch.el	2012-02-01 00:21:17 +0000
+++ lisp/isearch.el	2012-02-04 00:17:07 +0000
@@ -533,6 +533,9 @@ (defvar minibuffer-local-isearch-map
     map)
   "Keymap for editing Isearch strings in the minibuffer.")
 
+(defvar isearch-repeat-key nil)
+(defvar isearch-repeat-command nil)
+
 ;; Internal variables declared globally for byte-compiler.
 ;; These are all set with setq while isearching
 ;; and bound locally while editing the search string.
@@ -1662,6 +1665,8 @@
 (defun isearch-yank-line ()
   "Pull rest of line from buffer into search string."
   (interactive)
+  (setq isearch-repeat-key last-input-event
+	isearch-repeat-command 'isearch-yank-line)
   (isearch-yank-internal
    (lambda () (let ((inhibit-field-text-motion t))
 		(line-end-position (if (eolp) 2 1))))))
@@ -1962,8 +1967,13 @@ (defun isearch-other-meta-char (&optiona
                 (this-command-keys)))
 	 (main-event (aref key 0))
 	 (keylist (listify-key-sequence key))
+	 (repeat-key isearch-repeat-key)
          scroll-command isearch-point)
-    (cond ((and (= (length key) 1)
+    (setq isearch-repeat-key nil)
+    (cond ((and (eq main-event repeat-key) isearch-repeat-command)
+	   (setq isearch-repeat-key main-event)
+	   (command-execute isearch-repeat-command))
+	  ((and (= (length key) 1)
 		(let ((lookup (lookup-key local-function-key-map key)))
 		  (not (or (null lookup) (integerp lookup)
 			   (keymapp lookup)))))