From mboxrd@z Thu Jan 1 00:00:00 1970 From: "William Henney" Subject: Re: hotkeys for org in OS X (WAS gnome) Date: Sat, 22 Dec 2007 16:18:45 -0600 Message-ID: <41c818190712221418sddcd69j14ab6d18ddcf1ea5@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J6CgG-0005FP-Ht for emacs-orgmode@gnu.org; Sat, 22 Dec 2007 17:18:52 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J6CgB-00056p-KR for emacs-orgmode@gnu.org; Sat, 22 Dec 2007 17:18:50 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J6CgB-00056Y-HX for emacs-orgmode@gnu.org; Sat, 22 Dec 2007 17:18:47 -0500 Received: from ug-out-1314.google.com ([66.249.92.169]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1J6CgB-0004aV-65 for emacs-orgmode@gnu.org; Sat, 22 Dec 2007 17:18:47 -0500 Received: by ug-out-1314.google.com with SMTP id a2so964521ugf.48 for ; Sat, 22 Dec 2007 14:18:45 -0800 (PST) Content-Disposition: inline List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rustom Mody Cc: emacs-orgmode@gnu.org Hi list On Dec 22, 2007 12:00 PM, Rustom Mody wrote: > I guess that there are -- broadly speaking -- 3 ways of handling this: > > 1. A programmable window manager > 2. Generating arbitrary sequence of events by stuffing the > corresponding keys into the window manager using (something like) > xrecord > 3. Using emacs' own clientserver setup ie emacsclient > > I have as of now opted for the 3rd option. My setup is as follows: > > .emacs has the following: > > (server-start) > (defun myserver () > (raise-frame) > (make-frame-visible) > (remember)) > Inspired by Rustom's post, I have experimented with doing a similar thing for OS X, using applescript. The following seems to work OK. ------------- begin script --------------------------------- tell application "Aquamacs Emacs" =09activate =09delay 1 =09tell application "System Events" =09=09tell process "Emacs" =09=09=09tell window 1 =09=09=09=09key code 53 =09=09=09=09keystroke ":" =09=09=09=09keystroke "(myfunc)" =09=09=09=09keystroke return =09=09=09end tell =09=09end tell =09end tell end tell ------------ end script ------------------------------------ This script can be bound to a hotkey using QuickSilver, or similar. Note that this doesn't use emacsclient, so it is an example of Rustom's 1st option. It is heavily indebted to a similar script that Bill Clementson posted on his blog (http://bc.tech.coop/blog/041219.html) The function myfunc does not need to contain the raise-frame and make-frame-visible commands. The command "delay 1" is there to work around a bug in the virtual desktop software that I use. If emacs is running on a different desktop, then it receives a switch-frame command just after it is raised. Without the delay, the switch-frame can show up in the middle of the "M-: (myfunc)" sequence, which breaks things. Happy Xmas to all you org-ers! A special festive thanks to our glorious leader Carsten, and his trusty lieutenant Bastien. Cheers Will --=20 Dr William Henney, Centro de Radioastronom=EDa y Astrof=EDsica, Universidad Nacional Aut=F3noma de M=E9xico, Campus Morelia