unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Cochran <robert+Emacs@cochranmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] Make byte-compile-error-on-warn a safe variable for file compilation
Date: Tue, 09 Jan 2018 22:28:18 -0800	[thread overview]
Message-ID: <87zi5mcjnh.fsf@cochranmail.com> (raw)
In-Reply-To: <jwv8td79ng2.fsf-monnier+gmane.emacs.devel@gnu.org> (Stefan Monnier's message of "Tue, 09 Jan 2018 08:24:35 -0500")

[-- Attachment #1: Type: text/plain, Size: 933 bytes --]

Stefan Monnier <monnier@iro.umontreal.ca> 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.

Thanks,
-- 
~Robert Cochran

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch to mark byte-compile-error-on-warn as a safe file local variable --]
[-- Type: text/x-patch, Size: 1052 bytes --]

From f7e5bc29caafba09766ec17853f6c6561d96434f Mon Sep 17 00:00:00 2001
From: Robert Cochran <robert-git@cochranmail.com>
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 | 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
-- 
2.14.3


  reply	other threads:[~2018-01-10  6:28 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-04  9:40 [PATCH] Make byte-compile-error-on-warn a safe variable for file compilation Robert Cochran
2018-01-04 13:22 ` Noam Postavsky
2018-01-05  3:51   ` Stefan Monnier
2018-01-05  6:17   ` Robert Cochran
2018-01-05 12:05     ` Noam Postavsky
2018-01-06 22:42       ` Robert Cochran
2018-01-08 12:25         ` Noam Postavsky
2018-01-08 18:50           ` Eli Zaretskii
2018-01-09  3:42           ` Robert Cochran
2018-01-09 13:24             ` Stefan Monnier
2018-01-10  6:28               ` Robert Cochran [this message]
2018-01-10 15:26                 ` Eli Zaretskii
2018-01-10 15:57                   ` Noam Postavsky
2018-01-10 16:17                     ` Eli Zaretskii
2018-01-10 16:29                       ` Noam Postavsky
2018-01-10 19:36                         ` Eli Zaretskii
2018-01-10 19:44                           ` Noam Postavsky
2018-01-10 20:22                             ` Eli Zaretskii
2018-02-12  8:21                               ` Robert Cochran
2018-02-12 17:57                                 ` Eli Zaretskii
2018-02-13  4:49                                   ` Robert Cochran
     [not found]                                   ` <87tvulmrkd.fsf@cochranmail.com>
2018-02-16 15:53                                     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zi5mcjnh.fsf@cochranmail.com \
    --to=robert+emacs@cochranmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).