all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Trouble binding Alt *by itself* to the execute-extended-command...(Alt-x and ESC-x work fine.)
@ 2013-07-06 21:18 Chris Seberino
  2013-07-06 22:16 ` Pascal J. Bourguignon
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Chris Seberino @ 2013-07-06 21:18 UTC (permalink / raw)
  To: help-gnu-emacs

Alt-x invokes the execute-extended-command just fine.

I'd like the Alt key *by itself* to this command.

I'm on Ubuntu 12.04.  I've read a few docs on X Windows, xmodmap, xev, Ubuntu Unity 3D but *still* can't seem to make this work.



cs


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

* Re: Trouble binding Alt *by itself* to the execute-extended-command...(Alt-x and ESC-x work fine.)
  2013-07-06 21:18 Trouble binding Alt *by itself* to the execute-extended-command...(Alt-x and ESC-x work fine.) Chris Seberino
@ 2013-07-06 22:16 ` Pascal J. Bourguignon
  2013-07-06 22:21 ` Peter Dyballa
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Pascal J. Bourguignon @ 2013-07-06 22:16 UTC (permalink / raw)
  To: help-gnu-emacs

Chris Seberino <cseberino@gmail.com> writes:

> Alt-x invokes the execute-extended-command just fine.

Did you do something special?  Because in my emacs, A-x doesn't invoke
execut-extended-command.  I have to type M-x to get that.


> I'd like the Alt key *by itself* to this command.
>
> I'm on Ubuntu 12.04.  I've read a few docs on X Windows, xmodmap, xev,
> Ubuntu Unity 3D but *still* can't seem to make this work.

You can find interesting keysyms in /usr/include/X11/keysymdef.h
You can use xmodmap to bind keycodes to the keysyms you want.
And you can use global-set-key to bind keysyms to the functions you want.

To replace the keysym Alt_L and Alt_R by Execute you can evaluate:

(shell-command "for code in $(xmodmap -pke|awk '/= Alt/{print $2}') ; do
xmodmap -e 'keycode 133 = Execute' ; done")

There is already a binding from the Execute keysym to
execute-extended-command in emacs-version "24.2.1"
If not, you can bind it with:

(global-set-key (kbd "<Execute>") 'execute-extended-command)


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.  
You know you've been lisping too long when you see a recent picture of George 
Lucas and think "Wait, I thought John McCarthy was dead!" -- Dalek_Baldwin




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

* Re: Trouble binding Alt *by itself* to the execute-extended-command...(Alt-x and ESC-x work fine.)
  2013-07-06 21:18 Trouble binding Alt *by itself* to the execute-extended-command...(Alt-x and ESC-x work fine.) Chris Seberino
  2013-07-06 22:16 ` Pascal J. Bourguignon
@ 2013-07-06 22:21 ` Peter Dyballa
  2013-07-07  2:44 ` Bob Proulx
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Peter Dyballa @ 2013-07-06 22:21 UTC (permalink / raw)
  To: Chris Seberino; +Cc: help-gnu-emacs


Am 06.07.2013 um 23:18 schrieb Chris Seberino:

> I'd like the Alt key *by itself* to this command.

Clear its type of being a only a modifier, assign to it some special value, say ×, and then bind in GNU Emacs × to execute-extended-command!

