all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Disabling all keybindings - How?
@ 2002-10-11  7:42 Klaus Berndl
  2002-10-11 14:42 ` Jesper Harder
  2002-10-12 18:45 ` Stefan Monnier <foo@acm.com>
  0 siblings, 2 replies; 3+ messages in thread
From: Klaus Berndl @ 2002-10-11  7:42 UTC (permalink / raw)



I want to write a very small major-mode with only very few senseful
keybindings (e.g.: v, h, c, q, s). I want to disable all other keybindings of
Emacs because they make really no sense (A new frame is started with a new
buffer in this major-mode, some actions have to be performed by the user
(e.g.: hitting v or h), stuff is saved by hitting s and then we quit by
hitting q (which deletes the new frame) - That's all.

OK, now my question: How to disable all Emacs-keybindings for my new
major-mode? Is this possible with one command?

many thanks in advance,
Klaus

-- 
Klaus Berndl			mailto: klaus.berndl@sdm.de
sd&m AG				http://www.sdm.de
software design & management	
Thomas-Dehler-Str. 27, 81737 München, Germany
Tel +49 89 63812-392, Fax -220

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Disabling all keybindings - How?
  2002-10-11  7:42 Disabling all keybindings - How? Klaus Berndl
@ 2002-10-11 14:42 ` Jesper Harder
  2002-10-12 18:45 ` Stefan Monnier <foo@acm.com>
  1 sibling, 0 replies; 3+ messages in thread
From: Jesper Harder @ 2002-10-11 14:42 UTC (permalink / raw)


Klaus Berndl <Klaus.Berndl@sdm.de> writes:

> OK, now my question: How to disable all Emacs-keybindings for my new
> major-mode? Is this possible with one command?

You probably want `make-sparse-keymap'.  And now for a bit of fun --
Erik Naggum's poor man's vi-mode:

| e.g., you can do this to get into "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] 3+ messages in thread

* Re: Disabling all keybindings - How?
  2002-10-11  7:42 Disabling all keybindings - How? Klaus Berndl
  2002-10-11 14:42 ` Jesper Harder
@ 2002-10-12 18:45 ` Stefan Monnier <foo@acm.com>
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier <foo@acm.com> @ 2002-10-12 18:45 UTC (permalink / raw)


>>>>> "Klaus" == Klaus Berndl <Klaus.Berndl@sdm.de> writes:
> I want to write a very small major-mode with only very few senseful
> keybindings (e.g.: v, h, c, q, s). I want to disable all other keybindings of
> Emacs because they make really no sense (A new frame is started with a new
> buffer in this major-mode, some actions have to be performed by the user
> (e.g.: hitting v or h), stuff is saved by hitting s and then we quit by
> hitting q (which deletes the new frame) - That's all.

You can try

   (defvar bla-mode-map
     (let ((map (make-sparse-keymap)))
       (define-key map "v" 'bla-v-command)
       ...
       (define-key map "s" 'bla-s-command)
       ;; `t' is a special "default" binding.
       (define-key map [t] 'undefined)
       map))

it will prevent function-key-map from doing its job, tho since
all keys will be considered bound to `undefined'.
You might also have some problems with the fact that frame
switches (with the mouse) go through a `switch-frame' event,
so you might want to explicitly bind it to nil to make sure
that its binding in the global map is used.


        Stefan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-10-12 18:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-11  7:42 Disabling all keybindings - How? Klaus Berndl
2002-10-11 14:42 ` Jesper Harder
2002-10-12 18:45 ` Stefan Monnier <foo@acm.com>

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.