From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike McLean Subject: Re: [PATCH] Add Microsoft Outlook Support to org-mac-link Date: Mon, 9 Sep 2013 06:52:51 -0400 Message-ID: References: <96F5C919-0D51-4139-A2AE-4118BD675F83@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b471e6ac74d2604e5f131f5 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53651) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VIz5w-0004db-JA for emacs-orgmode@gnu.org; Mon, 09 Sep 2013 06:53:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VIz5q-00086C-PU for emacs-orgmode@gnu.org; Mon, 09 Sep 2013 06:53:24 -0400 Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:55608 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VIz5q-000843-JQ for emacs-orgmode@gnu.org; Mon, 09 Sep 2013 06:53:18 -0400 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 121F9BFE9 for ; Mon, 9 Sep 2013 06:53:13 -0400 (EDT) Received: from a-pb-sasl-quonix.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 0A92DBFE8 for ; Mon, 9 Sep 2013 06:53:13 -0400 (EDT) Received: from mail-oa0-f41.google.com (unknown [209.85.219.41]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 7875CBFE7 for ; Mon, 9 Sep 2013 06:53:12 -0400 (EDT) Received: by mail-oa0-f41.google.com with SMTP id j6so6365139oag.14 for ; Mon, 09 Sep 2013 03:53:11 -0700 (PDT) In-Reply-To: <96F5C919-0D51-4139-A2AE-4118BD675F83@gmail.com> 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: Carsten Dominik Cc: emacs-orgmode --047d7b471e6ac74d2604e5f131f5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I don't and I do need to check with my current employer before I could sign them (*I* don't have a problem with it, but I'm just not sure of the policies). On Sun, Sep 8, 2013 at 1:50 AM, Carsten Dominik wrote: > Hi Mike, > > we don't need papers for contrib stuff - but let > me ask anyway: Do you have signed FSF papers? > > Thanks > > - Carsten > > > On 7.9.2013, at 22:29, Mike McLean wrote: > > > * contrib/lisp/org-mac-link.el: Add =E2=80=9Co=E2=80=9Dutlook to captur= e descriptors > along with > > functions to capture links from Microsoft Outlook for Mac. > > > > The functions here replicate those that capture from Mail.app. > > --- > > contrib/lisp/org-mac-link.el | 140 > +++++++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 140 insertions(+) > > > > diff --git a/contrib/lisp/org-mac-link.el b/contrib/lisp/org-mac-link.e= l > > index 59b88d2..2ff6711 100644 > > --- a/contrib/lisp/org-mac-link.el > > +++ b/contrib/lisp/org-mac-link.el > > @@ -13,6 +13,11 @@ > > ;; Version: 1.1 > > ;; Keywords: org, mac, hyperlink > > ;; > > +;; Version: 1.2 > > +;; Keywords: outlook > > +;; Author: Mike McLean > > +;; Add support for Microsoft Outlook for Mac as Org mode links > > +;; > > ;; This file is not part of GNU Emacs. > > ;; > > ;; This program is free software; you can redistribute it and/or modify > > @@ -51,6 +56,7 @@ > > ;; Google Chrome.app - Grab the url of the frontmost tab in the > frontmost window > > ;; Together.app - Grab links to the selected items in the library list > > ;; Skim.app - Grab a link to the selected page in the topmost pdf > document > > +;; Microsoft Outlook.app - Grab a link to the selected message in the > message list > > ;; > > ;; > > ;; Installation: > > @@ -97,6 +103,12 @@ applications and inserting them in org documents" > > :group 'org-mac-link > > :type 'boolean) > > > > +(defcustom org-mac-grab-Outlook-app-p t > > + "Enable menu option [o]utlook to grab links from Microsoft > Outlook.app" > > + :tag "Grab Microsoft Outlook.app links" > > + :group 'org-mac-link > > + :type 'boolean) > > + > > (defcustom org-mac-grab-Addressbook-app-p t > > "Enable menu option [a]ddressbook to grab links from AddressBook.app" > > :tag "Grab AddressBook.app links" > > @@ -179,6 +191,7 @@ applications and inserting them in org documents" > > (interactive) > > (let* ((descriptors `(("F" "inder" org-mac-finder-insert-selected > ,org-mac-grab-Finder-app-p) > > ("m" "ail" org-mac-message-insert-selected > ,org-mac-grab-Mail-app-p) > > + ("o" "utlook" > org-mac-outlook-message-insert-selected ,org-mac-grab-Outlook-app-p) > > ("a" "ddressbook" > org-mac-addressbook-insert-selected ,org-mac-grab-Addressbook-app-p) > > ("s" "afari" org-mac-safari-insert-frontmost-ur= l > ,org-mac-grab-Safari-app-p) > > ("f" "irefox" > org-mac-firefox-insert-frontmost-url ,org-mac-grab-Firefox-app-p) > > @@ -574,6 +587,133 @@ applications and inserting them in org documents" > > > > ;; > > ;; > > +;; Handle links from Microsoft Outlook.app > > +;; > > + > > +(org-add-link-type "mac-outlook" 'org-mac-outlook-message-open) > > + > > +(defun org-mac-outlook-message-open (msgid) > > + "Open a message in outlook" > > + (let* ((record-id-string (format "mdfind > com_microsoft_outlook_recordID=3D=3D%s" msgid)) > > + (found-message (replace-regexp-in-string "\n$" "" > > + (shell-command-to-string record-id-string)))) > > + (if (string=3D found-message "") > > + (message "org-mac-link: error could not find Outlook message %s" > (substring-no-properties msgid)) > > + (shell-command (format "open \"`mdfind > com_microsoft_outlook_recordID=3D=3D%s`\"" msgid))))) > > + > > +(defun org-as-get-selected-outlook-mail () > > + "AppleScript to create links to selected messages in Microsoft > Outlook.app." > > + (do-applescript > > + (concat > > + "tell application \"Microsoft Outlook\"\n" > > + "set msgCount to count current messages\n" > > + "if (msgCount < 1) then\n" > > + "return\n" > > + "end if\n" > > + "set theLinkList to {}\n" > > + "set theSelection to (get current messages)\n" > > + "repeat with theMessage in theSelection\n" > > + "set theID to id of theMessage as string\n" > > + "set theURL to \"mac-outlook:\" & theID\n" > > + "set theSubject to subject of theMessage\n" > > + "set theLink to theURL & \"::split::\" & theSubject & \"\n\"\n" > > + "copy theLink to end of theLinkList\n" > > + "end repeat\n" > > + "return theLinkList as string\n" > > + "end tell"))) > > + > > +(defun org-sh-get-flagged-outlook-mail () > > + "Shell commands to create links to flagged messages in Microsoft > Outlook.app." > > + (mapconcat > > + (lambda (x) "" > > + (concat > > + "mac-outlook:" > > + (mapconcat > > + (lambda (y) "" y) > > + (split-string > > + (shell-command-to-string > > + (format "mdls -raw -name com_microsoft_outlook_recordID -name > kMDItemDisplayName \"%s\"" x)) > > + "\000") > > + "::split::") > > + "\n")) > > + (with-temp-buffer > > + (let ((coding-system-for-read (or file-name-coding-system 'utf-8)= ) > > + (coding-system-for-write 'utf-8)) > > + (shell-command > > + "mdfind com_microsoft_outlook_flagged=3D=3D1" > > + (current-buffer))) > > + (split-string > > + (buffer-string) "\n" t)) > > + "")) > > + > > +(defun org-mac-outlook-message-get-links (&optional select-or-flag) > > + "Create links to the messages currently selected or flagged in > Microsoft Outlook.app. > > +This will use AppleScript to get the message-id and the subject of the > > +messages in Microsoft Outlook.app and make a link out of it. > > +When SELECT-OR-FLAG is \"s\", get the selected messages (this is also > > +the default). When SELECT-OR-FLAG is \"f\", get the flagged messages. > > +The Org-syntax text will be pushed to the kill ring, and also returned= ." > > + (interactive "sLink to (s)elected or (f)lagged messages: ") > > + (setq select-or-flag (or select-or-flag "s")) > > + (message "Org Mac Outlook: searching mailboxes...") > > + (let* ((as-link-list > > + (if (string=3D select-or-flag "s") > > + (org-as-get-selected-outlook-mail) > > + (if (string=3D select-or-flag "f") > > + (org-sh-get-flagged-outlook-mail) > > + (error "Please select \"s\" or \"f\"")))) > > + (link-list > > + (mapcar > > + (lambda (x) (if (string-match "\\`\"\\(.*\\)\"\\'" x) (setq > x (match-string 1 x))) x) > > + (split-string as-link-list "[\r\n]+"))) > > + split-link URL description orglink orglink-insert rtn > orglink-list) > > + (while link-list > > + (setq split-link (split-string (pop link-list) "::split::")) > > + (setq URL (car split-link)) > > + (setq description (cadr split-link)) > > + (when (not (string=3D URL "")) > > + (setq orglink (org-make-link-string URL description)) > > + (push orglink orglink-list))) > > + (setq rtn (mapconcat 'identity orglink-list "\n")) > > + (kill-new rtn) > > + rtn)) > > + > > +(defun org-mac-outlook-message-insert-selected () > > + "Insert a link to the messages currently selected in Microsoft > Outlook.app. > > +This will use AppleScript to get the message-id and the subject of the > > +active mail in Microsoft Outlook.app and make a link out of it." > > + (interactive) > > + (insert (org-mac-outlook-message-get-links "s"))) > > + > > +(defun org-mac-outlook-message-insert-flagged (org-buffer org-heading) > > + "Asks for an org buffer and a heading within it, and replace message > links. > > +If heading exists, delete all mac-outlook:// links within heading's > first > > +level. If heading doesn't exist, create it at point-max. Insert > > +list of mac-outlook:// links to flagged mail after heading." > > + (interactive "bBuffer in which to insert links: \nsHeading after > which to insert links: ") > > + (with-current-buffer org-buffer > > + (goto-char (point-min)) > > + (let ((isearch-forward t) > > + (message-re > "\\[\\[\\(mac-outlook:\\)\\([^]]+\\)\\]\\(\\[\\([^]]+\\)\\]\\)?\\]")) > > + (if (org-goto-local-search-headings org-heading nil t) > > + (if (not (eobp)) > > + (progn > > + (save-excursion > > + (while (re-search-forward > > + message-re (save-excursion > (outline-next-heading)) t) > > + (delete-region (match-beginning 0) (match-end 0))) > > + (insert "\n" (org-mac-outlook-message-get-links "f")= )) > > + (flush-lines "^$" (point) (outline-next-heading))) > > + (insert "\n" (org-mac-outlook-message-get-links "f"))) > > + (goto-char (point-max)) > > + (insert "\n") > > + (org-insert-heading nil t) > > + (insert org-heading "\n" (org-mac-outlook-message-get-links > "f")))))) > > + > > + > > + > > +;; > > +;; > > ;; Handle links from Mail.app > > ;; > > > > -- > > 1.8.3.3 > > > > > > --047d7b471e6ac74d2604e5f131f5 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I don't and I do need to check with my current employe= r before I could sign them (*I* don't have a problem with it, but I'= ;m just not sure of the policies).


=
On Sun, Sep 8, 2013 at 1:50 AM, Carsten Dominik <carsten.dominik@g= mail.com> wrote:
Hi Mike,

we don't need papers for contrib stuff - but let
me ask anyway: =C2=A0Do you have signed FSF papers?

Thanks

- Carsten


On 7.9.2013, at 22:29, Mike McLean <mike.mclean@pobox.com> wrote:

> * contrib/lisp/org-mac-link.el: Add =E2=80=9Co=E2=80=9Dutlook to captu= re descriptors along with
> functions to capture links from Microsoft Outlook for Mac.
>
> The functions here replicate those that capture from Mail.app.
> ---
> contrib/lisp/org-mac-link.el | 140 +++++++++++++++++++++++++++++++++++= ++++++++
> 1 file changed, 140 insertions(+)
>
> diff --git a/contrib/lisp/org-mac-link.el b/contrib/lisp/org-mac-link.= el
> index 59b88d2..2ff6711 100644
> --- a/contrib/lisp/org-mac-link.el
> +++ b/contrib/lisp/org-mac-link.el
> @@ -13,6 +13,11 @@
> ;; Version: 1.1
> ;; Keywords: org, mac, hyperlink
> ;;
> +;; Version: 1.2
> +;; Keywords: outlook
> +;; Author: Mike McLean <m= ike.mclean@pobox.com>
> +;; Add support for Microsoft Outlook for Mac as Org mode links
> +;;
> ;; This file is not part of GNU Emacs.
> ;;
> ;; This program is free software; you can redistribute it and/or modif= y
> @@ -51,6 +56,7 @@
> ;; Google Chrome.app - Grab the url of the frontmost tab in the frontm= ost window
> ;; Together.app - Grab links to the selected items in the library list=
> ;; Skim.app - Grab a link to the selected page in the topmost pdf docu= ment
> +;; Microsoft Outlook.app - Grab a link to the selected message in the= message list
> ;;
> ;;
> ;; Installation:
> @@ -97,6 +103,12 @@ applications and inserting them in org documents&q= uot;
> =C2=A0 :group 'org-mac-link
> =C2=A0 :type 'boolean)
>
> +(defcustom org-mac-grab-Outlook-app-p t
> + =C2=A0"Enable menu option [o]utlook to grab links from Microsof= t Outlook.app"
> + =C2=A0:tag "Grab Microsoft Outlook.app links"
> + =C2=A0:group 'org-mac-link
> + =C2=A0:type 'boolean)
> +
> (defcustom org-mac-grab-Addressbook-app-p t
> =C2=A0 "Enable menu option [a]ddressbook to grab links from Addre= ssBook.app"
> =C2=A0 :tag "Grab AddressBook.app links"
> @@ -179,6 +191,7 @@ applications and inserting them in org documents&q= uot;
> =C2=A0 (interactive)
> =C2=A0 (let* ((descriptors `(("F" "inder" org-mac-= finder-insert-selected ,org-mac-grab-Finder-app-p)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 ("m" "ail" org-mac-message-insert-selecte= d ,org-mac-grab-Mail-app-p)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0("o" "utlook" org-mac-outlook-message-= insert-selected ,org-mac-grab-Outlook-app-p)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 ("a" "ddressbook" org-mac-addressbook-ins= ert-selected ,org-mac-grab-Addressbook-app-p)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 ("s" "afari" org-mac-safari-insert-frontm= ost-url ,org-mac-grab-Safari-app-p)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 ("f" "irefox" org-mac-firefox-insert-fron= tmost-url ,org-mac-grab-Firefox-app-p)
> @@ -574,6 +587,133 @@ applications and inserting them in org documents= "
>
> ;;
> ;;
> +;; Handle links from Microsoft Outlook.app
> +;;
> +
> +(org-add-link-type "mac-outlook" 'org-mac-outlook-messa= ge-open)
> +
> +(defun org-mac-outlook-message-open (msgid)
> + =C2=A0"Open a message in outlook"
> + =C2=A0(let* ((record-id-string (format "mdfind com_microsoft_ou= tlook_recordID=3D=3D%s" msgid))
> + =C2=A0 =C2=A0 (found-message (replace-regexp-in-string "\n$&quo= t; ""
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(shell-command-to-st= ring record-id-string))))
> + =C2=A0 =C2=A0(if (string=3D found-message "")
> + =C2=A0 =C2=A0 =C2=A0(message "org-mac-link: error could not fin= d Outlook message %s" =C2=A0 =C2=A0 =C2=A0 (substring-no-properties ms= gid))
> + =C2=A0 =C2=A0 =C2=A0(shell-command (format "open \"`mdfind= com_microsoft_outlook_recordID=3D=3D%s`\"" msgid)))))
> +
> +(defun org-as-get-selected-outlook-mail ()
> + =C2=A0"AppleScript to create links to selected messages in Micr= osoft Outlook.app."
> + =C2=A0(do-applescript
> + =C2=A0 (concat
> + =C2=A0 =C2=A0"tell application \"Microsoft Outlook\"\= n"
> + =C2=A0 =C2=A0"set msgCount to count current messages\n" > + =C2=A0 =C2=A0"if (msgCount < 1) then\n"
> + =C2=A0 =C2=A0"return\n"
> + =C2=A0 =C2=A0"end if\n"
> + =C2=A0 =C2=A0"set theLinkList to {}\n"
> + =C2=A0 =C2=A0"set theSelection to (get current messages)\n"= ;
> + =C2=A0 =C2=A0"repeat with theMessage in theSelection\n" > + =C2=A0 =C2=A0"set theID to id of theMessage as string\n" > + =C2=A0 =C2=A0"set theURL to \"mac-outlook:\" & th= eID\n"
> + =C2=A0 =C2=A0"set theSubject to subject of theMessage\n" > + =C2=A0 =C2=A0"set theLink to theURL & \"::split::\&quo= t; & theSubject & \"\n\"\n"
> + =C2=A0 =C2=A0"copy theLink to end of theLinkList\n"
> + =C2=A0 =C2=A0"end repeat\n"
> + =C2=A0 =C2=A0"return theLinkList as string\n"
> + =C2=A0 =C2=A0"end tell")))
> +
> +(defun org-sh-get-flagged-outlook-mail ()
> + =C2=A0"Shell commands to create links to flagged messages in Mi= crosoft Outlook.app."
> + =C2=A0(mapconcat
> + =C2=A0 (lambda (x) ""
> + =C2=A0 =C2=A0 (concat
> + =C2=A0 =C2=A0 =C2=A0"mac-outlook:"
> + =C2=A0 =C2=A0 =C2=A0(mapconcat
> + =C2=A0 =C2=A0 =C2=A0 (lambda (y) "" y)
> + =C2=A0 =C2=A0 =C2=A0 (split-string
> + =C2=A0 =C2=A0 (shell-command-to-string
> + =C2=A0 =C2=A0 =C2=A0(format "mdls -raw -name com_microsoft_outl= ook_recordID -name kMDItemDisplayName \"%s\"" x))
> + =C2=A0 =C2=A0 "\000")
> + =C2=A0 =C2=A0 =C2=A0 "::split::")
> + =C2=A0 =C2=A0 =C2=A0"\n"))
> + =C2=A0 (with-temp-buffer
> + =C2=A0 =C2=A0 (let ((coding-system-for-read (or file-name-coding-sys= tem 'utf-8))
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0(coding-system-for-write 'utf-8))
> + =C2=A0 =C2=A0 =C2=A0 (shell-command
> + =C2=A0 =C2=A0 "mdfind com_microsoft_outlook_flagged=3D=3D1"= ;
> + =C2=A0 =C2=A0 (current-buffer)))
> + =C2=A0 =C2=A0 (split-string
> + =C2=A0 =C2=A0 =C2=A0(buffer-string) "\n" t))
> + =C2=A0 ""))
> +
> +(defun org-mac-outlook-message-get-links (&optional select-or-fla= g)
> + =C2=A0"Create links to the messages currently selected or flagg= ed in Microsoft Outlook.app.
> +This will use AppleScript to get the message-id and the subject of th= e
> +messages in Microsoft Outlook.app and make a link out of it.
> +When SELECT-OR-FLAG is \"s\", get the selected messages (th= is is also
> +the default). =C2=A0When SELECT-OR-FLAG is \"f\", get the f= lagged messages.
> +The Org-syntax text will be pushed to the kill ring, and also returne= d."
> + =C2=A0(interactive "sLink to (s)elected or (f)lagged messages: = ")
> + =C2=A0(setq select-or-flag (or select-or-flag "s"))
> + =C2=A0(message "Org Mac Outlook: searching mailboxes...")<= br> > + =C2=A0(let* ((as-link-list
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if (string=3D select-or-flag &quo= t;s")
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-as-get-selected= -outlook-mail)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (string=3D select-or-flag "f&qu= ot;)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (org-sh-get-flagged-outloo= k-mail)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (error "Please select \"= ;s\" or \"f\""))))
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 (link-list
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(mapcar
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (lambda (x) (if (string-match &qu= ot;\\`\"\\(.*\\)\"\\'" x) (setq x (match-string 1 x))) x= )
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (split-string as-link-list "= [\r\n]+")))
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 split-link URL description orglink orgli= nk-insert rtn orglink-list)
> + =C2=A0 =C2=A0(while link-list
> + =C2=A0 =C2=A0 =C2=A0(setq split-link (split-string (pop link-list) &= quot;::split::"))
> + =C2=A0 =C2=A0 =C2=A0(setq URL (car split-link))
> + =C2=A0 =C2=A0 =C2=A0(setq description (cadr split-link))
> + =C2=A0 =C2=A0 =C2=A0(when (not (string=3D URL ""))
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq orglink (org-make-link-string URL d= escription))
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0(push orglink orglink-list)))
> + =C2=A0 =C2=A0(setq rtn (mapconcat 'identity orglink-list "\= n"))
> + =C2=A0 =C2=A0(kill-new rtn)
> + =C2=A0 =C2=A0rtn))
> +
> +(defun org-mac-outlook-message-insert-selected ()
> + =C2=A0"Insert a link to the messages currently selected in Micr= osoft Outlook.app.
> +This will use AppleScript to get the message-id and the subject of th= e
> +active mail in Microsoft Outlook.app and make a link out of it."=
> + =C2=A0(interactive)
> + =C2=A0(insert (org-mac-outlook-message-get-links "s"))) > +
> +(defun org-mac-outlook-message-insert-flagged (org-buffer org-heading= )
> + =C2=A0"Asks for an org buffer and a heading within it, and repl= ace message links.
> +If heading exists, delete all mac-outlook:// links within heading'= ;s first
> +level. =C2=A0If heading doesn't exist, create it at point-max. = =C2=A0Insert
> +list of mac-outlook:// links to flagged mail after heading."
> + =C2=A0(interactive "bBuffer in which to insert links: \nsHeadin= g after which to insert links: ")
> + =C2=A0(with-current-buffer org-buffer
> + =C2=A0 =C2=A0(goto-char (point-min))
> + =C2=A0 =C2=A0(let ((isearch-forward t)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(message-re "\\[\\[\\(mac-out= look:\\)\\([^]]+\\)\\]\\(\\[\\([^]]+\\)\\]\\)?\\]"))
> + =C2=A0 =C2=A0 =C2=A0(if (org-goto-local-search-headings org-heading = nil t)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if (not (eobp))
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(progn
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(save-excursi= on
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(while= (re-search-forward
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0message-re (save-excursion (outline-next-heading)) = t)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(delete-region (match-beginning 0) (match-end 0)))
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(inser= t "\n" (org-mac-outlook-message-get-links "f")))
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(flush-lines = "^$" (point) (outline-next-heading)))
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 (insert "\n" (org-mac-outlook-= message-get-links "f")))
> + =C2=A0 =C2=A0 (goto-char (point-max))
> + =C2=A0 =C2=A0 (insert "\n")
> + =C2=A0 =C2=A0 (org-insert-heading nil t)
> + =C2=A0 =C2=A0 (insert org-heading "\n" (org-mac-outlook-me= ssage-get-links "f"))))))
> +
> +
> +=0C
> +;;
> +;;
> ;; Handle links from Mail.app
> ;;
>
> --
> 1.8.3.3
>
>


--047d7b471e6ac74d2604e5f131f5--