Org-mode mailing list
 help / color / mirror / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Alan Schmitt <alan.schmitt@polytechnique.org>,
	emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: storing a link to a task from an agenda view
Date: Sun, 22 Nov 2020 13:36:28 +0800
Message-ID: <87d006eyw3.fsf@localhost> (raw)
In-Reply-To: <87h7pjgipj.fsf@m4x.org>

> 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


  reply	other threads:[~2020-11-22  5:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-21  9:30 Alan Schmitt
2020-11-22  5:36 ` Ihor Radchenko [this message]
2020-11-22 11:07   ` Alan Schmitt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://orgmode.org

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d006eyw3.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=alan.schmitt@polytechnique.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git