l3kn / org-fc

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

use-package defer option doesn't work #51

Closed souew closed 3 years ago

souew commented 3 years ago

When I use defer t for use-package I can't run any of org-fc commands because it isn't loaded. How can I ensure lazy loading of org-fc?

; download org-fc manually
(when (not (file-directory-p "~/.config/emacs/custom-packages/org-fc/"))
    (shell-command "git clone https://git.sr.ht/~l3kn/org-fc ~/.config/emacs/custom-packages/org-fc/"))
(add-to-list 'load-path "~/.config/emacs/custom-packages/org-fc/")
....
(use-package hydra)
(use-package org-fc
    :ensure nil
    :defer t
    :load-path "~/.config/emacs/custom-packages/org-fc/"
    :custom (org-fc-directories '("~/documents/pim/flashcards/"))
    :config
(require 'org-fc-hydra)
(setq org-fc-source-path "~/.config/emacs/custom-packages/org-fc/"))
l3kn commented 3 years ago

In the use-package documentation it sounds like the issue might be that that loading of org-fc functions is never triggered.

Maybe using :bind or :commands with the main bindings/commands you use to interact with org-fc is a better option?

souew commented 3 years ago

Adding :bind for org-fc-dashboard exposes that command to be used when defer is t. I don't know what exactly gets loaded in that case, only that function or not, sorry I'm not a programmer, but I guess it will do.

l3kn commented 3 years ago

Does the dashboard show any useful information and can you start a review from there?

I can give it a try later this week and see if using :bind or :command with one of the main functions like org-fc-review or org-fc-hydra/body loads everything that's needed to use org-fc.

souew commented 3 years ago

Yes, after I get to dashboard all other functions also become available.

l3kn commented 3 years ago

That's good to know!

Can I close this issue?

souew commented 3 years ago

Of course.