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: Richard Stallman
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, 02 Oct 2021 19:18:30 -0400

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

We have two kinds of uses for shorthands.

* Creating longer real names to avoid collisions.
In this kind of case the package that you load
creates shorthands for itself, which rename its symbols to longer
names that won't conflict.  This is what we will do with s.el.

* Creating shorter names for convenience.
In this kind of case, one Lisp file would create shorthand prefixes
for code in other files.  These prefixes might really be shorter
than the symbols' documented name.

People who had the second case in mind suggested name conventions
for the shorthand prefixes.  Suppose we use ":" as the end of a prefix.

Suppose you want to search for calls to find-outer-otter-create-otter.
If there is a call to foo:create-otter in a file wehack.el,
it would be possible to look at wehack.el and see if it defines
`foo:' as a shorthand for `find-outer-otter-'.  If so,
that is a call to find-outer-otter-create-otter.

The hard part is to determine which strings to actually grep for.
There are various ways to do it.

Here's one:

Assume the convention that the shorthand substitute always ends in
`-'.  So grep for `:otter', `:create-otter', `:outer-create-otter',
and so on.  When you find any of them, you can check whether that file
defines a shortcut that would supply what's missing to generate
`find-outer-otter-create-otter'.  For instance, if it defines
`walrus:' as a shorthand for `find-outer', then removing `find-outer'
from the start of `find-outer-otter-create-otter', you see that a
reference to that symbol using that shorthand would be
`walrus:otter-create-otter'.  If the file contains that, it is a hit.


-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





reply via email to

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