I have following .dir-locals.el
file in my project directory:
((nil . ((logbook . "todo.org"))))
and following function:
(defun project-switch (&optional project-dir)
"switch to project"
(interactive)
(let* ((project-dir (if project-dir
project-dir
(project-prompt-project-dir)))
(default-directory project-dir))
(message "%s " default-directory)
(hack-dir-local-variables-non-file-buffer)
(if (boundp 'logbook)
(message "logbooK: %s" logbook)
(message "nope"))))
If I run the function, it messages me nope
even though the .dir-locals.el
file is present.
EDIT: updated code with feedback. It still messages me nope
. If I manually open a file in the project directory it prints it just fine.
let
s by usinglet*
instead. See this post. – Tristan Riehs Oct 29 '23 at 12:44