From d17c85cab4f0841205c3ace84b12272116e045e5 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 18 Feb 2008 15:21:26 +0100 Subject: [PATCH] Create a function returning the link instead of inserting it. --- ChangeLog | 5 +++++ org-mac-message.el | 14 ++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index a6d90e3e8..ea33d85cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-02-18 Carsten Dominik + + * org-mac-message.el (org-mac-message-get-link): New function for + non-interactive use. + 2008-02-17 Carsten Dominik * org.el (org-local-logging): New function diff --git a/org-mac-message.el b/org-mac-message.el index 4f5849049..1e9fabc88 100644 --- a/org-mac-message.el +++ b/org-mac-message.el @@ -53,6 +53,12 @@ This will use the command `open' with the message url." This will use applescript to get the message-id and the subject of the active mail in AppleMail and make a link out of it." (interactive) + (insert (org-mac-message-get-link))) + +(defun org-mac-message-get-link () + "Insert a link to the messages currently selected in Apple Mail. +This will use applescript to get the message-id and the subject of the +active mail in AppleMail and make a link out of it." (let ((subject (do-applescript "tell application \"Mail\" set theMessages to selection subject of beginning of theMessages @@ -61,10 +67,10 @@ end tell")) set theMessages to selection message id of beginning of theMessages end tell"))) - (insert (org-make-link-string - (concat "message://" - (substring message-id 1 (1- (length message-id)))) - (substring subject 1 (1- (length subject))))))) + (org-make-link-string + (concat "message://" + (substring message-id 1 (1- (length message-id)))) + (substring subject 1 (1- (length subject)))))) (provide 'org-mac-message)