changeset 41927:c1669b7ec455

(isearch-yank-word-or-char): New function. (isearch-mode-map): Bind C-w to that.
author Richard M. Stallman <rms@gnu.org>
date Mon, 10 Dec 2001 20:45:27 +0000
parents 8748b5403232
children 31fb6b379d0f
files lisp/isearch.el
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/isearch.el	Mon Dec 10 20:41:18 2001 +0000
+++ b/lisp/isearch.el	Mon Dec 10 20:45:27 2001 +0000
@@ -291,7 +291,7 @@
     (define-key map " " 'isearch-whitespace-chars)
     (define-key map [?\S-\ ] 'isearch-whitespace-chars)
     
-    (define-key map "\C-w" 'isearch-yank-word)
+    (define-key map "\C-w" 'isearch-yank-word-or-char)
     (define-key map "\C-y" 'isearch-yank-line)
 
     ;; Define keys for regexp chars * ? |.
@@ -1096,6 +1096,15 @@
   (interactive)
   (isearch-yank-internal (lambda () (forward-char 1) (point))))
 
+(defun isearch-yank-word-or-char ()
+  "Pull next character or word from buffer into search string."
+  (interactive)
+  (isearch-yank-internal (lambda () 
+			   (if (or (= (char-syntax (or (char-after) 0)) ?w)
+				   (= (char-syntax (or (char-after (1+ (point))) 0)) ?w))
+			       (forward-word 1)
+			     (forward-char 1)) (point))))
+
 (defun isearch-yank-word ()
   "Pull next word from buffer into search string."
   (interactive)