felko / neuron-mode

An emacs mode for editing Zettelkasten notes with neuron
GNU General Public License v3.0
118 stars 21 forks source link

Adding new tags #35

Closed thoreinstein closed 4 years ago

thoreinstein commented 4 years ago

A little spelunking has surfaced an issue or maybe non-issue that I think deserves discussion. There are currently two functions for "adding" tags to a zettel, neuron-add-tag and neuron-insert-tag. I can see the differences in both, however I am slightly confused as to their naming versus their intention.

From the naming I would expect add to add a new tag and insert to insert and existing tag, though that is not the case. BOTH only query the existing tag set and present them via an ivy-read call. add attempts to do the correct thing but doesn't add text for a new tag.

I think a bit of refactoring neuron--select-tag-from-query is needed to properly return the text if it is a new tag. I am open to working on that, but wanted to open a discussion about the intended functionality before slamming in a PR.

felko commented 4 years ago

I can see the differences in both, however I am slightly confused as to their naming versus their intention.

Right that's a bit confusing. neuron-insert-tag was my previous (poor) attempt at automating the addition of a tag to the current zettel, so I think the function can be completely deleted now, since neuron-add-tag provides a way better way of doing this, unless someone can think of a use for inserting tags in the zettel body.

From the naming I would expect add to add a new tag and insert to insert and existing tag, though that is not the case.

There are two things to distinguish: adding a new tag to the current zettel (which is what neuron-add-tag does) and adding a new tag to the zettelkasten.

BOTH only query the existing tag set and present them via an ivy-read call. add attempts to do the correct thing but doesn't add text for a new tag.

What exactly do you mean by "adding text for a new tag"? If you're talking about adding the tag in the zettel YAML metadata block then that's now possible thanks to #33 which was just merged.

More generally, I agree that the code needs to be refactored a little bit, since I have basically been learning elisp along with writing neuron-mode. In particular, I exclusively use (interactive) to expose the functions to M-x, without taking advantage of its possible arguments, which could reduce the size of the code I think.

thoreinstein commented 4 years ago

Ah, I see, I must have missed #33 when was perusing earlier, or it was merged right before I looked. That is the exact issue I was looking at fixing myself. Fantastic work on this, and thanks for taking the time.

srid commented 4 years ago

unless someone can think of a use for inserting tags in the zettel body.

Tangential note: support for tags in zettel body is in neuron's roadmap. https://github.com/srid/neuron/issues/189

felko commented 4 years ago

unless someone can think of a use for inserting tags in the zettel body.

Tangential note: support for tags in zettel body is in neuron's roadmap. srid/neuron#189

Ah right, I forgot about that, so I suggest we leave neuron-insert-tag for now and eventually change its functionality to do something like (insert "#%s" (neuron-select-tag)).