emacs-devel
[Top][All Lists]
Advanced

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

Re: A read-based grep-like for symbols (el-search?) (was Do shorthands b


From: Michael Heerdegen
Subject: Re: A read-based grep-like for symbols (el-search?) (was Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorthands have landed on master))
Date: Fri, 01 Oct 2021 01:23:54 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

João Távora <joaotavora@gmail.com> writes:

> The "searching for symbols" problem is one of those embarrassingly parallel
> ones, right?

> Also, I can of course imaging that the `read' ing sexps is lower than
> reading
> lines, but once you fill up an obarray with all the symbols you read,
> you don't
> pay for the string comparison, since matching symbols to the search pattern
> (presumably also a symbol) should be much faster since you can just use
> the hashing of the obarray.

Actually, el-search searches expressions.  The search "pattern" is a
description (predicate) for expressions, and it searches for matching
expressions.  I made it so that search patterns are pcase patterns -
while this fits perfectly, it's also the most deterring aspect for most
people :-P

Symbols are compared with `eq', so I think the answer to the question of
fast symbol comparison is "yes".  One surprisingly time consuming part
in simple cases is setting up buffers (to support read and sexp-based
scanning).

IIRC, "elisp-refs" (Melpa) copied the basic approach and created
something more lightweight but easier to use (a bit like xref I think, I
don't use xref - not sure).  I think adding shorthand support to that
package would also be trivial.

Michael.



reply via email to

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