I’ve just started using Hook, and as an org-mode fan, I searched for integration with it and was very happy to find this thread!
Thanks @RobTrew for your script - that helped me enormously. I would like to also be able to link to an org headline in the way this is possible when you store an org-link within Emacs, but I can work on that.
I think I have found a solution for @seishonagon too: you can add custom URL formats to emacs org-mode fairly easily which use the macOS command
open to open the
What you need to do is add the following code somewhere in your init.el file (or wherever you customise Emacs in your setup):
(defun my/hook (hook)
"Create an org-link target string using `hook://` url scheme."
(shell-command (concat "open \"" hook "\"")))
(org-add-link-type "hook" 'my/hook)
The function tells Emacs what to do when you click a custom
hook:// link. We just wrap the hook URL in double quotes and then use the
open command to open it. The last line adds our new link type and tells it to call the function we have just written to handle those links.
There are fancier ways of building these links when allow autocompletion of possibilities and so on, but this works well enough for me.
Once you have restarted Emacs (or just executed that code) you should be able to call
(org-insert-link) (however you normally call it), then filter the list to find your new hook link. Paste the URL in and hit return, then add a description when prompted. Now you should be able to click that link and be taken to the file linked by Hook.
I’ve also set up a
template.org file in the custom templates folder and set that as the default for notes, so I am now a really happy bunny! Thanks so much for Hook Luc - it’s a really clever way to save each context of your work, and I’m really happy I can now use it with Emacs!