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

Update zettedeft-find-file, use non-matching input as new file title #126

Closed localauthor closed 2 years ago

localauthor commented 2 years ago

Fix #115

Adds option to use input as title for a new note.

cc: @iburunat

EFLS commented 2 years ago

Looks useful, thanks.

I'm trying to understand the code you added, could you explain what the following is meant for?

  (let* ((dir (expand-file-name deft-directory)))
    (unless (string-match (concat "^" dir) file)
      (setq file (concat dir "/" file)))
localauthor commented 2 years ago

It's a bit taken from deft-find-file, which adds the deft-directory prefix back onto the note file name before calling deft-open-file.

Since zetteldeft-find-file was just a thin wrapper around deft-find-file, extending it required some slight unwrapping and borrowing.

EFLS commented 2 years ago

Ah okay, that makes sense. Thanks for the clarification

iburunat commented 2 years ago

Thanks, another improvement to this could be to have the same title-prefix, -suffix, and id-format as a the standard Zetteldeft note, so it's formatted exactly like any other Zetteldeft note.

localauthor commented 2 years ago

It should do this already, since it uses zetteldeft-new-note to create the new note, and zetteldeft-new-note should take care of adding title-prefix, -suffix, and id-format. Is it not currently working that way on your end?

iburunat commented 2 years ago

It doesn't work like that on my end. What is zetteldeft-new-note? I can't find this function/variable.

localauthor commented 2 years ago

Sorry, the function is actually zetteldeft-new-file

iburunat commented 2 years ago

Thanks, weirdly enough, it's not working as it should, and I am using the updated package... it creates a blank file, without all the settings I have set for new files, such as (setq zetteldeft-title-prefix "#+TITLE: ") and (setq zetteldeft-title-suffix "\n#+STARTUP: overview, indent\n#+LAST_MODIFIED:\n\n").