[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] hotkeys for org in OS X (WAS gnome)

From: William Henney
Subject: Re: [Orgmode] hotkeys for org in OS X (WAS gnome)
Date: Sat, 22 Dec 2007 16:18:45 -0600

Hi list

On Dec 22, 2007 12:00 PM, Rustom Mody <address@hidden> 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"
        delay 1
        tell application "System Events"
                tell process "Emacs"
                        tell window 1
                                key code 53
                                keystroke ":"
                                keystroke "(myfunc)"
                                keystroke return
                        end tell
                end tell
        end 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

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.




  Dr William Henney, Centro de Radioastronomía y Astrofísica,
  Universidad Nacional Autónoma de México, Campus Morelia

reply via email to

[Prev in Thread] Current Thread [Next in Thread]