* Canonical way of marking a buf local var to be safe if nil/t?
@ 2016-05-12 17:32 Kaushal Modi
2016-05-12 17:39 ` John Mastro
0 siblings, 1 reply; 3+ messages in thread
From: Kaushal Modi @ 2016-05-12 17:32 UTC (permalink / raw)
To: Help Gnu Emacs mailing list
Hi,
What would be a canonical way (if any) of setting a var to be a safe buffer
local variable as long as its value is either nil or t?
I use
(put 'my-foo-var 'safe-local-variable (lambda (val) (or (equal val nil)
(equal val t))))
--
--
Kaushal Modi
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Canonical way of marking a buf local var to be safe if nil/t?
2016-05-12 17:32 Canonical way of marking a buf local var to be safe if nil/t? Kaushal Modi
@ 2016-05-12 17:39 ` John Mastro
2016-05-12 17:41 ` Kaushal Modi
0 siblings, 1 reply; 3+ messages in thread
From: John Mastro @ 2016-05-12 17:39 UTC (permalink / raw)
To: Help Gnu Emacs mailing list; +Cc: Kaushal Modi
Kaushal Modi <kaushal.modi@gmail.com> wrote:
> What would be a canonical way (if any) of setting a var to be a safe buffer
> local variable as long as its value is either nil or t?
>
> I use
>
> (put 'my-foo-var 'safe-local-variable (lambda (val) (or (equal val nil)
> (equal val t))))
Use `booleanp':
booleanp is a compiled Lisp function in ‘subr.el’.
(booleanp OBJECT)
Return t if OBJECT is one of the two canonical boolean values: t or nil.
Otherwise, return nil.
--
john
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Canonical way of marking a buf local var to be safe if nil/t?
2016-05-12 17:39 ` John Mastro
@ 2016-05-12 17:41 ` Kaushal Modi
0 siblings, 0 replies; 3+ messages in thread
From: Kaushal Modi @ 2016-05-12 17:41 UTC (permalink / raw)
To: John Mastro, Help Gnu Emacs mailing list
On Thu, May 12, 2016 at 1:39 PM John Mastro <john.b.mastro@gmail.com> wrote:
> Use `booleanp':
>
> booleanp is a compiled Lisp function in ‘subr.el’.
>
> (booleanp OBJECT)
>
> Return t if OBJECT is one of the two canonical boolean values: t or nil.
> Otherwise, return nil.
>
Thanks! I had a gut feeling that something basic like this had to be
already covered :)
--
--
Kaushal Modi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-05-12 17:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-12 17:32 Canonical way of marking a buf local var to be safe if nil/t? Kaushal Modi
2016-05-12 17:39 ` John Mastro
2016-05-12 17:41 ` Kaushal Modi
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).