Article View: gnu.emacs.bug
Article #87365Patch for hack-one-local-variable
From: Chris Madsen
Date: Tue, 27 Sep 1994 16:47
Date: Tue, 27 Sep 1994 16:47
55 lines
3144 bytes
3144 bytes
When I upgraded from 19.25 to 19.27, I found that compile-command was
now considered a "hook local variable". This bothered me, because I
frequently set compile-command in local variable lists. I didn't want
to confirm the list every time I loaded a file, nor did I want to set
enable-local-eval to t and disable the prompt entirely.
I found the place (hack-one-local-variable in files.el) where this
test for risky local variables is made, and found there was no way to
override it without patching files.el and redumping emacs (or at least
redefining hack-one-local-variable).
Here is my patch. This causes variables whose names are considered
"risky" to be considered "safe" if their safe-local-variable property
is non-nil. Thus, I added
(put 'compile-command 'safe-local-variable t)
to my .emacs file and no longer get asked about it.
Note that this does NOT override the risky-local-variable property.
If a variable has both properties set, it will be considered risky.
ChangeLog entry:
Tue Sep 27 12:03:04 1994 Christopher J. Madsen <ac608@yfn.ysu.edu>
* files.el (hack-one-local-variable): Allow setting risky
variables matched by name if their safe-local-variable property is
non-nil.
*** files.el$ Sat Sep 10 15:36:34 1994
--- files.el Tue Sep 27 12:06:54 1994
***************
*** 1183,1190 ****
;; "Setting" eval means either eval it or do nothing.
;; Likewise for setting hook variables.
((or (get var 'risky-local-variable)
! (string-match "-hooks?$\\|-functions?$\\|-forms?$\\|-program$\\|-command$"
! (symbol-name var)))
;; Permit evaling a put of a harmless property
;; if the args do nothing tricky.
(if (or (and (eq var 'eval)
--- 1183,1193 ----
;; "Setting" eval means either eval it or do nothing.
;; Likewise for setting hook variables.
((or (get var 'risky-local-variable)
! ;; Variables matched by name can be set without prompting
! ;; if their safe-local-variable property is non-nil.
! (and (string-match "-hooks?$\\|-functions?$\\|-forms?$\\|-program$\\|-command$"
! (symbol-name var))
! (not (get var 'safe-local-variable))))
;; Permit evaling a put of a harmless property
;; if the args do nothing tricky.
(if (or (and (eq var 'eval)
--
Chris Madsen ac608@yfn.ysu.edu GEnie: C.MADSEN
Technical Details
Message-ID:
<199409271643.AA18588@gateway.cis.ysu.edu>Path:
arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!redstone.interpath.net!ddsw1!panix!MathWorks.Com!europa.eng.gtefsd.com!howland.reston.ans.net!math.ohio-state.edu!cis.ohio-state.edu!cis.ysu.edu!srmadsenShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,8c57a90f3c5d65e,start X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1994-09-27 09:55:45 PST Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!redstone.interpath.net!ddsw1!panix!MathWorks.Com!europa.eng.gtefsd.com!howland.reston.ans.net!math.ohio-state.edu!cis.ohio-state.edu!cis.ysu.edu!srmadsen From: srmadsen@cis.ysu.edu (Chris Madsen) Newsgroups: gnu.emacs.bug Subject: Patch for hack-one-local-variable Date: 27 Sep 1994 12:47:56 -0400 Organization: GNUs Not Usenet Lines: 55 Sender: daemon@cis.ohio-state.edu Approved: bug-gnu-emacs@prep.ai.mit.edu Distribution: gnu Message-ID: <199409271643.AA18588@gateway.cis.ysu.edu>