3

How do you execute multiple actions on a single org-link?

Org-mode has links that can initiate actions, such as elisp: and shell:. It would be nice to initiate several such actions on following a single link.

Just creating a shell-file containing the tasks is possible, but seems inelegant.

How is this best done?

3

1 Answer 1

3

You can separate shell commands with a ;, like so:

[[shell:whoami%3B%20id][Two commands]]

The link you type in would be shell:whoami; id (it's stored in the document with special characters encoded).

Similarly, for Emacs Lisp, the link you type in might be:

elisp:(progn (message "Hello") (message "World!"))
2
  • For shell scripts, cmd1 && cmd2 might be better as it only executes the second command if the first succeeded.
    – erikstokes
    Aug 19, 2015 at 23:35
  • Works for several shell commands or several elisp commands. How would you execute two shell commands and then open a file?
    – serv-inc
    Aug 20, 2015 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.