Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.dir-locals.el values for org-roam-directory and org-roam-db-location being ignored #2419

Open
alexispurslane opened this issue Feb 8, 2024 · 0 comments

Comments

@alexispurslane
Copy link

Description

Steps to Reproduce

  1. Create a new directory with some org mode files in it.
  2. Put a .dir-locals.el file containing:
((nil . ((org-roam-directory . "/home/alexispurslane/Nextcloud/Documents/Roberto\ Fortesceu\ Universe/")
         (org-roam-db-location . "/home/alexispurslane/Nextcloud/Documents/Roberto\ Fortesceu\ Universe/.org-roam.db"))))
  1. Open one of the files in that directory, trust the directory local variables as safe when the prompt comes up, and watch org-roam fail to initialize because it can't find the default org roam directory, completely ignoring the directory local definition.
  2. Use the lisp evaluator to check the value of org-roam-directory and see it's still set to the default value
  3. Restart Emacs several times, not the same symptoms minus the "trust these directory variables" prompt.

Backtrace

Debugger entered--Lisp error: (file-missing "Opening directory" "No such file or directory" "/home/alexispurslane/org/roam")
  file-name-all-completions("" "/home/alexispurslane/org/roam")
  (sort (file-name-all-completions "" dir) 'string<)
  (let ((tail (sort (file-name-all-completions "" dir) 'string<))) (while tail (let ((file (car tail))) (if (member file '("./" "../")) nil (if (directory-name-p file) (let* ((leaf ...) (full-file ...)) (if (and ... ...) (progn ...)) (if (and include-directories ...) (progn ...))) (if (string-match regexp file) (progn (setq files ...))))) (setq tail (cdr tail)))))
  (let* ((result nil) (files nil) (dir (directory-file-name dir)) (tramp-mode (and tramp-mode (file-remote-p (expand-file-name dir))))) (let ((tail (sort (file-name-all-completions "" dir) 'string<))) (while tail (let ((file (car tail))) (if (member file '("./" "../")) nil (if (directory-name-p file) (let* (... ...) (if ... ...) (if ... ...)) (if (string-match regexp file) (progn ...)))) (setq tail (cdr tail))))) (nconc result (nreverse files)))
  org-roam--directory-files-recursively("/home/alexispurslane/org/roam/" "\\.\\(?:org\\)\\(?:\\.gpg\\|\\.age\\)?\\'" nil nil t)
  (let ((tail (org-roam--directory-files-recursively dir regex nil nil t))) (while tail (let ((file (car tail))) (if (and (file-readable-p file) (org-roam-file-p file)) (progn (setq result (cons file result)))) (setq tail (cdr tail)))) result)
  (let ((regex (concat "\\.\\(?:" (mapconcat #'regexp-quote org-roam-file-extensions "\\|") "\\)\\(?:\\.gpg\\|\\.age\\)?\\'")) result) (let ((tail (org-roam--directory-files-recursively dir regex nil nil t))) (while tail (let ((file (car tail))) (if (and (file-readable-p file) (org-roam-file-p file)) (progn (setq result (cons file result)))) (setq tail (cdr tail)))) result))
  org-roam--list-files-elisp("/home/alexispurslane/org/roam/")
  (if files files (org-roam--list-files-elisp dir))
  (let* ((files (and t (if path (progn (let (...) (if ... nil ...) (funcall fn path ...)))))) (files (and files (seq-filter #'org-roam-file-p files))) (files (and files (mapcar #'expand-file-name files)))) (if files files (org-roam--list-files-elisp dir)))
  (let (path exe) (catch '--cl-block-nil-- (let ((tail org-roam-list-files-commands)) (while tail (let ((cmd (car tail))) (cond ((consp cmd) (let* ... ...)) ((symbolp cmd) (let nil ...)) (t (let ... ...))) (if path (progn (throw ... nil))) (setq tail (cdr tail)))))) (let* ((files (and t (if path (progn (let ... ... ...))))) (files (and files (seq-filter #'org-roam-file-p files))) (files (and files (mapcar #'expand-file-name files)))) (if files files (org-roam--list-files-elisp dir))))
  org-roam--list-files("/home/alexispurslane/org/roam/")
  org-roam-list-files()
  (let* ((gc-cons-threshold org-roam-db-gc-threshold) (org-agenda-files nil) (org-roam-files (org-roam-list-files)) (current-files (org-roam-db--get-current-files)) (modified-files nil)) (let ((tail org-roam-files)) (while tail (let ((file (car tail))) (let ((contents-hash (org-roam-db--file-hash file))) (if (string= (gethash file current-files) contents-hash) nil (setq modified-files (cons file modified-files)))) (remhash file current-files) (setq tail (cdr tail))))) (let ((emacsql--connection (org-roam-db)) (emacsql--completed nil) (emacsql--transaction-level (1+ emacsql--transaction-level)) (emacsql--result)) (unwind-protect (while (not emacsql--completed) (condition-case nil (progn (if (= 1 emacsql--transaction-level) (progn ...)) (let (...) (setq emacsql--result result) (if ... ...) (setq emacsql--completed t))) (emacsql-locked (emacsql emacsql--connection [:rollback]) (sleep-for 0.05)))) (if (and (= 1 emacsql--transaction-level) (not emacsql--completed)) (progn (emacsql emacsql--connection [:rollback])))) emacsql--result))
  org-roam-db-sync(nil)
  funcall-interactively(org-roam-db-sync nil)
  command-execute(org-roam-db-sync record)
  execute-extended-command(nil "org-roam-db-sync" nil)
  funcall-interactively(execute-extended-command nil "org-roam-db-sync" nil)
  command-execute(execute-extended-command)

Expected Results

I expected org-roam to work like it did when I manually set the org-roam-directory variable to the current directory after startup, except with the variable automatically set by my dir-locals.

Actual Results

Org roam ignores dir-locals.

Environment

  • Emacs: GNU Emacs 29.2 (build 2, x86_64-suse-linux-gnu, GTK+ Version 3.24.39, cairo version 1.18.0)
  • Framework: Doom
  • Org: Org mode version 9.7 (9.7-??-7a6bb09 @ /home/alexispurslane/.emacs.d/.local/straight/build-29.2/org/)
  • Org-roam: 8667e44
  • sqlite-connector: sqlite-builtin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant