Subject: Re: bug#50959: 28.0.50; Shorthand symbols are unknown to Emacs

From: João Távora <[email-masked]>
Date: Sat, 2 Oct 2021 15:17:29 +0100

On Sat, Oct 2, 2021 at 1:37 PM Phil Sainty <[email-masked]> wrote:
>
> On 2021-10-03 01:10, Eli Zaretskii wrote:
> > Let me translate: is "C-h" command the only use case you have in mind
> > where you saw a problem with shorthands?  If there are others, and
> > they involve Emacs's internal functionalities (as opposed to, say,
> > searching with Grep or some other text-oriented tool), please describe
> > them.
>
> I think it's literally anything that hasn't has custom support added
> as part of the shorthands feature?
>
> E.g.:
>
> * describe-function|-variable|-face|-symbol
> * apropos|-command|-variable|-user-option|-symbol
> * customize-apropos|-face|-variable|-option
> * info-lookup-symbol
> * execute-extended-command
> * anything using read-command|-variable|-face-name
> * anything using these interactive codes:
>
> a -- Function name: symbol with a function definition.
> C -- Command name: symbol with interactive function definition.
>       This skips events that are integers or symbols.
> S -- Any symbol.
> v -- Variable name: symbol that is ‘custom-variable-p’.
>
> etc, etc...
>
> Basically everything?

As it is clear, that's not the case.  These things have and will always
deal with the global table of symbols obarray.  These commands operate on
symbols.  Shorthands are _not_ symbols! They are not! They are a textual
indirection to symbols, which -- as the manual explained long before I touched
it -- are objects composed of four things, blablabla.

Maybe this helps you think: it's just like (intern (concat "foo"
"bar")) is another
type of indirection to a symbol. A run-time indirection.  Shorthands
are read-time
indirections.

So: when the commands you reference are invoked in the buffer where
shorthands exist with point on the shorthand you which to describe, lookup, etc
all those functions and the interactive codes do the right thing.  What is that?
They follow the indirection to the symbol and operate on the symbol,
as they always
have.

If you find some case where they DON'T  follow this indirection, where
they clearly
COULD reasonably follow it then that is a bug and or feature request
for  shorthands.
But you should explain also why think it is reasonable.  Consider how SLIME (and
also proprietary Common Lisp IDE's, I think) have dealt with this issue (search
"package local nicknames" in your favourite search engine).

Soon I will propose that we font-lock shorthands specially (or at least make it
optional).  That should be easy to do, and should, in my opinion, extinguish at
least some of your anguish.

João