diff options
| author | Daniel Colascione | 2018-02-22 17:42:48 -0800 |
|---|---|---|
| committer | Daniel Colascione | 2018-02-22 17:50:39 -0800 |
| commit | b9d414e77c4f6396e202069fdd233b6687e6da64 (patch) | |
| tree | 0cfea149d344763b975fcad7aa6798cec1db545d | |
| parent | b7542b2a0a00adc8d216697db0b8afd8d568de00 (diff) | |
| download | emacs-b9d414e77c4f6396e202069fdd233b6687e6da64.tar.gz emacs-b9d414e77c4f6396e202069fdd233b6687e6da64.zip | |
Add isearch-yank-symbol-or-char
* doc/emacs/search.texi (Isearch Yank): Document new
function, keybindings.
* etc/NEWS: Mention isearch changes.
* lisp/isearch.el (isearch--yank-char-or-syntax): New function.
(isearch-yank-word-or-char): Call it.
(isearch-yank-symbol-or-char): New function.
(isearch-mode-map): Change 'C-M-w' binding from
'isearch-del-char' to isearch-yank-symbol-or-char; add 'C-M-d'
binding for 'isearch-del-char'.
| -rw-r--r-- | doc/emacs/search.texi | 11 | ||||
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/isearch.el | 24 |
3 files changed, 31 insertions, 9 deletions
diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi index 319f64fbae1..37446ca1c46 100644 --- a/doc/emacs/search.texi +++ b/doc/emacs/search.texi | |||
| @@ -229,6 +229,13 @@ character or word at point to the search string. This is an easy way | |||
| 229 | to search for another occurrence of the text at point. (The decision | 229 | to search for another occurrence of the text at point. (The decision |
| 230 | of whether to copy a character or a word is heuristic.) | 230 | of whether to copy a character or a word is heuristic.) |
| 231 | 231 | ||
| 232 | @kindex C-M-w @r{(Incremental search)} | ||
| 233 | @findex isearch-yank-symbol-or-char | ||
| 234 | @kbd{C-M-w} (@code{isearch-yank-symbol-or-char}) appends the next | ||
| 235 | character or symbol at point to the search string. This is an easy way | ||
| 236 | to search for another occurrence of the symbol at point. (The decision | ||
| 237 | of whether to copy a character or a word is heuristic.) | ||
| 238 | |||
| 232 | @kindex M-s C-e @r{(Incremental search)} | 239 | @kindex M-s C-e @r{(Incremental search)} |
| 233 | @findex isearch-yank-line | 240 | @findex isearch-yank-line |
| 234 | Similarly, @kbd{M-s C-e} (@code{isearch-yank-line}) appends the rest | 241 | Similarly, @kbd{M-s C-e} (@code{isearch-yank-line}) appends the rest |
| @@ -250,11 +257,11 @@ appended text with an earlier kill, similar to the usual @kbd{M-y} | |||
| 250 | in the echo area appends the current X selection (@pxref{Primary | 257 | in the echo area appends the current X selection (@pxref{Primary |
| 251 | Selection}) to the search string (@code{isearch-yank-x-selection}). | 258 | Selection}) to the search string (@code{isearch-yank-x-selection}). |
| 252 | 259 | ||
| 253 | @kindex C-M-w @r{(Incremental search)} | 260 | @kindex C-M-d @r{(Incremental search)} |
| 254 | @kindex C-M-y @r{(Incremental search)} | 261 | @kindex C-M-y @r{(Incremental search)} |
| 255 | @findex isearch-del-char | 262 | @findex isearch-del-char |
| 256 | @findex isearch-yank-char | 263 | @findex isearch-yank-char |
| 257 | @kbd{C-M-w} (@code{isearch-del-char}) deletes the last character | 264 | @kbd{C-M-d} (@code{isearch-del-char}) deletes the last character |
| 258 | from the search string, and @kbd{C-M-y} (@code{isearch-yank-char}) | 265 | from the search string, and @kbd{C-M-y} (@code{isearch-yank-char}) |
| 259 | appends the character after point to the search string. An | 266 | appends the character after point to the search string. An |
| 260 | alternative method to add the character after point is to enter the | 267 | alternative method to add the character after point is to enter the |
| @@ -109,6 +109,11 @@ regular expression was previously invalid, but is now accepted: | |||
| 109 | 109 | ||
| 110 | * Editing Changes in Emacs 27.1 | 110 | * Editing Changes in Emacs 27.1 |
| 111 | 111 | ||
| 112 | +++ | ||
| 113 | ** New isearch bindings. | ||
| 114 | 'C-M-w' in isearch changed from isearch-del-char to the new function | ||
| 115 | isearch-yank-symbol-or-char. isearch-del-char is now bound to 'C-M-d'. | ||
| 116 | |||
| 112 | --- | 117 | --- |
| 113 | ** New variable 'x-wait-for-event-timeout'. | 118 | ** New variable 'x-wait-for-event-timeout'. |
| 114 | This controls how long Emacs will wait for updates to the graphical | 119 | This controls how long Emacs will wait for updates to the graphical |
diff --git a/lisp/isearch.el b/lisp/isearch.el index 1835469bb2c..b6422401a88 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -480,7 +480,8 @@ This is like `describe-bindings', but displays only Isearch keys." | |||
| 480 | (define-key map [?\S-\ ] 'isearch-printing-char) | 480 | (define-key map [?\S-\ ] 'isearch-printing-char) |
| 481 | 481 | ||
| 482 | (define-key map "\C-w" 'isearch-yank-word-or-char) | 482 | (define-key map "\C-w" 'isearch-yank-word-or-char) |
| 483 | (define-key map "\M-\C-w" 'isearch-del-char) | 483 | (define-key map "\M-\C-w" 'isearch-yank-symbol-or-char) |
| 484 | (define-key map "\M-\C-d" 'isearch-del-char) | ||
| 484 | (define-key map "\M-\C-y" 'isearch-yank-char) | 485 | (define-key map "\M-\C-y" 'isearch-yank-char) |
| 485 | (define-key map "\C-y" 'isearch-yank-kill) | 486 | (define-key map "\C-y" 'isearch-yank-kill) |
| 486 | (define-key map "\M-s\C-e" 'isearch-yank-line) | 487 | (define-key map "\M-s\C-e" 'isearch-yank-line) |
| @@ -2089,17 +2090,26 @@ If optional ARG is non-nil, pull in the next ARG characters." | |||
| 2089 | (interactive "p") | 2090 | (interactive "p") |
| 2090 | (isearch-yank-internal (lambda () (forward-char arg) (point)))) | 2091 | (isearch-yank-internal (lambda () (forward-char arg) (point)))) |
| 2091 | 2092 | ||
| 2092 | (defun isearch-yank-word-or-char () | 2093 | (defun isearch--yank-char-or-syntax (syntax-list fn) |
| 2093 | "Pull next character or word from buffer into search string." | ||
| 2094 | (interactive) | ||
| 2095 | (isearch-yank-internal | 2094 | (isearch-yank-internal |
| 2096 | (lambda () | 2095 | (lambda () |
| 2097 | (if (or (= (char-syntax (or (char-after) 0)) ?w) | 2096 | (if (or (memq (char-syntax (or (char-after) 0)) syntax-list) |
| 2098 | (= (char-syntax (or (char-after (1+ (point))) 0)) ?w)) | 2097 | (memq (char-syntax (or (char-after (1+ (point))) 0)) |
| 2099 | (forward-word 1) | 2098 | syntax-list)) |
| 2099 | (funcall fn 1) | ||
| 2100 | (forward-char 1)) | 2100 | (forward-char 1)) |
| 2101 | (point)))) | 2101 | (point)))) |
| 2102 | 2102 | ||
| 2103 | (defun isearch-yank-word-or-char () | ||
| 2104 | "Pull next character or word from buffer into search string." | ||
| 2105 | (interactive) | ||
| 2106 | (isearch--yank-char-or-syntax '(?w) 'forward-word)) | ||
| 2107 | |||
| 2108 | (defun isearch-yank-symbol-or-char () | ||
| 2109 | "Pull next character or word from buffer into search string." | ||
| 2110 | (interactive) | ||
| 2111 | (isearch--yank-char-or-syntax '(?w ?_) 'forward-symbol)) | ||
| 2112 | |||
| 2103 | (defun isearch-yank-word (&optional arg) | 2113 | (defun isearch-yank-word (&optional arg) |
| 2104 | "Pull next word from buffer into search string. | 2114 | "Pull next word from buffer into search string. |
| 2105 | If optional ARG is non-nil, pull in the next ARG words." | 2115 | If optional ARG is non-nil, pull in the next ARG words." |