all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to truly unbind global bindings?
@ 2014-11-25 11:09 Alexander Shukaev
  2014-11-25 12:16 ` Alexander Shukaev
  0 siblings, 1 reply; 14+ messages in thread
From: Alexander Shukaev @ 2014-11-25 11:09 UTC (permalink / raw)
  To: help-gnu-emacs

I've just tried

(set 'global-map (make-sparse-keymap))


but issuing [C-h][b] still shows tons of mappings, especially in the
*Global Bindings* section:

Global Bindings:
> key             binding
> ---             -------
> C-@             set-mark-command
> C-a             move-beginning-of-line
> C-b             backward-char
> C-d             delete-char
> C-e             move-end-of-line
> C-f             forward-char
> C-g             keyboard-quit
> C-h             help-command
> TAB             indent-for-tab-command
> C-k             kill-line
> C-l             recenter-top-bottom
> RET             newline
> C-n             next-line
> C-o             open-line
> ...             ...


and there are so many more to come.

I would like to get rid of these completely. How can I possibly do that in
one simple function call? I would like the solution to be a total wipeout,
rather than a loop which is setting all of these mappings to `nil'. Thank
you in advance.


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

* Re: How to truly unbind global bindings?
  2014-11-25 11:09 How to truly unbind global bindings? Alexander Shukaev
@ 2014-11-25 12:16 ` Alexander Shukaev
  2014-11-25 15:43   ` Drew Adams
  0 siblings, 1 reply; 14+ messages in thread
From: Alexander Shukaev @ 2014-11-25 12:16 UTC (permalink / raw)
  To: help-gnu-emacs

The answer was:

(use-global-map (make-sparse-keymap))


Sorry for the noise.


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

* RE: How to truly unbind global bindings?
  2014-11-25 12:16 ` Alexander Shukaev
@ 2014-11-25 15:43   ` Drew Adams
  2014-11-25 16:09     ` Alexander Shukaev
  0 siblings, 1 reply; 14+ messages in thread
From: Drew Adams @ 2014-11-25 15:43 UTC (permalink / raw)
  To: Alexander Shukaev, help-gnu-emacs

> The answer was:
> (use-global-map (make-sparse-keymap))

Why do you want to do this?  (Doesn't sound advisable, to me.)

Perhaps if you describe your use case/scenario, people will
have something useful to suggest.  I cannot imagine why anyone
would try to replace the `global-map' with a new, sparse keymap.



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

* Re: How to truly unbind global bindings?
  2014-11-25 15:43   ` Drew Adams
@ 2014-11-25 16:09     ` Alexander Shukaev
  2014-11-25 16:13       ` Drew Adams
  0 siblings, 1 reply; 14+ messages in thread
From: Alexander Shukaev @ 2014-11-25 16:09 UTC (permalink / raw)
  To: Drew Adams; +Cc: help-gnu-emacs

>
> Why do you want to do this?  (Doesn't sound advisable, to me.)
>
> Perhaps if you describe your use case/scenario, people will
> have something useful to suggest.  I cannot imagine why anyone
> would try to replace the `global-map' with a new, sparse keymap.
>

Easy. I almost don't use Emacs default key bindings. I have highly
customized layer on top of Evil, where I have either rewritten or extended
certain text object, operators, and commands. Evil default keymaps were
also wiped out and the keys were totally rearranged by myself too. In other
words, I used evil as a framework to develop my own modal text editing
approach. Those essential commands which I might need from plain Emacs I
would just carefully map to those keys which I want once again, and it's
not that many of them. The rest (like 99%) default mappings are irritating
noise to me. Minimalism and pragmatism FTW.


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

* RE: How to truly unbind global bindings?
  2014-11-25 16:09     ` Alexander Shukaev
@ 2014-11-25 16:13       ` Drew Adams
  2014-11-25 19:04         ` Alexander Shukaev
  0 siblings, 1 reply; 14+ messages in thread
From: Drew Adams @ 2014-11-25 16:13 UTC (permalink / raw)
  To: Alexander Shukaev; +Cc: help-gnu-emacs

>> Why do you want to do this?  (Doesn't sound advisable, to me.)
>> Perhaps if you describe your use case/scenario, people will
>> have something useful to suggest.  I cannot imagine why anyone
>> would try to replace the `global-map' with a new, sparse keymap.
>
> Easy. I almost don't use Emacs default key bindings. I have
> highly customized layer on top of Evil, where I have either
> rewritten or extended certain text object, operators, and
> commands. Evil default keymaps were also wiped out and the
> keys were totally rearranged by myself too. In other words,
> I used evil as a framework to develop my own modal text
> editing approach. Those essential commands which I might
> need from plain Emacs I would just carefully map to those
> keys which I want once again, and it's not that many of them.
> The rest (like 99%) default mappings are irritating noise to me.
> Minimalism and pragmatism FTW.

