Subject: bug#79485: 31.0.50; Loaded files inherit read-symbol-shorthands

From: David Rosenbaum <[email-masked]>
Date: Mon, 22 Sep 2025 15:17:48 -0700

I think package authors are already aware that all prefixes will be
replaced. It's just that there don't seem to be good alternatives for
dealing with these sorts of namespace issues as all the options have
downsides.

I already mentioned what I wrote below but I forgot to reply all and also
may not have been particularly clear anyway so I'll try again.

My preferred solution would be to make a special character cause the whole
symbol to be matched instead of just the prefix. # is already not readable
at the start of a symbol so it seems like that wouldn't cause conflicts.
For example:

;; read-symbol-shorthands: (
;; ("mvlp-" . "my-very-long-prefix-")
;; ("#db" . "cl-destructuring-bind"))

The idea is that "db" is only replaced when it matches the entire symbol
due to the #. "mvlp-" on the other hand is replaced whenever it occurs as
the prefix of a symbol.

On Mon, Sep 22, 2025 at 12:25 PM Eli Zaretskii <[email-masked]> wrote:

> > From: David Rosenbaum <[email-masked]>
> > Date: Mon, 22 Sep 2025 10:04:21 -0700
> > Cc: Eli Zaretskii <[email-masked]>, [email-masked]
> >
> > > Also they were designed to abbreviate prefixes, not full symbol names,
> so the db idea is probably not
> > going to work. As far as I remember, these things were well explained in
> the manual...
> >
> > Intended or not, shorthands are being used this way by packages authors.
> For example, see cond-let and
> > llama.
>
> So maybe we should improve our documentation to explicitly recommend
> against such practices.
>
> Emacs gives Lisp programmers enough rope to hang themselves, but
> hanging themselves is probably not what they want.
>