aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2010-11-11 17:19:01 -0500
committerStefan Monnier2010-11-11 17:19:01 -0500
commitacef0722fc954a88eea588486b478f49b1afdc6a (patch)
tree6d7b78590da45bbedec5fd7486e22dd28e56daed
parent7bea8c7a92e1fb3eaf1a4e9f2becdaf0074f64ad (diff)
downloademacs-acef0722fc954a88eea588486b478f49b1afdc6a.tar.gz
emacs-acef0722fc954a88eea588486b478f49b1afdc6a.zip
* lisp/files.el (safe-local-variable-p): Gracefully handle errors.
* lisp/emacs-lisp/bytecomp.el (byte-compile-warnings): Simplify the safety predicate.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/emacs-lisp/bytecomp.el17
-rw-r--r--lisp/files.el5
3 files changed, 13 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 88dc22a011d..fef5fec5ce9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
12010-11-11 Stefan Monnier <monnier@iro.umontreal.ca> 12010-11-11 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * emacs-lisp/bytecomp.el (byte-compile-warnings): Simplify the
4 safety predicate.
5
6 * files.el (safe-local-variable-p): Gracefully handle errors.
7
3 * emacs-lisp/smie.el (smie-rule-parent, smie-indent--rule): 8 * emacs-lisp/smie.el (smie-rule-parent, smie-indent--rule):
4 Use smie-indent-virtual when indenting relative to an opener. 9 Use smie-indent-virtual when indenting relative to an opener.
5 (smie-rule-separator): Use smie-rule-parent. 10 (smie-rule-separator): Use smie-rule-parent.
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 394169be99d..cdfac80ca78 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -294,21 +294,12 @@ suppress. For example, (not mapcar) will suppress warnings about mapcar."
294 (set :menu-tag "Some" 294 (set :menu-tag "Some"
295 ,@(mapcar (lambda (x) `(const ,x)) 295 ,@(mapcar (lambda (x) `(const ,x))
296 byte-compile-warning-types)))) 296 byte-compile-warning-types))))
297;;;###autoload(put 'byte-compile-warnings 'safe-local-variable 'byte-compile-warnings-safe-p)
298 297
299;;;###autoload 298;;;###autoload
300(defun byte-compile-warnings-safe-p (x) 299(put 'byte-compile-warnings 'safe-local-variable
301 "Return non-nil if X is valid as a value of `byte-compile-warnings'." 300 (lambda (v)
302 (or (booleanp x) 301 (or (symbolp v)
303 (and (listp x) 302 (null (delq nil (mapcar (lambda (x) (not (symbolp x))) v))))))
304 (if (eq (car x) 'not) (setq x (cdr x))
305 t)
306 (equal (mapcar
307 (lambda (e)
308 (when (memq e byte-compile-warning-types)
309 e))
310 x)
311 x))))
312 303
313(defun byte-compile-warning-enabled-p (warning) 304(defun byte-compile-warning-enabled-p (warning)
314 "Return non-nil if WARNING is enabled, according to `byte-compile-warnings'." 305 "Return non-nil if WARNING is enabled, according to `byte-compile-warnings'."
diff --git a/lisp/files.el b/lisp/files.el
index 0664bfd3844..4901c3872cd 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3134,7 +3134,10 @@ It is safe if any of these conditions are met:
3134 evaluates to a non-nil value with VAL as an argument." 3134 evaluates to a non-nil value with VAL as an argument."
3135 (or (member (cons sym val) safe-local-variable-values) 3135 (or (member (cons sym val) safe-local-variable-values)
3136 (let ((safep (get sym 'safe-local-variable))) 3136 (let ((safep (get sym 'safe-local-variable)))
3137 (and (functionp safep) (funcall safep val))))) 3137 (and (functionp safep)
3138 ;; If the function signals an error, that means it
3139 ;; can't assure us that the value is safe.
3140 (with-demoted-errors (funcall safep val))))))
3138 3141
3139(defun risky-local-variable-p (sym &optional ignored) 3142(defun risky-local-variable-p (sym &optional ignored)
3140 "Non-nil if SYM could be dangerous as a file-local variable. 3143 "Non-nil if SYM could be dangerous as a file-local variable.