From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christopher Suckling Subject: Re: [ANN] OS X only: Insert links to flagged emails Date: Fri, 27 Mar 2009 10:30:28 +0100 Message-ID: <7BBA0982-52F0-4155-9CCB-2BE29B36127E@gmail.com> References: <52888DD3-1730-4F7F-B047-A8F2195F2D35@uva.nl> <613C2101-B997-498C-8383-3D82F6059A28@gmail.com> <7CA2F7EA-9632-445A-BE4B-E163FF6A7458@gmail.com> <8B72E954-171B-4965-9919-8A0C64621CD2@uva.nl> Mime-Version: 1.0 (Apple Message framework v930.3) Content-Type: multipart/mixed; boundary=Apple-Mail-12--6493188 Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ln8Ow-00046I-7e for emacs-orgmode@gnu.org; Fri, 27 Mar 2009 05:30:58 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ln8Or-0003yh-1W for emacs-orgmode@gnu.org; Fri, 27 Mar 2009 05:30:57 -0400 Received: from [199.232.76.173] (port=38688 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ln8Oq-0003yP-R4 for emacs-orgmode@gnu.org; Fri, 27 Mar 2009 05:30:52 -0400 Received: from mail-ew0-f160.google.com ([209.85.219.160]:65185) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ln8Oq-0000VK-AJ for emacs-orgmode@gnu.org; Fri, 27 Mar 2009 05:30:52 -0400 Received: by ewy4 with SMTP id 4so1020985ewy.42 for ; Fri, 27 Mar 2009 02:30:50 -0700 (PDT) In-Reply-To: <8B72E954-171B-4965-9919-8A0C64621CD2@uva.nl> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Carsten Dominik Cc: emacs-orgmode Mailinglist , Christopher Suckling --Apple-Mail-12--6493188 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit On 22 Mar 2009, at 16:04, Carsten Dominik wrote: > Applied, thanks. > > Would you like to write a short description/manual of org-mac- > message.el for > > http://orgmode.org/worg/org-contrib/ > > ? > Hopefully I got everything right first time and the manual is making it's way to Worg as I write. Meanwhile, I've rewritten some of the org-mac-message.el code to better handle multiple selections in Mail.app. Patch attached. Christopher --Apple-Mail-12--6493188 Content-Disposition: attachment; filename=org-mac-message.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="org-mac-message.patch" Content-Transfer-Encoding: 7bit diff --git a/lisp/org-mac-message.el b/lisp/org-mac-message.el index f8c4de2..9abcb58 100644 --- a/lisp/org-mac-message.el +++ b/lisp/org-mac-message.el @@ -4,6 +4,7 @@ ;; Author: John Wiegley ;; Christopher Suckling + ;; Version: 6.24trans ;; Keywords: outlines, hypermedia, calendar, wp @@ -85,24 +86,47 @@ 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))) + (org-mac-message-get-link) + (yank)) (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 -end tell")) - (message-id (do-applescript "tell application \"Mail\" - set theMessages to selection - message id of beginning of theMessages -end tell"))) - (org-make-link-string - (concat "message://" - (substring message-id 1 (1- (length message-id)))) - (substring subject 1 (1- (length subject)))))) + (let* ((as-link-list + (do-applescript + (concat + "tell application \"Mail\"\n" + "set theLinkList to {}\n" + "set theSelection to selection\n" + "repeat with theMessage in theSelection\n" + "set theID to message id of theMessage\n" + "set theSubject to subject of theMessage\n" + "set theLink to \"message://\" & theID & \"::split::\" & theSubject & \"\n\"\n" + "copy theLink to end of theLinkList\n" + "end repeat\n" + "return theLinkList as string\n" + "end tell"))) + (link-list (split-string as-link-list "\n")) + split-link + URL + description + orglink + orglink-insert + (orglink-list nil)) + (while link-list + (progn + (setq split-link (split-string (pop link-list) "::split::")) + (setq URL (car split-link)) + (setq description (cadr split-link)) + (if (not (string= URL "")) + (progn + (setq orglink (org-make-link-string URL description)) + (push orglink orglink-list))))) + (with-temp-buffer + (while orglink-list + (insert (concat (pop orglink-list)) "\n")) + (kill-region (point-min) (point-max))))) (defun org-mac-create-flagged-mail () "Create links to flagged messages in a Mail.app account and --Apple-Mail-12--6493188 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit --Apple-Mail-12--6493188 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --Apple-Mail-12--6493188--