On Sun, Dec 16, 2007 at 10:26:40PM +0530, Rustom Mody wrote:
> On Dec 16, 2007 5:03 PM, Adam Spiers <[EMAIL PROTECTED]> wrote:
> > :
> > :
> > Returning the favour: http://xmacro.sourceforge.net/
> 
> Could you make it work? I could not (about 20 minutes of trying)
> Seems worthwhile but a bit ancient

Yes, got it working in the end.  Found a few patches lying around the
web to fix various things, so it compiles cleanly now.  You can use
mercurial to do a hg clone of my repository from

  http://www.adamspiers.org/cgi-bin/hg.cgi/xmacro/

There appears to be a complete lack of sanity checking of the input
you feed it, so for example

  echo "KeyStr Escape" | ./xmacroplay :0

works great, but

  echo "KeySym Escape" | ./xmacroplay :0

will blow up in your face.

Attached is an example script which I have bound to Win-a in openbox.
#!/bin/sh

if [ -z "$DISPLAY" ]; then
    echo "$0: no DISPLAY" >&2
    exit 1
fi

if ! wmctrl -a emacs; then
    echo "$0: wmctrl failed" >&2
    exit 1
fi

# It seems there is some kind of timing issue which requires this
# sleep - probably we have to ensure that wmctrl has finished
# switching before feeding the command to emacs.
sleep 0.2

if true; then

    # Use M-x org-agenda; works regardless of key-binding or current
    # buffer.  Also Escape should be more portable than Meta_L etc.
    xmacroplay $DISPLAY <<EOF >/dev/null
KeyStr Escape
String xorg-agenda
KeyStr Return
EOF

else

    # Another way of doing it since I bind C-c C-a to `org-agenda',
    # but this only works if the current emacs buffer is in org-mode.
    xmacroplay $DISPLAY <<EOF >/dev/null
KeyStrPress Control_L
String ca
KeyStrRelease Control_L
EOF

fi
_______________________________________________
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