Skip to content
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

There should be a command to add a link description to the destination's #+ROAM_ALIAS #1149

Closed
1 task done
spacekitteh opened this issue Sep 28, 2020 · 7 comments
Closed
1 task done
Labels
1. enhancement Requests to add new functionality

Comments

@spacekitteh
Copy link
Contributor

spacekitteh commented Sep 28, 2020

Brief Abstract

In order to more easily populate the #+ROAM_ALIAS field, there should be a command to add a link's description to the destination's alias field.

Long Description

  • Point should be in the link to an org-roam note
  • The command should should copy the link's description
  • If there is no #+ROAM_ALIAS: for the destination, create one. Note that for id links, this means there should be a :ROAM_ALIAS: property, treated just like the #+ROAM_ALIAS file header
  • Add the copied link description to the destination's ROAM_ALIAS field, adding quotes if necessary

This should not bring up the destination's buffer.

Please check the following:

  • No similar feature requests
@spacekitteh spacekitteh added the 1. enhancement Requests to add new functionality label Sep 28, 2020
@d12frosted
Copy link
Contributor

🤔 I've spent some time trying to better understand your use case, so let me share my thoughts and please let me know if I missed the point 😸

From my experience, I need an alias in two cases - when (1) I want to open a note or when (2) I link a note. Both of them rely on searching for a note, but use cases are different.

(1) So when I just want to open a note and I realise that it requires an alias, I open the file by original name and add an alias using +org-notes-alias-add (and +org-notes-alias-delete for removal). You can find their definition in this gist (it originally describes how to set tags). It doesn't support :ROAM_ALIAS: property for headers, and this is something I will add.

(2) When I want to link a note, if I realise that the note requires an alias, I usually stop linking process, open a note and the task boils down to the (1) scenario. But here comes your interesting proposal - to link using an old name and be able to add an alias for the linked note without opening it! It actually might be useful in other scenarios - even for long existing links.

@spacekitteh Is that right? :)


That being said, @jethrokuan would you be interested to get a PR with functions to add/remove roam tags/aliases? I believe it might be useful by itself and possibly for resolving this issue.

@spacekitteh
Copy link
Contributor Author

That's pretty much it. For example, I have a lot of "definition" notes, and I like to add aliases for, e.g. plural forms of the title, the initial letter capitalised, adjective forms, synonyms, etc, so that links are suggested in more cases. A concrete example:

#+TITLE: Topological solitons are solutions to a field theory homotopically distinct from the vacuum solution
#+FILETAGS: :definition-note:topology:
#+ROAM_ALIAS: "topological solitons" "solitons" "soliton" "topological soliton" "topological defect" "Topological defect" "Topological defects" "topological defects"
<the content>

When I'm writing in another note, say I write "topologically defective". Currently write that, then mark it, and C-c n i for (e.g.) topological defect. I would like to do either of these things:

  1. After marking it, instead of C-c n i, run a hypothetical command like org-roam-add-alias-and-insert which would work like org-roam-insert-link, except it would also add the alias to the target note. This could be implemented by...
  2. If point is in a link with a description that doesn't match an existing title or alias, add it to the aliases of the linked note.

@jethrokuan
Copy link
Member

That being said, @jethrokuan would you be interested to get a PR with functions to add/remove roam tags/aliases? I believe it might be useful by itself and possibly for resolving this issue.

Sure. Tags was a pretty ad-hoc thing, but if people are using it extensively (I'm not), it makes sense to have first-class support for it, probably under its own file.

@spacekitteh the example you gave above suggests to me that tags is just a makeshift solution for a deeper issue. You'd like to be able to find/link to notes, based on some stemmed version of your original phrase.

e.g. searching for "topological defects" should also show "topological defect"

I think it makes more sense to look into finding or building completion frameworks that support these.

@d12frosted
Copy link
Contributor

@jethrokuan cool, I will prepare it in few days.


@jethrokuan I think that @spacekitteh example is not about tags and search, but rather about aliases and how links are titled when using org-roam. In many contexts you don't want to have a fully qualified name of the note (for the sake of readability), so you have to put many aliases. For the sake of search many of the aliases are pointless as ivy/helm would find the note by substring by default.

e.g. searching for "topological defects" should also show "topological defect"

On the first though it sounds cool, but then I realised that in order to type plural form, one has to type singular form meaning that 'topological defect' will be found anyways.

@spacekitteh wdyt? :)

@d12frosted
Copy link
Contributor

Oh, actually I had some time now, so here is PR: #1183

@spacekitteh
Copy link
Contributor Author

Yep, this is not about tags or searching at all :)

#1183 is a great start; it shouldn't be much more difficult to make a wrapper function to add it to the link at point!

@jethrokuan
Copy link
Member

v2 has org-roam-alias-add, but Org-roam doesn't cache the link description, only the link path when building the database, so there isn't a fast way to do this. There are no plans to cache the description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. enhancement Requests to add new functionality
Projects
None yet
Development

No branches or pull requests

3 participants