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

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

RE: M-x mystery


From: Drew Adams
Subject: RE: M-x mystery
Date: Mon, 2 Jan 2012 10:26:08 -0800

> And that's what I don't understand. It's one thing for <ESC> x to be
> treated as M-x because some people lack that alt key, but for emacs to
> *convert* the keycode <alt>x to <ESC> x seems to me like poor design.

That's just what Emacs does, and it always has.  (This much has nothing to do
with Icicles.)

See user option `meta-prefix-char', which is bound by default to ESC (character
value 27).  See also the Elisp manual, node `Functions for Key Lookup'.  (You
might also look at node `Other Char Bits', about the Alt key.)

I'm no expert on Emacs's `Meta' key and the `Alt' key.  No doubt others could
inform you better about this.  In particular, perhaps a Vip or Viper user can
help you here.

> Why is it poor design? This is where I need to explain my motivation
> for rebinding <ESC>.
> 
> Vi makes a distinction between insert mode and command mode. The fact
> that (standard) emacs treats undecorated keys as self-insertion is in
> my view its only major design flaw, and one that is neatly remedied by
> vi emulation. In vi, undecorated keys are used for all sorts of
> purposes, like moving around the file, which avoid having to reach for
> the control key for every damn thing. Naturally, when you're adding
> text you want these same keys to self-insert; ergo, there is an insert
> mode. And in insert mode, ESC means "get me out of insert mode".
> 
> So that's why vip rebinds ESC (when in insert mode). Icicle disables
> that.

I wonder how.  Are you sure it does?  I believe there are some people who use
Icicles with Viper (dunno about Vip).

By default (see my previous mail about customizing this), Icicles remaps command
`execute-extended-command' to `icicle-execute-extended-command' when in Icicle
mode.  If you use Emacs 22+ (you still haven't said what Emacs version you are
using), then this is done using `remap' with `define-key'.  If you are using
Emacs < 22 then this is done using `substitute-key-definition'.

In effect, this rebinds `M-x' to the Icicles version of the command.  And AFAIK
this remapping means that all keys normally bound to `execute-extended-command'
are rebound - and that includes `ESC x'.

But I'm not aware where Icicles binds `ESC' - it remains a prefix key, but I
don't believe that Icicles redefines it as a prefix key if you have undefined it
as such by binding it to a command (e.g. `kill-line').  In any case, you should
be able to customize the binding of `icicle-execute-extended-command', as I
mentioned.

As I said, my attempt to repro your problem failed - I guess I need a more
detailed recipe.  When I tried to follow your recipe, `M-x' still behaved
normally, invoking `(icicle-)execute-extended-command' in and out of Icicle
mode.  AFAICT, I was never really in Vip mode (?).

> So I was trying to rebind vip-change-to-vi-mode (get out of
> insert mode) away from ESC to, say, <F1>, which is close to ESC on the
> keyboard -- close enough that I can live with it. But nothing I did
> worked.

It might be easier to leave Vip alone and customize Icicles.  Follow up off
list, if you like.  Let me know in detail (in order) what goes wrong when you
make no changes to either, and I can perhaps tell you how to customize Icicles
to help the two get along well.  Or perhaps a Vipian or Viperian on the list can
help.

> And in trying to figure out why, I'm frustrated by the fact that
> <alt>x is disabled by vip's rebinding of ESC. And **that's** the
> problem I'm trying to solve first. I have a hard time imagining that
> emacs cannot be persuaded to recognize <alt>x separately from <ESC>.

See above.  See option `meta-prefix-char'.

And can you please give me a more detailed recipe that will let me repro the
problem?  When and how do you activate Vip and Icicles etc.  See my previous
reply.  Thx - Drew.





reply via email to

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