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

Disable defaulting to find-file when the file is not found in the deft folder #115

Closed iburunat closed 3 years ago

iburunat commented 3 years ago

Hi, I asked earlier in the Deft package page (no answers yet) about being able to disable defaulting to find-file when the file is not found in the deft folder, so a new file is created using deft-new-file-format template for creating new notes. I was wondering if this is possible.

EFLS commented 3 years ago

I'm not sure what you mean, can you be a bit more detailed about what you want to achieve? You mean using the Deft search to create new files?

iburunat commented 3 years ago

Thanks and sorry for my incomplete and vague question. Let's try again :) :

As it is now, when I use zetteldeft-find-file to find a file that happens not to exist, a new blank file is created using the find-file basic command, which does not use the zetteldeft-new-file template.

In short: how to have zetteldeft-find-file have the same behaviour as zetteldeft-new-file when the file to be found does not exist and it is created on the spot? It would be handy that in those cases zetteldeft-find-file defaults to the same template used by zetteldeft-new-file. I hope I made myself understood! :)

Edit: the reason why I asked in the deft package page is because I think this behaviour seems to be related to deft rather than zetteldeft.

EFLS commented 3 years ago

Ah yes, I see what you mean. Not sure how to achieve this, though.

Currently, as you can see in the source code, zetteldeft-find-file uses completing-read and passes the result to deft-find-file. So I guess the file is created by Deft is it doesn't exist already.

Perhaps I could implement an extra check to see whether the result from completing-read actually exists, but not sure what to do then. Prompt the user again for a title? Use the filename as title? Filenames and file titles are different things in Zetteldeft. Not sure how to make something that is well integrated with the rest of the package and workflow.

iburunat commented 3 years ago

Yes, I realize now it's harder to implement this without messing the whole zetteldeft system. Instead of using the file name as a title, one possibility is (as you mentioned above) to prompt the user again for a title («file does not exist. Create new one?»). And then run zetteldeft-new-file instead. Would this be sensible without messing the package?

EFLS commented 3 years ago

Makes sense. Feel free to submit a PR if you feel up to the task, or I'll have a go in a couple of weeks when I've got more time for things like these.

iburunat commented 3 years ago

Not likely I can attend to this myself in the near future unfortunately. Thanks for your replies, though, and hopefully it can be implemented at some point!