Subject: Re: insert-file-contents can corrupt buffers. [Was: bug#50946: Emacs-28: Inadequate coding in hack-elisp-shorthands]

From: Eli Zaretskii <[email-masked]>
Date: Sun, 03 Oct 2021 20:56:19 +0300

> From: João Távora <[email-masked]>
> Cc: [email-masked]
> Date: Sun, 03 Oct 2021 18:05:33 +0100
> 
> Icky or not, the fboundp one isn't working, the hook one I gave you
> earlier does.
> 
> With the fboundp, I get some recursive load error (not the first time).
> I didn't investigate, maybe you can tell what's going on?  I am missing
> sometehing obvious?

Not entirely sure, but I don't think the fboundp test is the culprit.
The trigger is something else:

> --- a/lisp/loadup.el
> +++ b/lisp/loadup.el
> @@ -355,7 +355,6 @@
>  (load "paren")
>  
>  (load "shorthands")
> -(setq load-source-file-function #'load-with-shorthands-and-code-conversion)

Note that previously, the shorthand searching and application was
effectively turned off until very late into the loadup procedure.  But
now, we enable it as soon as files.el is loaded, which is way
earlier.  Somewhere there is the reason for the problem.

So I think, instead of the fboundp test, introduce a variable,
say inhibit-shorthands, set it to t at the beginning of loadup, then
reset to nil after shorthands.el has been loaded.  Then in mule.el
condition the call to hack-local-variables--find-variables on that new
variable instead.