* disabling key bindings
@ 2003-11-27 13:51 Phillip Lord
2003-11-27 14:13 ` Jesper Harder
0 siblings, 1 reply; 4+ messages in thread
From: Phillip Lord @ 2003-11-27 13:51 UTC (permalink / raw)
Very quick question.
I a new major mode, how do I disable all keybindings, except for those
that I specify. In particular I would want all the normally
self-insert keys to do nothing at all (except where I have bound the
explicitly).
I've tried suppress-keymap. Perhaps I am doing something wrong
though.
Phil
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: disabling key bindings
2003-11-27 13:51 disabling key bindings Phillip Lord
@ 2003-11-27 14:13 ` Jesper Harder
2003-11-27 16:33 ` Phillip Lord
2003-11-28 12:47 ` Phillip Lord
0 siblings, 2 replies; 4+ messages in thread
From: Jesper Harder @ 2003-11-27 14:13 UTC (permalink / raw)
Phillip Lord <p.lord@russet.org.uk> writes:
> I a new major mode, how do I disable all keybindings, except for those
> that I specify. In particular I would want all the normally
> self-insert keys to do nothing at all (except where I have bound the
> explicitly).
Sounds a bit like Erik Naggums's "poor man's vi-mode":
,----
| (use-global-map (make-sparse-keymap))
|
| like vi, it will beep at everything you do, and you can't quit.
| have fun!
`----
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: disabling key bindings
2003-11-27 14:13 ` Jesper Harder
@ 2003-11-27 16:33 ` Phillip Lord
2003-11-28 12:47 ` Phillip Lord
1 sibling, 0 replies; 4+ messages in thread
From: Phillip Lord @ 2003-11-27 16:33 UTC (permalink / raw)
>>>>> "Jesper" == Jesper Harder <harder@myrealbox.com> writes:
Jesper> Phillip Lord <p.lord@russet.org.uk> writes:
>> I a new major mode, how do I disable all keybindings, except for
>> those that I specify. In particular I would want all the normally
>> self-insert keys to do nothing at all (except where I have bound
>> the explicitly).
Jesper> Sounds a bit like Erik Naggums's "poor man's vi-mode":
Jesper> ,---- | (use-global-map (make-sparse-keymap))
Jesper> |
Jesper> | like vi, it will beep at everything you do, and you can't quit.
Jesper> | have fun!
Jesper> `----
Ah yeah, I'd forgotten about that.
I shall give this a go.
Cheers
Phil
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: disabling key bindings
2003-11-27 14:13 ` Jesper Harder
2003-11-27 16:33 ` Phillip Lord
@ 2003-11-28 12:47 ` Phillip Lord
1 sibling, 0 replies; 4+ messages in thread
From: Phillip Lord @ 2003-11-28 12:47 UTC (permalink / raw)
>>>>> "Jesper" == Jesper Harder <harder@myrealbox.com> writes:
Jesper> Phillip Lord <p.lord@russet.org.uk> writes:
>> I a new major mode, how do I disable all keybindings, except for
>> those that I specify. In particular I would want all the normally
>> self-insert keys to do nothing at all (except where I have bound
>> the explicitly).
Jesper> Sounds a bit like Erik Naggums's "poor man's vi-mode":
Jesper> ,---- | (use-global-map (make-sparse-keymap))
Jesper> |
Jesper> | like vi, it will beep at everything you do, and you can't quit.
Jesper> | have fun!
Jesper> `----
Well I tried this, but it doesn't seem to work.
I think that the problem is that there are more than just the major
mode keymap active.
So I am defining my major mode like so....
(define-derived-mode pabbrev-select-mode fundamental-mode
"Pabbrev Select"
"Major mode for selecting `pabbrev-mode' expansions.
The number keys selects the various possible expansions. \\[pabbrev-suggestions-delete]
removes the previously added expansion, \\[pabbrev-suggestions-mimimum] selects the mimimum
matching substring, while \\[pabbrev-suggestions-delete-window] just deletes the window
\\{pabbrev-select-mode-map}")
(setq pabbrev-select-mode-map (make-sparse-keymap))
(define-key pabbrev-select-mode-map "\t" 'pabbrev-suggestions-select-default)
(define-key pabbrev-select-mode-map [delete] 'pabbrev-suggestions-delete)
(define-key pabbrev-select-mode-map [backspace] 'pabbrev-suggestions-delete)
(define-key pabbrev-select-mode-map "\C-m" 'pabbrev-suggestions-mimimum)
(define-key pabbrev-select-mode-map " "
'pabbrev-suggestions-delete-window)
But in a buffer with this mode I can still type "A" and I get an "A"
in the buffer.
I guess I could do....
(loop for i from 33 to 126 do
(define-key pabbrev-select-mode-map (char-to-string i) 'pabbrev-noop))
(defun pabbrev-noop()
(interactive))
which seems to work. But it seems a little messy...
Cheers
Phil
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-11-28 12:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-27 13:51 disabling key bindings Phillip Lord
2003-11-27 14:13 ` Jesper Harder
2003-11-27 16:33 ` Phillip Lord
2003-11-28 12:47 ` Phillip Lord
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).