emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* hotkeys for org in gnome
@ 2007-12-15  4:34 Rustom Mody
  2007-12-16 11:33 ` Adam Spiers
  2007-12-17  6:27 ` Dmitri Minaev
  0 siblings, 2 replies; 12+ messages in thread
From: Rustom Mody @ 2007-12-15  4:34 UTC (permalink / raw)
  To: emacs-orgmode

There was a thread here (sorry cant exactly find it) about how when
running emacs under windows it has been possible to setup a keyboard
shortcut such that from anywhere, any application one can jump to
emacs under a remember in org mode.

Something similar should be possible under gnome.  Anyone know how?

What I have been able to do so far is that in
gconf-editor -> apps -> metacity -> global-keybindings run_command_1
is bound to the key <mod4> e (that is WIN e)
And in
gconf-editor -> apps -> metacity -> keybinding-commands command_1 is
bound to wmctrl -a emacs

In combination this makes Win e a 'global hotkey' so that from any
application under gnome Win-e activates emacs (assuming it is there
iconified)

I was wondering if there is some way that in addition to activating
emacs it is possible to run remember

Thanks

Rustom

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: hotkeys for org in gnome
  2007-12-15  4:34 hotkeys for org in gnome Rustom Mody
@ 2007-12-16 11:33 ` Adam Spiers
  2007-12-16 16:56   ` Rustom Mody
  2007-12-17  6:27 ` Dmitri Minaev
  1 sibling, 1 reply; 12+ messages in thread
From: Adam Spiers @ 2007-12-16 11:33 UTC (permalink / raw)
  To: emacs-orgmode

On Sat, Dec 15, 2007 at 10:04:44AM +0530, Rustom Mody wrote:
> There was a thread here (sorry cant exactly find it) about how when
> running emacs under windows it has been possible to setup a keyboard
> shortcut such that from anywhere, any application one can jump to
> emacs under a remember in org mode.

I missed that first time, but what a great idea!

> Something similar should be possible under gnome.  Anyone know how?
> 
> What I have been able to do so far is that in
> gconf-editor -> apps -> metacity -> global-keybindings run_command_1
> is bound to the key <mod4> e (that is WIN e)
> And in
> gconf-editor -> apps -> metacity -> keybinding-commands command_1 is
> bound to wmctrl -a emacs
> 
> In combination this makes Win e a 'global hotkey' so that from any
> application under gnome Win-e activates emacs (assuming it is there
> iconified)

Wow, thanks!  What a great discovery wmctrl is.

> I was wondering if there is some way that in addition to activating
> emacs it is possible to run remember

Returning the favour: http://xmacro.sourceforge.net/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: hotkeys for org in gnome
  2007-12-16 11:33 ` Adam Spiers
@ 2007-12-16 16:56   ` Rustom Mody
  2007-12-17 15:19     ` Adam Spiers
  0 siblings, 1 reply; 12+ messages in thread
From: Rustom Mody @ 2007-12-16 16:56 UTC (permalink / raw)
  To: Adam Spiers, emacs-orgmode

On Dec 16, 2007 5:03 PM, Adam Spiers <orgmode@adamspiers.org> 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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: hotkeys for org in gnome
  2007-12-15  4:34 hotkeys for org in gnome Rustom Mody
  2007-12-16 11:33 ` Adam Spiers
@ 2007-12-17  6:27 ` Dmitri Minaev
  2007-12-17 15:20   ` Adam Spiers
  1 sibling, 1 reply; 12+ messages in thread
From: Dmitri Minaev @ 2007-12-17  6:27 UTC (permalink / raw)
  To: Rustom Mody; +Cc: emacs-orgmode

On Dec 15, 2007 8:34 AM, Rustom Mody <rustompmody@gmail.com> wrote:
> I was wondering if there is some way that in addition to activating
> emacs it is possible to run remember

I believe this is one more argument in favor of scriptable window
managers. In Stumpwm, Sawfish and, I assume, in Ion it's a trivial
task.

-- 
With best regards,
Dmitri Minaev

Russian history blog: http://minaev.blogspot.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: hotkeys for org in gnome
  2007-12-16 16:56   ` Rustom Mody
