summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2018-03-09 00:29:04 +0200
committerJuri Linkov <juri@linkov.net>2018-03-09 00:29:04 +0200
commit6bc78d5b16b6bc56f3ef401c519de6ff2fff3111 (patch)
treed2ac3377a67dd5ecd8022b8990ef3d7a97efc585 /lisp
parentf67a14efb6fc9c00bd69d3bdee509c999bc17cb1 (diff)
downloademacs-6bc78d5b16b6bc56f3ef401c519de6ff2fff3111.tar.gz
* lisp/isearch.el (search-exit-option): Add option 'append'.
(isearch-pre-command-hook): Use it. * doc/emacs/search.texi: Replace search-exit-option option nil with append. https://lists.gnu.org/archive/html/emacs-devel/2018-03/msg00202.html
Diffstat (limited to 'lisp')
-rw-r--r--lisp/isearch.el13
1 files changed, 9 insertions, 4 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 96faa27c174..4f5f4948757 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -77,11 +77,14 @@ If `shift-move', extend the search string by motion commands
while holding down the shift key.
Both `move' and `shift-move' extend the search string by yanking text
that ends at the new position after moving point in the current buffer.
+If `append', the characters which you type that are not interpreted by
+the incremental search are simply appended to the search string.
If nil, run the command without exiting Isearch."
:type '(choice (const :tag "Terminate incremental search" t)
(const :tag "Edit the search string" edit)
(const :tag "Extend the search string by motion commands" move)
(const :tag "Extend the search string by shifted motion keys" shift-move)
+ (const :tag "Append control characters to the search string" append)
(const :tag "Don't terminate incremental search" nil))
:version "27.1")
@@ -2452,13 +2455,15 @@ See more for options in `search-exit-option'."
this-command-keys-shift-translated))
(setq this-command-keys-shift-translated nil)
(setq isearch-pre-move-point (point)))
+ ;; Append control characters to the search string
+ ((eq search-exit-option 'append)
+ (when (cl-every #'characterp key)
+ (isearch-process-search-string key key))
+ (setq this-command 'ignore))
;; Other characters terminate the search and are then executed normally.
(search-exit-option
(isearch-done)
- (isearch-clean-overlays))
- ;; If search-exit-option is nil, run the command without exiting Isearch.
- (t
- (isearch-process-search-string key key)))))
+ (isearch-clean-overlays)))))
(defun isearch-post-command-hook ()
(cond