[Top][All Lists]

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

[PATCH] Make byte-compile-error-on-warn a safe variable for file compila

From: Robert Cochran
Subject: [PATCH] Make byte-compile-error-on-warn a safe variable for file compilation
Date: Thu, 04 Jan 2018 01:40:49 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Greetings emacs-devel,

Attached is a patch that adds the variable `byte-compile-error-on-warn'
to the safe variable list temporarily during calls to
`byte-compile-file`, so that individual files can easily and simply
include "byte-compile-error-on-warn: t" in their file local variables.

This allows programmers to be able to ensure thoroughly that there are
no warnings in their code, which theoretically leads to better

It is my eventual hope that this is accepted so that
`byte-compile-error-on-warn' can be enable on files in the core Emacs
Git repository, extending the aforementioned correctness potential to
files in the core.

For example, something that is bothering me right now
is that there are quite a few 'foo is obsolete' warnings during the byte
compilation portion of the build phase. Enabling error on warning means
that trying to byte compile files that reference stale
functions/variables/what have you will fail, prompting patches that
obsolete Lisp objects to also fix usage of it in the core with the
appropriate recommended replacement.

I ran the full test suite (`make check-expensive`), and got the same
results pre- and post-patch. Unless there are already files that have
`byte-compile-error-on-warn' set in their local variables (which
wouldn't have worked prior to this), nothing should have suddenly
broken as a result of this patch.

Suggestions, comments, concerns, and all those other things are welcomed
and requested.

~Robert Cochran

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


>From d36eccbc8fe6c1737c02a11dce1d845b3e3e5211 Mon Sep 17 00:00:00 2001
From: Robert Cochran <address@hidden>
Date: Thu, 4 Jan 2018 01:09:50 -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-file): Make
  `byte-compiler-error-on-warn' a safe local variable for file
 lisp/emacs-lisp/bytecomp.el | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 2f5f9f8c05..3c43ab21a5 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1874,6 +1874,11 @@ byte-compile-file
       ;; If they change the file name, then change it for the output also.
       (let ((buffer-file-name filename)
             (dmm (default-value 'major-mode))
+            ;; Ensure that byte-compile-error-on-warn is recognized as
+            ;; safe, even if it's not in safe-local-variable-values.
+            (safe-local-variable-values (append (list 
'(byte-compile-error-on-warn . t)
'(byte-compile-error-on-warn . nil))
+                                                safe-local-variable-values))
             ;; Ignore unsafe local variables.
             ;; We only care about a few of them for our purposes.
             (enable-local-variables :safe)

reply via email to

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