emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/emacs-23 r100199: * lisp/files.el (safe-loc


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-23 r100199: * lisp/files.el (safe-local-variable-p): Gracefully handle errors.
Date: Thu, 11 Nov 2010 17:19:01 -0500
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100199
committer: Stefan Monnier <address@hidden>
branch nick: emacs-23
timestamp: Thu 2010-11-11 17:19:01 -0500
message:
  * lisp/files.el (safe-local-variable-p): Gracefully handle errors.
  * lisp/emacs-lisp/bytecomp.el (byte-compile-warnings): Simplify the
  safety predicate.
modified:
  lisp/ChangeLog
  lisp/emacs-lisp/bytecomp.el
  lisp/files.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-11-11 05:08:25 +0000
+++ b/lisp/ChangeLog    2010-11-11 22:19:01 +0000
@@ -1,5 +1,10 @@
 2010-11-11  Stefan Monnier  <address@hidden>
 
+       * emacs-lisp/bytecomp.el (byte-compile-warnings): Simplify the
+       safety predicate.
+
+       * files.el (safe-local-variable-p): Gracefully handle errors.
+
        * emacs-lisp/smie.el (smie-rule-parent, smie-indent--rule):
        Use smie-indent-virtual when indenting relative to an opener.
        (smie-rule-separator): Use smie-rule-parent.

=== modified file 'lisp/emacs-lisp/bytecomp.el'
--- a/lisp/emacs-lisp/bytecomp.el       2010-05-24 21:01:10 +0000
+++ b/lisp/emacs-lisp/bytecomp.el       2010-11-11 22:19:01 +0000
@@ -294,21 +294,12 @@
                 (set :menu-tag "Some"
                       ,@(mapcar (lambda (x) `(const ,x))
                                 byte-compile-warning-types))))
-;;;###autoload(put 'byte-compile-warnings 'safe-local-variable 
'byte-compile-warnings-safe-p)
 
 ;;;###autoload
-(defun byte-compile-warnings-safe-p (x)
-  "Return non-nil if X is valid as a value of `byte-compile-warnings'."
-  (or (booleanp x)
-      (and (listp x)
-           (if (eq (car x) 'not) (setq x (cdr x))
-             t)
-          (equal (mapcar
-                  (lambda (e)
-                    (when (memq e byte-compile-warning-types)
-                      e))
-                  x)
-                 x))))
+(put 'byte-compile-warnings 'safe-local-variable
+     (lambda (v)
+       (or (symbolp v)
+           (null (delq nil (mapcar (lambda (x) (not (symbolp x))) v))))))
 
 (defun byte-compile-warning-enabled-p (warning)
   "Return non-nil if WARNING is enabled, according to `byte-compile-warnings'."

=== modified file 'lisp/files.el'
--- a/lisp/files.el     2010-11-06 14:04:23 +0000
+++ b/lisp/files.el     2010-11-11 22:19:01 +0000
@@ -3134,7 +3134,10 @@
    evaluates to a non-nil value with VAL as an argument."
   (or (member (cons sym val) safe-local-variable-values)
       (let ((safep (get sym 'safe-local-variable)))
-        (and (functionp safep) (funcall safep val)))))
+        (and (functionp safep)
+             ;; If the function signals an error, that means it
+             ;; can't assure us that the value is safe.
+             (with-demoted-errors (funcall safep val))))))
 
 (defun risky-local-variable-p (sym &optional ignored)
   "Non-nil if SYM could be dangerous as a file-local variable.


reply via email to

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