unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Why the C-M-<keys> is invalid in my emacs?
@ 2015-08-08  1:56 Navy Cheng
  2015-08-08  5:26 ` Ian Zimmerman
  0 siblings, 1 reply; 10+ messages in thread
From: Navy Cheng @ 2015-08-08  1:56 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I find I can't use *C-M-<keys>* combined key in my emacs. I have to use
*Esc C-<keys>* to instead. However, when I close X-server in my OS and
use emacs in the console, *C-M-<keys>* is OK.

Why? How can I use *C-M-<keys>*, such as *C-M-h* in X?

Thanks.





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

* Re: Why the C-M-<keys> is invalid in my emacs?
       [not found] <mailman.7970.1438999012.904.help-gnu-emacs@gnu.org>
@ 2015-08-08  2:42 ` Rusi
  2015-08-08  3:10   ` Navy Cheng
       [not found]   ` <mailman.7971.1439003457.904.help-gnu-emacs@gnu.org>
  2015-08-08  4:17 ` Pascal J. Bourguignon
  1 sibling, 2 replies; 10+ messages in thread
From: Rusi @ 2015-08-08  2:42 UTC (permalink / raw)
  To: help-gnu-emacs

On Saturday, August 8, 2015 at 7:26:56 AM UTC+5:30, Navy Cheng wrote:
> Hi,
> 
> I find I can't use *C-M-<keys>* combined key in my emacs. I have to use
> *Esc C-<keys>* to instead. However, when I close X-server in my OS and
> use emacs in the console, *C-M-<keys>* is OK.
> 
> Why? How can I use *C-M-<keys>*, such as *C-M-h* in X?
> 
> Thanks.

Probably this is OS-related
And you need to tell which OS so that those who know more specifics can answer.
Also 'M-' means what exactly to you?


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

* Re: Why the C-M-<keys> is invalid in my emacs?
  2015-08-08  2:42 ` Rusi
@ 2015-08-08  3:10   ` Navy Cheng
  2015-08-08 17:36     ` Robert Thorpe
       [not found]   ` <mailman.7971.1439003457.904.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 10+ messages in thread
From: Navy Cheng @ 2015-08-08  3:10 UTC (permalink / raw)
  To: help-gnu-emacs

On Fri, Aug 07, 2015 at 07:42:57PM -0700, Rusi wrote:
> On Saturday, August 8, 2015 at 7:26:56 AM UTC+5:30, Navy Cheng wrote:
> > Hi,
> > 
> > I find I can't use *C-M-<keys>* combined key in my emacs. I have to use
> > *Esc C-<keys>* to instead. However, when I close X-server in my OS and
> > use emacs in the console, *C-M-<keys>* is OK.
> > 
> > Why? How can I use *C-M-<keys>*, such as *C-M-h* in X?
> > 
> > Thanks.
> 
> Probably this is OS-related
> And you need to tell which OS so that those who know more specifics can answer.
> Also 'M-' means what exactly to you?

I use Debian 8 and Xfce Desktop Environment. 'M-' is OK and 'C-M-' is OK in other
software execpt emacs.




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

* Re: Why the C-M-<keys> is invalid in my emacs?
       [not found]   ` <mailman.7971.1439003457.904.help-gnu-emacs@gnu.org>
@ 2015-08-08  3:12     ` Rusi
  2015-08-08  4:16       ` Navy Cheng
  0 siblings, 1 reply; 10+ messages in thread
From: Rusi @ 2015-08-08  3:12 UTC (permalink / raw)
  To: help-gnu-emacs

On Saturday, August 8, 2015 at 8:40:59 AM UTC+5:30, Navy Cheng wrote:
> On Fri, Aug 07, 2015 at 07:42:57PM -0700, Rusi wrote:
> > On Saturday, August 8, 2015 at 7:26:56 AM UTC+5:30, Navy Cheng wrote:
> > > Hi,
> > > 
> > > I find I can't use *C-M-<keys>* combined key in my emacs. I have to use
> > > *Esc C-<keys>* to instead. However, when I close X-server in my OS and
> > > use emacs in the console, *C-M-<keys>* is OK.
> > > 
> > > Why? How can I use *C-M-<keys>*, such as *C-M-h* in X?
> > > 
> > > Thanks.
> > 
> > Probably this is OS-related
> > And you need to tell which OS so that those who know more specifics can answer.
> > Also 'M-' means what exactly to you?
> 
> I use Debian 8 and Xfce Desktop Environment. 'M-' is OK and 'C-M-' is OK in other
> software execpt emacs.

What physical hardware key is 'M-'?


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

