unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Declaring a variable safe
@ 2010-03-28 17:58 Eli Zaretskii
  2010-03-28 18:16 ` Glenn Morris
  2010-03-28 18:20 ` Stefan Monnier
  0 siblings, 2 replies; 4+ messages in thread
From: Eli Zaretskii @ 2010-03-28 17:58 UTC (permalink / raw)
  To: emacs-devel

The way to specify that a variable is safe for certain categories of
values is by giving it a `safe-local-variable' property.  For example:

  (put 'foobar 'safe-local-variable 'booleanp)

But what is the recommended way of doing this with a variable that is
defined in the C sources?  One possibility is to put the above form
somewhere in a Lisp file that is preloaded, like simple.el.  Is there
a better way?

TIA




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Declaring a variable safe
  2010-03-28 17:58 Declaring a variable safe Eli Zaretskii
@ 2010-03-28 18:16 ` Glenn Morris
  2010-03-28 20:34   ` Eli Zaretskii
  2010-03-28 18:20 ` Stefan Monnier
  1 sibling, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2010-03-28 18:16 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii wrote:

>   (put 'foobar 'safe-local-variable 'booleanp)
>
> But what is the recommended way of doing this with a variable that is
> defined in the C sources?  One possibility is to put the above form
> somewhere in a Lisp file that is preloaded, like simple.el.

This is currently done ~ line 2770 of files.el.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Declaring a variable safe
  2010-03-28 17:58 Declaring a variable safe Eli Zaretskii
  2010-03-28 18:16 ` Glenn Morris
@ 2010-03-28 18:20 ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2010-03-28 18:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

> The way to specify that a variable is safe for certain categories of
> values is by giving it a `safe-local-variable' property.  For example:

>   (put 'foobar 'safe-local-variable 'booleanp)

> But what is the recommended way of doing this with a variable that is
> defined in the C sources?  One possibility is to put the above form
> somewhere in a Lisp file that is preloaded, like simple.el.  Is there
> a better way?

You can also call Fput in an equivalent way from C, but it's usually
a lot more convenient to do it from Elisp.  I guess we could even
retarget the cus-start.el to be used specifically for these kinds of
uses where we stash Elisp that conceptually is related to the C code,
but just happens to be a lot more convenient do in Elisp.


        Stefan




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Declaring a variable safe
  2010-03-28 18:16 ` Glenn Morris
@ 2010-03-28 20:34   ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2010-03-28 20:34 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

> Cc: emacs-devel@gnu.org
> From: Glenn Morris <rgm@gnu.org>
> Date: Sun, 28 Mar 2010 14:16:15 -0400
> 
> Eli Zaretskii wrote:
> 
> >   (put 'foobar 'safe-local-variable 'booleanp)
> >
> > But what is the recommended way of doing this with a variable that is
> > defined in the C sources?  One possibility is to put the above form
> > somewhere in a Lisp file that is preloaded, like simple.el.
> 
> This is currently done ~ line 2770 of files.el.

Thanks, this is exactly what I was looking for.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-03-28 20:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-28 17:58 Declaring a variable safe Eli Zaretskii
2010-03-28 18:16 ` Glenn Morris
2010-03-28 20:34   ` Eli Zaretskii
2010-03-28 18:20 ` Stefan Monnier

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