Create a function returning the link instead of inserting it.

This commit is contained in:
Carsten Dominik 2008-02-18 15:21:26 +01:00
parent 93b4787cb2
commit d17c85cab4
2 changed files with 15 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2008-02-18 Carsten Dominik <dominik@science.uva.nl>
* org-mac-message.el (org-mac-message-get-link): New function for
non-interactive use.
2008-02-17 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-local-logging): New function

View File

@ -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)