-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zetteldeft-insert-list-links fails if no UID in filename #105
Comments
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:
As far as I can tell:
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 |
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?
The text was updated successfully, but these errors were encountered: