* 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
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.