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 zetteldeft-insert-tag #107

Closed puzan closed 3 years ago

puzan commented 3 years ago

Add zetteldeft-insert-tag function which helps to find existed tag and insert it in the current point.

EFLS commented 3 years ago

This looks very promising! I hope to find some time to check it out soon

EFLS commented 3 years ago

Seems to work nicely. I've updated some notes on documentation.

The current function inserts the tag at point, but it would be nice to automatically add the tags at the correct spot. Not sure how to achieve this easily. Perhaps by finding a string that indicates which line tags belong to?

EFLS commented 3 years ago

I've updated the function to find the correct spot, which is the line starting with zetteldeft-tag-line-prefix. You'll have to customize it to make it work, but can you try it out and let me know whether it works?

puzan commented 3 years ago

@EFLS It works for me. Looks good! I have tested with the following config for markdown files:

(setq zetteldeft-tag-line-prefix "^Tags: ")
EFLS commented 3 years ago

Great, thanks for the feedback. I should think further about a default setup (as there currently is no tag line configured), and then merge the PR

puzan commented 3 years ago

I think it will be good to have two options:

It seems it is better to use two separate functions. What do you think?

EFLS commented 3 years ago

Excellent suggestion. Best to split into two functions indeed, which gives the most user freedom and doesn’t require configuring the tag line prefix string for people to insert tags interactively.

puzan commented 3 years ago

@EFLS Are you going to update the code yourself? Or do you expect this from me?

I think I can find time tomorrow to split functions.

EFLS commented 3 years ago

I'm still thinking about the best approach. Perhaps we can have a single function, but depending on whether zetteldeft-tag-line-prefix is set or nil, the tag is inserted at the line or at point. So actually very close to the current function (but without the message). This would make it easier for the user: only one function and one keybinding. Does this make sense? Or would you prefer two separate functions?

EFLS commented 3 years ago

I changed my mind yet again and now include two functions:

This should provide the most user convenience, I think.

puzan commented 3 years ago

@EFLS Looks good! Could we merge this solution? Do you expect something from me for this PR? I'm ready to help.

EFLS commented 3 years ago

Done!