[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 'ignore hides \r in keymap
From: |
Johan Bockgård |
Subject: |
Re: 'ignore hides \r in keymap |
Date: |
Thu, 03 Nov 2005 22:50:55 +0100 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
Lennart Borgman <address@hidden> writes:
> This is one of those strange errors I wish I did not see. It seems like
> 'ignore somehow hides \r in a keymap. To show this start with "emacs -Q"
> and evaluate the following:
>
> ;; Set up
> (defconst km (make-sparse-keymap))
> (define-key km "\r" (lambda()(interactive)(message "hit RET")))
>
> ;; Convinience switching to/from km
> (define-key km [(home)] (lambda()(interactive)(use-local-map nil)))
> (global-set-key [(control meta home)]
> (lambda()(interactive)(use-local-map km)))
>
> ;; Test using either of these and then hit RET
> (define-key km [?i] (lambda()(interactive)(define-key km '[t] 'ignore)))
> (define-key km [?n] (lambda()(interactive)(define-key km '[t] nil)))
>
> Activate the km keymap with C-M-home. Switch between using 'ignore or
> nil for unbound keys in km by hitting i and n. I see the following:
>
> - Using nil and hitting RET gives the message "hit RET"
> - Using 'ignore and hitting RET gives nothing.
>
> I am doing this with CVS Emacs from 2005-10-27 on w32.
Looks like it's a problem of RET (C-m) vs <return> (function key). You
would see the same thing if you bound TAB (C-i) and pressed <tab> etc.
Apparently the default binding is used before the <return> --> RET
translation is made.
In other words, after you press "i":
(key-binding [return] t) => ignore
(key-binding "\C-m" t) => (lambda nil (interactive) (message "hit RET"))
--
Johan Bockgård