浏览代码

Create a function returning the link instead of inserting it.

Carsten Dominik 17 年之前
父节点
当前提交
d17c85cab4
共有 2 个文件被更改,包括 15 次插入4 次删除
  1. 5 0
      ChangeLog
  2. 10 4
      org-mac-message.el

+ 5 - 0
ChangeLog

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

+ 10 - 4
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)