[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: /srv/bzr/emacs/trunk r100059: (bug-reference-url-format): Mark as `
From: |
Davis Herring |
Subject: |
Re: /srv/bzr/emacs/trunk r100059: (bug-reference-url-format): Mark as `safe-local-variable' if the value |
Date: |
Wed, 28 Apr 2010 08:32:56 -0700 (PDT) |
User-agent: |
SquirrelMail/1.4.8-5.el5_4.10.lanl1 |
> (put 'bug-reference-url-format 'safe-local-variable
> (let ((f (get 'bug-reference-url-format 'safe-local-variable)))
> (lambda (s) (or (funcall f s) (eq s
> 'clisp-bug-reference-url-format)))))
That won't work if the existing value is not a function (e.g. if it is t
(which would be foolish, of course) or nil). Moreover, you need to use
backquotes: (let ((f ...)) `(lambda (s) (or (funcall ,f s) ...))) (this is
one of the reasons people want lexbind).
> so that if others do that too, I will not override them.
> in fact, maybe the above should be a standard function
> (add-safe-value variable symbol)
I don't know how often it is useful to be able to add many individual safe
values for a variable; perhaps instead there should be another variable
whose file-local value can be a string s from which
`bug-reference-url-format' is calculated as (intern (concat s
"-url-format")). Then only functions intended for the purpose could be
selected by the file.
Or, more generally, perhaps there should be a symbol property
`safe-file-function' placed on symbols whose values as functions were safe
to call regardless of context, so that we could then allow precisely those
symbols as the values of certain function-valued file locals:
(put 'clisp-bug-reference-url-format 'safe-file-function t)
(defun safe-file-function-p (f)
(and (symbolp f) (get f 'safe-file-function))
(put 'bug-reference-url-format 'safe-local-variable 'safe-file-function-p)
Davis
--
This product is sold by volume, not by mass. If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.