* bug#19004: 24.4; Please provide a non-regexp interface to occur
@ 2014-11-09 20:00 Juliusz Chroboczek
2014-11-09 20:49 ` Juri Linkov
2021-05-28 2:20 ` Lars Ingebrigtsen
0 siblings, 2 replies; 3+ messages in thread
From: Juliusz Chroboczek @ 2014-11-09 20:00 UTC (permalink / raw)
To: 19004
Hi.
I like occur a lot, but I find it inflexible -- the matched lines can only
be specified by a regexp. I'd like to be aple to pass a function to occur
instead of a regexp.
The function should be called with point at the beginning of a line to
match/not match, so that
(occur regexp)
is equivalent to
(occur #'(lambda () (looking-at regexp)))
Of course, the function should be able to examine the context around the
line being matched.
-- Juliusz
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#19004: 24.4; Please provide a non-regexp interface to occur
2014-11-09 20:00 bug#19004: 24.4; Please provide a non-regexp interface to occur Juliusz Chroboczek
@ 2014-11-09 20:49 ` Juri Linkov
2021-05-28 2:20 ` Lars Ingebrigtsen
1 sibling, 0 replies; 3+ messages in thread
From: Juri Linkov @ 2014-11-09 20:49 UTC (permalink / raw)
To: Juliusz Chroboczek; +Cc: 19004
> I like occur a lot, but I find it inflexible -- the matched lines can only
> be specified by a regexp. I'd like to be aple to pass a function to occur
> instead of a regexp.
>
> The function should be called with point at the beginning of a line to
> match/not match, so that
>
> (occur regexp)
>
> is equivalent to
>
> (occur #'(lambda () (looking-at regexp)))
>
> Of course, the function should be able to examine the context around the
> line being matched.
At the core of the Occur engine there is the function re-search-forward.
We could move it out to a separate variable e.g. occur-search-function
(as we do for isearch-search-fun-function). Then you will be able to
override it with your own like
(let ((occur-search-function 'word-search-forward))
(occur string))
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#19004: 24.4; Please provide a non-regexp interface to occur
2014-11-09 20:00 bug#19004: 24.4; Please provide a non-regexp interface to occur Juliusz Chroboczek
2014-11-09 20:49 ` Juri Linkov
@ 2021-05-28 2:20 ` Lars Ingebrigtsen
1 sibling, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-05-28 2:20 UTC (permalink / raw)
To: Juliusz Chroboczek; +Cc: 19004
Juliusz Chroboczek <jch@pps.univ-paris-diderot.fr> writes:
> I like occur a lot, but I find it inflexible -- the matched lines can only
> be specified by a regexp. I'd like to be aple to pass a function to occur
> instead of a regexp.
(I'm going through old bug reports that unfortunately got little response at
the time.)
There are many ways to search in Emacs, and there's a some packages that
provide structured searching, too. (For instance, to search based on
semantic qualities in the code.)
Given that, I don't think it makes that much sense to extend the `occur'
command itself -- it does the thing it does very well, and extending it
in that way would make an already complex command even more complicated.
So I'm closing this bug report.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-28 2:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-09 20:00 bug#19004: 24.4; Please provide a non-regexp interface to occur Juliusz Chroboczek
2014-11-09 20:49 ` Juri Linkov
2021-05-28 2:20 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.