emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

storing a link to a task from an agenda view


From: Alan Schmitt
Subject: storing a link to a task from an agenda view
Date: Sat, 21 Nov 2020 10:30:48 +0100

Hello,

I'm trying to store a link to a task while the cursor is on it in the
agenda view. I tried ~org-store-link~ on it, but it tells me there is no
method to do so. So I looked at some of the org-agenda code to find a
way to get to the underlying task, and I tried this:

#+begin_src emacs-lisp
(defun as/mk-agenda-link ()
  (interactive)
  (let* ((marker (or (org-get-at-bol 'org-marker)
                     (org-agenda-error)))
         (buffer (marker-buffer marker))
         (pos (marker-position marker)))
    (with-current-buffer buffer
      (save-excursion
        (goto-char pos)
        (org-store-link nil)
        ))))
#+end_src

but it does not store anything. (I have to put the ~nil~ at the
~org-store-link~ code otherwise I have an error, and looking at some of
the ~org-capture~ code, I saw it there.)

Do you have suggestions on how to store such a link from an agenda view?
It can either end up in ~org-stored-links~ or captured in a variable.

Thanks,

Alan

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]