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

Add a function named zetteldeft-upsert #95

Open maw opened 3 years ago

maw commented 3 years ago

ref https://github.com/EFLS/zetteldeft/issues/94

@EFLS I started using this today. I bound it to C-c d u.

I wouldn't accept this as-is (if nothing else, the name doesn't fit with the general aesthetic you've laid out for zetteldeft commands) but I hope it can be the basis for something that is inclusionworthy.

For completeness' sake, I think there should be equivalent functions for zetteldeft-new-file-and-backlink and zetteldeft-new-file-and-link. It might be worthwhile to rework them all.

EFLS commented 3 years ago

I've just tried the zetteldeft-upsert function to better understand what it does, but get an error:

(wrong-type-argument stringp :preselect)

Any idea what I'm missing?

maw commented 2 years ago

I finally had a look at this. It turns out that :preselect and :initial-input are ivy-readisms.

348678197b48eeff5e7a013a3863d28875abd955 fixes it, sort of. But the end result is far worse.

I think it could be improved by filtering the result of deft-find-all-files-no-prefix before passing them to the completing reader as options, although losing :preselect would still be unfortunate.

I'm sorry for taking so long to respond.

maw commented 2 years ago

@EFLS I've been using a personal branch for months which includes my completing read enhancements and this upsert functionality.

I can't remember for sure but I think what I did was create the upsert code in my personal branch which already included my completing read changes. Then I cherry-picked it back into a branch dedicated to upsert -- but I made mistakes, which you bumped into in https://github.com/EFLS/zetteldeft/pull/95#issuecomment-811356813.

I think it'll be easier to clean this up over once https://github.com/EFLS/zetteldeft/pull/91 lands.