0

I'd like to add links to custom agenda commands within org files and other agenda views.

I think the answer would likely use org-add-link-type.

I also know that you can call a custom agenda view with the following code:

(org-agenda nil "p")

But I don't know how to combine the two, or if it is even possible.

Ideally, I would like be able to create a heading that launches a custom agenda. Something like the following:

* [[Code which I don't know][View current project tasks by assignment]]

1

2 Answers 2

1

You don't need to define a new link type: you can have elisp links that execute an arbitrary Lisp form - because the code is arbitrary, they can be dangerous so you get a question whether you are OK with following the link. See External Links in the manual. For example:


* [[elisp:(org-agenda nil "p")][View current project tasks by assignment]]

N.B. No space between the colon and the opening paren!

0

If you get tired of answering yes each time, defining a custom link is as simple as

  (require 'ol) ; provides org-link-set-parameters; see `org-man-open' etc. for more example usage
  (org-link-set-parameters "agenda" :follow #'my-org-agenda-link-open)
  (defun my-org-agenda-link-open (letter _)
    "Open the agenda defined on LETTER."
    (org-agenda nil letter))

and then you get a link from an org file to your agenda with:

[[agenda d][Open the d agenda]]

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.