@ 2007-12-17 15:19     ` Adam Spiers
  0 siblings, 0 replies; 12+ messages in thread
From: Adam Spiers @ 2007-12-17 15:19 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 846 bytes --]

On Sun, Dec 16, 2007 at 10:26:40PM +0530, Rustom Mody wrote:
> On Dec 16, 2007 5:03 PM, Adam Spiers <orgmode@adamspiers.org> 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.

[-- Attachment #2: org-agenda --]
[-- Type: text/plain, Size: 839 bytes --]

#!/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

[-- Attachment #3: Type: text/plain, Size: 204 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: hotkeys for org in gnome
  2007-12-17  6:27 ` Dmitri Minaev
@ 2007-12-17 15:20   ` Adam Spiers
  2007-12-17 15:41     ` Eric Schulte
  0 siblings, 1 reply; 12+ messages in thread
From: Adam Spiers @ 2007-12-17 15:20 UTC (permalink / raw)
  To: emacs-orgmode

On Mon, Dec 17, 2007 at 10:27:40AM +0400, Dmitri Minaev wrote:
> On Dec 15, 2007 8:34 AM, Rustom Mody <rustompmody@gmail.com> wrote:
> > I was wondering if there is some way that in addition to activating
> > emacs it is possible to run remember
> 
> I believe this is one more argument in favor of scriptable window
> managers. In Stumpwm, Sawfish and, I assume, in Ion it's a trivial
> task.

Agreed!  Alas, I was forced to abandon sawfish after its development
and maintenance slowed down to a crawl.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: hotkeys for org in gnome
  2007-12-17 15:20   ` Adam Spiers
@ 2007-12-17 15:41     ` Eric Schulte
  2007-12-22 15:52       ` Bastien
  0 siblings, 1 reply; 12+ messages in thread
From: Eric Schulte @ 2007-12-17 15:41 UTC (permalink / raw)
  To: Adam Spiers; +Cc: emacs-orgmode

On Monday, December 17, at 15:20, Adam Spiers wrote:
 > On Mon, Dec 17, 2007 at 10:27:40AM +0400, Dmitri Minaev wrote:
 > > On Dec 15, 2007 8:34 AM, Rustom Mody <rustompmody@gmail.com> wrote:
 > > > I was wondering if there is some way that in addition to activating
 > > > emacs it is possible to run remember
 > > 
 > > I believe this is one more argument in favor of scriptable window
 > > managers. In Stumpwm, Sawfish and, I assume, in Ion it's a trivial
 > > task.
 > 
 > Agreed!  Alas, I was forced to abandon sawfish after its development
 > and maintenance slowed down to a crawl.

I've been looking into window managers which can integrate well
w/emacs, and it looks like FVWM http://fvwm.org/ is *very*
customizable, and it is actively maintained.

-- 
schulte

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: hotkeys for org in gnome
  2007-12-17 15:41     ` Eric Schulte
@ 2007-12-22 15:52       ` Bastien
  2007-12-22 18:00         ` Rustom Mody
  0 siblings, 1 reply; 12+ messages in thread
From: Bastien @ 2007-12-22 15:52 UTC (permalink / raw)
  To: emacs-orgmode

"Eric Schulte" <schulte.eric@gmail.com> writes:

> On Monday, December 17, at 15:20, Adam Spiers wrote:
>  > On Mon, Dec 17, 2007 at 10:27:40AM +0400, Dmitri Minaev wrote:
>  > > On Dec 15, 2007 8:34 AM, Rustom Mody <rustompmody@gmail.com> wrote:
>  > > > I was wondering if there is some way that in addition to activating
>  > > > emacs it is possible to run remember
>  > > 
>  > > I believe this is one more argument in favor of scriptable window
>  > > managers. In Stumpwm, Sawfish and, I assume, in Ion it's a trivial
>  > > task.
>  > 
>  > Agreed!  Alas, I was forced to abandon sawfish after its development
>  > and maintenance slowed down to a crawl.
>
> I've been looking into window managers which can integrate well
> w/emacs, and it looks like FVWM http://fvwm.org/ is *very*
> customizable, and it is actively maintained.

For those who speak python, I've just discover this new window manager
and think it could get along great with Emacs: PycaWM

http://pycawm.last-exile.org/

