help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: killing the result of isearch


From: Drew Adams
Subject: RE: killing the result of isearch
Date: Tue, 7 Nov 2017 09:24:51 -0800 (PST)

> 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))

> 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.

> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]