|
From: | Gregory Heytings |
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 22:58:09 +0000 |
Speaking of shorthands, if only the "local" part of every symbol's name was something reliable (as is often the case in module/package systems out there), we could still implement the search for references using Grep fairly efficiently: you Grep across the files for the local name, and then post-filter the references by looking at the end of the file.Yes, yes, that's basically what happens with Common Lisp, because things are separated by `:`. And in many other languages as you say. Unfortunately, it's not 100% clean in Elisp because it relies on convention, not syntax.
It seems very easy to enforce a syntax for this: diff --git a/src/lread.c b/src/lread.c index af0a799459..b66585df7d 100644 --- a/src/lread.c +++ b/src/lread.c@@ -4657,6 +4657,7 @@ oblookup_considering_shorthand (Lisp_Object obarray, const char *in,
Lisp_Object lh_prefix = XCDR (pair); if (!STRINGP (sh_prefix) || !STRINGP (lh_prefix)) continue; + sh_prefix = concat2 (sh_prefix, build_string ("::")); ptrdiff_t sh_prefix_size = SBYTES (sh_prefix); /* Compare the prefix of the transformation pair to the symbolThe "::" separator has a similar purpose in other languages (C++, Perl), it is not used anywhere in Emacs core, and it is used in a single place in ELPA (var::append-list in hyperbole). The ":" separator is already used in quite a few places, in Emacs core and in ELPA.
[Prev in Thread] | Current Thread | [Next in Thread] |