emacs-devel
[Top][All Lists]
Advanced

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

Re: [patch] Run occur command restricted to a region


From: Juri Linkov
Subject: Re: [patch] Run occur command restricted to a region
Date: Fri, 30 Dec 2016 01:31:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (x86_64-pc-linux-gnu)

> is it worth to have versions of `occur' restricting the
> search to lines before (after) the current line?
>
> Maybe there is already a way to do that, and i just ignore it.
> I usually just i copy the region into a temporary buffer; then
> i run `occur' there.

(info "(emacs) Other Repeating Search") says what is the recommended way
to do this is:

`M-x occur'
     Prompt for a regexp, and display a list showing each line in the
     buffer that contains a match for it.  The text that matched is
     highlighted using the `match' face.  To limit the search to part
     of the buffer, narrow to that part (*note Narrowing::).

> I just wrote a patch to show my point; it adds the following commands:
> 1) occur-backward: for lines before the current one.

The name occur-backward falsely implies it uses re-search-backward,
and I'm unsure if we need it as a counter part of isearch-backward.

> 2) occur-forward: for lines after the current one.
> 3) occur-in-region: for lines within the active region.

Maybe we should use the same logic of other related commands in replace.el
how-many, keep-lines, flush-lines that limit the affected lines to the
active region, or when the region is not active, take only lines after
the current line.  Then we don't need separate commands, and no keys for them.



reply via email to

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