From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Belohrad Subject: org-store-link programmatically? Date: Fri, 01 Nov 2013 22:47:44 +0100 Message-ID: <87eh6zpzen.fsf@pcbe13433.cern.ch> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60875) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VcMZN-00016V-RX for emacs-orgmode@gnu.org; Fri, 01 Nov 2013 17:47:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VcMZJ-0001vg-CG for emacs-orgmode@gnu.org; Fri, 01 Nov 2013 17:47:53 -0400 Received: from static-212-101-19-163.adsl.solnet.ch ([212.101.19.163]:50367 helo=server.belohrad.ch) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VcMZJ-0001vI-4i for emacs-orgmode@gnu.org; Fri, 01 Nov 2013 17:47:49 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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