help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange characters produced by M-x in emacs -nw


From: Bob Proulx
Subject: Re: Strange characters produced by M-x in emacs -nw
Date: Fri, 20 Sep 2013 11:28:47 -0600
User-agent: Mutt/1.5.21 (2010-09-15)

Harry Putnam wrote:
> `M-x' produces   'ø'
> `M-Shift + !' produces '¡'
> `M-shift + :  produces 'º'
> [...]
> That said, yes, I am referring to the Alt labeled on most common
> keyboards... at least in the US.
> [...]
> I'm still puzzled but the way this problem just turned up sort of
> suddenly. .. I mean I don't often use emacs -nw when in X but it can't
> have been more that 5-6 mnths since last time.
> 
> So something has changed in my environment on my Debian Linux box of
> several yrs standing.  Possibly an update or something.  I had
> thoughts of tracking it down... but probably a loosing battle since
> I'm not sure of when the change occurred.

Almost certainly something with your keyboard mapping has changed.  I
suspect that the Alt key has been configured as an AltGr key, or a
compose key, or other such modifier.  It definitely isn't normal for
Alt-x to produce the special zero character.  Which Alt key is this?
The left or right Alt key?  Or both?

Check the timestamp to see if the file /etc/default/keyboard has been
updated recently?  This is also managed by the keyboard-configuration
package in Debian.  You can run 'dpkg-reconfigure keyboard-configuration'
if you would like to re-run the package configuration dialogs.  After
reconfiguring any custom xmodmap commands such as to remap the control
key will need to be run again.

You should decide what keys you would like to use for AltGr and
Compose.  Thinking about laptops without all of the keys means that
sometimes compromises must be made to select the best available key
and sometimes not the best key everywhere.  For example on my laptop I
use the right Alt for AltGr and right Control for Compose.  But the
logo key and the menu key are also possible.

A typical configuration line from /etc/default/keyboard might be:

  XKBOPTIONS="lv3:ralt_switch,compose:menu,terminate:ctrl_alt_bksp"

[Of course choice of terminate is old-school and has become
controvercial of late.  I still prefer it.  YMMV.  I will include it
but if you think it is dangerous then by all means leave it off.]

Alternatively you can twiddle the mapping directly using the setxkbmap
command.  I would play with the following interactively and see if it
solves your problem.

  $ setxkbmap -model pc104 -layout us -option compose:rctrl -option 
terminate:ctrl_alt_bksp

Or if not try setting the AltGr variant explicitly:

  $ setxkbmap -model pc104 -layout us -variant altgr-intl -option compose:rctrl 
-option terminate:ctrl_alt_bksp

Does that repair your problem with Alt?  (For me I move control and
other customizations using xmodmap.  Therefore after running the above
which resets everything note that I load 'xmodmap $HOME/.xmodmap' in
order to overlay my customizations.)

To see what the Compose key setting is doing try these combinations.
Do not hold down the Compose key.  It is not a shift or control key
any longer.  Tap the Compose key.  Nothing will be displayed.  Tap the
next letter.  Nothing will be displayed.  Tap the final letter.  The
composed character will be displayed.  One, two, three.  Tap, tap,
tap.  The letter is displayed after the third keystroke.

  Compose e ' -> é
  Compose a " -> ä
  Compose A ` -> À

Or the reverse.  Use whichever makes sense to your brain.

  Compose ' e -> é
  Compose " a -> ä
  Compose ^ a -> â
  Compose , c -> ç

And if you have loaded the AltGr variant then you can use
Right-Alt-somekey to produce characters using chords.  AFAIK it is six
of one and a half dozen of the other.  Personal preference as to which
you prefer.  Personally I prefer the Compose key.

The entire set of possible combinations is listed in this file.  The
Compose key there is listed as Multi_key.  To see how to type in any
particular character look through the file and see the combination.

  /usr/share/X11/locale/en_US.UTF-8/Compose

Of course you weren't asking how to type in these characters.  You
were reporting that you were typing in these characters, at least for
Alt-x, and wanted to cure it.  I think you somehow acquired a munged
configuration of the above.  That is why I suggested setting the above
and thinking that it would clear the previous munged configuration out
and set it up into something useful.  At least you should get Alt-x
back again.

In the old, old days using US-ASCII Meta would set the high bit and
this enabled emacs to know that it was a meta key.  But today it is
more useful to be able to use latin-1 and utf-8 characters which
require access to the high bit for those characters.  Therefore meta
is pushed into only having the ESC-char encoding available in order to
interoperate with non-ascii characters.

And then after fixing Alt *then* the xterm resource configuration of
XTerm*metaSendsEscape:true will make sense.  However note that I
recommend using "XTerm" like that with that exact case, first two
chars capitalized, over using "xterm" all lower case.  The former
configures the class of programs while the later is only the one
specific program.  And you can turn that on interactively with
Control-LeftMouse drag.

  XTerm*metaSendsEscape:true

With that then running emacs in a terminal I believe will do what you
want it to do.  This is my normal runtime configuration.

Bob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]