* Re: Why the C-M-<keys> is invalid in my emacs?
  2015-08-08  3:12     ` Rusi
@ 2015-08-08  4:16       ` Navy Cheng
  0 siblings, 0 replies; 10+ messages in thread
From: Navy Cheng @ 2015-08-08  4:16 UTC (permalink / raw)
  To: help-gnu-emacs

On Fri, Aug 07, 2015 at 08:12:59PM -0700, Rusi wrote:
> On Saturday, August 8, 2015 at 8:40:59 AM UTC+5:30, Navy Cheng wrote:
> > On Fri, Aug 07, 2015 at 07:42:57PM -0700, Rusi wrote:
> > > On Saturday, August 8, 2015 at 7:26:56 AM UTC+5:30, Navy Cheng wrote:
> > > > Hi,
> > > > 
> > > > I find I can't use *C-M-<keys>* combined key in my emacs. I have to use
> > > > *Esc C-<keys>* to instead. However, when I close X-server in my OS and
> > > > use emacs in the console, *C-M-<keys>* is OK.
> > > > 
> > > > Why? How can I use *C-M-<keys>*, such as *C-M-h* in X?
> > > > 
> > > > Thanks.
> > > 
> > > Probably this is OS-related
> > > And you need to tell which OS so that those who know more specifics can answer.
> > > Also 'M-' means what exactly to you?
> > 
> > I use Debian 8 and Xfce Desktop Environment. 'M-' is OK and 'C-M-' is OK in other
> > software execpt emacs.
> 
> What physical hardware key is 'M-'?

'M-' is Alt, 'C-' is Ctrl.




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

* Re: Why the C-M-<keys> is invalid in my emacs?
       [not found] <mailman.7970.1438999012.904.help-gnu-emacs@gnu.org>
  2015-08-08  2:42 ` Rusi
@ 2015-08-08  4:17 ` Pascal J. Bourguignon
  1 sibling, 0 replies; 10+ messages in thread
From: Pascal J. Bourguignon @ 2015-08-08  4:17 UTC (permalink / raw)
  To: help-gnu-emacs

Navy Cheng <navych@126.com> writes:

> Hi,
>
> I find I can't use *C-M-<keys>* combined key in my emacs. I have to use
> *Esc C-<keys>* to instead. However, when I close X-server in my OS and
> use emacs in the console, *C-M-<keys>* is OK.
>
> Why? How can I use *C-M-<keys>*, such as *C-M-h* in X?

That would depend on your window manager, that probably preempt C-M- or
just M- for its own purposes.  Configure your window manager to use
another combination, or change the window manager.

Also, you may edit your ~/.xmodmap

You can bind the X symbols: Super_L Super_R Hyper_L Hyper_R Control_L
Control_R Shift_L Shift_R Alt_L Alt_R Meta_L Meta_R to keycodes.

You can also bind Multi_key and Mode_switch which have special X
keyboard functions.

For example, I have (codes depend on your keyboard):

    keycode 127 = Super_R
    keycode  66 = Control_L
    keycode  50 = Shift_L
    keycode  62 = Shift_R         
    keycode 133 = Alt_L
    keycode  64 = Meta_L
    keycode 108 = Meta_R
    keycode 135 = Hyper_R
    keycode 105 = Control_R
    keycode  90 = Super_R

    keycode  37 = Multi_key       
    keycode 134 = Mode_switch


