From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Make byte-compile-error-on-warn a safe variable for file compilation Date: Tue, 09 Jan 2018 08:24:35 -0500 Message-ID: References: <87wp0yhsgu.fsf@cochranmail.com> <87vaggrfqo.fsf@cochranmail.com> <87r2r2txqp.fsf@cochranmail.com> <87373fpujo.fsf@cochranmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1515504192 4800 195.159.176.226 (9 Jan 2018 13:23:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 9 Jan 2018 13:23:12 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 09 14:23:08 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYtrv-0000sj-0p for ged-emacs-devel@m.gmane.org; Tue, 09 Jan 2018 14:23:07 +0100 Original-Received: from localhost ([::1]:52609 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYttu-0004Vx-I3 for ged-emacs-devel@m.gmane.org; Tue, 09 Jan 2018 08:25:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48062) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYtto-0004Vm-F1 for emacs-devel@gnu.org; Tue, 09 Jan 2018 08:25:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eYttl-0001FF-Bi for emacs-devel@gnu.org; Tue, 09 Jan 2018 08:25:04 -0500 Original-Received: from [195.159.176.226] (port=46081 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eYttl-0001E8-5H for emacs-devel@gnu.org; Tue, 09 Jan 2018 08:25:01 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1eYtrY-0007yF-3M for emacs-devel@gnu.org; Tue, 09 Jan 2018 14:22:44 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 20 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:Ui5HzoyxPXGjGqKRS7dS7Hel8+k= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:221758 Archived-At: >> 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