emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "William Henney" <whenney@gmail.com>
To: Rustom Mody <rustompmody@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: hotkeys for org in OS X (WAS gnome)
Date: Sat, 22 Dec 2007 16:18:45 -0600	[thread overview]
Message-ID: <41c818190712221418sddcd69j14ab6d18ddcf1ea5@mail.gmail.com> (raw)

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

                 reply	other threads:[~2007-12-22 22:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41c818190712221418sddcd69j14ab6d18ddcf1ea5@mail.gmail.com \
    --to=whenney@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=rustompmody@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).