From mboxrd@z Thu Jan 1 00:00:00 1970 From: Manish Subject: Re: using %(sexp) in capture templates Date: Sat, 12 Oct 2013 17:54:23 -0400 Message-ID: References: <5CA12BD7-331F-42C0-9F2E-59B7E381B286@pobox.com> <8E522C56-8A36-4726-B928-2E86B305E5F2@pobox.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c1d7e0ef79e404e8924871 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42556) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VV79D-0006yh-Uq for emacs-orgmode@gnu.org; Sat, 12 Oct 2013 17:54:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VV79C-0006gh-Jo for emacs-orgmode@gnu.org; Sat, 12 Oct 2013 17:54:55 -0400 Received: from mail-oa0-x22c.google.com ([2607:f8b0:4003:c02::22c]:58216) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VV79C-0006gb-Bm for emacs-orgmode@gnu.org; Sat, 12 Oct 2013 17:54:54 -0400 Received: by mail-oa0-f44.google.com with SMTP id l20so2850830oag.31 for ; Sat, 12 Oct 2013 14:54:53 -0700 (PDT) In-Reply-To: <8E522C56-8A36-4726-B928-2E86B305E5F2@pobox.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: Mike McLean Cc: Org-Mode --001a11c1d7e0ef79e404e8924871 Content-Type: text/plain; charset=ISO-8859-1 > On Sat, Oct 12, 2013 at 7:24 AM, Mike McLean wrote: > > > On Oct 12, 2013, at 2:03 AM, Manish wrote: > > > > > On Fri, Oct 11, 2013 at 9:55 PM, Mike McLean wrote: > > > > > > > On Oct 10, 2013, at 9:51 PM, Manish wrote: > > > > > > > > i am trying to use %(org-mac-outlook-message-insert-selected) in > > > > a capture template to create a todo entry from an email selected > > > > in outlook on mac os x. i was expecting that the function will > > > > get executed when the template is called and enter a link to the > > > > email but seems to return nothing. the function works when used > > > > outside of template. any ideas how i can begin to debug this or > > > > if i should be doing anything differently? > > > > > > > > > > When I added the support for Outlook I matched the style and > > > design of the existing Org mac message (for Mail). In particular > > > org-mac-outlook-message-insert-selected does not return a value, > > > it is designed to be called interactively and inserts a link at > > > the current point in the current buffer. As such it would not work > > > as a %() capture template. > > > > > > Now on the other hand all org-mac-outlook-message-insert-selected > > > does is ~(insert (org-mac-outlook-message-get-links "s"))~. I > > > presume (though I haven't tested) that you could use the inner > > > form ~(org-mac-outlook-message-get-links "s")~ in a %() sexp in a > > > capture template. > > > > > > > thanks! it does work this way. > > > > i am not sure if it's directly related but there's a weird issue. > > once i have a link to an email, i can open it by c-c c-o only once. > > any following attempt just fails with a message: "org-mac-link: > > error could not find outlook message " where msgid is the id > > of the message. when i ran the mdfind command that i found in the > > source in the terminal, it again worked once only. any subsequent > > attempt opens a finder window. very very odd behavior since i am > > not even modifying the email in anyway (other than just opening it) > > that might change its message id or something. > > it has definitely worked for the same message multiple times for me > (even after changing a message by moving it, etc.). since the org mac > outlook interface uses spotlight indexing, and spotlight uses the > loose messages in the microsoft user data folder, maybe rebuilding one > or both of the outlook profile or the spotlight index would fix your > issues? i'll look into rebuilding outlook profiles and spotlight indexes. meanwhile, following has worked consistently for me: #+begin_src emacs-lisp (defun org-mac-outlook-message-open (msgid) "open a message in outlook" (do-applescript (concat "tell application \"Microsoft Outlook\"\n" (format "open message id %s\n" msgid) "activate\n" "end tell"))) #+end_src cheers! --manish --001a11c1d7e0ef79e404e8924871 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
> On Sa= t, Oct 12, 2013 at 7:24 AM, Mike McLean wrote:
>=A0
> > On Oct 12, 2013, at 2:03 AM, Manish wrote:=
> >=A0
> > > On Fri, Oct 11, 2013 at = 9:55 PM, Mike McLean wrote:
> > >=A0
> > > > On Oct 10, 2= 013, at 9:51 PM, Manish wrote:
> > > >=A0
> > > > i am trying to use %(org-mac-outlook-mess= age-insert-selected) in
> > > > a capture te= mplate to create a todo entry from an email selected
> > > > in outlook on mac os x= . =A0i was expecting that the function will
> > > > get executed= when the template is called and enter a link to the
> > > > email but seems to ret= urn nothing. =A0the function works when used
> > > > outside of t= emplate. =A0any ideas how i can begin to debug this or
> > > > if i should be doing= anything differently?
> > > >=A0
> > >=A0
> > > When I added the= support for Outlook I matched the style and
> > > design of the exi= sting Org mac message (for Mail). In particular
> > > org-mac-outlook-message-insert-s= elected does not return a value,
> > > it is designed to= be called interactively and inserts a link at
> > > the current point in the current= buffer. As such it would not work
> > > as a %() capture = template.
> > = >=A0
> > &g= t; Now on the other hand all org-mac-outlook-message-insert-selected=
> > > does is ~(insert = (org-mac-outlook-message-get-links "s"))~. I
> > > presume (though I haven&#= 39;t tested) that you could use the inner
> > > form ~(org-mac-ou= tlook-message-get-links "s")~ in a %() sexp in a
> > > capture template.
> > >=A0
> >=A0
> > thanks! =A0it does work this wa= y.
> >=A0
> > i am not sure if it's dir= ectly related but there's a weird issue.
> > once i have a link to an email, i can op= en it by c-c c-o only once.
> > any following attempt = just fails with a message: "org-mac-link:
> > error could not find outlook message = <msgid>" where msgid is the id
> > of the message. when i= ran the mdfind command that i found in the
> > source in the terminal, it again worked o= nce only. =A0any subsequent
> > attempt opens a finder= window. =A0very very odd behavior since i am
> > not even modifying the email in anywa= y (other than just opening it)
> > that might change its = message id or something.
>=A0
> it= has definitely worked for the same message multiple times for me
> (even after changing a mess= age by moving it, etc.). since the org mac
> outlook interface uses spotlight indexing, and = spotlight uses the
> loose messages in the micro= soft user data folder, maybe rebuilding one
> or both of the outlook profile or the spotligh= t index would fix your
> issues?

i'll look into rebuilding outlook profiles and spo= tlight indexes.
meanwhile, following has worked = consistently for me:

#+begin_src em= acs-lisp
(defun org-mac-outlook-message-o= pen (msgid)
=A0 &quo= t;open a message in outlook"
=A0 (do-applescript
=A0 =A0(concat
= =A0 =A0 "tell application \"= ;Microsoft Outlook\"\n"
=A0 =A0 =A0(format "open message id %s\n" msgid)
=A0 =A0 =A0"activate\n"= ;
=A0 =A0 =A0"e= nd tell")))
#+e= nd_src

cheers!
--manish

--001a11c1d7e0ef79e404e8924871--