* Is there a way to unset all Emacs key bindings?
@ 2014-01-16 7:43 Parke
2014-01-16 9:27 ` Marcin Borkowski
0 siblings, 1 reply; 6+ messages in thread
From: Parke @ 2014-01-16 7:43 UTC (permalink / raw)
To: help-gnu-emacs
Hi,
I have made a list of the key bindings I want. I want to unset all
other key bindings.
(Or, alternatively, I want to unset all the key bindings, and then
global-set-key the bindings I want.)
Is this possible?
I have tried:
(global-unset-key "\x00" )
... through ...
(global-unset-key "\xff" )
I also tried:
(setq global-map nil)
Neither of these worked. There are still over 2500 lines of bindings
when I run describe-bindings (in both Lisp Interaction and Fundamental
modes).
Thanks!
-Parke
^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <mailman.12070.1389861047.10748.help-gnu-emacs@gnu.org>]
* Re: Is there a way to unset all Emacs key bindings?
[not found] <mailman.12070.1389861047.10748.help-gnu-emacs@gnu.org>
@ 2014-01-16 17:17 ` Emanuel Berg
2014-01-16 17:42 ` Drew Adams
2014-01-16 18:14 ` Emanuel Berg
1 sibling, 1 reply; 6+ messages in thread
From: Emanuel Berg @ 2014-01-16 17:17 UTC (permalink / raw)
To: help-gnu-emacs
Parke <parke.nexus@gmail.com> writes:
> I have made a list of the key bindings I want. I
> want to unset all other key bindings.
I don't know how to do that, but is that wise? Don't
you want different keybindings for different modes? Or
do you intend to set them up one by one? That would be
a huge (and boring) task.
If you want a couple of global keybindings, that is,
"global" in the sense they'd work everywhere, what I do
is I first define them as global, and then if I find
they don't work in some mode (because of a local
binding on top) -- and I don't have to analyze that
because sooner rather and later I run into it by normal
usage -- in any case, then, I set the local binding to
nil in initialization, be it a hook or otherwise.
They say you should prefix your personal bindings C-c,
in what case the above will never happen, because such
bindings should not appear in any shipped mode. However
you may still want other shortcuts and if so the above
method works.
--
underground experts united:
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: Is there a way to unset all Emacs key bindings?
2014-01-16 17:17 ` Emanuel Berg
@ 2014-01-16 17:42 ` Drew Adams
0 siblings, 0 replies; 6+ messages in thread
From: Drew Adams @ 2014-01-16 17:42 UTC (permalink / raw)
To: help-gnu-emacs
> I have made a list of the key bindings I want. I
> want to unset all other key bindings.
Be aware that in Emacs every key you touch (and that has an
effect) is bound to a command. That includes keys such as
`a', which have command `self-insert-command' as their global
key binding.
Pretty much everything you do in Emacs invokes an Emacs command.
Every key you press, every menu item you choose, every mouse
action you perform.
This is at the base of the Emacs approach (design).
And most of those commands are defined in Lisp, not C, which
means you can easily change their definitions, even on the fly,
interactively. And you can of course easily change key bindings
as well.
These features are also basic to the design of Emacs. You
might even say that they constitute the whole point of Emacs
(as opposed to some other editors).
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Is there a way to unset all Emacs key bindings?
[not found] <mailman.12070.1389861047.10748.help-gnu-emacs@gnu.org>
2014-01-16 17:17 ` Emanuel Berg
@ 2014-01-16 18:14 ` Emanuel Berg
2014-01-17 6:47 ` Kevin Rodgers
1 sibling, 1 reply; 6+ messages in thread
From: Emanuel Berg @ 2014-01-16 18:14 UTC (permalink / raw)
To: help-gnu-emacs
Parke <parke.nexus@gmail.com> writes:
> I also tried: (setq global-map nil)
Try:
(use-global-map '(keymap nil))
--
underground experts united:
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Is there a way to unset all Emacs key bindings?
2014-01-16 18:14 ` Emanuel Berg
@ 2014-01-17 6:47 ` Kevin Rodgers
0 siblings, 0 replies; 6+ messages in thread
From: Kevin Rodgers @ 2014-01-17 6:47 UTC (permalink / raw)
To: help-gnu-emacs
On 1/16/14 11:14 AM, Emanuel Berg wrote:
> (use-global-map '(keymap nil))
Or: (use-global-map (make-keymap))
And on a suitable hook: (use-local-map (make-sparse-keymap))
But according to the "Active Keymaps" node of the Emacs manual, there may be
other keymaps to disable to make emacs completely unusable:
+-------------------------------------------------------------------------------
| Normally the active keymaps are the `keymap' property keymap, the
| keymaps of any enabled minor modes, the current buffer's local keymap,
| and the global keymap, in that order. Emacs searches for each input
| key sequence in all these keymaps. *Note Searching Keymaps::, for more
| details of this procedure.
+-------------------------------------------------------------------------------
And here is what the "Searching Keymaps" node says:
+-------------------------------------------------------------------------------
| After translation of event subsequences (*note Translation Keymaps::)
| Emacs looks for them in the active keymaps. Here is a pseudo-Lisp
| description of the order and conditions for searching them:
|
| (or (if overriding-terminal-local-map
| (FIND-IN overriding-terminal-local-map)
| (if overriding-local-map
| (FIND-IN overriding-local-map)
| (or (FIND-IN (get-char-property (point) 'keymap))
| (FIND-IN-ANY emulation-mode-map-alists)
| (FIND-IN-ANY minor-mode-overriding-map-alist)
| (FIND-IN-ANY minor-mode-map-alist)
| (if (get-text-property (point) 'local-map)
| (FIND-IN (get-char-property (point) 'local-map))
| (FIND-IN (current-local-map))))))
| (FIND-IN (current-global-map)))
+-------------------------------------------------------------------------------
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-01-17 6:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-16 7:43 Is there a way to unset all Emacs key bindings? Parke
2014-01-16 9:27 ` Marcin Borkowski
[not found] <mailman.12070.1389861047.10748.help-gnu-emacs@gnu.org>
2014-01-16 17:17 ` Emanuel Berg
2014-01-16 17:42 ` Drew Adams
2014-01-16 18:14 ` Emanuel Berg
2014-01-17 6:47 ` Kevin Rodgers
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).