From: Eshel Yaron Date: Sat, 13 Jul 2024 19:41:23 +0000 (+0200) Subject: New command 'search-from-isearch' X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8a516fbd5bd56201db217f74dd90262634119a28;p=emacs.git New command 'search-from-isearch' --- 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."