From: Gregory Heytings <gregory@heytings.org>
To: Juri Linkov <juri@linkov.net>
Cc: Ergus <spacibba@aol.com>, 47599-done@debbugs.gnu.org
Subject: bug#47599: 28.0.50; Feature request improve/update isearch
Date: Wed, 07 Apr 2021 10:44:23 +0000 [thread overview]
Message-ID: <3ec7e2e58a163e5f05c8@heytings.org> (raw)
In-Reply-To: <acf6f0cd7e8e56885611@heytings.org>
[-- Attachment #1: Type: text/plain, Size: 584 bytes --]
>>> 1) Option or command to automatically go to the other end on exit.
>>
>> It seems the conclusion was that it should not be an option. As for a
>> command, there were objections against binding it to a key, but without
>> a keybinding such command has little sense.
>
> I attach a patch which implements these two "options" in isearch-exit.
>
And here is an updated patch which adds three options to isearch-exit: C-u
RET moves point to the other end, C-u C-u RET activates region around
match, C-u C-u C-u RET moves point to the other end and activate region
around match.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff; name=0001-Add-options-when-exiting-isearch.patch, Size: 2001 bytes --]
From 8922c42ad93c5c1bfeb0ed29c598941e9141227c Mon Sep 17 00:00:00 2001
From: Gregory Heytings <gregory@heytings.org>
Date: Wed, 7 Apr 2021 10:39:19 +0000
Subject: [PATCH] Add options when exiting isearch
* lisp/isearch.el (isearch-exit): Add three options when exiting
isearch, that can be used with prefix arguments.
---
lisp/isearch.el | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/lisp/isearch.el b/lisp/isearch.el
index a828c569aa..e4679f78a8 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -1532,16 +1532,29 @@ REGEXP if non-nil says use the regexp search ring."
\f
;; Commands active while inside of the isearch minor mode.
-(defun isearch-exit ()
+(defun isearch-exit (&optional arg)
"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'."
- (interactive)
+nonincremental search instead via `isearch-edit-string'.
+With a single prefix argument, move point to the other end of the
+search match, unless the region is active.
+With two prefix arguments, activate the region around the search
+match, unless the region is already active.
+With three prefix arguments, activate the region around the search
+match and move point to the other end of the search match, unless
+the region is already active."
+ (interactive "p")
(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)
+ (progn
+ (push-mark isearch-other-end t 'activate)
+ (if (> arg 16) (exchange-point-and-mark)))
+ (goto-char isearch-other-end)))
(isearch-done))
(isearch-clean-overlays))
--
2.30.2
next prev parent reply other threads:[~2021-04-07 10:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210405020725.ob7bewlin7cid4pa.ref@Ergus>
2021-04-05 2:07 ` bug#47599: 28.0.50; Feature request improve/update isearch Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-06 19:16 ` Juri Linkov
2021-04-06 20:38 ` Gregory Heytings
2021-04-06 21:01 ` Gregory Heytings
2021-04-06 21:32 ` Gregory Heytings
2021-04-06 22:39 ` bug#47599: [External] : " Drew Adams
2021-04-06 22:43 ` Gregory Heytings
2021-04-06 23:26 ` Gregory Heytings
2021-04-07 16:20 ` Juri Linkov
2021-04-07 17:58 ` Gregory Heytings
2021-04-08 19:05 ` Juri Linkov
2021-04-07 2:29 ` Eli Zaretskii
2021-04-07 10:44 ` Gregory Heytings [this message]
2021-04-07 11:20 ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-07 11:33 ` Gregory Heytings
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3ec7e2e58a163e5f05c8@heytings.org \
--to=gregory@heytings.org \
--cc=47599-done@debbugs.gnu.org \
--cc=juri@linkov.net \
--cc=spacibba@aol.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).