--
Greetings

  Pete
              <\
                \__     O                       __O
                | O\   _\\/\-%                _`\<,
                '()-'-(_)--(_)               (_)/(_)




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

* Re: Trouble binding Alt *by itself* to the execute-extended-command...(Alt-x and ESC-x work fine.)
  2013-07-06 21:18 Trouble binding Alt *by itself* to the execute-extended-command...(Alt-x and ESC-x work fine.) Chris Seberino
  2013-07-06 22:16 ` Pascal J. Bourguignon
  2013-07-06 22:21 ` Peter Dyballa
@ 2013-07-07  2:44 ` Bob Proulx
  2013-07-07  3:49 ` Yuri Khan
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Bob Proulx @ 2013-07-07  2:44 UTC (permalink / raw)
  To: help-gnu-emacs

Chris Seberino wrote:
> Alt-x invokes the execute-extended-command just fine.
> I'd like the Alt key *by itself* to this command.

That doesn't make any sense to me.  It would be like asking for making
the shift key by itself produce a shift-A.  Keys like shift and
meta (alt on modern keyboards) and control aren't supposed to produce
keys by themselves.  They are supposed to modify other keys pressed
with them.

If you did this then how would you type in M-a or M-e or any of the
others without the meta (alt) key?

> I'm on Ubuntu 12.04.  I've read a few docs on X Windows, xmodmap,
> xev, Ubuntu Unity 3D but *still* can't seem to make this work.

I think that is because it just isn't something that makes sense to
do.  Now if you phrase something in the form of a challenge people
will go to extreme lengths to accomplish it.  So I have no doubt that
what you are asking for is possible.  I am just challenging that it
isn't actually something that should be done.  IMNHO. :-)

For example you can move the meta modifier from alt and assign it to a
different key.  Or leave it on ALT_R while reassigning ALT_L.  And
then you could assign a high numbered function key to ALT_L.  And then
have your window manager apply a keyboard macro short whenever that
(new) function key is pressed.  It would do exactly as you have
asked.  But it would make no sense to me.

Bob



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

* Re: Trouble binding Alt *by itself* to the execute-extended-command...(Alt-x and ESC-x work fine.)
  2013-07-06 21:18 Trouble binding Alt *by itself* to the execute-extended-command...(Alt-x and ESC-x work fine.) Chris Seberino
                   ` (2 preceding siblings ...)
  2013-07-07  2:44 ` Bob Proulx
@ 2013-07-07  3:49 ` Yuri Khan
  2013-07-07  5:08 ` Chris Seberino
       [not found] ` <mailman.469.1373165078.12400.help-gnu-emacs@gnu.org>
  5 siblings, 0 replies; 11+ messages in thread
From: Yuri Khan @ 2013-07-07  3:49 UTC (permalink / raw)
  To: Chris Seberino; +Cc: help-gnu-emacs

On Sun, Jul 7, 2013 at 4:18 AM, Chris Seberino <cseberino@gmail.com> wrote:
> Alt-x invokes the execute-extended-command just fine.
>
> I'd like the Alt key *by itself* to this command.

What you are *asking for* is possible but requires additional
software. Using At-Home-Modifier or xcape, you can assign a dual
function to any key — one function (single key) when the key is tapped
shortly, another (modifier) when the key is held down. So, make your
Alt double as Apps, and you’re good to go.

What you *want* seems to be an easy single key for invoking
execute-extended-command. Would you be satisfied with Apps (aka Menu)
key? It’s bound by default.

However, what you *need* is probably to bind some keys to commands you
frequently use with execute-extended-command.



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

* Re: Trouble binding Alt *by itself* to the execute-extended-command...(Alt-x and ESC-x work fine.)
  2013-07-06 21:18 Trouble binding Alt *by itself* to the execute-extended-command...(Alt-x and ESC-x work fine.) Chris Seberino
                   ` (3 preceding siblings ...)
  2013-07-07  3:49 ` Yuri Khan
@ 2013-07-07  5:08 ` Chris Seberino
  2013-07-07 12:24   ` Raffaele Ricciardi
  2013-07-07 12:51   ` Pascal J. Bourguignon
       [not found] ` <mailman.469.1373165078.12400.help-gnu-emacs@gnu.org>
  5 siblings, 2 replies; 11+ messages in thread
From: Chris Seberino @ 2013-07-07  5:08 UTC (permalink / raw)
  To: help-gnu-emacs

Thank you all for your help. I finally got it.
In Ubuntu 12.04.2 LTS with Emacs 23.3.1 I did the following:

1. Remap Alt keys to the menu key...

