]> git.eshelyaron.com Git - emacs.git/commitdiff
(isearch-yank-word-or-char): New function.
authorRichard M. Stallman <rms@gnu.org>
Mon, 10 Dec 2001 20:45:27 +0000 (20:45 +0000)
committerRichard M. Stallman <rms@gnu.org>
Mon, 10 Dec 2001 20:45:27 +0000 (20:45 +0000)
(isearch-mode-map): Bind C-w to that.

lisp/isearch.el

index ca7b4af3cad587d244a2ed8ab79cd5c4b37f0ed3..29e18be7743599bbd5c7ac0a145442518113f6da 100644 (file)
@@ -291,7 +291,7 @@ Default value, nil, means edit the string instead."
     (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 @@ might return the position of the end of the line."
   (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)