summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1993-06-10 21:31:56 +0000
committerRichard M. Stallman <rms@gnu.org>1993-06-10 21:31:56 +0000
commit7d3221d7e32e0c9b359d46fd7a74e0d5b220dbdd (patch)
tree70a8f30bec978f97269fe5526b617dedbdcb8eca /lisp/files.el
parentc2225d0026d73b23be56993d1332096f02bdec0e (diff)
downloademacs-7d3221d7e32e0c9b359d46fd7a74e0d5b220dbdd.tar.gz
(hack-one-local-variable): Treat ...-hook(s) and ..-function(s)
like setting the `eval' variable.
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el11
1 files changed, 8 insertions, 3 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 37ad1c980bc..047bea3c2df 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1011,7 +1011,9 @@ If `enable-local-variables' is nil, this function does not check for a
((memq var ignored-local-variables)
nil)
;; "Setting" eval means either eval it or do nothing.
- ((eq var 'eval)
+ ;; Likewise for setting hook variables.
+ ((or (eq var 'eval)
+ (string-match "-hooks?$\\|-functions?$" (symbol-name var)))
(if (and (not (string= (user-login-name) "root"))
(or (eq enable-local-eval t)
(and enable-local-eval
@@ -1021,9 +1023,12 @@ If `enable-local-variables' is nil, this function does not check for a
(beginning-of-line)
(set-window-start (selected-window) (point)))
(setq enable-local-eval
- (y-or-n-p (format "Process `eval' local variable in file %s? "
+ (y-or-n-p (format "Process `eval' or hook local variables in file %s? "
(file-name-nondirectory buffer-file-name))))))))
- (save-excursion (eval val))
+ (if (eq var 'eval)
+ (save-excursion (eval val))
+ (make-local-variable var)
+ (set var val))
(message "Ignoring `eval:' in file's local variables")))
;; Ordinary variable, really set it.
(t (make-local-variable var)