xmodmap -e "keycode 64 = Menu"
xmodmap -e "keycode 108 = Menu"

2. Store that permanently...

xmodmap -pke > ~/.Xmodmap
echo "xmodmap .Xmodmap in" > ~/.xinitrc

...

That should work since the menu key runs execute-extended-command already.

I personally wanted to add some stuff before and after running
execute-extended-command so I added this to my .emacs ...

(global-set-key (kbd "<menu>") (lambda () (interactive)
                               
                                ....extra commands here...

                                (execute-extended-command t)
                                
                                ....extra commands here...))


It seems there is almost nothing Emacs can't do!


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

* Re: Trouble binding Alt *by itself* to the execute-extended-command...(Alt-x and ESC-x work fine.)
  2013-07-07  5:08 ` Chris Seberino
@ 2013-07-07 12:24   ` Raffaele Ricciardi
  2013-07-07 12:51   ` Pascal J. Bourguignon
  1 sibling, 0 replies; 11+ messages in thread
From: Raffaele Ricciardi @ 2013-07-07 12:24 UTC (permalink / raw)
  To: help-gnu-emacs

On 07/07/13 07:08, Chris Seberino wrote:
 > It seems there is almost nothing Emacs can't do!

Actually, Emacs would not have been able do what you were trying to do
- that is: binding a modifier key - unless Xmodmap was there to perform
the heavy lifting.


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

* Re: Trouble binding Alt *by itself* to the execute-extended-command...(Alt-x and ESC-x work fine.)
       [not found] ` <mailman.469.1373165078.12400.help-gnu-emacs@gnu.org>
@ 2013-07-07 12:49   ` Pascal J. Bourguignon
  0 siblings, 0 replies; 11+ messages in thread
From: Pascal J. Bourguignon @ 2013-07-07 12:49 UTC (permalink / raw)
  To: help-gnu-emacs

Bob Proulx <bob@proulx.com> writes:

> Chris Seberino wrote:
>> Alt-x invokes the execute-extended-command just fine.
>> I'd like the Alt key *by itself* to this command.
>
> That doesn't make any sense to me.  It would be like asking for making
> the shift key by itself produce a shift-A.  

Which is no problem, as I shown in my other answer!

Shift_L_keycode=$(xmodmap -pke|awk '/= Shift_L/{print $2}')
xmodmap -e "keycode $(Shift_L_keycode) = A A"

#to revert:
xmodmap -e "keycode $(Shift_L_keycode) = Shift_L" 

> Keys like shift and meta (alt on modern keyboards) and control aren't
> supposed to produce keys by themselves.  They are supposed to modify
> other keys pressed with them.

You are confused.  

There are keys on a keyboard that are supposed to be pressed.  When you
press a key, a keycode is supposed to be transmitted to the computer.
When a keycode is received, a keysym is supposed to be mapped from it by
X11, and sent to the application.  When emacs receives a keysym it is
supposed to map it to a command.  

Emacs doesn't see keys or key presses on the keyboard!


> If you did this then how would you type in M-a or M-e or any of the
> others without the meta (alt) key?

You could press on the ESC key or on the CONTROL key with the [ key
(assuming the default mapping of keycodes to keysyms and keysyms to
emacs commands).



-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.  
You know you've been lisping too long when you see a recent picture of George 
Lucas and think "Wait, I thought John McCarthy was dead!" -- Dalek_Baldwin


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

* Re: Trouble binding Alt *by itself* to the execute-extended-command...(Alt-x and ESC-x work fine.)
  2013-07-07  5:08 ` Chris Seberino
  2013-07-07 12:24   ` Raffaele Ricciardi
@ 2013-07-07 12:51   ` Pascal J. Bourguignon
  2013-07-07 20:50     ` Chris Seberino
  1 sibling, 1 reply; 11+ messages in thread
From: Pascal J. Bourguignon @ 2013-07-07 12:51 UTC (permalink / raw)
  To: help-gnu-emacs

Chris Seberino <cseberino@gmail.com> writes:

> Thank you all for your help. I finally got it.
> In Ubuntu 12.04.2 LTS with Emacs 23.3.1 I did the following:
>
> 1. Remap Alt keys to the menu key...
>
> xmodmap -e "keycode 64 = Menu"
> xmodmap -e "keycode 108 = Menu"

As I proposed in my first answer, it's obviously the Execute keysym that
should be used, to map to the execute-extended-command command.

You would bind Menu to tmm-menubar.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.  
You know you've been lisping too long when you see a recent picture of George 
Lucas and think "Wait, I thought John McCarthy was dead!" -- Dalek_Baldwin


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

* Re: Trouble binding Alt *by itself* to the execute-extended-command...(Alt-x and ESC-x work fine.)
  2013-07-07 12:51   ` Pascal J. Bourguignon
