Mercurial > emacs
comparison lisp/files.el @ 722:0a2391511b46
*** empty log message ***
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 23 Jun 1992 21:48:27 +0000 |
parents | c7d478752305 |
children | ea0823fe7df5 |
comparison
equal
deleted
inserted
replaced
721:6ef7049ea916 | 722:0a2391511b46 |
---|---|
169 nil means they are ignored; anything else means query. | 169 nil means they are ignored; anything else means query. |
170 | 170 |
171 The command \\[normal-mode] always obeys local-variables lists | 171 The command \\[normal-mode] always obeys local-variables lists |
172 and ignores this variable.") | 172 and ignores this variable.") |
173 | 173 |
174 (defconst ignore-local-eval nil | 174 (defconst enable-local-eval nil |
175 "*Non-nil means ignore the \"variable\" `eval' in a file's local variables. | 175 "*Control processing of the \"variable\" `eval' in a file's local variables. |
176 This applies when the local-variables list is scanned automatically | 176 The value can be t, nil or something else. |
177 after you find a file. If you explicitly request such a scan with | 177 A value of t means obey `eval' variables; |
178 \\[normal-mode], there is no query, regardless of this variable.") | 178 nil means ignore them; anything else means query. |
179 | |
180 The command \\[normal-mode] always obeys local-variables lists | |
181 and ignores this variable.") | |
179 | 182 |
180 ;; Avoid losing in versions where CLASH_DETECTION is disabled. | 183 ;; Avoid losing in versions where CLASH_DETECTION is disabled. |
181 (or (fboundp 'lock-buffer) | 184 (or (fboundp 'lock-buffer) |
182 (fset 'lock-buffer 'ignore)) | 185 (fset 'lock-buffer 'ignore)) |
183 (or (fboundp 'unlock-buffer) | 186 (or (fboundp 'unlock-buffer) |
642 ;; Set the variable. "Variables" mode and eval are funny. | 645 ;; Set the variable. "Variables" mode and eval are funny. |
643 (cond ((eq var 'mode) | 646 (cond ((eq var 'mode) |
644 (funcall (intern (concat (downcase (symbol-name val)) | 647 (funcall (intern (concat (downcase (symbol-name val)) |
645 "-mode")))) | 648 "-mode")))) |
646 ((eq var 'eval) | 649 ((eq var 'eval) |
647 (if (or ignore-local-eval | 650 (if (and (not (string= (user-login-name) "root")) |
648 (string= (user-login-name) "root")) | 651 (or (eq enable-local-eval t) |
649 (message "Ignoring `eval:' in file's local variables") | 652 (and enable-local-eval |
650 (save-excursion (eval val)))) | 653 (save-window-excursion |
654 (switch-to-buffer (current-buffer)) | |
655 (save-excursion | |
656 (beginning-of-line) | |
657 (set-window-start (selected-window) (point))) | |
658 (y-or-n-p (format "Process `eval' local variable in file %s? " | |
659 (file-name-nondirectory buffer-file-name))))))) | |
660 (save-excursion (eval val)) | |
661 (message "Ignoring `eval:' in file's local variables"))) | |
651 (t (make-local-variable var) | 662 (t (make-local-variable var) |
652 (set var val)))))))))) | 663 (set var val)))))))))) |
653 | 664 |
654 (defun set-visited-file-name (filename) | 665 (defun set-visited-file-name (filename) |
655 "Change name of file visited in current buffer to FILENAME. | 666 "Change name of file visited in current buffer to FILENAME. |