Open mediapathic opened 3 years ago
The Zetteldeft approach does indeed assume IDs for each note. That said, it shouldn't be too hard to prevent errors such as these. In fact, I remember running into this as well and thought it was fixed already. I'll look into it when I have some time.
Eh, so I took a look already. The following code should work even when filenames don't contain an ID. It overwrites a helper function. Let me know if it works for you.
(defun zetteldeft--list-entry-file-link (zdFile)
"Insert ZDFILE as list entry."
(let ((id (zetteldeft--lift-id (file-name-base zdFile))))
(insert zetteldeft-list-prefix)
(when id
(insert zetteldeft-link-indicator
id
zetteldeft-link-suffix
" "))
(insert (zetteldeft--lift-file-title zdFile)
"\n")))
It sort of works. It no longer errors on the creation of the list, but only some of the links are created. Here is a sample, with links made visible in org mode:
- [[202102120951]] A Garde
- [[202102150638]] Zetteldeft docs
- [[202009240000]] ---
- tags: #newsletter #jobsheet #MOC #active
- 000 org-index
- tags: #active #gigs #MOC #writing
As far as I can tell:
#+title
field, not the filename, which I suppose makes sense.I hope this is useful and not just random noise!
I think the issue here is with how the titles are extracted from each of these notes. This is done via deft-parse-title
, so if Deft misinterprets the title, it will be mangled in the lists as well.
I've found a behavior in zetteldeft that is a bug for my use cases, but may not be given the way you designed things.
The function
zetteldeft-insert-list-links
works perfectly well with filenames that are formed as you intended, i.e. with a UID in the filename. However, with filenames that do not have a UID, the function aborts with an error.I realize that my use case here is, again, not as you have this designed. But I would argue that there may be more people than me who would want to use this functionality. Between the work I've done and the suggestions you've made here, I believe I'm 90% to a way of operating with bare filenames. And I think we agree that a non-UID file naming scheme is not optimal, but it happens often enough that I'd like to be able to tell people that it's usable.
Basically I'm saying-- if this is an easy fix I think you should do it, and if it's not, don't bother.
I'll see if I can figure out some code for this, but I have little faith in my lisp abilities to do so. Is this worth you looking at?