emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: David Belohrad <david@belohrad.ch>
To: emacs-orgmode@gnu.org
Subject: org-store-link programmatically?
Date: Fri, 01 Nov 2013 22:47:44 +0100	[thread overview]
Message-ID: <87eh6zpzen.fsf@pcbe13433.cern.ch> (raw)


Dear all,

i want to write a piece of code as a 'template', which generates TODO
using capture template, and inserts into the todo a LINK TO THE
LOCATION, from which I have called the org-capture.

the main usage for me is basically when I get email message (notmuch),
to generate a journal entry with some comments and at the end of this
entry a link to that email.

I thought like defining a function like this one:

  (defun org-notmuch-copymail ()
    (interactive)
    (org-store-link)
    ;; some code to get the link into the yank buffer
    (org-capture nil "c"))
 
where the 'c' template is defined as follows:

("c" "Global todo entry with clipboard content" entry (file+headline (concat my-org-files "gtd.org") "Tasks")
"* TODO %?\n:LOGBOOK:\n%c\n:END:\n")

The trouble #1 I have is a call to (org-store-link), which always fails,
because it requires 'an argument' I have a hard time to find which one.

One of the options I was considering was as well to 'construct' the link
myself. That requires some 'generalization' as I would have to detect
(somehow) what type of buffer it is. As filelinks:

[[mylink.png][sometext]]

are different from notmuch links:

[[notmuch:id:75a7a46b727b42dca8c70b1c64db05f4@CERNFE23.cern.ch][email]]


Any ideas how to solve this?

As a bonus question: I've noticed, that when I store link, and then
paste it, it pastes the files using absolute paths. I would very much
prefer relative paths. Is there any way how to change this behaviour?

many thanks

david

             reply	other threads:[~2013-11-01 21:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-01 21:47 David Belohrad [this message]
2013-11-01 22:26 ` org-store-link programmatically? Josiah Schwab
2013-11-01 22:53   ` David Belohrad

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://www.orgmode.org/

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

  git send-email \
    --in-reply-to=87eh6zpzen.fsf@pcbe13433.cern.ch \
    --to=david@belohrad.ch \
    --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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).