From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steve Purcell Subject: PATCH: org-mac-link.el: Don't fail on machines without Growl installed Date: Wed, 24 Sep 2014 12:12:31 +0100 Message-ID: <7B9D9129-4BEC-42F3-851D-00D4D2A43A8A@sanityinc.com> Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_172BA50C-17D0-4C8D-BFA8-B14E7F59C0AF" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38290) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWkVa-0001Ju-WD for emacs-orgmode@gnu.org; Wed, 24 Sep 2014 07:13:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XWkVT-000433-Ga for emacs-orgmode@gnu.org; Wed, 24 Sep 2014 07:13:18 -0400 Received: from h1189701.stratoserver.net ([85.214.32.38]:44219) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWkVT-00042H-6w for emacs-orgmode@gnu.org; Wed, 24 Sep 2014 07:13:11 -0400 Received: from [192.168.1.104] (host81-156-15-155.range81-156.btcentralplus.com [81.156.15.155]) by h1189701.stratoserver.net (Postfix) with ESMTPSA id 63173820016 for ; Wed, 24 Sep 2014 13:12:33 +0200 (CEST) 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: emacs-orgmode@gnu.org --Apple-Mail=_172BA50C-17D0-4C8D-BFA8-B14E7F59C0AF Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 The existing Applescript for grabbing flagged mail messages can only = work on machines which have Growl installed. This is increasingly rarely = the case as Growl has been obsoleted by OS X=92s own notification = system. -Steve --Apple-Mail=_172BA50C-17D0-4C8D-BFA8-B14E7F59C0AF Content-Disposition: attachment; filename=0001-org-mac-link.el-Don-t-fail-on-machines-without-Growl.patch Content-Type: application/octet-stream; name="0001-org-mac-link.el-Don-t-fail-on-machines-without-Growl.patch" Content-Transfer-Encoding: quoted-printable =46rom=203608ea50704a2479839b91bb1a92cacf453bae8c=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Steve=20Purcell=20=0A= Date:=20Wed,=2024=20Sep=202014=2012:07:20=20+0100=0ASubject:=20[PATCH]=20= org-mac-link.el:=20Don't=20fail=20on=20machines=20without=20Growl=0A=20= installed=0A=0A*=20contrib/lisp/org-mac-link.el=20= (org-as-get-flagged-mail):=20Don't=20assume=20Growl=20is=20installed.=0A=0A= Applescript=20can't=20run=20if=20it=20refers=20to=20uninstalled=20apps,=20= so=20since=20Growl=20is=20not=20universally=0Ainstalled,=20references=20= to=20it=20should=20be=20dropped.=20This=20change=20also=20provides=20a=20= less=20cryptic=0Amessage=20when=20`org-mac-mail-account'=20is=20unset=20= at=20the=20time=20flagged=20messages=20are=20grabbed.=0A=0ATINYCHANGE=0A= ---=0A=20contrib/lisp/org-mac-link.el=20|=2033=20= +++------------------------------=0A=201=20file=20changed,=203=20= insertions(+),=2030=20deletions(-)=0A=0Adiff=20--git=20= a/contrib/lisp/org-mac-link.el=20b/contrib/lisp/org-mac-link.el=0Aindex=20= 3b58d04..e05a67d=20100644=0A---=20a/contrib/lisp/org-mac-link.el=0A+++=20= b/contrib/lisp/org-mac-link.el=0A@@=20-171,7=20+171,7=20@@=0A=20=20=20= :tag=20"Org=20Mail.app"=0A=20=20=20:group=20'org-link)=0A=20=0A= -(defcustom=20org-mac-mail-account=20"customize"=0A+(defcustom=20= org-mac-mail-account=20nil=0A=20=20=20"The=20Mail.app=20account=20in=20= which=20to=20search=20for=20flagged=20messages."=0A=20=20=20:group=20= 'org-mac-flagged-mail=0A=20=20=20:type=20'string)=0A@@=20-799,18=20= +799,10=20@@=20This=20will=20use=20the=20command=20`open'=20with=20the=20= message=20URL."=0A=20=0A=20(defun=20org-as-get-flagged-mail=20()=0A=20=20= =20"AppleScript=20to=20create=20links=20to=20flagged=20messages=20in=20= Mail.app."=0A+=20=20(unless=20org-mac-mail-account=0A+=20=20=20=20(error=20= "You=20must=20set=20org-mac-mail-account"))=0A=20=20=20(do-applescript=0A= =20=20=20=20(concat=0A-=20=20=20=20;;=20Is=20Growl=20installed?=0A-=20=20= =20=20"tell=20application=20\"System=20Events\"\n"=0A-=20=20=20=20"set=20= growlHelpers=20to=20the=20name=20of=20every=20process=20whose=20creator=20= type=20contains=20\"GRRR\"\n"=0A-=20=20=20=20"if=20(count=20of=20= growlHelpers)=20>=200=20then\n"=0A-=20=20=20=20"set=20growlHelperApp=20= to=20item=201=20of=20growlHelpers\n"=0A-=20=20=20=20"else\n"=0A-=20=20=20= =20"set=20growlHelperApp=20to=20\"\"\n"=0A-=20=20=20=20"end=20if\n"=0A-=20= =20=20=20"end=20tell\n"=0A-=0A=20=20=20=20=20;;=20Get=20links=0A=20=20=20= =20=20"tell=20application=20\"Mail\"\n"=0A=20=20=20=20=20"set=20= theMailboxes=20to=20every=20mailbox=20of=20account=20\""=20= org-mac-mail-account=20"\"\n"=0A@@=20-822,25=20+814,6=20@@=20This=20will=20= use=20the=20command=20`open'=20with=20the=20message=20URL."=0A=20=20=20=20= =20"set=20theSubject=20to=20subject=20of=20theMessage\n"=0A=20=20=20=20=20= "set=20theLink=20to=20\"message://\"=20&=20theID=20&=20\"::split::\"=20&=20= theSubject=20&=20\"\n\"\n"=0A=20=20=20=20=20"copy=20theLink=20to=20end=20= of=20theLinkList\n"=0A-=0A-=20=20=20=20;;=20Report=20progress=20through=20= Growl=0A-=20=20=20=20;;=20This=20"double=20tell"=20idiom=20is=20= described=20in=20detail=20at=0A-=20=20=20=20;;=20= http://macscripter.net/viewtopic.php?id=3D24570=20The=0A-=20=20=20=20;;=20= script=20compiler=20needs=20static=20knowledge=20of=20the=0A-=20=20=20=20= ;;=20growlHelperApp.=20=20Hmm,=20since=20we're=20compiling=0A-=20=20=20=20= ;;=20on-the-fly=20here,=20this=20is=20likely=20to=20be=20way=20less=0A-=20= =20=20=20;;=20portable=20than=20I'd=20hoped.=20=20It'll=20work=20when=20= the=20name=0A-=20=20=20=20;;=20is=20still=20"GrowlHelperApp",=20though.=0A= -=20=20=20=20"if=20growlHelperApp=20is=20not=20\"\"=20then\n"=0A-=20=20=20= =20"tell=20application=20\"GrowlHelperApp\"\n"=0A-=20=20=20=20"tell=20= application=20growlHelperApp\n"=0A-=20=20=20=20"set=20the=20= allNotificationsList=20to=20{\"FlaggedMail\"}\n"=0A-=20=20=20=20"set=20= the=20enabledNotificationsList=20to=20allNotificationsList\n"=0A-=20=20=20= =20"register=20as=20application=20\"FlaggedMail\"=20all=20notifications=20= allNotificationsList=20default=20notifications=20= enabledNotificationsList=20icon=20of=20application=20\"Mail\"\n"=0A-=20=20= =20=20"notify=20with=20name=20\"FlaggedMail\"=20title=20\"Importing=20= flagged=20message\"=20description=20theSubject=20application=20name=20= \"FlaggedMail\"\n"=0A-=20=20=20=20"end=20tell\n"=0A-=20=20=20=20"end=20= tell\n"=0A-=20=20=20=20"end=20if\n"=0A=20=20=20=20=20"end=20repeat\n"=0A=20= =20=20=20=20"end=20repeat\n"=0A=20=20=20=20=20"return=20theLinkList=20as=20= string\n"=0A--=20=0A2.1.1=0A=0A= --Apple-Mail=_172BA50C-17D0-4C8D-BFA8-B14E7F59C0AF--