l3kn / org-fc

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

org-fc hydra like bar in minor mode implementation #32

Closed natask closed 4 years ago

natask commented 4 years ago

are there plans to include a hydra like bar in the bottom for the minor mode implementation? What I liked with the hydra implementation is that I can see the keys I need to press on the bottom. Thanks

Tubo commented 4 years ago

There should be one by default. Are you not seeing the bottom hydra bar, like below?

image
l3kn commented 4 years ago

@natask I'll see if I can come up with something. The easiest solution would be to show a message listing all keys each time one of the modes is entered. One problem with that is that the minor-mode keymaps don't include labels like "Flip" and "Quit", only the function names (org-fc-review-flip and org-fc-review-quit).

How do you like the new header-line showing the review progress?

@Tubo With a recent commit the two hydras have been replaced by two minor modes and the status line (cards remaining / percent right) has been moved to the header-line of the buffer.

l3kn commented 4 years ago

A quick workaround might look like this:

(defun org-fc-review-flip-mode-hint ()
  (message "[RET] Flip [s]uspend [q]uit"))

(defun org-fc-review-rate-mode-hint ()
  (message "[a]gain [h]ard [g]ood [e]asy [s]uspend [q]uit"))

(add-hook 'org-fc-review-flip-mode-hook #'org-fc-review-flip-mode-hint)
(add-hook 'org-fc-review-rate-mode-hook #'org-fc-review-rate-mode-hint)

2020-06-26_hints

There's an option to define keymap entries with an additional string, however I've not found any information on what this is used for.

(setq org-fc-review-flip-mode-map
  (let ((map (make-sparse-keymap)))
    (define-key map (kbd "RET") '("Flip" . org-fc-review-flip))
    (define-key map (kbd "q") '("Quit" . org-fc-review-quit))
    (define-key map (kbd "s") '("Suspend". org-fc-review-suspend-card))
    map))

These strings could be used for the labels in the hint message, but that would require some logic for formatting (kbd "RET") as RET instead of ^M.

natask commented 4 years ago

the workaround you recommend works fine for my current workflow. I would imagine that the second approach works well for letters. therefore Even without support for formatting in the beginning, it would clean to integrate keymap configurations with bottom bar messages and display most of them as expected.

l3kn commented 4 years ago

I've added a contrib/ directory for extensions like this that might be more experimental / unstable than "core" org-fc.

You can enable keymap-hints with (require 'org-fc-keymap-hint).

l3kn commented 4 years ago

One thing I dislike about the current implementation is that there are two ways keys are shown:

  1. At the bottom of the buffer when flipping / rating cards
  2. in the header line when editing cards

Removing the rating stats from the header line, the flip / rate keys could be shown there, too.

Because the header line can't contain linebreaks (as far as I know) this would not scale well for larger keymaps, but at least it would be consistent.

Any opinions on this?

l3kn commented 4 years ago

Closing, moved to https://todo.sr.ht/~l3kn/org-fc/6