The answer is to use elisp:
org-mode links more, and combining them with named keyboard macros gives us this solution:
For example, starting the org agenda for the current day: I want to do the same thing that C-c a a
does. Hyperbole's implicit buttons let me just do M-RET
on {C-c a a}
. We can do the same thing in org:
- Record a keyboard macro that does what you want. Or...don't, and just take your existing Hyperbole thing and copy the relevant string. Or use the strategy below with
funcall
and kmacro
.
- Name the macro:
name-last-kbd-macro
. Call that my-start-org-agenda
.
- Insert the macro with
insert-kbd-macro
to give it an alias that the elisp:
link can use. That gives me:
(defalias 'start-org-agenda
(kmacro "C-c a a"))
- Make elisp call that: in your org-mode buffer, just put in
elisp:start-org-agenda
or [[elisp:start-org-agenda][run org agenda!]]
.
Now you follow the org mode link as usual, and it does the same thing.
You may consider marking that as safe to call or otherwise making org
not pester you about evaluating that lisp.
That lets me replace almost all of my Hyperbole use. And for slightly more complex bits, you can write a function to "parametrize" your call: do, say,
(defun start-org-agenda-and-send-useless-message (msg)
(start-org-agenda)
(message "You said '%s'." msg))
and make your link on: [[elisp:(start-org-agenda-and-send-useless-message "from an elisp link")][hello]]
.
If you want to parameterize the actual keyboard macro, it seems you can use funcall
: continuing my silly example with the org-mode agenda, say you want a function that will launch various flavors of the agenda via C-c a TYPE
:
(defun do-some-agenda-command (cmd)
"Launch the org agenda with command `cmd'."
(interactive)
(let ((the-macro-string (format "C-c a %s" cmd)))
(funcall (kmacro the-macro-string))))
Then replace Hyperbole things like {C-c a a}
and {C-c a t}
with elisp:(do-some-agenda command "a")
and elisp:(do-some-agenda-command "t")
.