I want to create an Emacs lisp function which
- composes a path of a diary file which has the format
<some directory>/t<timestamp>.org
and - determines whether or not such file exists.
I wrote this:
(defun open-diary ()
(interactive)
;; TODO: Find out whether or not file-name exists
(let ((file-name (format-time-string "/some-dir/diary-files/t%Y%m%d.org"))
(diary-file-exists (file-exists-p file-name)))
(message diary-file-exists)))
When I run M-x open-diary
I get the error Symbol's value as variable is void: file-name
.
How can I fix it, i. e. make sure that (file-exists-p file-name)
sees the file-name
variable defined above?
let
bindings occur in parallel. You wantlet*
instead (or evenwhen-let
, but lets get this working first :-)