search exits the search before executing the command. Thus, the
command operates on the buffer from which you invoked the search.
However, if you customize the variable @code{search-exit-option} to
-@code{nil}, the characters which you type that are not interpreted by
+@code{append}, the characters which you type that are not interpreted by
the incremental search are simply appended to the search string. This
is so you could include in the search string control characters, such
as @kbd{C-a}, that would normally exit the search and invoke the
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")
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