From: "Drew Adams" <drew.adams@oracle.com>
To: "'Silvio Levy'" <levy@msri.org>, <help-gnu-emacs@gnu.org>
Subject: RE: M-x mystery
Date: Mon, 2 Jan 2012 08:34:33 -0800 [thread overview]
Message-ID: <9FB2AF988B2F4C1389CB30235F2266A0@us.oracle.com> (raw)
In-Reply-To: <20120102095123.F3895181003@neo.msri.org>
> in trying to debug some bad interactions between vip.el (VI emulation)
> and icicles, I've come against an obstable I can't surmount: M-x
> sometimes ceases to be M-x and becomes instead ESC-x.
>
> Minimal example: I run "emacs -q -l foo.el" where foo.el
> contains this code:
> (defun doit ()
> "run test"
> (interactive)
> (defvar vip-mode-map (make-keymap))
> (define-key vip-mode-map "\e" 'kill-line)
> (use-local-map vip-mode-map))
>
> Then I into a scratch buffer and type M-x doit<RET> -- so far so good.
> After that, when I type M-x the behavior, it is as if I had typed ESC
> and x: the current line is killed and an x is inserted.
> Any ideas about what I'm doing wrong?
`M-x' is typically the same as `ESC x' (it is translated from `ESC x'). If you
redefine `ESC' as a command (`kill-line') then it can no longer continue to act
as a prefix key. So both `M-x' and `ESC x' are then undefined.
(Also, why are you doing `make-keymap' here? Why is that necessary? Why not
just invoke `doit' after you have loaded Vip, so the keymap will be already
defined?)
FYI: You can customize the key that Icicles uses to invoke
`icicle-execute-extended-command' (by default it is `M-x'). Just customize
option `icicle-top-level-key-bindings', changing the entry for that command.
Anyway, I tried to follow your recipe. It seems incomplete. You start with
`emacs -q`, which is good, but you do not show where/when you load vip.el[c] or
Icicles, and you do not show where/when you turn on Vip mode or Icicles mode.
Sometimes the load or mode-invocation order can matter (but it should not).
When I do `emacs -Q', then load vip.el, then evaluate the code above and do `M-x
doit', then load Icicles and turn on Icicle mode, I do not see the behavior you
describe. If I then turn on Vip mode (using `M-x vip-mode' and answering `n' to
inhibiting startup msg), I still do not see that behavior. If I toggle Icicle
mode off then on again I still do not see that behavior. And I don't see any
difference if I turn on vip-mode before Icicle mode, etc. The order does not
seem to matter.
`C-h k' says `M-x' and `ESC x' are undefined. But they both seem to work
normally, invoking `icicle-execute-extended-command' in Icicle mode and
`execute-extended-command' when I turn off Icicle mode! Yet looking at
`vip-mode-map' I see that it has `ESC' defined as `kill-line'. But `C-h w
kill-line' does not list `ESC' as one of the bindings. I get the impression
that I am not really in Vip mode (?). And yet I see `Vi:' in the mode line.
But `C-h m' does not mention Vip at all (?).
I tried toggling Vip mode using `M-x vip-mode', but I still see `Vi:' in the
mode line. I know nothing about Vip, so I'm probably not turning it off and on
correctly. I took a quick look at the Vip doc, but it wasn't very helpful,
IMHO.
Please send me a more complete recipe, mentioning also your Emacs version. We
can take this off list. But if someone else familiar with Vip can help, please
post.
next prev parent reply other threads:[~2012-01-02 16:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-02 9:51 M-x mystery Silvio Levy
2012-01-02 16:32 ` Alexander
2012-01-02 16:34 ` Drew Adams [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-01-02 17:37 Silvio Levy
2012-01-02 18:26 ` Drew Adams
2012-01-02 19:40 ` Teemu Likonen
2012-01-02 20:07 Silvio Levy
2012-01-02 22:33 Silvio Levy
2012-01-02 23:25 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9FB2AF988B2F4C1389CB30235F2266A0@us.oracle.com \
--to=drew.adams@oracle.com \
--cc=help-gnu-emacs@gnu.org \
--cc=levy@msri.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.