But now as you can see, there are more key symbols above than mode bits
in an X event.  There are only 8 mode bits (which means that you can
only generate 256 different symbols from a single keycode.  Theorically,
you could have 256 symbols on the keycode lines (not in practice, there
are implementation restrictions on reading the xmodmap, but internally,
the tables would allow it AFAIK).

Anyways, the 8 mode bits are:

    clear Shift
    clear Lock
    clear Control
    clear Mod1
    clear Mod2
    clear Mod3
    clear Mod4
    clear Mod5

And you can map the key syms you wish to those mode bits as you want:

    !!! In order of bits (for order of keysyms on keycode lines):
    add    Shift   = Shift_L     Shift_R
    add    Lock    = Caps_Lock
    add    Control = Control_L   Control_R
    add    Mod1    = Num_Lock
    add    Mod2    = Alt_L       Alt_R       Mode_switch
    add    Mod3    = Meta_L      Meta_R
    add    Mod4    = Super_L     Super_R
    add    Mod5    = Hyper_L     Hyper_R     

And the point here, is that window managers often use the mode bit to
activate their functions. I've used window managers that used Mod2;
therefore you assigning Meta_L and Meta_R to a different mode bit, you
can let it pass free thru the window manager to emacs.


So:

1. type a key on the keyboard -> produces a keycode

2. X dispatches the keycode x current mode bits -> produce a keysym
   (as per keycode lines).

3. X processes Mode_switch, Multi_key

4. X maps keysym to mode bits

5. X send event with keycode, keysym and mode bits

6. window manager processes event, filters it out, pass it to the
   application; most often uses a given mode bit.

7. application gets the event and processes it as it wishes

8. then you get emacs event processing (key-translations, chord sequence
   aggregation, command dispatching), so you can also make your own
   transformations at the key-translation level, or by finally binding a
   command to do the thing you want on the final key chord you get.
   emacs translates ESC x to M-x in the chord sequence aggregation step.

   More details can be found in documentation and sources of emacs.
   But the solution to your problem is probably in the configuration of
   your window manager or editing your .xmodmap

-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


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

* Re: Why the C-M-<keys> is invalid in my emacs?
  2015-08-08  1:56 Why the C-M-<keys> is invalid in my emacs? Navy Cheng
@ 2015-08-08  5:26 ` Ian Zimmerman
  2015-08-08  5:57   ` Navy Cheng
  0 siblings, 1 reply; 10+ messages in thread
From: Ian Zimmerman @ 2015-08-08  5:26 UTC (permalink / raw)
  To: help-gnu-emacs

On 2015-08-08 09:56 +0800, Navy Cheng wrote:

> I find I can't use *C-M-<keys>* combined key in my emacs.

Of course you can :-P  But, maybe they don't work.
What happens if you try?

-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.




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

* Re: Why the C-M-<keys> is invalid in my emacs?
  2015-08-08  5:26 ` Ian Zimmerman
@ 2015-08-08  5:57   ` Navy Cheng
  2015-08-08  6:42     ` Ian Zimmerman
  0 siblings, 1 reply; 10+ messages in thread
From: Navy Cheng @ 2015-08-08  5:57 UTC (permalink / raw)
  To: help-gnu-emacs

On Fri, Aug 07, 2015 at 10:26:42PM -0700, Ian Zimmerman wrote:
> On 2015-08-08 09:56 +0800, Navy Cheng wrote:
> 
> > I find I can't use *C-M-<keys>* combined key in my emacs.
> 
> Of course you can :-P  But, maybe they don't work.
> What happens if you try?
> 

Nothing happens. And I use *C-h k* to test *C-M-<keys>*, nothing
happens too.




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

* Re: Why the C-M-<keys> is invalid in my emacs?
  2015-08-08  5:57   ` Navy Cheng
@ 2015-08-08  6:42     ` Ian Zimmerman
  0 siblings, 0 replies; 10+ messages in thread
From: Ian Zimmerman @ 2015-08-08  6:42 UTC (permalink / raw)
  To: help-gnu-emacs

On 2015-08-08 13:57 +0800, Navy Cheng wrote:

> Nothing happens. And I use *C-h k* to test *C-M-<keys>*, nothing
> happens too.

From a terminal emulator, run xev.  With the pointer in the test window,
press C-M-h.  What does xev report about the final key press event?  In
particular, what is the "state" field?

-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.




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

* Re: Why the C-M-<keys> is invalid in my emacs?
  2015-08-08  3:10   ` Navy Cheng
@ 2015-08-08 17:36     ` Robert Thorpe
  0 siblings, 0 replies; 10+ messages in thread
From: Robert Thorpe @ 2015-08-08 17:36 UTC (permalink / raw)
  To: Navy Cheng; +Cc: help-gnu-emacs

Navy Cheng <navych@126.com> writes:
> I use Debian 8 and Xfce Desktop Environment. 'M-' is OK and 'C-M-' is OK in other
> software execpt emacs.

That's odd.  Have you tried "emacs -q"?  Do C-M-something keys work in
unconfigured Emacs?

BR,
Robert Thorpe



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

end of thread, other threads:[~2015-08-08 17:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-08  1:56 Why the C-M-<keys> is invalid in my emacs? Navy Cheng
2015-08-08  5:26 ` Ian Zimmerman
2015-08-08  5:57   ` Navy Cheng
2015-08-08  6:42     ` Ian Zimmerman
     [not found] <mailman.7970.1438999012.904.help-gnu-emacs@gnu.org>
2015-08-08  2:42 ` Rusi
2015-08-08  3:10   ` Navy Cheng
2015-08-08 17:36     ` Robert Thorpe
     [not found]   ` <mailman.7971.1439003457.904.help-gnu-emacs@gnu.org>
2015-08-08  3:12     ` Rusi
2015-08-08  4:16       ` Navy Cheng
2015-08-08  4:17 ` Pascal J. Bourguignon

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