annotate lisp/emacs-lisp/unsafep.el @ 66851:89a5e481928a

(custom-make-dependencies): Typo.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 14 Nov 2005 04:18:53 +0000
parents 5b1a238fcbb4
children 728253cae438 2d92f5c9d6ae
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
1 ;;;; unsafep.el -- Determine whether a Lisp form is safe to evaluate
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
2
64751
5b1a238fcbb4 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64085
diff changeset
3 ;; Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
4
52042
c195b419ef52 Updated contact address.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 49598
diff changeset
5 ;; Author: Jonathan Yavner <jyavner@member.fsf.org>
c195b419ef52 Updated contact address.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 49598
diff changeset
6 ;; Maintainer: Jonathan Yavner <jyavner@member.fsf.org>
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
7 ;; Keywords: safety lisp utility
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
8
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
10
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
14 ;; any later version.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
15
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
20
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64085
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
24 ;; Boston, MA 02110-1301, USA.
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
25
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
26 ;;; Commentary:
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
27
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
28 ;; This is a simplistic implementation that does not allow any modification of
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
29 ;; buffers or global variables. It does no dataflow analysis, so functions
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
30 ;; like `funcall' and `setcar' are completely disallowed. It is designed
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
31 ;; for "pure Lisp" formulas, like those in spreadsheets, that don't make any
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
32 ;; use of the text editing capabilities of Emacs.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
33
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
34 ;; A formula is safe if:
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
35 ;; 1. It's an atom.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
36 ;; 2. It's a function call to a safe function and all arguments are safe
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
37 ;; formulas.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
38 ;; 3. It's a special form whose arguments are like a function's (and,
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
39 ;; catch, if, or, prog1, prog2, progn, while, unwind-protect).
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
40 ;; 4. It's a special form or macro that creates safe temporary bindings
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
41 ;; (condition-case, dolist, dotimes, lambda, let, let*).
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
42 ;; 4. It's one of (cond, quote) that have special parsing.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
43 ;; 5. It's one of (add-to-list, setq, push, pop) and the assignment variable
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
44 ;; is safe.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
45 ;; 6. It's one of (apply, mapc, mapcar, mapconcat) and its first arg is a
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
46 ;; quoted safe function.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
47 ;;
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
48 ;; A function is safe if:
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
49 ;; 1. It's a lambda containing safe formulas.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
50 ;; 2. It's a member of list `safe-functions', so the user says it's safe.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
51 ;; 3. It's a symbol with the `side-effect-free' property, defined by the
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
52 ;; byte compiler or function author.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
53 ;; 4. It's a symbol with the `safe-function' property, defined here or by
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
54 ;; the function author. Value t indicates a function that is safe but
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
55 ;; has innocuous side effects. Other values will someday indicate
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
56 ;; functions with side effects that are not always safe.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
57 ;; The `side-effect-free' and `safe-function' properties are provided for
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
58 ;; built-in functions and for functions and macros defined in subr.el.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
59 ;;
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
60 ;; A temporary binding is unsafe if its symbol:
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
61 ;; 1. Has the `risky-local-variable' property.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
62 ;; 2. Has a name that ends with -command, font-lock-keywords(-[0-9]+)?,
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
63 ;; font-lock-syntactic-keywords, -form, -forms, -frame-alist, -function,
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
64 ;; -functions, -history, -hook, -hooks, -map, -map-alist, -mode-alist,
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
65 ;; -predicate, or -program.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
66 ;;
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
67 ;; An assignment variable is unsafe if:
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
68 ;; 1. It would be unsafe as a temporary binding.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
69 ;; 2. It doesn't already have a temporary or buffer-local binding.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
70
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
71 ;; There are unsafe forms that `unsafep' cannot detect. Beware of these:
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
72 ;; 1. The form's result is a string with a display property containing a
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
73 ;; form to be evaluated later, and you insert this result into a
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
74 ;; buffer. Always remove display properties before inserting!
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
75 ;; 2. The form alters a risky variable that was recently added to Emacs and
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
76 ;; is not yet marked with the `risky-local-variable' property.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
77 ;; 3. The form uses undocumented features of built-in functions that have
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
78 ;; the `side-effect-free' property. For example, in Emacs-20 if you
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
79 ;; passed a circular list to `assoc', Emacs would crash. Historically,
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
80 ;; problems of this kind have been few and short-lived.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
81
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
82 (provide 'unsafep)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
83 (require 'byte-opt) ;Set up the `side-effect-free' properties
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
84
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
85 (defcustom safe-functions nil
48028
c8f5ce92a086 Fixed first-line problem for function documentation strings.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 48008
diff changeset
86 "t to disable `unsafep', or a list of assumed-safe functions."
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
87 :group 'lisp
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
88 :type '(choice (const :tag "No" nil) (const :tag "Yes" t) hook))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
89
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
90 (defvar unsafep-vars nil
48028
c8f5ce92a086 Fixed first-line problem for function documentation strings.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 48008
diff changeset
91 "Dynamically-bound list of variables with lexical bindings at this point
c8f5ce92a086 Fixed first-line problem for function documentation strings.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 48008
diff changeset
92 in the parse.")
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
93 (put 'unsafep-vars 'risky-local-variable t)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
94
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
95 ;;Side-effect-free functions from subr.el
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
96 (dolist (x '(assoc-default assoc-ignore-case butlast last match-string
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
97 match-string-no-properties member-ignore-case remove remq))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
98 (put x 'side-effect-free t))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
99
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
100 ;;Other safe functions
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
101 (dolist (x '(;;Special forms
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
102 and catch if or prog1 prog2 progn while unwind-protect
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
103 ;;Safe subrs that have some side-effects
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
104 ding error message minibuffer-message random read-minibuffer
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
105 signal sleep-for string-match throw y-or-n-p yes-or-no-p
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
106 ;;Defsubst functions from subr.el
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
107 caar cadr cdar cddr
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
108 ;;Macros from subr.el
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
109 save-match-data unless when with-temp-message
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
110 ;;Functions from subr.el that have side effects
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
111 read-passwd split-string replace-regexp-in-string
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
112 play-sound-file))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
113 (put x 'safe-function t))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
114
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
115 ;;;###autoload
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
116 (defun unsafep (form &optional unsafep-vars)
48028
c8f5ce92a086 Fixed first-line problem for function documentation strings.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 48008
diff changeset
117 "Return nil if evaluating FORM couldn't possibly do any harm;
c8f5ce92a086 Fixed first-line problem for function documentation strings.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 48008
diff changeset
118 otherwise result is a reason why FORM is unsafe. UNSAFEP-VARS is a list
c8f5ce92a086 Fixed first-line problem for function documentation strings.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 48008
diff changeset
119 of symbols with local bindings."
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
120 (catch 'unsafep
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
121 (if (or (eq safe-functions t) ;User turned off safety-checking
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
122 (atom form)) ;Atoms are never unsafe
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
123 (throw 'unsafep nil))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
124 (let* ((fun (car form))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
125 (reason (unsafep-function fun))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
126 arg)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
127 (cond
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
128 ((not reason)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
129 ;;It's a normal function - unsafe if any arg is
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
130 (unsafep-progn (cdr form)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
131 ((eq fun 'quote)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
132 ;;Never unsafe
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
133 nil)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
134 ((memq fun '(apply mapc mapcar mapconcat))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
135 ;;Unsafe if 1st arg isn't a quoted lambda
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
136 (setq arg (cadr form))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
137 (cond
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
138 ((memq (car-safe arg) '(quote function))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
139 (setq reason (unsafep-function (cadr arg))))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
140 ((eq (car-safe arg) 'lambda)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
141 ;;Self-quoting lambda
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
142 (setq reason (unsafep arg unsafep-vars)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
143 (t
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
144 (setq reason `(unquoted ,arg))))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
145 (or reason (unsafep-progn (cddr form))))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
146 ((eq fun 'lambda)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
147 ;;First arg is temporary bindings
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
148 (mapc #'(lambda (x)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
149 (let ((y (unsafep-variable x t)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
150 (if y (throw 'unsafep y)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
151 (or (memq x '(&optional &rest))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
152 (push x unsafep-vars)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
153 (cadr form))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
154 (unsafep-progn (cddr form)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
155 ((eq fun 'let)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
156 ;;Creates temporary bindings in one step
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
157 (setq unsafep-vars (nconc (mapcar #'unsafep-let (cadr form))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
158 unsafep-vars))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
159 (unsafep-progn (cddr form)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
160 ((eq fun 'let*)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
161 ;;Creates temporary bindings iteratively
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
162 (dolist (x (cadr form))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
163 (push (unsafep-let x) unsafep-vars))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
164 (unsafep-progn (cddr form)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
165 ((eq fun 'setq)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
166 ;;Safe if odd arguments are local-var syms, evens are safe exprs
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
167 (setq arg (cdr form))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
168 (while arg
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
169 (setq reason (or (unsafep-variable (car arg) nil)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
170 (unsafep (cadr arg) unsafep-vars)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
171 (if reason (throw 'unsafep reason))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
172 (setq arg (cddr arg))))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
173 ((eq fun 'pop)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
174 ;;safe if arg is local-var sym
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
175 (unsafep-variable (cadr form) nil))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
176 ((eq fun 'push)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
177 ;;Safe if 2nd arg is a local-var sym
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
178 (or (unsafep (cadr form) unsafep-vars)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
179 (unsafep-variable (nth 2 form) nil)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
180 ((eq fun 'add-to-list)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
181 ;;Safe if first arg is a quoted local-var sym
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
182 (setq arg (cadr form))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
183 (if (not (eq (car-safe arg) 'quote))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
184 `(unquoted ,arg)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
185 (or (unsafep-variable (cadr arg) nil)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
186 (unsafep-progn (cddr form)))))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
187 ((eq fun 'cond)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
188 ;;Special form with unusual syntax - safe if all args are
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
189 (dolist (x (cdr form))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
190 (setq reason (unsafep-progn x))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
191 (if reason (throw 'unsafep reason))))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
192 ((memq fun '(dolist dotimes))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
193 ;;Safe if COUNT and RESULT are safe. VAR is bound while checking BODY.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
194 (setq arg (cadr form))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
195 (or (unsafep-progn (cdr arg))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
196 (let ((unsafep-vars (cons (car arg) unsafep-vars)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
197 (unsafep-progn (cddr form)))))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
198 ((eq fun 'condition-case)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
199 ;;Special form with unusual syntax - safe if all args are
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
200 (or (unsafep-variable (cadr form) t)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
201 (unsafep (nth 2 form) unsafep-vars)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
202 (let ((unsafep-vars (cons (cadr form) unsafep-vars)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
203 ;;var is bound only during handlers
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
204 (dolist (x (nthcdr 3 form))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
205 (setq reason (unsafep-progn (cdr x)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
206 (if reason (throw 'unsafep reason))))))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
207 (t
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
208 ;;First unsafep-function call above wasn't nil, no special case applies
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
209 reason)))))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
210
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
211
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
212 (defun unsafep-function (fun)
48028
c8f5ce92a086 Fixed first-line problem for function documentation strings.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 48008
diff changeset
213 "Return nil if FUN is a safe function
c8f5ce92a086 Fixed first-line problem for function documentation strings.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 48008
diff changeset
214 \(either a safe lambda or a symbol that names a safe function). Otherwise
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48028
diff changeset
215 result is a reason code."
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
216 (cond
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
217 ((eq (car-safe fun) 'lambda)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
218 (unsafep fun unsafep-vars))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
219 ((not (and (symbolp fun)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
220 (or (get fun 'side-effect-free)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
221 (eq (get fun 'safe-function) t)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
222 (eq safe-functions t)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
223 (memq fun safe-functions))))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
224 `(function ,fun))))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
225
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
226 (defun unsafep-progn (list)
48028
c8f5ce92a086 Fixed first-line problem for function documentation strings.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 48008
diff changeset
227 "Return nil if all forms in LIST are safe, or the reason
c8f5ce92a086 Fixed first-line problem for function documentation strings.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 48008
diff changeset
228 for the first unsafe form."
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
229 (catch 'unsafep-progn
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
230 (let (reason)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
231 (dolist (x list)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
232 (setq reason (unsafep x unsafep-vars))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
233 (if reason (throw 'unsafep-progn reason))))))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
234
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
235 (defun unsafep-let (clause)
48028
c8f5ce92a086 Fixed first-line problem for function documentation strings.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 48008
diff changeset
236 "CLAUSE is a let-binding, either SYM or (SYM) or (SYM VAL). Checks VAL
c8f5ce92a086 Fixed first-line problem for function documentation strings.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 48008
diff changeset
237 and throws a reason to `unsafep' if unsafe. Returns SYM."
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
238 (let (reason sym)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
239 (if (atom clause)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
240 (setq sym clause)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
241 (setq sym (car clause)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
242 reason (unsafep (cadr clause) unsafep-vars)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
243 (setq reason (or (unsafep-variable sym t) reason))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
244 (if reason (throw 'unsafep reason))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
245 sym))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
246
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
247 (defun unsafep-variable (sym global-okay)
48028
c8f5ce92a086 Fixed first-line problem for function documentation strings.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 48008
diff changeset
248 "Returns nil if SYM is safe as a let-binding sym
c8f5ce92a086 Fixed first-line problem for function documentation strings.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 48008
diff changeset
249 \(because it already has a temporary binding or is a non-risky buffer-local
c8f5ce92a086 Fixed first-line problem for function documentation strings.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 48008
diff changeset
250 variable), otherwise a reason why it is unsafe. Failing to be locally bound
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
251 is okay if GLOBAL-OKAY is non-nil."
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
252 (cond
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
253 ((not (symbolp sym))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
254 `(variable ,sym))
48008
54e6db99ee89 (unsafep-variable): Pass second arg to risky-local-variable-p.
Richard M. Stallman <rms@gnu.org>
parents: 47667
diff changeset
255 ((risky-local-variable-p sym nil)
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
256 `(risky-local-variable ,sym))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
257 ((not (or global-okay
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
258 (memq sym unsafep-vars)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
259 (local-variable-p sym)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
260 `(global-variable ,sym))))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
261
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 52042
diff changeset
262 ;;; arch-tag: 6216f98b-eb8f-467a-9c33-7a7644f50658
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
263 ;; unsafep.el ends here.