[Top][All Lists]

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

Re: Help sought understanding shorthands wrt modules/packages

From: João Távora
Subject: Re: Help sought understanding shorthands wrt modules/packages
Date: Sun, 6 Nov 2022 11:19:55 +0000

On Sun, Nov 6, 2022 at 9:06 AM Michael Albinus <michael.albinus@gmx.de> wrote:

> > I wrote text for etc/NEWS:
> >
> >     ** Shorthands for loading a file can be specified from "outside".
> >
> >     The new function `load-with-shorthands' loads a file
> >     and specifies additional shorthands for reading it.

I think it's fair to say, as the person who originally implemented shorthands,
that I don't agree with this change.

Providing two different ways to load an .el file so that each interns different
symbols into obarray would lead to unfortunate consequences where it would
be hard or impossible for humans or programs to understand the provenance of
a given symbol.

I cannot understand Richard's assertion that "shorthands are incomplete". 
Shorthands were primarily designed to solve the "the s.el problem", and the current
implementation available since Emacs 28 solves that problem already, IMO.

I've described how to do so multiple times in the past, but here goes again:

Anyway, here are the instructions again summarized:

1. Grab s.el from its upstream repository
2. Don't touch any of its code.  Just add this local variable
   definition to the end of the file.

   ;; Local Variables:
   ;; read-symbol-shorthands: (("s-" . "magnars-string-"))
   ;; End:

3. Rename the file from s.el to magnars-string.el.  Change its line

     (provide 's)


     (provide 'magnars-string)

4. Include magnars-string.el in Emacs core or GNU/NonGNU Elpa
5. Tell the current users of s.el, say im-a-s-user.el, in the world to type

     (require 'magnars-string)

   instead of

     (require 's)

6. In the local variables footer of im-a-s-user.el, also add

   ;; Local Variables:
   ;; read-symbol-shorthands: (("s-" . "magnars-string-"))
   ;; End:

That's it.  Minimal code was changed, and im-a-s-user.el continues to work as
previously, except that the "namespace pollution" of many symbols with a very
short prefix is not present anymore.

reply via email to

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