aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2018-03-09 00:29:04 +0200
committerJuri Linkov2018-03-09 00:29:04 +0200
commit6bc78d5b16b6bc56f3ef401c519de6ff2fff3111 (patch)
treed2ac3377a67dd5ecd8022b8990ef3d7a97efc585
parentf67a14efb6fc9c00bd69d3bdee509c999bc17cb1 (diff)
downloademacs-6bc78d5b16b6bc56f3ef401c519de6ff2fff3111.tar.gz
emacs-6bc78d5b16b6bc56f3ef401c519de6ff2fff3111.zip
* 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
-rw-r--r--doc/emacs/search.texi2
-rw-r--r--lisp/isearch.el13
2 files changed, 10 insertions, 5 deletions
diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi
index 0de3aee1b21..8ac9794c379 100644
--- a/doc/emacs/search.texi
+++ b/doc/emacs/search.texi
@@ -446,7 +446,7 @@ they are not themselves part of incremental search.
446search exits the search before executing the command. Thus, the 446search exits the search before executing the command. Thus, the
447command operates on the buffer from which you invoked the search. 447command operates on the buffer from which you invoked the search.
448However, if you customize the variable @code{search-exit-option} to 448However, if you customize the variable @code{search-exit-option} to
449@code{nil}, the characters which you type that are not interpreted by 449@code{append}, the characters which you type that are not interpreted by
450the incremental search are simply appended to the search string. This 450the incremental search are simply appended to the search string. This
451is so you could include in the search string control characters, such 451is so you could include in the search string control characters, such
452as @kbd{C-a}, that would normally exit the search and invoke the 452as @kbd{C-a}, that would normally exit the search and invoke the
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
77while holding down the shift key. 77while holding down the shift key.
78Both `move' and `shift-move' extend the search string by yanking text 78Both `move' and `shift-move' extend the search string by yanking text
79that ends at the new position after moving point in the current buffer. 79that ends at the new position after moving point in the current buffer.
80If `append', the characters which you type that are not interpreted by
81the incremental search are simply appended to the search string.
80If nil, run the command without exiting Isearch." 82If nil, run the command without exiting Isearch."
81 :type '(choice (const :tag "Terminate incremental search" t) 83 :type '(choice (const :tag "Terminate incremental search" t)
82 (const :tag "Edit the search string" edit) 84 (const :tag "Edit the search string" edit)
83 (const :tag "Extend the search string by motion commands" move) 85 (const :tag "Extend the search string by motion commands" move)
84 (const :tag "Extend the search string by shifted motion keys" shift-move) 86 (const :tag "Extend the search string by shifted motion keys" shift-move)
87 (const :tag "Append control characters to the search string" append)
85 (const :tag "Don't terminate incremental search" nil)) 88 (const :tag "Don't terminate incremental search" nil))
86 :version "27.1") 89 :version "27.1")
87 90
@@ -2452,13 +2455,15 @@ See more for options in `search-exit-option'."
2452 this-command-keys-shift-translated)) 2455 this-command-keys-shift-translated))
2453 (setq this-command-keys-shift-translated nil) 2456 (setq this-command-keys-shift-translated nil)
2454 (setq isearch-pre-move-point (point))) 2457 (setq isearch-pre-move-point (point)))
2458 ;; Append control characters to the search string
2459 ((eq search-exit-option 'append)
2460 (when (cl-every #'characterp key)
2461 (isearch-process-search-string key key))
2462 (setq this-command 'ignore))
2455 ;; Other characters terminate the search and are then executed normally. 2463 ;; Other characters terminate the search and are then executed normally.
2456 (search-exit-option 2464 (search-exit-option
2457 (isearch-done) 2465 (isearch-done)
2458 (isearch-clean-overlays)) 2466 (isearch-clean-overlays)))))
2459 ;; If search-exit-option is nil, run the command without exiting Isearch.
2460 (t
2461 (isearch-process-search-string key key)))))
2462 2467
2463(defun isearch-post-command-hook () 2468(defun isearch-post-command-hook ()
2464 (cond 2469 (cond