# HG changeset patch # User Richard M. Stallman # Date 1008017127 0 # Node ID c1669b7ec455d1bf2816a998fad560d3deddb4c0 # Parent 8748b5403232f7ccf44ac7fe3566363b00370d12 (isearch-yank-word-or-char): New function. (isearch-mode-map): Bind C-w to that. diff -r 8748b5403232 -r c1669b7ec455 lisp/isearch.el --- 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)