[Top][All Lists]

[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: Robert Cochran
Subject: Re: [PATCH] Make byte-compile-error-on-warn a safe variable for file compilation
Date: Tue, 09 Jan 2018 22:28:18 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

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

Huh. I would have guessed that the byte compiler would have been loaded
automatically myself, but I suppose I can see why it wouldn't be.

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

Yeah, I noticed I forgot the autoload cookie, so I knew I had to do it
over again anyways.

Thus, new (and hopefully) final version of the patch.

Please let me know if I need to do anything else.

~Robert Cochran

GPG Fingerprint - BD0C 5F8B 381C 64F0 F3CE  E7B9 EC9A 872C 41B2 77C2

>From f7e5bc29caafba09766ec17853f6c6561d96434f Mon Sep 17 00:00:00 2001
From: Robert Cochran <address@hidden>
Date: Sat, 6 Jan 2018 13:19:55 -0800
Subject: [PATCH] Make byte-compile-error-on-warn a safe variable for file

This allows individual files to easily specify whether or not byte
compilation should error on encountering warnings, ala -Werror from

* lisp/emacs-lisp/bytecomp.el (byte-compile-error-on-warn): Mark as a
  safe local variable.
 lisp/emacs-lisp/bytecomp.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 2f5f9f8c05..a481b41aa5 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -295,6 +295,7 @@ byte-compile-error-on-warn
   "If true, the byte-compiler reports warnings with `error'."
   :group 'bytecomp
   :type 'boolean)
+;;;###autoload(put 'byte-compile-error-on-warn 'safe-local-variable 'booleanp)
 (defconst byte-compile-warning-types
   '(redefine callargs free-vars unresolved

reply via email to

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