unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: emacs-28 d3a832a: Simplify hack-read-symbol-shorthands again (bug#50946)
       [not found] ` <20211003231920.7ACA521048@vcs0.savannah.gnu.org>
@ 2021-10-04  2:02   ` Stefan Monnier
  2021-10-04  7:32     ` João Távora
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2021-10-04  2:02 UTC (permalink / raw)
  To: emacs-devel; +Cc: João Távora

> --- 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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: emacs-28 d3a832a: Simplify hack-read-symbol-shorthands again (bug#50946)
  2021-10-04  2:02   ` emacs-28 d3a832a: Simplify hack-read-symbol-shorthands again (bug#50946) Stefan Monnier
@ 2021-10-04  7:32     ` João Távora
  0 siblings, 0 replies; 2+ messages in thread
From: João Távora @ 2021-10-04  7:32 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 926 bytes --]

On Mon, Oct 4, 2021, 03:02 Stefan Monnier <monnier@iro.umontreal.ca> wrote:

>
> I know mule.el is very namespace-unclean, but could we try and not make
> things worse.


Use shorthands! ;-)

  E.g. we could call this `shorthands--hack-read-symbol-function`?
>

I was kidding. Go ahead.

 Variables" parsing.
> > +  (alist-get 'read-symbol-shorthands
> (hack-local-variables--find-variables)))
>
> Same here?
>

Same, yes, it's the same variable.

BTW, we could also skip the var and do
>
>                        (and (fboundp 'shorthands--hack-read-symbol)
>                             (shorthands--hack-read-symbol))
>

If the function is set up late enough, I guess.  Else it'll make the loop
described. I always find variables a cleaner API than fboundp.

But feel free to change, this the part of the feature where I have no
opinion. As long as it passes the tests...

João

>
>

[-- Attachment #2: Type: text/html, Size: 2268 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-04  7:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20211003231919.18078.17793@vcs0.savannah.gnu.org>
     [not found] ` <20211003231920.7ACA521048@vcs0.savannah.gnu.org>
2021-10-04  2:02   ` emacs-28 d3a832a: Simplify hack-read-symbol-shorthands again (bug#50946) Stefan Monnier
2021-10-04  7:32     ` João Távora

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).