From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.help Subject: Re: killing the result of isearch Date: Tue, 07 Nov 2017 09:45:14 -0800 Message-ID: <87h8u60yqd.fsf@ericabrahamsen.net> References: <433bd3d0-a506-4d89-9d10-dcbfb0e23be0@default> <852BAA28-2A50-4AD9-B8D6-9F06905A4395@gmail.com> <87r2tava5x.fsf@hornfels.zedat.fu-berlin.de> <87y3nigy86.fsf@hornfels.zedat.fu-berlin.de> <8B436DA2-1C8B-471F-8D90-08C282864A70@gmail.com> <4c3d56b0-5151-4244-8b1b-fb4376b4fa88@default> <92E2F0E3-E2FD-46A7-97C5-292894D08B5C@gmail.com> <87tvy6114b.fsf@ericabrahamsen.net> <9848de48-1894-4a0c-99be-de3c4718d6b2@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1510076858 12436 195.159.176.226 (7 Nov 2017 17:47:38 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 7 Nov 2017 17:47:38 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Nov 07 18:47:33 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eC7yG-0002zG-DI for geh-help-gnu-emacs@m.gmane.org; Tue, 07 Nov 2017 18:47:32 +0100 Original-Received: from localhost ([::1]:55132 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eC7yN-0000Wg-OQ for geh-help-gnu-emacs@m.gmane.org; Tue, 07 Nov 2017 12:47:39 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eC7xu-0000Ux-Pb for help-gnu-emacs@gnu.org; Tue, 07 Nov 2017 12:47:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eC7xr-0000vB-Rh for help-gnu-emacs@gnu.org; Tue, 07 Nov 2017 12:47:10 -0500 Original-Received: from [195.159.176.226] (port=49228 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eC7xr-0000uw-Kc for help-gnu-emacs@gnu.org; Tue, 07 Nov 2017 12:47:07 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1eC7xd-0001Rl-Gf for help-gnu-emacs@gnu.org; Tue, 07 Nov 2017 18:46:53 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 61 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:HLrOTKIhyL6ubIEW5lrUaMyYvP0= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:114787 Archived-At: Drew Adams writes: >> Several years ago, when I wanted to do this, I wrote the following: >> >> (define-key isearch-mode-map (kbd "M-m") 'my-isearch-mark-search-as-region) >> (defun my-isearch-mark-search-as-region () >> (interactive) >> (if (not isearch-mode) >> (message "This is only useful during isearch") >> (isearch-exit) >> (push-mark isearch-other-end) >> (activate-mark))) > > That's essentially the same thing used in Isearch+: > > (defun isearchp-set-region-around-search-target () > "Set the region around the last search or query-replace target." > (interactive) > (case last-command > ((isearch-forward isearch-backward > isearch-forward-regexp isearch-backward-regexp) > (push-mark isearch-other-end t 'activate)) > (t (push-mark (match-beginning 0) t 'activate))) > (setq deactivate-mark nil)) Ah, I hadn't noticed the extra arguments to `push-mark', thanks. Anyway, OP should be happy with `isearch-other-end'. >> I guess that's just a tiny half-step in the direction that isearch+ is >> headed. > > Isearch+ isn't really headed anywhere. ;-) I just add/change things as > they come to me. > >> Another very good facility to get comfortable with is recursive editing: >> type "C-r" during search mode, do whatever editing you like, then >> "C-M-c" to go back into search mode. > > +1 > > But that's not in vanilla Emacs, AFAIK. (It's certainly not > bound to `C-r' by default - `C-r' is ` isearch-repeat-backward'.) > > With Isearch+, `C-x o' during Isearch opens a recursive edit. > And `C-M-c' (`exit-recursive-edit') resumes searching. Oops, that binding is for query-replace, not search. Another good argument for simply starting out in (or switching to) query-replace. >> I think what people are trying to say is that Emacs' defaults can often >> seem lacking, but it makes up for it by giving you enormous power to >> create your ideal behavior yourself... I think we all expect that we >> need to go the last half-mile ourselves. > > +1 > > But sometimes it's not so much that we need to go the last > half mile ourselves. Sometimes it's more that we want to > go the next N miles, for fun and learning. Most definitely!