Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Does something already exist to do this?
(defun good (var)
(and (boundp 'var) var))
There is a macro defined in bindings.el that does exactly that:
(defmacro bound-and-true-p (var)
"Return the value of symbol VAR if it is bound, else nil."
`(and (boundp (quote ,var)) ,var))
How about this:
bound-and-true-p is a Lisp macro in `bindings.el'.
Return the value of symbol VAR if it is bound, else nil.
Required, but never shown