summaryrefslogtreecommitdiff
path: root/lisp/isearch.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2001-12-10 20:45:27 +0000
committerRichard M. Stallman <rms@gnu.org>2001-12-10 20:45:27 +0000
commit868bf43ad4c87799c5805e5930e2c4e447ce0568 (patch)
treebc907c64277f4da2d44618b1c27814739210a466 /lisp/isearch.el
parent4d8ae757b2662eca9e0d49c3fb27e69fb85cab85 (diff)
downloademacs-868bf43ad4c87799c5805e5930e2c4e447ce0568.tar.gz
(isearch-yank-word-or-char): New function.
(isearch-mode-map): Bind C-w to that.
Diffstat (limited to 'lisp/isearch.el')
-rw-r--r--lisp/isearch.el11
1 files changed, 10 insertions, 1 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el
index ca7b4af3cad..29e18be7743 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -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)