GNU bug report logs -
#79485
31.0.50; Loaded files inherit read-symbol-shorthands
Previous Next
Full log
Message #17 received at 79485 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> 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.
> By the way, I understand the problem easily now. The symbol 'dbus' has
the prefix 'db' and when the example file is read 'dbus' becomes
'cl-destructuring-bindus'. This happens at read-time well before evaluation
or byte-compilation.
(require 'dbus) isn't in the example file though. It's in tramp-gvfs which
was precompiled when emacs was built. It is tramp-gvfs that is required
from the example file.
On Mon, Sep 22, 2025, 4:00 AM João Távora <joaotavora <at> gmail.com> wrote:
> By the way, I understand the problem easily now. The symbol 'dbus' has the
> prefix 'db' and when the example file is read 'dbus' becomes
> 'cl-destructuring-bindus'. This happens at read-time well before evaluation
> or byte-compilation.
>
> It happens to occur inside a 'load' or 'require' form (didn't check), but
> it's completely unrelated to that operation specifically. The file intended
> to be loaded is completely isolated. This is just a misunderstanding of
> what shorthands were designed for and how they work. If anything is missing
> in the manual, feel free to add.
>
> João Távora
>
> On Mon, Sep 22, 2025, 11:52 João Távora <joaotavora <at> gmail.com> wrote:
>
>> Here's the reply I meant to send to the tracker but sent to Eli only on
>> accident:
>>
>> Shorthands are read at file read-time and specified exclusively as
>> per-file variables. So I don't understand this about inheritance from load.
>> 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...
>>
>> João
>>
>> On Mon, Sep 22, 2025, 07:41 Eli Zaretskii <eliz <at> gnu.org> wrote:
>>
>>> > From: "David J. Rosenbaum" <djr7c4 <at> gmail.com>
>>> > Date: Sun, 21 Sep 2025 16:58:06 -0700
>>> >
>>> > Hello,
>>> >
>>> > I am using read-symbol-shorthands to alias db to
>>> > cl-destructuring-bind. It works but causes problems when I load a file
>>> > containing a symbol that starts with db. For example, one can use
>>> emacs -Q
>>> > with the following file.
>>> >
>>> > ================================================================
>>> > (require 'tramp-gvfs)
>>> >
>>> > ;; Local Variables:
>>> > ;; read-symbol-shorthands: (("db" . "cl-destructuring-bind"))
>>> > ;; End:
>>> > ================================================================
>>> >
>>> > To reproduce, save the above and load it with M-x load-file. This
>>> > results in the following error.
>>> >
>>> > ================================================================
>>> > Loading /home/david/tmp/read-symbol-example.el (source)...
>>> > byte-code: Cannot open load file: No such file or directory,
>>> cl-destructuring-bindus
>>> > ================================================================
>>> >
>>> > The problem seems to be that tramp-gvfs requires dbus and db is being
>>> > replaced with cl-destructuring-bind. IMO, loaded files should not
>>> inherit
>>> > shorthands from files that require them since those shorthands are only
>>> > valid for that particular file.
>>>
>>> Thanks, I hope João (CC'ed) will have some ideas or suggestions.
>>>
>>
[Message part 2 (text/html, inline)]
This bug report was last modified today.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.