Hi list

On Dec 22, 2007 12:00 PM, Rustom Mody <[EMAIL PROTECTED]> 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"
        activate
        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
(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

-- 

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


_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to