[Top][All Lists]

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

Re: A short defense of shorthands.el (but CL packages are still better)

From: Richard Stallman
Subject: Re: A short defense of shorthands.el (but CL packages are still better)
Date: Mon, 07 Nov 2022 02:44:02 -0500

[[[ 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. ]]]

  > As you know, he underlying interned symbol is xenomorph-foo, and that's
  > the symbol that the at-point documentation system ElDoc shows you in the
  > echo area, and that's what shows up C-h f.

I've never used ElDoc and I don't know what it does.  Maybe you're
right about C-h f, but you have not specified the scenario fully.
What does the user actually type, to invoke it?

Perhaps the user type C-h f x-foo RET, after seeing `x-foo' in the
code and gets the answer that it doesn't exist.  That would be an
unhelpful result.

So maybe each file's shorthands, as actually used when it was loaded,
should be remembered in an alist, so that C-h f and friends can look
them up and DTRT.

As for the grep shortcoming, it can't be addressed by changing the code
of grep.  But I have an idea for how coding conventions can do it.

We can identify the usual scenarios in which shorthands affect grepping,
and write dummy definitions to deal with them.

For instance, in the file string.el, we can have dummy definitions for all
the renamings that it does.

;;; (defalias 'string-foo  's-foo)  ;; in s.el
;;; (defalias 'string-bar  's-bar)  ;; in s.el

Grepping for string-foo will find that line, which will tell you to
look at s.el and find s-foo.

We could conceivably make the commands for finding that grep hit
understand that and go straight to the right line in s.el.

In the case of doing something like CL packages, where the shorthands
look like ("frobnicate" . "frob:frobnicate") and ("scramble"
. "frob:scramble"), we may not need to do anything.  If you see a call
to `frobnicate' and grep for `frobnicate', you will find the
definition of `frob:frobnicate', as well as perhaps a few other
functions named frobnicate in various other packages.

You will need to study the code to see which of those functions is
actually used in the program you are studying.

I think the same grep issue will occur with actual CL packages, or
anything that mimics them.  Shorthands are neither better nor worse in
this case.

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]