GNU bug report logs - #54086
Occur should offer more interactive input options

Previous Next

Package: emacs;

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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 54086 in the body.
You can then email your comments to 54086 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#54086; Package emacs. (Mon, 21 Feb 2022 10:37:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to emacsq <laszlomail <at> protonmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 21 Feb 2022 10:37:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: emacsq <laszlomail <at> protonmail.com>
To: "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
Subject: Occur should offer more interactive input options
Date: Mon, 21 Feb 2022 10:36:02 +0000
[Message part 1 (text/plain, inline)]
In my experience it is often that I search for something under the cursor, so it
makes sense for occur to pick up the word at point and offer that for search.

Also, if a region is selected occur could offer this as input.

I did these for myself long ago and it's a pretty useful hack which could improve
built in occur too.

So something like this for initial input :

(if (use-region-p)
(buffer-substring (region-beginning) (region-end))
(thing-at-point 'symbol))))))
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54086; Package emacs. (Mon, 21 Feb 2022 14:15:02 GMT) Full text and rfc822 format available.

Message #8 received at 54086 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: emacsq <laszlomail <at> protonmail.com>
Cc: 54086 <at> debbugs.gnu.org
Subject: Re: bug#54086: Occur should offer more interactive input options
Date: Mon, 21 Feb 2022 15:14:38 +0100
emacsq <laszlomail <at> protonmail.com> writes:

> In my experience it is often that I search for something under the cursor, so it 
> makes sense for occur to pick up the word at point and offer that for search.

It does -- it's put in the future history, so you can hit `M-n' to get
at it.

> Also, if a region is selected occur could offer this as input.

Same with this.

So this works as designed, and I'm therefore closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) notabug. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 21 Feb 2022 14:15:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 54086 <at> debbugs.gnu.org and emacsq <laszlomail <at> protonmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 21 Feb 2022 14:15:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54086; Package emacs. (Mon, 21 Feb 2022 17:14:01 GMT) Full text and rfc822 format available.

Message #15 received at 54086 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: emacsq <laszlomail <at> protonmail.com>, "54086 <at> debbugs.gnu.org"
 <54086 <at> debbugs.gnu.org>
Subject: RE: [External] : bug#54086: Occur should offer more interactive input
 options
Date: Mon, 21 Feb 2022 17:13:18 +0000
> 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


bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 22 Mar 2022 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 146 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.