From 8a516fbd5bd56201db217f74dd90262634119a28 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sat, 13 Jul 2024 21:41:23 +0200 Subject: [PATCH] New command 'search-from-isearch' --- lisp/isearch.el | 1 + lisp/search.el | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lisp/isearch.el b/lisp/isearch.el index 8d209147ee8..8f65d28cdb2 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -646,6 +646,7 @@ This is like `describe-bindings', but displays only Isearch keys." (define-key map [?\M-%] 'isearch-query-replace) (define-key map [?\C-\M-%] 'isearch-query-replace-regexp) (define-key map "\M-so" 'isearch-occur) + (define-key map "\M-s\M-s" 'search-from-isearch) (define-key map "\M-shr" 'isearch-highlight-regexp) (define-key map "\M-shl" 'isearch-highlight-lines-matching-regexp) diff --git a/lisp/search.el b/lisp/search.el index 829da463282..837de96d22a 100644 --- a/lisp/search.el +++ b/lisp/search.el @@ -27,10 +27,10 @@ ;; - Support multi-buffer `search'. ;; - Add regexp completion style and use it for `search' completion. -;; - Isearch-to-search and vice versa. ;; - Search non-matches. ;; - Highlight subgroups in matches. ;; - Improve documentation. +;; - Support toggling search case sensitivity. ;;; Code: @@ -166,6 +166,21 @@ (goto-char beg) (pulse-momentary-highlight-region beg end 'isearch)) +;;;###autoload +(defun search-from-isearch (beg end) + (interactive + (if isearch-mode + (save-excursion + (isearch-done) + (search-read-target nil nil + (if isearch-regexp + isearch-string + (regexp-quote isearch-string)))) + (user-error "Isearch not in progress"))) + ;; TODO: Consider handling `isearch-recursive-edit' like + ;; `isearch-query-replace' does. + (search beg end)) + ;;;###autoload (defun search-lines (beg end) "Go to and pulse line starting at BEG and ending at END." -- 2.39.2