emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Mike McLean <mike.mclean@pobox.com>
Subject: [PATCH] Org Mac Outlook opens messages via AppleScript
Date: Sun, 13 Oct 2013 09:04:59 -0400	[thread overview]
Message-ID: <20131013141600.BEE015E0AF63@mac-mike-2013.mclean> (raw)

Previously ~org-mac-outlook-message-open~ used the Mac OS X Spotlight
index via ~mdfind~ to open messages via shell commands. This patch
changes the open to an AppleScript method to resolve an issue reported
by Manish Sharma.
---
 contrib/lisp/org-mac-link.el | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/contrib/lisp/org-mac-link.el b/contrib/lisp/org-mac-link.el
index 2ff6711..ebcff75 100644
--- a/contrib/lisp/org-mac-link.el
+++ b/contrib/lisp/org-mac-link.el
@@ -593,13 +593,13 @@ applications and inserting them in org documents"
 (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)))))
+  "Open a message in Outlook"
+  (do-applescript
+   (concat
+    "tell application \"Microsoft Outlook\"\n"
+     (format "open message id %s\n" (substring-no-properties msgid))
+     "activate\n"
+     "end tell")))
 
 (defun org-as-get-selected-outlook-mail ()
   "AppleScript to create links to selected messages in Microsoft Outlook.app."
-- 
1.8.3.4

                 reply	other threads:[~2013-10-13 14:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131013141600.BEE015E0AF63@mac-mike-2013.mclean \
    --to=mike.mclean@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).