| categories: | tags: | View Comments

I have played with a lot of options to give org-mode links extra functionality. Here are a few of the ideas I have looked at so far.

1. Enabling right clicks on links
3. A helm buffer in org-ref

Here, I want to explore a hydra menu for a link. The idea is pretty simple, we need functions that do something with the link at point, and a hydra interface to call them. This turned out to be a little tricky. I could not get the path from the link in the link lambda function, and we need a way to pass the path to the function. I use a global variable for that. I wish there was another way to do that, but this does actually work. We illustrate it here with a more functional doi link.

(defun doi-crossref ()
"Search DOI in CrossRef."
(interactive)
(browse-url
(format
"http://search.crossref.org/?q=%s" *doi-hydra-path*)))

(interactive)
(browse-url
(format

(defun doi-pubmed ()
"Pubmed the doi."
(interactive)
(browse-url
(format
"http://www.ncbi.nlm.nih.gov/pubmed/?term=%s"
(url-hexify-string *doi-hydra-path*))))

(defhydra doi-hydra ()
"org-ref"
("c" doi-crossref "Crossref")
("p" doi-pubmed "Pubmed"))

(lambda (path) (setq *doi-hydra-path* path) (doi-hydra/body)))

 lambda (path) (setq doi-hydra-path path) (doi-hydra/body)

Now for a test, 10.1021/jp047349j.

It works fine, when you click on a link, you get a minibuffer menu with context hints, and pressing any other key than is defined simply cancels the command.