GNU bug report logs -
#54086
Occur should offer more interactive input options
Previous Next
Reported by: emacsq <laszlomail <at> protonmail.com>
Date: Mon, 21 Feb 2022 10:37:01 UTC
Severity: normal
Tags: notabug
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #15 received at 54086 <at> debbugs.gnu.org (full text, mbox):
> something like this for initial input :
> (if (use-region-p)
> (buffer-substring (region-beginning) (region-end))
> (thing-at-point 'symbol))
As Lars pointed out, you can use `M-n' to
retrieve such a default input (and there can
be multiple reasonable default inputs - repeat
`M-n' to access them).
However, when the region is active there are
two different (i.e., alternative) behaviors
that can be useful:
1. Use the region content as the text to find.
(This is what you suggested.)
2. Limit searching to the region.
#2 is very useful. (You can of course narrow
to the region and then search, but it helps to
be able to see the surrounding text while you
search only the region text.)
Users should have a way to choose which of the
behaviors they prefer by default and to change
to the other alternative on the fly (without
having to change their default choice by, e.g.,
flipping an option value).
With library `isearch+.el' you can limit
searching to the region: use non-nil option
`search/replace-region-as-default-flag'.
And not only Isearch. If you also use library
`replace+.el' then `occur' and all replace
commands also respect the option.
To prefer using the region content as what to
search for, leave the option as nil and use a
function that does what your `if' does as the
value of option `search/replace-default-fn'.
___
isearch+.el:
https://www.emacswiki.org/emacs/download/isearch%2b.el
replace+.el:
https://www.emacswiki.org/emacs/download/replace%2b.el
This bug report was last modified 3 years and 147 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.