0

Sometimes I use the diary instead of org-mode to add meetings to the org-agenda, and occasionally these include links to emails or websites in the standard org format: [[https://duckduckgo.com][link here]]. The display looks fine, i.e., the previous link would appear highlighted in blue displaying "link here", but for some reason org-agenda-open-link or C-c C-o do not open the link and instead return user-error: Before first headline at position 62615 in buffer .diary. I can get it to work by using org-open-at-point or by mouse-clicking the link, but I cannot shake the feeling that this is not normal.

A MWE is a .diary entry containing

21 Mar 2023 Today is a great day (as any other) to surf the web using [[https://duckduckgo.com][this search engine]]

and then if I go to the agenda buffer a "search engine" link shows up on 21 Mar but I cannot open it with C-c C-o (only by mouse clicking it).

So my questions are 1) if org-agenda-open-link is meant to be used to open such links, and if so, 2) why am I unable to open them with my setup? Thank you in advance for any help.

0

1 Answer 1

1

org-agenda-open-link is very picky: it assumes that it is called from the agenda and it also assumes that it can call org-offer-links-in-entry to calculate the links. org-offer-links-in-entry works in the target buffer (the diary buffer in this case) and assumes that the target buffer is an Org mode buffer, which is not true in this case: it does an org-back-to-heading and that fails with the user error you see.

Clicking on the link with the mouse runs org-open-at-mouse which works since it only looks around the mouse click point to discern a link. It does not make any assumptions about the buffer it is run in (but the binding is only valid in Org mode and related buffers - like Org agenda buffers).

You can set org-agenda-diary-file to the path of an Org mode file that is used for diary purposes. You lose the ability to modify it from the calendar, but if you don't care about that, that might be a good solution for you.

1
  • Thanks for the explanation and potential solution. I find it strange that something can be accomplished in emacs with a mouse click but there is no equivalent keybinding. There are probably other reasons why org-agenda-open-link is so picky and this cannot/should not be changed.
    – Ajned
    Commented Mar 21, 2023 at 14:39

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.