1

A recent feature request raised a new area of integration/customization for me. I've developed a package to browse GitHub content and we'd like to be able to store a link to the current 'thing' using org-store-link (C-c C-l). Problem is – it doesn't seem like I can change the behavior of the https? protocol without completely replacing it.

At any given time, there are multiple things you might want to get the link for – and they'd all be https? links. How can I define multiple functions for a link type such that they can provide multiple options? Reading org-link-parameters and org-store-link-functions, this doesn't appear to be possible.


Pursuant to the comments below…

This is for proposed Magithub functionality. Magithub is a Magit-based GitHub client that can view issues, pull requests, and comments (among other things). You can choose to visit the current 'thing' in the browser using w, though sometimes the current 'thing' is ambiguous. For example, if point is at a comment, it is also technically at an issue or PR. Point could even be at a link within a comment on an issue – and now there are three distinct link candidates for storing. Ideally, org-store-link should at this point prompt for which link should be stored (which does appear to be possible per the results-alist variable in the definition). The list of functions though comes from the return of org-store-link-functions which collects over org-link-parameters, so it seems it's not as simple as adding a function to a list.

When org-store-link completes, I'm guessing org-stored-links would just have a list ("some human-readable title I define" "https://github.com/some/project/issues/123") added as an element.

  • I don't have time right now to read your question carefully (sorry), but maybe an Org link that invokes a bookmark would help? The bookmark invocation can do anything you like. – Drew Feb 17 '18 at 16:04
  • IMHO If you need special functionality for certain https entries changing the :action property in the https entry of org-link-parameters is just wrong. Better define a new entry with a new protocol type in org-link-parameters. If I understand your answer to the feature request right you already suggested something like that with github:. The function registered as :action-property of that protocol can open a popup-menu (defined e.g. with easy-menu-define). – Tobias Feb 17 '18 at 20:59
  • @tobias I have a feeling though people will want to use use http links more. After that I could just add a browse-url handler. – Sean Allred Feb 17 '18 at 21:23
  • Changing :action is indeed entirely inappropriate. – Sean Allred Feb 17 '18 at 21:29
  • Yes :action is inappropriate since I actually meant :follow;-). – Tobias Feb 17 '18 at 21:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.