-- 
Bastien

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: hotkeys for org in gnome
  2007-12-22 15:52       ` Bastien
@ 2007-12-22 18:00         ` Rustom Mody
  2007-12-24  1:02           ` Adam Spiers
  0 siblings, 1 reply; 12+ messages in thread
From: Rustom Mody @ 2007-12-22 18:00 UTC (permalink / raw)
  To: emacs-orgmode

On Dec 22, 2007 9:22 PM, Bastien <bzg@altern.org> wrote:
> "Eric Schulte" <schulte.eric@gmail.com> writes:
>
> > On Monday, December 17, at 15:20, Adam Spiers wrote:
> >  > On Mon, Dec 17, 2007 at 10:27:40AM +0400, Dmitri Minaev wrote:
> >  > > On Dec 15, 2007 8:34 AM, Rustom Mody <rustompmody@gmail.com> wrote:
> >  > > > I was wondering if there is some way that in addition to activating
> >  > > > emacs it is possible to run remember
> >  > >
> >  > > I believe this is one more argument in favor of scriptable window
> >  > > managers. In Stumpwm, Sawfish and, I assume, in Ion it's a trivial
> >  > > task.
> >  >
> >  > Agreed!  Alas, I was forced to abandon sawfish after its development
> >  > and maintenance slowed down to a crawl.
> >
> > I've been looking into window managers which can integrate well
> > w/emacs, and it looks like FVWM http://fvwm.org/ is *very*
> > customizable, and it is actively maintained.
>
> For those who speak python, I've just discover this new window manager
> and think it could get along great with Emacs: PycaWM
>
> http://pycawm.last-exile.org/
>
> --
> Bastien

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))

gconf-editor->apps->metacity->keybindings->command_1 has the binding:

bash -c "wmctrl -a emacs; emacsclient -n -e '(myserver)'"
Actually it has
bash -c "wmctrl -a emacs-snapshot-gtk; emacsclient.emacs-snapshot -n
-e '(myserver)'"
because of debian peculiarities with respect to emacs 22.

And gconf-editor->apps->metacity->global-keybindings has run_command_1
bound to the keystroke <mod4>e ie Win-e

Note that this is not quite satisfactory to me because the raise-frame
and the make-frame-visible are both redundant and insufficient.  Which
is why I need the wmctrl. Which is why I need the bash -c.

If anyone finds a way of streamlining this please post it!

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: hotkeys for org in gnome
  2007-12-22 18:00         ` Rustom Mody
@ 2007-12-24  1:02           ` Adam Spiers
  2007-12-24  4:05             ` Rustom Mody
  0 siblings, 1 reply; 12+ messages in thread
From: Adam Spiers @ 2007-12-24  1:02 UTC (permalink / raw)
  To: emacs-orgmode

On Sat, Dec 22, 2007 at 11:30:52PM +0530, Rustom Mody wrote:
> On Dec 22, 2007 9:22 PM, Bastien <bzg@altern.org> wrote:
> > "Eric Schulte" <schulte.eric@gmail.com> writes:
> >
> > > On Monday, December 17, at 15:20, Adam Spiers wrote:
> > >  > On Mon, Dec 17, 2007 at 10:27:40AM +0400, Dmitri Minaev wrote:
> > >  > > On Dec 15, 2007 8:34 AM, Rustom Mody <rustompmody@gmail.com> wrote:
> > >  > > > I was wondering if there is some way that in addition to activating
> > >  > > > emacs it is possible to run remember

[snipped]

> 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))
> 
> gconf-editor->apps->metacity->keybindings->command_1 has the binding:
> 
> bash -c "wmctrl -a emacs; emacsclient -n -e '(myserver)'"
> Actually it has
> bash -c "wmctrl -a emacs-snapshot-gtk; emacsclient.emacs-snapshot -n
> -e '(myserver)'"
> because of debian peculiarities with respect to emacs 22.
> 
> And gconf-editor->apps->metacity->global-keybindings has run_command_1
> bound to the keystroke <mod4>e ie Win-e

Nice.  I'm currently on the 2nd option as documented in a post a few
days again, but there's very little difference; in fact it could well
be worth me switching to the emacsclient approach as there are a few
minor issues with using xmacro.

> Note that this is not quite satisfactory to me because the raise-frame
> and the make-frame-visible are both redundant and insufficient.

You lost me there.  .emacs is only run at startup, after which the
window manager can do anything it wants with the positioning and
visibility of the frames - or was that your point?

