emacs-devel
[Top][All Lists]
Advanced

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

Re: Help sought understanding shorthands wrt modules/packages


From: Eli Zaretskii
Subject: Re: Help sought understanding shorthands wrt modules/packages
Date: Thu, 03 Nov 2022 10:46:53 +0200

> From: Richard Stallman <rms@gnu.org>
> Date: Wed, 02 Nov 2022 23:17:19 -0400
> 
> I just wrote changes which ought to provide the missing
> functionality in the shorthands feature.  It adds an argument to Fload
> which specifies additional shorthands to apply to that file.
> See below.
> 
> I have made it compile but I have not had a chance yet to test running
> it.  I hope to find a chance to do that soon.

Please do test it, but in any case please don't install before the
emacs-29 release branch is cut.  This change is significant enough to
not risk it for the upcoming release of Emacs 29.

> -DEFUN ("load", Fload, Sload, 1, 5, 0,
> +DEFUN ("load", Fload, Sload, 1, 6, 0,
>         doc: /* Execute a file of Lisp code named FILE.
>  First try FILE with `.elc' appended, then try with `.el', then try
>  with a system-dependent suffix of dynamic modules (see `load-suffixes'),
> @@ -1206,6 +1206,13 @@ When searching suffixes, this function normally stops 
> at the first
>  one that exists.  If the option `load-prefer-newer' is non-nil,
>  however, it tries all suffixes, and uses whichever file is the newest.
>  
> +ADD-SHORTHANDS specifies a list of additional shorthands (symbol
> +renamings) to perform when loading this file,
> +in addition to those specified in the file itself.
> +Normally you should call `load-with-shorthands' to specify this,
> +rather than calling `load' with nil for all args
> +except for FILE and ADD-SHORTHANDS.
> +
>  Loading a file records its definitions, and its `provide' and
>  `require' calls, in an element of `load-history' whose
>  car is the file name loaded.  See `load-history'.

This needs a NEWS entry and a suitable change in the ELisp manual.

>  #ifdef HAVE_NATIVE_COMP
>        loadhist_initialize (hist_file_name);
> +      /* ??? Does this require fixing for shorthands?  */
>        Fnative_elisp_load (found, Qnil);
>        build_load_history (hist_file_name, true);

Andrea, can you please comment on the above question?

> +  DEFVAR_LISP ("read-symbol-added-shorthands", Vread_symbol_added_shorthands,
> +          doc: /* Alist of symbol-name shorthands added by `load'.
> +This variable's value comes from the ADDED-SHORTHANDS argument to `load'.
> +See Info node `(elisp)Shorthands' for more details.  */);
> +  Vread_symbol_added_shorthands = Qnil;

This variable should be documented in the ELisp manual and mentioned
in the NEWS entry.

Thanks.

P.S. It would be good to add tests for this new feature; see the test
suite we have in tests/.



reply via email to

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