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

No cards found #128

Open
gab-dev opened this issue May 30, 2024 · 4 comments
Open

No cards found #128

gab-dev opened this issue May 30, 2024 · 4 comments

Comments

@gab-dev
Copy link

gab-dev commented May 30, 2024

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
Copy link
Owner

l3kn commented May 31, 2024

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
Copy link
Owner

l3kn commented May 31, 2024

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
Copy link
Author

gab-dev commented Jun 1, 2024

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
Copy link
Owner

l3kn commented Jun 1, 2024

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))

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

2 participants