> Which is why I need the wmctrl. Which is why I need the bash -c.

Right.  I'm using -c as well.

> If anyone finds a way of streamlining this please post it!

If it's the -c you don't like, you can always dump the commands in a
script.  That's nice because it gives you more breathing space to do
things like error checking on the exit code of the wmctrl.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: hotkeys for org in gnome
  2007-12-24  1:02           ` Adam Spiers
@ 2007-12-24  4:05             ` Rustom Mody
  2007-12-24 12:32               ` Adam Spiers
  0 siblings, 1 reply; 12+ messages in thread
From: Rustom Mody @ 2007-12-24  4:05 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1561 bytes --]

On Dec 24, 2007 6:32 AM, Adam Spiers <orgmode@adamspiers.org> wrote:

> On Sat, Dec 22, 2007 at 11:30:52PM +0530, Rustom Mody wrote:
> > Note that this is not quite satisfactory to me because the raise-frame
> > and the make-frame-visible are both redundant and insufficient.
>
> You lost me there.  .emacs is only run at startup, after which the
> window manager can do anything it wants with the positioning and
> visibility of the frames - or was that your point?
>
> > Which is why I need the wmctrl. Which is why I need the bash -c.
>
> Right.  I'm using -c as well.
>

The requirement is this: I should be able to -- with a single keystroke --
to get from any application into emacs into org mode.  However
make-frame-visible and raise-frame dont quite work: If emacs is iconized it
gets de-iconized but if it is already one of the open windows below some
other -- firefox, shell, whatever -- it *remains under that with the emacs
tab blinking.* As a consequence Ive got to use the mouse (or shuffle through
Alt-Tab).

wmctrl does the job. But using it makes for two calls -- wmctrl and
emacsclient -- and that makes for a packaging under a (inline) shell-script.



> If anyone finds a way of streamlining this please post it!
>
> If it's the -c you don't like, you can always dump the commands in a
> script.  That's nice because it gives you more breathing space to do
> things like error checking on the exit code of the wmctrl.
>
>
What I dont like is having to use a shell call for some functionality that
is almost certainly available under elisp.

[-- Attachment #1.2: Type: text/html, Size: 2257 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: hotkeys for org in gnome
  2007-12-24  4:05             ` Rustom Mody
@ 2007-12-24 12:32               ` Adam Spiers
  0 siblings, 0 replies; 12+ messages in thread
From: Adam Spiers @ 2007-12-24 12:32 UTC (permalink / raw)
  To: emacs-orgmode

Rustom Mody (rustompmody@gmail.com) wrote:
> On Dec 24, 2007 6:32 AM, Adam Spiers <orgmode@adamspiers.org> wrote:
> > On Sat, Dec 22, 2007 at 11:30:52PM +0530, Rustom Mody wrote:
> > > If anyone finds a way of streamlining this please post it!
> >
> > If it's the -c you don't like, you can always dump the commands in a
> > script.  That's nice because it gives you more breathing space to do
> > things like error checking on the exit code of the wmctrl.
> >
> What I dont like is having to use a shell call for some functionality that
> is almost certainly available under elisp.

Why not?  The operation you're talking about (find an emacs, and
ensure it is visible and focused) is more related to the window
manager and X11 environment, so to me it makes much more sense to use
wmctrl than look for some elisp.  Plus, wmctrl is easy and already
works, so why look for an alternative?  I certainly wouldn't class
this solution as an ugly hack; the only slightly ugly thing is
embedding sh -c somewhere, but as I already pointed out, that is
easily surmountable.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2007-12-24 12:33 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-15  4:34 hotkeys for org in gnome Rustom Mody
2007-12-16 11:33 ` Adam Spiers
2007-12-16 16:56   ` Rustom Mody
2007-12-17 15:19     ` Adam Spiers
2007-12-17  6:27 ` Dmitri Minaev
2007-12-17 15:20   ` Adam Spiers
2007-12-17 15:41     ` Eric Schulte
2007-12-22 15:52       ` Bastien
2007-12-22 18:00         ` Rustom Mody
2007-12-24  1:02           ` Adam Spiers
2007-12-24  4:05             ` Rustom Mody
2007-12-24 12:32               ` Adam Spiers

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).