help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Canonical way of marking a buf local var to be safe if nil/t?


From: John Mastro
Subject: Re: Canonical way of marking a buf local var to be safe if nil/t?
Date: Thu, 12 May 2016 10:39:04 -0700

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]