* storing a link to a task from an agenda view
@ 2020-11-21 9:30 Alan Schmitt
2020-11-22 5:36 ` Ihor Radchenko
0 siblings, 1 reply; 3+ messages in thread
From: Alan Schmitt @ 2020-11-21 9:30 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1015 bytes --]
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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: storing a link to a task from an agenda view
2020-11-21 9:30 storing a link to a task from an agenda view Alan Schmitt
@ 2020-11-22 5:36 ` Ihor Radchenko
2020-11-22 11:07 ` Alan Schmitt
0 siblings, 1 reply; 3+ messages in thread
From: Ihor Radchenko @ 2020-11-22 5:36 UTC (permalink / raw)
To: Alan Schmitt, emacs-orgmode
> 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.
(org-store-link nil) -> (org-store-link nil 'interactive)
Or you can just save the return value of (org-store-link nil)
Best,
Ihor
Alan Schmitt <alan.schmitt@polytechnique.org> writes:
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-22 11:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-21 9:30 storing a link to a task from an agenda view Alan Schmitt
2020-11-22 5:36 ` Ihor Radchenko
2020-11-22 11:07 ` Alan Schmitt
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).