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

Re: Meta key for 'emacs -nw'



On Mon 01 Feb 2016 at 21:28:50 (-0600), Nate Bargmann wrote:
> * On 2016 01 Feb 20:07 -0600, Bob Bernstein wrote:
> > [...] Emacs running in X honors Alt as its Meta key. But if I
> > launch 'emacs -nw' to avoid running in X that understanding (Meta == Alt)
> > evaporates. Perhaps I need to set something specific in my .emacs for the
> > minibuffer?
> > 
> > I've got amd64 Jessie running without systemd and icewm for X.
> 
> I don't have an answer, however, I am using Emacs -nw to type this
> message calling it from Mutt and running in Xfce Terminal and
> Alt-X. etc, works just fine.

I too use emacs -nw from mutt (because mutt is running remotely),
but in xterm, and typing Alt-X gives me the character useful for
typing Tromsø. Not that I'm bothered; I use Esc-X instead.
The Alt- characters (like ñ÷åòôùõéïð) would be more useful if the keys
were appropriately engraved.

> What I've not sat down and figured out is how to use Ctl-Left/Right to
> navigate word left/right but use Alt-B/F instead.  Even Bash will allow
> the Ctl variants.

Let's see...I have the following in /etc/console-setup/remap.inc

# Ctrl-arrow keys need to send the same codes as in X/xterm.
Control keycode 105 = F51
string F51 = "\033[1;5D"
Control keycode 106 = F52
string F52 = "\033[1;5C"
Control keycode 108 = F53
string F53 = "\033[1;5B"
Control keycode 103 = F54
string F54 = "\033[1;5A"

and ~/.inputrc has

set input-meta on
set output-meta on
set convert-meta off
# Ctrl-Right arrow
"\e[1;5C": forward-word
# Ctrl-Left arrow
"\e[1;5D": backward-word

and my emacs startup contains

(global-set-key [?\e left] 'backward-word)
(global-set-key [?\e right] 'forward-word)

That's enough to make Ctrl-Left/Right move by word on the commandline
and in emacs with the exception of emacs -nw in a VC (where it types
5C for example).

If you're tempted to follow suit, note that configuring the keyboard
with /etc/console-setup/remap.inc is a bit fraught. You must run
# dpkg-reconfigure console-setup
# dpkg-reconfigure keyboard-configuration
in a genuine VC without X running at all (getting to a VC from X with
Ctrl-Alt-Fn is not good enough) and /etc/console-setup/remap.inc
must be perfectly formed or strange things may get defined.

Cheers,
David.


Reply to: