EFLS / zetteldeft

A Zettelkasten system! Or rather, some functions on top of the emacs deft package.
https://efls.github.io/zetteldeft
GNU General Public License v3.0
394 stars 42 forks source link

initialized zetteldeft at start #116

Open AtomicNess123 opened 3 years ago

AtomicNess123 commented 3 years ago

Is there a way to start emacs with initialized zetteldeft (to avoid waiting in the first note creation)? Thanks!

EFLS commented 3 years ago

I'm not sure I understand your question. Do you mean configure Emacs so that Zetteldeft loads at the start?

Or is the issue that you manually need to launch Deft before you can create a new Zetteldeft note?

AtomicNess123 commented 3 years ago

The issue is, everytime I do M-x zetteldeft-new-file, I enter the name of the note and then I must wait while "initializing deft".

gklimowicz commented 3 years ago

This seems like a timing issue with package initialization. Why not just load and run deft automatically when loading zetteldeft. If you use use-package, run (deft) in :config, perhaps?

EFLS commented 3 years ago

Why not just load and run deft automatically when loading zetteldeft. If you use use-package, run (deft) in :config, perhaps?

Yeah, or instead of using (deft), use (deft-cache-initialize). That should load the cache at startup, rather than when you launch Deft for the first time.

The issue is, everytime I do M-x zetteldeft-new-file, I enter the name of the note and then I must wait while "initializing deft".

Do you really mean every time? Deft should only initialize the first time. Then it's ready to go.

AtomicNess123 commented 3 years ago

Yeah, or instead of using (deft), use (deft-cache-initialize). That should load the cache at startup, rather than when you launch Deft for the first time.

I put this line after (require 'deft) in my init and restarted Emacs. However, when I create a new Zetteldeft note... I see again the "deft initializing" message, taking some time.

Do you really mean every time? Deft should only initialize the first time. Then it's ready to go.

No, I stand myself corrected: just the first time when I start Emacs.

EFLS commented 3 years ago

Can you share more of your init file? My guess would be that Deft loading is still somehow delayed

AtomicNess123 commented 3 years ago

This is all my deft and zetteldeft config:

(require 'zetteldeft)
(require 'deft)
(deft-cache-initialize)
(setq deft-default-extension "org")
(setq deft-extensions '("org" "md" "txt"))
(setq deft-directory "~/Documents/Zettel/")
(setq deft-recursive t)
(setq deft-use-filename-as-title t)
(global-set-key [f8] 'zetteldeft-new-file)
(setq deft-new-file-format zetteldeft-id-format)
EFLS commented 3 years ago

Not sure if it will make a huge difference, but you could try this order:

(require 'deft)
(setq deft-default-extension "org")
(setq deft-extensions '("org" "md" "txt"))
(setq deft-directory "~/Documents/Zettel/")
(setq deft-recursive t)
(setq deft-use-filename-as-title t)
(deft-cache-initialize)
(deft-cache-update-all)
(require 'zetteldeft)
(global-set-key [f8] 'zetteldeft-new-file)
(setq deft-new-file-format zetteldeft-id-format)

I also added deft-cache-update-all

AtomicNess123 commented 3 years ago

The reordering did not work, unfortunately! Not sure what it is anymore at this stage!

EFLS commented 3 years ago

Can you check which version of Zetteldeft you are using? Assuming you installed via MELPA, what's the package's date?

AtomicNess123 commented 3 years ago

Thanks, it is: 20210602.841