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

Noam Postavsky <address@hidden> writes:

> Okay, I think preventing easy tampering (by the user) is not a useful goal.

Yeah, I'll agree with that now that I've set the property the right way.

> See `(elisp) File Local Variables':
>
>    You can specify safe values for a variable with a
> `safe-local-variable' property.  The property has to be a function of
> one argument; any value is safe if the function returns non-`nil' given
> that value.  Many commonly-encountered file variables have
> `safe-local-variable' properties; these include `fill-column',
> `fill-prefix', and `indent-tabs-mode'.  For boolean-valued variables
> that are safe, use `booleanp' as the property value.

Ah, symbol properties! I don't ever use them myself in my Lisp, so I
have a tendency to forget that's something I can do. New patch attached
that does it the right way.

>>> Solving Bug#4837 would be helpful for this, as currently there is no
>>> practical way to fix/suppress the obsolete warnings in the code that
>>> remains to support the obsolete option.
>>>
>>> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=4837
>>
>> Yeah, I was thinking about that. In private discussion with friends, it
>> was mentioned that it could be a `declare' option - something like
>> (declare no-warn-obsolete) - but that's not very satifying for anything
>> other than defuns.
>
> That would cover too much code as well.

I still hold that we can transition to having everything compile
error-on-warn in the same manner that lexical-binding was enabled slowly
as the code was changed in individual files to support it. I definitely
agree that looking into some way to fix/suppress the warning in
supporting code is someting worthwhile, but I'm just as unsure of a
proper solution as anyone else is.

Thanks,
-- 
~Robert Cochran

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

>From 6e8573da34a9a76e6114449b30c2354d87da6039 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
 compilation

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

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

diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 2f5f9f8c05..a1fe524390 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -296,6 +296,8 @@ byte-compile-error-on-warn
   :group 'bytecomp
   :type 'boolean)
 
+(put 'byte-compile-error-on-warn 'safe-local-variable #'booleanp)
+
 (defconst byte-compile-warning-types
   '(redefine callargs free-vars unresolved
             obsolete noruntime cl-functions interactive-only
-- 
2.14.3


reply via email to

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