diff options
author | Miles Bader <miles@gnu.org> | 2006-04-17 08:41:12 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 2006-04-17 08:41:12 +0000 |
commit | cfc2051d0ed5a268528a647ab0911a2f5cc451de (patch) | |
tree | cb622fe0b6c1ba8b97314fb80ba2fd8fad60a5a2 /lisp/files.el | |
parent | ca49cf1703cc20d50653c32ca2f438c8819b78bd (diff) | |
parent | e4a89ccf738861d7b9c4f611185aa0f204c9c208 (diff) | |
download | emacs-cfc2051d0ed5a268528a647ab0911a2f5cc451de.tar.gz emacs-cfc2051d0ed5a268528a647ab0911a2f5cc451de.tar.bz2 emacs-cfc2051d0ed5a268528a647ab0911a2f5cc451de.zip |
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-56
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 204-225)
- Update from CVS
- Sync from erc--emacs--0
- Merge from gnus--rel--5.10
- Improve tq.el.
- Update from CVS: src/puresize.h (PURESIZE_RATIO): Reduce to 10/6.
* gnus--rel--5.10 (patch 81-85)
- Update from CVS
- Merge from emacs--devo--0
Diffstat (limited to 'lisp/files.el')
-rw-r--r-- | lisp/files.el | 55 |
1 files changed, 34 insertions, 21 deletions
diff --git a/lisp/files.el b/lisp/files.el index 3e4602643db..cd474e868d0 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -444,14 +444,19 @@ use `before-save-hook'.") (defcustom enable-local-variables t "*Control use of local variables in files you visit. -The value can be t, nil or something else. +The value can be t, nil, :safe, or something else. A value of t means file local variables specifications are obeyed if all the specified variable values are safe; if any values are not safe, Emacs queries you, once, whether to set them all. +\(When you say yes to certain values, they are remembered as safe.) + +:safe means set the safe variables, and ignore the rest. +nil means always ignore the file local variables. -A value of nil means always ignore the file local variables. Any other value means always query you once whether to set them all. +\(When you say yes to certain values, they are remembered as safe, but +this has no effect when `enable-local-variables' is \"something else\".) This variable also controls use of major modes specified in a -*- line. @@ -460,6 +465,7 @@ The command \\[normal-mode], when used interactively, always obeys file local variable specifications and the -*- line, and ignores this variable." :type '(choice (const :tag "Obey" t) + (const :tag "Safe Only" :safe) (const :tag "Ignore" nil) (other :tag "Query" other)) :group 'find-file) @@ -1779,8 +1785,7 @@ Uses the visited file name, the -*- line, and the local variables spec. This function is called automatically from `find-file'. In that case, we may set up the file-specified mode and local variables, -depending on the value of `enable-local-variables': if it is t, we do; -if it is nil, we don't; otherwise, we query. +depending on the value of `enable-local-variables'. In addition, if `local-enable-local-variables' is nil, we do not set local variables (though we do notice a mode specified with -*-.) @@ -2413,8 +2418,7 @@ n -- to ignore the local variables list.") "" ", or C-v to scroll"))) (goto-char (point-min)) - (let ((inhibit-quit t) - (cursor-in-echo-area t) + (let ((cursor-in-echo-area t) (exit-chars (if offer-save '(?! ?y ?n ?\s ?\C-g) '(?y ?n ?\s ?\C-g))) done) @@ -2426,9 +2430,7 @@ n -- to ignore the local variables list.") (condition-case nil (scroll-up) (error (goto-char (point-min)))) - (setq done (memq (downcase char) exit-chars))))) - (if (= char ?\C-g) - (setq quit-flag nil))) + (setq done (memq (downcase char) exit-chars)))))) (setq char (downcase char)) (when (and offer-save (= char ?!) unsafe-vars) (dolist (elt unsafe-vars) @@ -2616,13 +2618,22 @@ is specified, returning t if it is specified." (and (risky-local-variable-p var val) (push elt risky-vars)) (push elt unsafe-vars)))) - (if (or (and (eq enable-local-variables t) - (null unsafe-vars) - (null risky-vars)) - (hack-local-variables-confirm - result unsafe-vars risky-vars)) + (if (eq enable-local-variables :safe) + ;; If caller wants only the safe variables, + ;; install only them. (dolist (elt result) - (hack-one-local-variable (car elt) (cdr elt))))) + (unless (or (memq (car elt) unsafe-vars) + (memq (car elt) risky-vars)) + (hack-one-local-variable (car elt) (cdr elt)))) + ;; Query, except in the case where all are known safe + ;; if the user wants no quuery in that case. + (if (or (and (eq enable-local-variables t) + (null unsafe-vars) + (null risky-vars)) + (hack-local-variables-confirm + result unsafe-vars risky-vars)) + (dolist (elt result) + (hack-one-local-variable (car elt) (cdr elt)))))) (run-hooks 'hack-local-variables-hook)))))) (defun safe-local-variable-p (sym val) @@ -2678,12 +2689,14 @@ It is dangerous if either of these conditions are met: (and (eq (car exp) 'put) (hack-one-local-variable-quotep (nth 1 exp)) (hack-one-local-variable-quotep (nth 2 exp)) - (memq (nth 1 (nth 2 exp)) - '(lisp-indent-hook)) - ;; Only allow safe values of lisp-indent-hook; - ;; not functions. - (or (numberp (nth 3 exp)) - (equal (nth 3 exp) ''defun))) + (let ((prop (nth 1 (nth 2 exp))) (val (nth 3 exp))) + (cond ((eq prop 'lisp-indent-hook) + ;; Only allow safe values of lisp-indent-hook; + ;; not functions. + (or (numberp val) (equal val ''defun))) + ((eq prop 'edebug-form-spec) + ;; Only allow indirect form specs. + (edebug-basic-spec val))))) ;; Allow expressions that the user requested. (member exp safe-local-eval-forms) ;; Certain functions can be allowed with safe arguments |