On Oct 11, 2012, at 6:04 PM, Nathan Neff wrote:
Hello,
I'm trying to create a function that will tell org-capture
dynamically where to put the captured item.
I have it almost working -- where I'm getting hung up on is
with basic Emacs lisp. I want to basically implement this
pseudo code:
IF I have defined a variable called njn/current-q-file then
(find-file njn/current-q-file)
ELSE
(find-file (questions.org)))
However, if I do not define my njn/current-q-file then
I get a Symbol's value as variable is void error when Emacs starts up.
How do I test for the existence (and non-nil ness of a variable in Emacs)
You can use boundp. So
(if (boundp 'njn/current-q-file)
njn/current-q-file
questions.org)
can be used wherever you need it.
-Ivan