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

Fails to create a new daily note. File list retrieval error in the background #1398

Closed
bvraghav opened this issue Jan 22, 2021 · 1 comment · Fixed by #1409
Closed

Fails to create a new daily note. File list retrieval error in the background #1398

bvraghav opened this issue Jan 22, 2021 · 1 comment · Fixed by #1409

Comments

@bvraghav
Copy link

Description

M-x org-roam-dailies-find-date fails with an error message Not an Org time string: dataset.cpython-38.

Looks like there is a problem with the implementation of org-roam-dailies--list-files. It searches the org-roam-dailies-directory recursively, and removes a hardcoded blacklist. Instead, may I suggest that recursive search be done only for *.org as a hardcoded whitelist and later ignore a defcustom based blacklist.

Steps to Reproduce

  1. Create a proxy for python __pycache__; say something like
TDIR=$ORG_ROAM_DAILIES/data/alpha/beta/__pycache__
mkdir -p $TDIR
touch $TDIR/dataset.cpython-38.pyc
  1. Load Emacs and Org-Roam (preferably starting with emacs -Q)
  2. M-x org-roam-dailies-find-date

Backtrace

  signal(error ("Not an Org time string: dataset.cpython-38"))
  error("Not an Org time string: %s" "dataset.cpython-38")
  org-parse-time-string("dataset.cpython-38")
  org-roam-dailies-calendar--file-to-date("/home/USER/org-roam/daily/data/d6/64b54c-33c4-46cc-...")
  mapcar(org-roam-dailies-calendar--file-to-date (LONG-LIST-OF-FILES-HERE ...))
  org-roam-dailies-calendar-mark-entries()
  run-hooks(org-roam-dailies-calendar-hook)
  org-roam-dailies-calendar--run-hook()
  run-hooks(calendar-today-visible-hook)
  #f(compiled-function () #<bytecode SOME-MACHIINE-ADDRESS>)()
  calendar-generate-window(1 2021)
  calendar-basic-setup(nil)
  calendar()
  org-read-date(nil nil nil "Find daily-note: ")
  org-roam-dailies-capture-date(t nil)
  org-roam-dailies-find-date()
  funcall-interactively(org-roam-dailies-find-date)
  call-interactively(org-roam-dailies-find-date nil nil)
  command-execute(org-roam-dailies-find-date)

Expected Results

to choose a date from calendar and follow it up with org-roam-dailies specific find-file.

Actual Results

Error message Not an Org time string: dataset.cpython-38 with backtrace as above.

Environment

Copy info below this line into issue:

  • Emacs: GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.22, cairo version 1.17.3)
    of 2020-08-28

  • Framework: N/A

  • Org: Org mode version 9.3.8 (9.3.8-1-g13dfab-elpaplus @ /home/bvr/.emacs.d/elpa/org-plus-contrib-20200914/)

  • Org-roam: 1.2.3

  • Org-roam commit:

    ;;; Navigation
    (defun org-roam-dailies--list-files (&rest extra-files)
    "List all files in `org-roam-dailies-directory'.
    EXTRA-FILES can be used to append extra files to the list."
    (let ((dir (org-roam-dailies-directory--get-absolute-path)))
    (append (--remove (let ((file (file-name-nondirectory it)))
    (when (or (auto-save-file-name-p file)
    (backup-file-name-p file)
    (string-match "^\\." file))
    it))
    (directory-files-recursively dir ""))
    extra-files)))

@bvraghav
Copy link
Author

bvraghav commented Jan 22, 2021

As a proof of concept, replacing the aforementioned lines with following function (followed by recompiling and reloading the library) works for me

;;; Navigation
(defun org-roam-dailies--list-files (&rest extra-files)
  "List all files in `org-roam-dailies-directory'.
EXTRA-FILES can be used to append extra files to the list."
  (let ((dir (org-roam-dailies-directory--get-absolute-path)))
    (append (directory-files-recursively dir "\\.org$")
            extra-files)))

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

Successfully merging a pull request may close this issue.

1 participant