d12frosted / vulpea

A collection of functions for note taking based on `org` and `org-roam`.
GNU General Public License v3.0
242 stars 12 forks source link

Provide interactive interface for vulpea-meta #98

Closed d12frosted closed 3 years ago

d12frosted commented 3 years ago

Some context - https://github.com/d12frosted/vulpea/discussions/96.

In short, it would be nice to have interactive interface to modify metadata lists, e.g. vulpea-meta-add and vulpea-meta-remove. It should use note at point or read a note interactively. And should support list keys.

d12frosted commented 3 years ago

@hyan46 I've added interactive functions to manipulate meta via https://github.com/d12frosted/vulpea/commit/937ae09f0321ae0793950ea0f6113d8100c086ab (available in feature/org-roam-v2 branch):

Would be glad to have some feedback.

hyan46 commented 3 years ago

@hyan46 I've added interactive functions to manipulate meta via 937ae09 (available in feature/org-roam-v2 branch):

  • vulpea-meta-add
  • vulpea-meta-add-list
  • vulpea-meta-remove
  • vulpea-meta-clean

Would be glad to have some feedback.

Thank you very much, @d12frosted ! It works pretty well now. A quick question, what is the current behavior if we like to add a new meta to an existing tag? It seems that the current vulpea-meta-add will overwrite the existing tag. Should I use vulpea-meta-add-list for this purpose? I probably don't fully understand the meaning of list meta yet.

d12frosted commented 3 years ago

When you simply add (better name would be set) you override any existent value with the same key. So this operation doesn't allow multiple values for the same key, or in other words, key can be used only once. List allows it to be repeated.

Cheers, @.***

On Thu, Jul 15, 2021 at 10:14, Hao Yan @.***> wrote:

@.***(https://github.com/hyan46) I've added interactive functions to manipulate meta via 937ae09 (available in feature/org-roam-v2 branch):

  • vulpea-meta-add
  • vulpea-meta-add-list
  • vulpea-meta-remove
  • vulpea-meta-clean

Would be glad to have some feedback.

Thank you very much, @.***(https://github.com/d12frosted) ! It works pretty well now. A quick question, what is the current behavior if we like to add a new meta to an existing tag? It seems that the current vulpea-meta-add will overwrite the existing tag. Should I use vulpea-meta-add-list for this purpose? I probably don't fully understand the meaning of list meta yet.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

Cletip commented 2 years ago

Hello, Is there a function that returns a list of available metadata for a note ?

d12frosted commented 2 years ago

@Cletip since you are asking in the context of 'interactive inteface', I need more details. Do you want an interactive function that will present a list of note metadata? Or just a non-interactive function like vulpea-note-meta?

In the first case there are no plans for that as you already have metadata inside your note :) Just open it and that's it.

In the latter case, it's already there and is used by vulpea-note-meta-get and vulpea-note-meta-get-list. But keep in mind that it contains raw data (e.g. each value is a list of not parsed strings). But maybe this is what you want.

Cletip commented 2 years ago

Oh, gee, I'm sorry I didn't see the "interactive". Sorry to have restarted this issue for nothing. I want a simple function that takes a note as a parameter and returns a list of the metadatas of that note, without their associated values and non-interactive.

Thanks for the "vulpea-note-meta" function, I don't know how or why I didn't see it before (I had only seen "vulpea-meta"), now the solution seems obvious.

Here is the function (feel free to change the name, description etc):

  (defun vulpea-note-meta-get-list-of-name (note)
  "Get a list of name of metadata from NOTE"
  (mapcar 'car (vulpea-note-meta note))

Sorry again to have restarted this issue for nothing ^^ And thanks again for your help ;)

d12frosted commented 2 years ago

pff @Cletip no worries :) this is why we have these communication mediums like github issues!

yup, in your case you can simply do (mapcar 'car (vulpea-note-meta note). IMO it's not worth a separate function in vulpea, but I will keep an eye on that.

let me know if you have any other questions ;)

P.S. i remember about tag inheritance, i just need more time to process everything after vacation

Cletip commented 2 years ago

Ok cool :)

No other questions, but if I have any other questions, I will open a new issue XD

No problem for tag inheritance, take your time !