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: Eli Zaretskii
Subject: Re: [patch] Run occur command restricted to a region
Date: Sat, 31 Dec 2016 10:37:55 +0200

> From: Juri Linkov <address@hidden>
> Cc: address@hidden,  address@hidden
> Date: Sat, 31 Dec 2016 01:16:34 +0200
> 
> >> > 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.
> >
> > I can suggest occur-before and occur-after instead.
> 
> Or occur-above and occur-below.
> 
> What causes the doubt is that there are no other commands like that.
> No ‘count-words-before’, no ‘count-words-above’, just ‘count-words-region’
> no ‘comment-before’, no ‘comment-above’, just ‘comment-region’,
> no ‘delete-before’, no ‘delete-above’, just ‘delete-region’,
> and tens of other similar commands.

This command emulates Grep, with its -A and -B options.  That's why I
suggested "after" and "before".  No other command need to show
context, so it's quite understandable why this one is unique in that
sense.

> This means that it's simple enough to select the region (e.g. ‘M-<’
> to the beginning of the buffer) and use ‘*-region’ commands to
> operate on the active region.  So it should be enough to handle the
> active region in ‘occur’ without creating new commands.

The problem is that the meaning of the region here says nothing about
the context lines the user wants displayed in the Occur buffer.  I
agree that an active region should mean "find matches in that region",
but we still need a way for the user to specify non-default number of
context lines to show with the matches, I think.



reply via email to

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