I see.  Thanks for the background.  Hopefully, someone will be
able to help.



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

* Re: How to truly unbind global bindings?
  2014-11-25 16:13       ` Drew Adams
@ 2014-11-25 19:04         ` Alexander Shukaev
  2014-11-25 19:31           ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: Alexander Shukaev @ 2014-11-25 19:04 UTC (permalink / raw)
  To: Drew Adams; +Cc: help-gnu-emacs

Since I have wiped out the `global-map' now, I don't have the following:

Global Bindings:
key             binding
---             -------

SPC .. ~ self-insert-command
> \200 .. self-insert-command
> \200 .. \377 self-insert-command


I would have to recreate that manually in my Emacs configuration. I found
the relevant C code in "cmds.c":

  for (n = 040; n < 0177; n++)
    initial_define_key (global_map, n, "self-insert-command");
#ifdef MSDOS
  for (n = 0200; n < 0240; n++)
    initial_define_key (global_map, n, "self-insert-command");
#endif
  for (n = 0240; n < 0400; n++)
    initial_define_key (global_map, n, "self-insert-command");


I understand that the first loop is simply pushing the printable 7-bits of
ASCII table into the `global-map'. Could anyone elaborate what are the rest
loops for? Do I really need them?


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

* Re: How to truly unbind global bindings?
  2014-11-25 19:04         ` Alexander Shukaev
@ 2014-11-25 19:31           ` Eli Zaretskii
  2014-11-25 19:39             ` Alexander Shukaev
  0 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2014-11-25 19:31 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Tue, 25 Nov 2014 20:04:23 +0100
> From: Alexander Shukaev <haroogan@gmail.com>
> Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
> 
>   for (n = 040; n < 0177; n++)
>     initial_define_key (global_map, n, "self-insert-command");
> #ifdef MSDOS
>   for (n = 0200; n < 0240; n++)
>     initial_define_key (global_map, n, "self-insert-command");
> #endif
>   for (n = 0240; n < 0400; n++)
>     initial_define_key (global_map, n, "self-insert-command");
> 
> 
> I understand that the first loop is simply pushing the printable 7-bits of
> ASCII table into the `global-map'. Could anyone elaborate what are the rest
> loops for?

Non-ASCII single-byte characters.

> Do I really need them?

I don't understand what you are trying to do enough to answer that.



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

* Re: How to truly unbind global bindings?
  2014-11-25 19:31           ` Eli Zaretskii
@ 2014-11-25 19:39             ` Alexander Shukaev
  2014-11-25 19:50               ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: Alexander Shukaev @ 2014-11-25 19:39 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

>
> I don't understand what you are trying to do enough to answer that.
>

 After:

(use-global-map (make-sparse-keymap))

I lost:

Global Bindings:

key             binding
> ---             -------
>


SPC .. ~ self-insert-command
> \200 .. self-insert-command
> \200 .. \377 self-insert-command


which is needed for typing.

I will have to add them back from my configuration. What are symbols
starting from 0200 mean? And do I really need them in the usual workflow?
Or restoring ASCII would be enough? Why some of them are protected with
MSDOS preprocessor check?


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

* Re: How to truly unbind global bindings?
  2014-11-25 19:39             ` Alexander Shukaev
@ 2014-11-25 19:50               ` Eli Zaretskii
  2014-11-25 20:00                 ` Alexander Shukaev
  0 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2014-11-25 19:50 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Tue, 25 Nov 2014 20:39:37 +0100
> From: Alexander Shukaev <haroogan@gmail.com>
> Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
> 
> After:
> 
> (use-global-map (make-sparse-keymap))
> 
> I lost:
> 
>     Global Bindings:
> 
>     key binding
>     --- -------
>     
> 
>     SPC .. ~ self-insert-command
>     \200 .. self-insert-command
>     \200 .. \377 self-insert-command
> 
> which is needed for typing.
> 
> I will have to add them back from my configuration. What are symbols starting
> from 0200 mean?

Like I said: single-byte non-ASCII characters.

> And do I really need them in the usual workflow?

Not sure what "the usual workflow" means.

> Or restoring ASCII would be enough?

Probably enough.

> Why some of them are protected with MSDOS preprocessor check?

Because other systems use Latin-1, which start at 0240 octal, while
MS-DOS uses DOS codepages that have valid characters between 0200 and
0240.



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

* Re: How to truly unbind global bindings?
  2014-11-25 19:50               ` Eli Zaretskii
