emacs-devel
[Top][All Lists]
Advanced

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

Re: emacs-28 d3a832a: Simplify hack-read-symbol-shorthands again (bug#50


From: Stefan Monnier
Subject: Re: emacs-28 d3a832a: Simplify hack-read-symbol-shorthands again (bug#50946)
Date: Sun, 03 Oct 2021 22:02:30 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> --- a/lisp/international/mule.el
> +++ b/lisp/international/mule.el
> @@ -294,6 +294,9 @@ attribute."
>  
>      (apply 'define-charset-internal name (mapcar 'cdr attrs))))
>  
> +(defvar hack-read-symbol-shorthands-function nil
> +  "Holds function to compute `read-symbol-shorthands'.")

I know mule.el is very namespace-unclean, but could we try and not make
things worse.  E.g. we could call this `shorthands--hack-read-symbol-function`?

> +(defun hack-read-symbol-shorthands ()
> +  "Compute `read-symbol-shorthands' from Local Variables section."
> +  ;; FIXME: relies on the `hack-local-variables--find-variables'
> +  ;; detail of files.el.  That function should be exported,
> +  ;; possibly be refactored into two parts, since we're only
> +  ;; interested in basic "Local Variables" parsing.
> +  (alist-get 'read-symbol-shorthands (hack-local-variables--find-variables)))

Same here?

> +              (setq shorthands
> +                    ;; We need this indirection because hacking local
> +                    ;; variables in too early seems to have cause
> +                    ;; recursive load loops (bug#50946).  Thus it
> +                    ;; remains nil until it is save to do so.
> +                    (and hack-read-symbol-shorthands-function
> +                         (funcall hack-read-symbol-shorthands-function)))

BTW, we could also skip the var and do

                       (and (fboundp 'shorthands--hack-read-symbol)
                            (shorthands--hack-read-symbol))

-- Stefan




reply via email to

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