unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Davis Herring" <herring@lanl.gov>
To: "Sam Steingold" <sds@gnu.org>
Cc: Chong Yidong <cyd@stupidchicken.com>, emacs-devel@gnu.org
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)	[thread overview]
Message-ID: <49686.130.55.132.217.1272468776.squirrel@webmail.lanl.gov> (raw)
In-Reply-To: <w2l1f77704b1004271610je3670990y4c724c25f0266f5@mail.gmail.com>

> (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.




  reply	other threads:[~2010-04-28 15:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1O6mXN-0006ds-3k@internal.in.savannah.gnu.org>
2010-04-27 21:32 ` /srv/bzr/emacs/trunk r100059: (bug-reference-url-format): Mark as `safe-local-variable' if the value Glenn Morris
2010-04-27 21:46   ` Chong Yidong
2010-04-27 22:09   ` Sam Steingold
2010-04-27 22:39     ` Lennart Borgman
2010-04-27 22:42     ` Chong Yidong
2010-04-27 23:10       ` Sam Steingold
2010-04-28 15:32         ` Davis Herring [this message]
2010-04-28 15:51           ` Chong Yidong
2010-04-28 16:25             ` Davis Herring
2010-04-28 17:21               ` Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49686.130.55.132.217.1272468776.squirrel@webmail.lanl.gov \
    --to=herring@lanl.gov \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=sds@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).