@ 2013-07-07 20:50     ` Chris Seberino
  2013-07-07 22:06       ` Pascal J. Bourguignon
  0 siblings, 1 reply; 11+ messages in thread
From: Chris Seberino @ 2013-07-07 20:50 UTC (permalink / raw)
  To: help-gnu-emacs

On Sunday, July 7, 2013 7:51:18 AM UTC-5, Pascal J. Bourguignon wrote:

> As I proposed in my first answer, it's obviously the Execute keysym that
> 
> should be used, to map to the execute-extended-command command.

Binding the Alt key to the end goal is the logical solution.  Your answer would be the BEST one if I could get it to work.  The problem is I got burned out trying to make Emacs understand the lone Alt key by itself.

Peter's solution was to outsource the Alt keybinding to the desktop.  By avoiding fighting Emacs on this one it was doable for me.


cs


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

* Re: Trouble binding Alt *by itself* to the execute-extended-command...(Alt-x and ESC-x work fine.)
  2013-07-07 20:50     ` Chris Seberino
@ 2013-07-07 22:06       ` Pascal J. Bourguignon
  0 siblings, 0 replies; 11+ messages in thread
From: Pascal J. Bourguignon @ 2013-07-07 22:06 UTC (permalink / raw)
  To: help-gnu-emacs

Chris Seberino <cseberino@gmail.com> writes:

> On Sunday, July 7, 2013 7:51:18 AM UTC-5, Pascal J. Bourguignon wrote:
>
>> As I proposed in my first answer, it's obviously the Execute keysym that
>> 
>> should be used, to map to the execute-extended-command command.
>
> Binding the Alt key to the end goal is the logical solution.  Your
> answer would be the BEST one if I could get it to work.  The problem
> is I got burned out trying to make Emacs understand the lone Alt key
> by itself.

Of course, since what you're asking is just IMPOSSIBLE!

There is absolutely ZERO, NONE, NO WAY to bind any modifier keysym to a
command.

That's why everybody is telling you to bind ANOTHER keysym to they
keycode produced when you press the so called "Alt" key.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.  
You know you've been lisping too long when you see a recent picture of George 
Lucas and think "Wait, I thought John McCarthy was dead!" -- Dalek_Baldwin


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

end of thread, other threads:[~2013-07-07 22:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-06 21:18 Trouble binding Alt *by itself* to the execute-extended-command...(Alt-x and ESC-x work fine.) Chris Seberino
2013-07-06 22:16 ` Pascal J. Bourguignon
2013-07-06 22:21 ` Peter Dyballa
2013-07-07  2:44 ` Bob Proulx
2013-07-07  3:49 ` Yuri Khan
2013-07-07  5:08 ` Chris Seberino
2013-07-07 12:24   ` Raffaele Ricciardi
2013-07-07 12:51   ` Pascal J. Bourguignon
2013-07-07 20:50     ` Chris Seberino
2013-07-07 22:06       ` Pascal J. Bourguignon
     [not found] ` <mailman.469.1373165078.12400.help-gnu-emacs@gnu.org>
2013-07-07 12:49   ` Pascal J. Bourguignon

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.