~l3kn/org-fc#40: 
org-fc-review produces "No cards due to review"

I use org-fc with howm mode. And here's how I configured org-fc:

(use-package org-fc
  :load-path "~/.emacs.d/src/org-fc"
  :custom
  (org-fc-review-history-file "~/howm/org-fc-reviews.tsv")
  (org-fc-directories (my-howm-subsubdirs))
  :config
  (require 'org-fc-hydra))

So M-: org-fc-directories would return

("~/howm/2023/02" "~/howm/2023/03" "~/howm/2023/06" "~/howm/2023/07" "~/howm/2023/08" "~/howm/2023/09" "~/howm/2023/10" "~/howm/2023/11" "~/howm/2023/12" "~/howm/2024/01")

File ~/howm/org-fc-reviews.tsv exist, althought it is empty.

I looked at this issue and set variable org-id-track-globally to nil.

I installed gawk, find and xargs comes preninstalled in OpenBSD.

My file looks like this:

* Методы интегрирования: Интегрирование по частям. :flascards:
[2023-10-22 13:40]

** Вопрос про формулу интегрирования                                     :fc:
:PROPERTIES:
:FC_CREATED: 2024-01-08T21:20:34Z
:FC_TYPE:  normal
:ID:       28b9107f-1735-40e1-9740-bfd25c05c453
:END:
:REVIEW_DATA:
| position | ease | box | interval | due                  |
|----------+------+-----+----------+----------------------|
| front    |  2.5 |   0 |        0 | 2024-01-08T21:20:34Z |
:END:

Формула интегрирования по частям.

*** Ответ

$\int udv = uv - \int vdu$

It was card that I initially created to test org-drill and then I redone it for org-fc.

I tried changing :FC-CREATED: and due date in to 2023-10-22, date when file was created, but it shill would not mark it as due and start review.

Status
REPORTED
Submitter
~artsi0m
Assigned to
No-one
Submitted
1 year, 30 days ago
Updated
1 year, 20 days ago
Labels
No labels applied.

~l3kn 1 year, 30 days ago

The card data looks correct to me, does M-x org-fc-dashboard show any cards? You can also try M-x org-fc-demo to see if reviewing cards works at all.

Another potential issue is that the current version of org-fc expects the second heading to be named "Back" not "Ответ" but we can add a new configuration variable for alternative heading names.

~artsi0m 1 year, 30 days ago

org-fcc-dashboard doesn't show any cards. org-fc-demo works, althought I opened in another frame keybindings, so I know how to rate cards. I renamed heading from Ответ to Back althought it is still third level heading, unfortunately this doesn't change something and org-fc-review says that there is no cards due to review and also org-fc-dashboard doesn't show any new cards.

~artsi0m 1 year, 30 days ago

Renaming Вопрос про формулу интегрирования to Normal card doesn't help either.

~l3kn 1 year, 30 days ago

I don't think the other headings are a problem, when I copy your card into an org-file and rename the Back heading, I can review it.

If org-fc-demo works that's a good sign because it uses the same code as reviewing a buffer. Can you try manually creating a file in another directory (not one of the "~/howm/..." directories) and open the (buffer) dashboard for that?

I'm not sure how howm is implemented, maybe the way it links or stores files doesn't work with org-fc yet.

Regarding the "Ответ" heading name, in my Russian flashcards I use a different style of card so I haven't noticed this problem, but it would be nice to support different languages for cards with a heading for the back side. I'll look into a way of implementing that.

~l3kn 1 year, 30 days ago

With the most recent commit I've added support for different titles of the “Back” heading.

After you've updated the package, you should now be able to (add-to-list 'org-fc-back-heading-titles "Ответ") to your use-package definition and review your card without changing the title of any heading.

~artsi0m 1 year, 30 days ago

I updated the package, I fetched it as git submodule. I executed (add-to-list 'org-fc-back-heading-titles "Ответ"), althought I changed third level heading to Back already and put file inside ~/Documents, but it still won't work.

~l3kn 1 year, 30 days ago

(with-current-buffer (get-buffer-create "*org-fc debug*")
  (erase-buffer)
  (insert (format "Directories: %s\n" org-fc-directories))
  (insert "Find Version:\n")
  (insert
   (shell-command-to-string "find --version | head -n1"))

  (insert "Find output:\n")
  (insert
   (shell-command-to-string
    (org-fc-awk--find org-fc-directories)))
  (insert "\n")

  (insert "AWK Version:\n")
  (insert
   (shell-command-to-string "gawk -V | head -n1"))

  (insert "AWK output:\n")
  (insert
   (shell-command-to-string
    (org-fc-awk--pipe
     (org-fc-awk--find org-fc-directories)
     (org-fc-awk--xargs
      (org-fc-awk--command
       "awk/index.awk"
       :variables (org-fc-awk--indexer-variables))))))
  (switch-to-buffer (current-buffer)))

I think it would be useful to have some kind of debugging / test script as part of org-fc. For now you can paste this into some "test.el" file, then run M-x eval-buffer on it.

This should open a new buffer with some debug information. The "Find output:" line should include your org file and the "AWK output:" should also contain an entry for that file.

~artsi0m 1 year, 30 days ago*

I copied it inside that file and executed using org babel, here the results that appered in another buffer:

Directories: (~/howm/2023/02 ~/howm/2023/03 ~/howm/2023/06 ~/howm/2023/07 ~/howm/2023/08 ~/howm/2023/09 ~/howm/2023/10 ~/howm/2023/11 ~/howm/2023/12 ~/howm/2024/01)
Find Version:
find: unknown option -- -
usage: find [-dHhLXx] [-f path] path ... [expression]
Find output:

AWK Version:
GNU Awk 5.1.0, API: 3.0 (GNU MPFR 4.2.1, GNU MP 6.3.0)
AWK output:
(:path "-" :cards (
  )  :title nil)

To me it seems as issue with OpenBSD find. I might install GNU findutils from packages and then try to configure org-fc to execute gfind. It would be gfind because prefix g is used for GNU coreutils because of conflict that maybe introduced without it.

I also dualboot with windows and installed unxutils there, because I can't find findutils (no pun intended) in uutils-coreutils. So, maybe I come up with another issue from windows, or maybe no, because now you give me that elisp script.

I think it would be useful to have some kind of debugging / test script as part of org-fc.

Would be nice, to have "dependency" script, something that when executed will create dashboard with system programms and their status, like:

GNU AWK: [OK]
GNU FIND: [NO]
GNU XARGS: [NO]

Try to install GNU findutils package for your operating system.

Sorry, that for now I only give suggestions and not actual code.

~l3kn 1 year, 30 days ago

Thanks for the suggestion with the dependency script, I'll look into ways of implementing it.

From the OpenBSD documentation of find, I can't tell which one of the flags used by org-fc causes problems. Maybe running this command in your shell will give us more information:

find -L ~/howm -type f -name "*.org" -not -name ".*" -print0

This should be very close to the command used by org-fc:

find -L ~/howm -type f -name "*.org" -not -name ".*" -print0 | xargs -0 gawk -F: 'BEGINFILE {print FILENAME}'

Both should print out a list of org files that were found, or some error message.

~artsi0m 1 year, 29 days ago

I run it and it returned nothing, but you were right that it is issue with howm, not with OpenBSD's find.

You see, when I execute find -L ~/howm -type f -name "*.org" -not -name ".*" -print0 it would return nothing, because there are not any *.org file in ~/howm. Howm uses *.txt extension by default, althought I edited use-package macro for howm to enable working with org, because by default howm will use its own format. Howm can be combined with org because howm is minor-mode. Here that part of ~/.emacs.d/init.el:

(use-package howm
  :init (setq howm-view-title-header "*"))

I renamed file from first post on this issue to have org extension, tested in document and bring it back to howm, but it still won't work, althought by now, we know what's going wrong.

Sorry, if there are any grammar mistakes in text, English is not my native mother tongue.

~l3kn 1 year, 29 days ago

Do you mean that the card from your first post is working with org-fc when saved as a .org file or is there still a problem with org-fc running on OpenBSD?

Org-fc should work for files with org-mode contents that have a .txt but this would require some extra configuration.

No worries about your grammar and feel free to write in Russian if that's more comfortable for you. That way I'll get some practice reading Russian, but I'll probably have to reply in English.

~artsi0m 1 year, 29 days ago

"~l3kn" outgoing@sr.ht writes:

Do you mean that the card from your first post is working with org-fc when saved as a .org file or is there still a problem with org-fc running on OpenBSD?

There is still problem with org-fc running on OpenBSD, althought I saved file with that card as .org inside path that my function for discovering paths in howm returns.

org-fc-review still return No cards due to review, no matter the context.

Org-fc should work for files with org-mode contents that have a .txt but this would require some extra configuration.

I would glad to try this extra configuration, if this even possible.

No worries about your grammar and feel free to write in Russian if that's more comfortable for you.

I think that I should stick to English in this particular place.

That way I'll get some practice reading Russian, but I'll probably have to reply in English.

You can send me mail to karakin2000@gmail.com and suggest some topic to discuss in Russian and I can write an respond. It would be nice and interesting and I would answer. Althought maybe not as soon as possible because of my studies in university.

Frankly speaking, due to sourcehut capabilities I am already writing this in the email client, which happens to be gnus.

And thank you for the effort you've done to create this flashcards package.

~l3kn 1 year, 29 days ago

Very odd, I've tried the following in a fresh OpenBSD 7.4 VM:

  1. pkg_add git, gawk and emacs
  2. install org-fc, cloning it from source
  3. create a directory "/root/cards" and copy "demo.org" from the org-fc sources to this folder
  4. set org-fc-directories to '("/root/cards")

Selecting all when running org-fc-dashboard then shows me all 5 cards.

I don't think using "/root/cards" or "~/cards" makes a difference. I had to use a full path because for some reason I can't type a "~" in the VM.

If org-fc-demo works for you, this should too.

~mesaoptimizer 1 year, 24 days ago

For what its worth, I use OpenBSD and org-fc ran fine on it after installing gawk. I don't recall fiddling with anything to make it work out of the box.

~artsi0m 1 year, 22 days ago

So glad that sourcehut is up and I can finally describe what was the real issue. As I said in email, the problem was with the file with card having DOS line endings, when saved with UNIX line endings (with C-x f utf-8-unix or M-x set-buffer-file-coding-system utf-8-unix) card worked well, it was found by indexing script, I reninitialized it, and reviewed and all worked fine.

And of course file should have *.org extensions, but I configured it for howm with this code:

(use-package howm
  :init (setq howm-view-title-header "*")
  (setq howm-file-name-format "%Y/%m/%Y-%m-%d-%H%M%S.org"))

~artsi0m 1 year, 22 days ago*

mesaoptimizer, thanks for responding to this issue.

Turns out, it is more Windows in dualboot with OpenBSD problem, than OpenBSD by itself problem. I am happy, that I am not the only one who use OpenBSD, emacs and learning something with flashcards.

And, by the way, I think this issue could be named «org-fc-review won't work with CRLF line endings». Don't know how to rename it though.

~l3kn 1 year, 22 days ago

Good to hear that you found a way to make it work!

I think there are at least some people who use org-fc on Windows and I suspect on there, gawk will be configured differently so it uses the correct line endings. Creating files on Windows and reviewing them on a OS where gawk assumes other line endings would then prevent it from correctly parsing the files.

There should be a way to configure AWK so it accepts both kinds of line endings but I'm not sure if this will affect how fast it runs. If you want to keep moving files between operating systems or save the effort of having to convert each file, we can look into ways of fixing this and try e.g. setting RS = "\r?\n" in the AWK scripts.

~artsi0m 1 year, 20 days ago

If you want to keep moving files between operating systems or save the effort of having to convert each file, we can look into ways of fixing this and try e.g. setting RS = "\r?\n" in the AWK scripts.

Yes, I want to keep moving files between operating systems. I have a shared partition where git bare repository with this files located.

I would be happy to make setup work on windows too, and it seems that I will continue to use org-fc on OpenBSD in the near future.

~l3kn 1 year, 20 days ago

I've pushed a new version of org-fc that should support different kinds of line endings. You can enable this with (setq org-fc-awk-mixed-line-endings t).

Please let me know if this works for you. With a file where I replaced each "\n" with a "\r\n" setting the variable makes the difference between org-fc not finding any cards and finding the cards but I haven't tried to review them.

Register here or Log in to comment, or comment via email.