diff options
| author | Richard M. Stallman | 2001-12-10 20:45:27 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2001-12-10 20:45:27 +0000 |
| commit | 868bf43ad4c87799c5805e5930e2c4e447ce0568 (patch) | |
| tree | bc907c64277f4da2d44618b1c27814739210a466 | |
| parent | 4d8ae757b2662eca9e0d49c3fb27e69fb85cab85 (diff) | |
| download | emacs-868bf43ad4c87799c5805e5930e2c4e447ce0568.tar.gz emacs-868bf43ad4c87799c5805e5930e2c4e447ce0568.zip | |
(isearch-yank-word-or-char): New function.
(isearch-mode-map): Bind C-w to that.
| -rw-r--r-- | lisp/isearch.el | 11 |
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." | |||
| 291 | (define-key map " " 'isearch-whitespace-chars) | 291 | (define-key map " " 'isearch-whitespace-chars) |
| 292 | (define-key map [?\S-\ ] 'isearch-whitespace-chars) | 292 | (define-key map [?\S-\ ] 'isearch-whitespace-chars) |
| 293 | 293 | ||
| 294 | (define-key map "\C-w" 'isearch-yank-word) | 294 | (define-key map "\C-w" 'isearch-yank-word-or-char) |
| 295 | (define-key map "\C-y" 'isearch-yank-line) | 295 | (define-key map "\C-y" 'isearch-yank-line) |
| 296 | 296 | ||
| 297 | ;; Define keys for regexp chars * ? |. | 297 | ;; Define keys for regexp chars * ? |. |
| @@ -1096,6 +1096,15 @@ might return the position of the end of the line." | |||
| 1096 | (interactive) | 1096 | (interactive) |
| 1097 | (isearch-yank-internal (lambda () (forward-char 1) (point)))) | 1097 | (isearch-yank-internal (lambda () (forward-char 1) (point)))) |
| 1098 | 1098 | ||
| 1099 | (defun isearch-yank-word-or-char () | ||
| 1100 | "Pull next character or word from buffer into search string." | ||
| 1101 | (interactive) | ||
| 1102 | (isearch-yank-internal (lambda () | ||
| 1103 | (if (or (= (char-syntax (or (char-after) 0)) ?w) | ||
| 1104 | (= (char-syntax (or (char-after (1+ (point))) 0)) ?w)) | ||
| 1105 | (forward-word 1) | ||
| 1106 | (forward-char 1)) (point)))) | ||
| 1107 | |||
| 1099 | (defun isearch-yank-word () | 1108 | (defun isearch-yank-word () |
| 1100 | "Pull next word from buffer into search string." | 1109 | "Pull next word from buffer into search string." |
| 1101 | (interactive) | 1110 | (interactive) |