@ 2014-11-25 20:00                 ` Alexander Shukaev
  2014-11-25 20:34                   ` Eli Zaretskii
  2014-11-26  2:57                   ` Yuri Khan
  0 siblings, 2 replies; 14+ messages in thread
From: Alexander Shukaev @ 2014-11-25 20:00 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

>
> Because other systems use Latin-1, which start at 0240 octal, while
> MS-DOS uses DOS codepages that have valid characters between 0200 and
> 0240.
>
>
Thank you. How can I replicate MS-DOS condition in Emacs Lisp code?
Something like

(unless (eq system-type 'windows-nt)
  ...)

? Which symbol denotes MS-DOS? `ms-dos'?


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

* Re: How to truly unbind global bindings?
  2014-11-25 20:00                 ` Alexander Shukaev
@ 2014-11-25 20:34                   ` Eli Zaretskii
  2014-11-25 21:05                     ` Alexander Shukaev
  2014-11-26  2:57                   ` Yuri Khan
  1 sibling, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2014-11-25 20:34 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Tue, 25 Nov 2014 21:00:19 +0100
> From: Alexander Shukaev <haroogan@gmail.com>
> Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
> 
> How can I replicate MS-DOS condition in Emacs Lisp code? Something
> like
> 
> (unless (eq system-type 'windows-nt)
> ...)
> 
> ? Which symbol denotes MS-DOS? `ms-dos'?

Yes, 'ms-dos'.



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

* Re: How to truly unbind global bindings?
  2014-11-25 20:34                   ` Eli Zaretskii
@ 2014-11-25 21:05                     ` Alexander Shukaev
  0 siblings, 0 replies; 14+ messages in thread
From: Alexander Shukaev @ 2014-11-25 21:05 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

Maybe it will be helpful to somebody in the future:

(use-global-map (make-sparse-keymap))

(global-set-key [t] #'self-insert-command)
(let ((c ?\s))
  (while (< c ?\d)
    (global-set-key (vector c) #'self-insert-command)
    (setq c (1+ c)))
  (when (eq system-type 'ms-dos)
    (setq c 128)
    (while (< c 160)
      (global-set-key (vector c) #'self-insert-command)
      (setq c (1+ c))))
  (setq c 160)
  (while (< c 256)
    (global-set-key (vector c) #'self-insert-command)
    (setq c (1+ c))))


Tested. This is how you totally wipe out default global bindings, but
preserve the very basic --- typing of printable characters from 8-bit ASCII
code page.

Best regards,
Alexander


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

* Re: How to truly unbind global bindings?
  2014-11-25 20:00                 ` Alexander Shukaev
  2014-11-25 20:34                   ` Eli Zaretskii
@ 2014-11-26  2:57                   ` Yuri Khan
  2014-11-26  9:33                     ` Alexander Shukaev
  1 sibling, 1 reply; 14+ messages in thread
From: Yuri Khan @ 2014-11-26  2:57 UTC (permalink / raw)
  To: Alexander Shukaev; +Cc: help-gnu-emacs

On Wed, Nov 26, 2014 at 2:00 AM, Alexander Shukaev <haroogan@gmail.com> wrote:

> Thank you. How can I replicate MS-DOS condition in Emacs Lisp code?

Are you really planning to use your configuration on DOS?



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

* Re: How to truly unbind global bindings?
  2014-11-26  2:57                   ` Yuri Khan
@ 2014-11-26  9:33                     ` Alexander Shukaev
  0 siblings, 0 replies; 14+ messages in thread
From: Alexander Shukaev @ 2014-11-26  9:33 UTC (permalink / raw)
  To: Yuri Khan; +Cc: help-gnu-emacs

>
> Are you really planning to use your configuration on DOS?
>

Of course not ;))


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

end of thread, other threads:[~2014-11-26  9:33 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-25 11:09 How to truly unbind global bindings? Alexander Shukaev
2014-11-25 12:16 ` Alexander Shukaev
2014-11-25 15:43   ` Drew Adams
2014-11-25 16:09     ` Alexander Shukaev
2014-11-25 16:13       ` Drew Adams
2014-11-25 19:04         ` Alexander Shukaev
2014-11-25 19:31           ` Eli Zaretskii
2014-11-25 19:39             ` Alexander Shukaev
2014-11-25 19:50               ` Eli Zaretskii
2014-11-25 20:00                 ` Alexander Shukaev
2014-11-25 20:34                   ` Eli Zaretskii
2014-11-25 21:05                     ` Alexander Shukaev
2014-11-26  2:57                   ` Yuri Khan
2014-11-26  9:33                     ` Alexander Shukaev

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.