From e7df31567e9175392a677c225825a4f2784376eb Mon Sep 17 00:00:00 2001 From: Gregory Heytings Date: Tue, 6 Apr 2021 20:33:09 +0000 Subject: [PATCH] Add options when exiting isearch * lisp/isearch.el (isearch-exit): Add two options when exiting isearch. --- lisp/isearch.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lisp/isearch.el b/lisp/isearch.el index 943e24aa56..a2ac4964d2 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -1523,12 +1523,20 @@ REGEXP if non-nil says use the regexp search ring." "Exit search normally. However, if this is the first command after starting incremental search and `search-nonincremental-instead' is non-nil, do a -nonincremental search instead via `isearch-edit-string'." +nonincremental search instead via `isearch-edit-string'. +With a single prefix argument, move point to the beginning of the +search string, unless the region is active. +With two prefix arguments, activate the region around the match, +unless the region is already active." (interactive) (if (and search-nonincremental-instead (= 0 (length isearch-string))) (let ((isearch-nonincremental t)) (isearch-edit-string)) ;; this calls isearch-done as well + (if (and (> arg 1) isearch-other-end (not (use-region-p))) + (if (> arg 4) + (push-mark isearch-other-end t 'activate) + (goto-char isearch-other-end))) (isearch-done)) (isearch-clean-overlays)) -- 2.30.2