From 4ad8bd9b483f5229888e448a895740c0a96035fa Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 15 Apr 2026 20:40:23 +0300 Subject: [PATCH] Handle the symbol property 'isearch-exit' in 'isearch-occur' (bug#80785) * lisp/isearch.el (isearch-occur): When the command has a non-nil symbol property 'isearch-exit', exit the search before running the command. --- lisp/isearch.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lisp/isearch.el b/lisp/isearch.el index b677e89c7cd..745b0745fd6 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -2468,7 +2468,10 @@ the search words, ignoring punctuation. If the last search command was a regular expression search, REGEXP is the regular expression used in that search. If the last search command searched for a literal string, REGEXP is constructed by quoting all the special -characters in that string." +characters in that string. + +When the symbol property `isearch-exit' of this command is non-nil, +the search exits before it runs `occur'." (interactive (let* ((perform-collect (consp current-prefix-arg)) (regexp (cond @@ -2495,6 +2498,11 @@ characters in that string." ;; Otherwise normal occur takes numerical prefix argument. (when current-prefix-arg (prefix-numeric-value current-prefix-arg)))))) + (when (and (symbolp this-command) + (get this-command 'isearch-exit)) + (let ((isearch-recursive-edit nil)) + (isearch-done nil t) + (isearch-clean-overlays))) (let ((case-fold-search isearch-case-fold-search) ;; Set `search-upper-case' to nil to not call ;; `isearch-no-upper-case-p' in `occur-1'.