l3kn / org-fc

Spaced Repetition System for Emacs org-mode
https://www.leonrische.me/fc/index.html
GNU General Public License v3.0
254 stars 31 forks source link

No cards found #128

Open gab-dev opened 1 month ago

gab-dev commented 1 month ago

I've updated org-fc to the last version but I'm not able to view any cards.

I've noticed this kind of behavior after the tag v0.6.0.

I've reduced my setup to the bare minimum to isolate the problem.

    (use-package hydra)
    (use-package org-fc
      :ensure t
      :quelpa (org-fc
           :fetcher github
           :repo "l3kn/org-fc"
           :files (:defaults "awk" "demo.org")
           )
      ;; ;; :load-path
      ;; "~/.emacs.d/packages/org-fc"
      :custom
      (org-fc-directories '("~/Remi/" "~/remi-setup/remi/.emacs.d/"))

      :config
      (require 'org-fc-hydra))

image

If I try to add a new card, this is what I get image

However if I try to review the cards in the buffer, nothing shows up. image

If I remove the indentation from the properties, it seems to work. image

image

Is this the intended behaviour?

l3kn commented 1 month ago

Thanks for the detailed bug report!

The whitespace in front of properties should be ignored so what you're seeing is not the intended behavior. I can replicate the bug but I'm not yet sure what causes it.

l3kn commented 1 month ago

This should be fixed with the most recent commit (org-fc version 0.6.2).

The AWK parser already allows properties whitespace in front but the added filter for finding org files with flashcards in them did not allow this whitespace.

gab-dev commented 1 month ago

Just tested and it works. Thanks.

I've noticed another thing though. I'm trying to put some fc inside my config file in .emacs.d so I added it in org-fc-directories, but there is no way to make it works. I have something like this:

(setq org-fc-directories '("~/org/" "~/.emacs.d")

I've also tried just "/.emacs.d". Nothing.

l3kn commented 1 month ago

I think this is also due to how org-fc filters files. Initially I wanted to filter out files whose name starts with a "." but this seems to also filter out directories like .emacs.d.

In some cases, this behavior is desirable, e.g. to avoid searching .git directories with many files in them.

Unfortunately, there is currently no easy way of customizing the find command org-fc uses (except overwriting the function yourself) and we'll need to be careful when changing the default command to avoid making it less performant in other use cases.

From a quick test, the following replacement finds cards in my .emacs.d directory:

(defun org-fc-awk--find (paths)
  "Generate shell code to search PATHS for org files.
Matches all .org files ignoring ones with names don't start with
a `.' to exclude temporary / backup files.
With the `-L' option, `find' follows symlinks."
  (format
   "find -L %s -name \"[^.]*.org\" -type f -exec grep -l --null \"^[ \\t]*:%s:\" {} \\+"
   (mapconcat
    (lambda (path) (shell-quote-argument (expand-file-name path)))
    paths " ")
   org-fc-created-property))