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: Dmitry Gutov
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: Sat, 2 Oct 2021 05:13:23 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

On 02.10.2021 04:46, João Távora wrote:

* designing a caching strategy seems fairly easy here.
Probably doable, yes, though both harder than the approach I
described, and almost certainly slower even with cache (which needs
regular invalidation). And the first search in the session (without
cache to fall back on) will likely hurt the most.

You can very well make big parts of the database when building, for
example when byte-compiling.  And you only invalidate when you change a
file.

And then someone will change a file using Vim, or an older version of Emacs. Or a misconfigured one.

Anyway, good luck. I just hope you don't end up with etags-like
approach where the user will need to built and rebuild the index
manually every time they want it to be fresh.

No that's not the goal.  The goal is to make a proper symbolic
xref-find-references for elisp which isn't regexp based (and which takes
around 4-5 seconds here everytime, btw...

(benchmark 1 '(xref-find-references "wrong-type-argument"))

=> 0.28s

Maybe try the version in emacs-28 branch.

Or if you are on macOS, see bug#50733 (its Grep is very slow).

and sometimes asks me if I
want to apply local variables for a file it's visiting... bug?)

Maybe during set-auto-mode in xref--collect-matches? I don't recall seeing anything like this recently, though.

Anyway, the reason I'm reasonably confident this _can_ be done is also
because this _has_ been done, in Common Lisp implementations.  That's
were xref.el comes from, ultimately.  They use even more advanced stuff,
like macroexpansion, so they catch the make-foo of defstruct.  Some
implementations have even more advanced stuff like proper who-calls,
who-sets, who-macroexpands.  They've had it for decades!  Have a look at
SLIME or Sly and plug them to SBCL or Allegro Common Lisp, for example.

I'd be happy to see such features in Elisp, sure.



reply via email to

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