[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: @#$! new behavior of C-b & C-f in i-search

From: Juri Linkov
Subject: Re: @#$! new behavior of C-b & C-f in i-search
Date: Mon, 07 Jun 2004 09:43:45 +0300
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

Juri Linkov <address@hidden> writes:
> When C-f is typed in the end of the isearch minibuffer (activated by
> M-e) it could append characters from the isearch buffer to the
> search string in the minibuffer.

Since no one objected, I propose the following patch.  Generally, this
means that to pull characters into the search string instead of typing

C-s C-f C-f ... C-f C-s

to type one key more:

C-s M-e C-f C-f ... C-f C-s

But there is another small difference: the cursor is moved into the
minibuffer.  So separate keybindings for `isearch-yank-char' and
`isearch-del-char' are still needed.  I propose to bind them to
C-M-w and C-M-y, because these keybindings are absolutely harmless
(unlike other proposals) and have good mnemonics being bound to the
same keys as `isearch-yank-word-or-char' and `isearch-yank-line'.
For keyboards where C-M-w and C-M-y are not easy to type, the
alternative is `isearch-yank-char-in-minibuffer' accessible by M-e.

Index: lisp/isearch.el
RCS file: /cvsroot/emacs/emacs/lisp/isearch.el,v
retrieving revision 1.228
diff -u -w -b -r1.228 isearch.el
--- lisp/isearch.el     6 Jun 2004 13:57:39 -0000       1.228
+++ lisp/isearch.el     7 Jun 2004 00:59:38 -0000
@@ -294,6 +294,8 @@
     (define-key map " " 'isearch-whitespace-chars)
     (define-key map [?\S-\ ] 'isearch-whitespace-chars)
+    (define-key map "\C-\M-w" 'isearch-del-char)
+    (define-key map "\C-\M-y" 'isearch-yank-char)
     (define-key map "\C-w" 'isearch-yank-word-or-char)
     (define-key map "\C-y" 'isearch-yank-line)
@@ -343,11 +345,14 @@
     (define-key map "\M-\t" 'isearch-complete-edit)
     (define-key map "\C-s" 'isearch-forward-exit-minibuffer)
     (define-key map "\C-r" 'isearch-reverse-exit-minibuffer)
+    (define-key map "\C-f"  'isearch-yank-char-in-minibuffer)
+    (define-key map [right] 'isearch-yank-char-in-minibuffer)
   "Keymap for editing isearch strings in the minibuffer.")
@@ -1126,10 +1131,21 @@
          (goto-char isearch-other-end))
      (buffer-substring-no-properties (point) (funcall jumpform)))))
+(defun isearch-yank-char-in-minibuffer (&optional arg)
+  "Pull next character from isearch buffer into end of search string in 
+  (interactive "p")
+  (if (eobp)
+      (insert
+       (save-excursion
+         (set-buffer (cadr (buffer-list)))
+         (buffer-substring-no-properties
+          (point) (progn (forward-char arg) (point)))))
+    (forward-char arg)))
 (defun isearch-yank-char (&optional arg)
   "Pull next character from buffer into search string."
   (isearch-yank-internal (lambda () (forward-char 1) (point))))

Juri Linkov

reply via email to

[Prev in Thread] Current Thread [Next in Thread]