all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* org-store-link programmatically?
@ 2013-11-01 21:47 David Belohrad
  2013-11-01 22:26 ` Josiah Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: David Belohrad @ 2013-11-01 21:47 UTC (permalink / raw)
  To: emacs-orgmode


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: org-store-link programmatically?
  2013-11-01 21:47 org-store-link programmatically? David Belohrad
@ 2013-11-01 22:26 ` Josiah Schwab
  2013-11-01 22:53   ` David Belohrad
  0 siblings, 1 reply; 3+ messages in thread
From: Josiah Schwab @ 2013-11-01 22:26 UTC (permalink / raw)
  To: David Belohrad; +Cc: emacs-orgmode

Hi David,

> 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.

Have you looked at "9.1.3 Capture templates" in the documentation?
http://orgmode.org/manual/Capture-templates.html

It seems to me that the example TODO entry given (using "%a" in the
template) will do what you describe:

,----
| During expansion of the template, %a has been replaced by a link to
| the location from where you called the capture command. This can be
| extremely useful for deriving tasks from emails, for example.
`----

Best,
Josiah

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: org-store-link programmatically?
  2013-11-01 22:26 ` Josiah Schwab
@ 2013-11-01 22:53   ` David Belohrad
  0 siblings, 0 replies; 3+ messages in thread
From: David Belohrad @ 2013-11-01 22:53 UTC (permalink / raw)
  To: Josiah Schwab; +Cc: emacs-orgmode

Josiah Schwab <jschwab@gmail.com> writes:

> Hi David,
>
>> 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.
>
> Have you looked at "9.1.3 Capture templates" in the documentation?
> http://orgmode.org/manual/Capture-templates.html
>
> It seems to me that the example TODO entry given (using "%a" in the
> template) will do what you describe:
>
> ,----
> | During expansion of the template, %a has been replaced by a link to
> | the location from where you called the capture command. This can be
> | extremely useful for deriving tasks from emails, for example.
> `----
>
> Best,
> Josiah

Right! Thanks for hint. I did not see this one. Does exactly what I
wanted to achieve

nice weekend

.d.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-01 22:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-01 21:47 org-store-link programmatically? David Belohrad
2013-11-01 22:26 ` Josiah Schwab
2013-11-01 22:53   ` David Belohrad

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.