emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Make byte-compile-error-on-warn a safe variable for file com


From: Stefan Monnier
Subject: Re: [PATCH] Make byte-compile-error-on-warn a safe variable for file compilation
Date: Tue, 09 Jan 2018 08:24:35 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>>    When defining a user option using `defcustom', you can set its
>> `safe-local-variable' property by adding the arguments `:safe FUNCTION'
>> to `defcustom' (*note Variable Definitions::).
> Uhm, when I did that (removing the put, and adding ":safe #'booleanp" to
> the defcustom), Emacs prompts that the variable list in the file may not
> be safe, despite the fact that describe variable clearly states "This
> variable is safe as a file local variable if its value satisfies the
> predicate ‘booleanp’".

That's because the var and its safety predicate are only known once the
bytecompiler is loaded, so if you iopen the file in a session where the
bytecompiler has not yet been loaded Emacs won't know about the
safety predicate.

For this reason the `:safe` arg of defcustom is often not useful.
Instead, you want to use the `(put ...)` form with a `;;;###autoload`
cookie in front of it, so that the safety predicate is preloaded.


        Stefan




reply via email to

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