Re: [O] [PATCH] Add Microsoft Outlook Support to org-mac-link
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 “o”utlook to capture 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 > > +;; 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-url > ,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==%s" msgid)) > > + (found-message (replace-regexp-in-string "\n$" "" > > + (shell-command-to-string record-id-string > > +(if (string= 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==%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 -
Re: [O] [PATCH] Add Microsoft Outlook Support to org-mac-link
Applied, thanks. - Carsten On 7.9.2013, at 22:29, Mike McLean wrote: > * contrib/lisp/org-mac-link.el: Add “o”utlook to capture 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 > +;; 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-url > ,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==%s" msgid)) > + (found-message (replace-regexp-in-string "\n$" "" > + (shell-command-to-string record-id-string > +(if (string= 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==%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==1" > + (current-buffer))) > + (split-string > + (buffer-string) "\n" t)) > + "")) > + > +(defun org-mac-outlook-message-get-links (&optional select-or-flag) > +
Re: [O] [PATCH] Add Microsoft Outlook Support to org-mac-link
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 “o”utlook to capture 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 > +;; 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-url > ,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==%s" msgid)) > + (found-message (replace-regexp-in-string "\n$" "" > + (shell-command-to-string record-id-string > +(if (string= 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==%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==1" > + (current-buffer))) > + (split-string > + (buffer-string) "\
[O] [PATCH] Add Microsoft Outlook Support to org-mac-link
* contrib/lisp/org-mac-link.el: Add “o”utlook to capture 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 +;; 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-url ,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==%s" msgid)) + (found-message (replace-regexp-in-string "\n$" "" + (shell-command-to-string record-id-string +(if (string= 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==%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==1" + (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 +th