emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Re: hotkeys for org in OS X (WAS gnome)
@ 2007-12-22 22:18 William Henney
  0 siblings, 0 replies; only message in thread
From: William Henney @ 2007-12-22 22:18 UTC (permalink / raw)
  To: Rustom Mody; +Cc: emacs-orgmode

Hi list

On Dec 22, 2007 12:00 PM, Rustom Mody <rustompmody@gmail.com> 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-12-22 22:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-22 22:18 hotkeys for org in OS X (WAS gnome) William Henney

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).