summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2021-01-04 22:57:21 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2021-01-04 23:41:19 -0500
commitd6f30e5632b1c9cf43ebfbdbf164d5c54be33475 (patch)
treed358a335c8404ba9233379b5baf8bf158da90487
parent898a94a9be06a3ab51116778f6b4a263f832759d (diff)
downloademacs-d6f30e5632b1c9cf43ebfbdbf164d5c54be33475.tar.gz
* lisp/subr.el (global-map): Initialize inside declaration.
* src/commands.h (global_map): * src/keymap.c (global_map): Delete variable. (syms_of_keymap): Don't initialize global_map here. (keys_of_keymap): Delete function. * src/lisp.h (keys_of_cmds): * src/cmds.c (keys_of_cmds): Delete function. * src/emacs.c (main): Don't call them. * src/window.c (keys_of_window): Don't initialize global_map here. * src/keyboard.c (keys_of_keyboard): Don't initialize global_map here.
-rw-r--r--lisp/subr.el36
-rw-r--r--src/cmds.c21
-rw-r--r--src/commands.h1
-rw-r--r--src/emacs.c2
-rw-r--r--src/keyboard.c2
-rw-r--r--src/keymap.c15
-rw-r--r--src/keymap.h1
-rw-r--r--src/lisp.h1
-rw-r--r--src/window.c1
9 files changed, 32 insertions, 48 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 1acc3c3250b..6187f7ad3c4 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1242,11 +1242,6 @@ in a cleaner way with command remapping, like this:
;; global-map, esc-map, and ctl-x-map have their values set up in
;; keymap.c; we just give them docstrings here.
-(defvar global-map nil
- "Default global keymap mapping Emacs keyboard input into commands.
-The value is a keymap that is usually (but not necessarily) Emacs's
-global map.")
-
(defvar esc-map nil
"Default keymap for ESC (meta) commands.
The normal global definition of the character ESC indirects to this keymap.")
@@ -1269,6 +1264,37 @@ The normal global definition of the character C-x indirects to this keymap.")
"Keymap for tab-bar related commands.")
(define-key ctl-x-map "t" tab-prefix-map)
+(defvar global-map
+ (let ((map (make-keymap)))
+ (define-key map "\C-[" 'ESC-prefix)
+ (define-key map "\C-x" 'Control-X-prefix)
+
+ (define-key map "\C-i" #'self-insert-command)
+ (let* ((vec1 (make-vector 1 nil))
+ (f (lambda (from to)
+ (while (< from to)
+ (aset vec1 0 from)
+ (define-key map vec1 #'self-insert-command)
+ (setq from (1+ from))))))
+ (funcall f #o040 #o0177)
+ (when (eq system-type 'ms-dos) ;FIXME: Why?
+ (funcall f #o0200 #o0240))
+ (funcall f #o0240 #o0400))
+
+ (define-key map "\C-a" #'beginning-of-line)
+ (define-key map "\C-b" #'backward-char)
+ (define-key map "\C-e" #'end-of-line)
+ (define-key map "\C-f" #'forward-char)
+ (define-key map "\C-z" #'suspend-emacs) ;FIXME: Re-bound later!
+
+ (define-key map "\C-v" #'scroll-up-command)
+ (define-key map "\C-]" #'abort-recursive-edit)
+ map)
+ "Default global keymap mapping Emacs keyboard input into commands.
+The value is a keymap that is usually (but not necessarily) Emacs's
+global map.")
+(use-global-map global-map)
+
;;;; Event manipulation functions.
diff --git a/src/cmds.c b/src/cmds.c
index 798fd68a920..1547db80e88 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -529,24 +529,3 @@ This is run after inserting the character. */);
defsubr (&Sdelete_char);
defsubr (&Sself_insert_command);
}
-
-void
-keys_of_cmds (void)
-{
- int n;
-
- initial_define_key (global_map, Ctl ('I'), "self-insert-command");
- 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");
-
- initial_define_key (global_map, Ctl ('A'), "beginning-of-line");
- initial_define_key (global_map, Ctl ('B'), "backward-char");
- initial_define_key (global_map, Ctl ('E'), "end-of-line");
- initial_define_key (global_map, Ctl ('F'), "forward-char");
-}
diff --git a/src/commands.h b/src/commands.h
index a09858d050d..be6f5823bcc 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -27,7 +27,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
calls to initial_define_key. These should *not* be used after
initialization; use-global-map doesn't affect these; it sets
current_global_map instead. */
-extern Lisp_Object global_map;
extern Lisp_Object meta_map;
extern Lisp_Object control_x_map;
diff --git a/src/emacs.c b/src/emacs.c
index fe8dcb1c476..3c293d85edd 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1957,10 +1957,8 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
#endif
keys_of_casefiddle ();
- keys_of_cmds ();
keys_of_buffer ();
keys_of_keyboard ();
- keys_of_keymap ();
keys_of_window ();
}
else
diff --git a/src/keyboard.c b/src/keyboard.c
index cf15cd73572..52d913c537d 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -12388,10 +12388,8 @@ syms_of_keyboard_for_pdumper (void)
void
keys_of_keyboard (void)
{
- initial_define_key (global_map, Ctl ('Z'), "suspend-emacs");
initial_define_key (control_x_map, Ctl ('Z'), "suspend-emacs");
initial_define_key (meta_map, Ctl ('C'), "exit-recursive-edit");
- initial_define_key (global_map, Ctl (']'), "abort-recursive-edit");
initial_define_key (meta_map, 'x', "execute-extended-command");
initial_define_lispy_key (Vspecial_event_map, "delete-frame",
diff --git a/src/keymap.c b/src/keymap.c
index 1eeea81f627..772ced42ccd 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -59,8 +59,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
Lisp_Object current_global_map; /* Current global keymap. */
-Lisp_Object global_map; /* Default global key bindings. */
-
Lisp_Object meta_map; /* The keymap used for globally bound
ESC-prefixed default commands. */
@@ -3195,11 +3193,7 @@ syms_of_keymap (void)
Each one is the value of a Lisp variable, and is also
pointed to by a C variable */
- global_map = Fmake_keymap (Qnil);
- Fset (intern_c_string ("global-map"), global_map);
-
- current_global_map = global_map;
- staticpro (&global_map);
+ current_global_map = Qnil;
staticpro (&current_global_map);
meta_map = Fmake_keymap (Qnil);
@@ -3328,10 +3322,3 @@ be preferred. */);
defsubr (&Swhere_is_internal);
defsubr (&Sdescribe_buffer_bindings);
}
-
-void
-keys_of_keymap (void)
-{
- initial_define_key (global_map, 033, "ESC-prefix");
- initial_define_key (global_map, Ctl ('X'), "Control-X-prefix");
-}
diff --git a/src/keymap.h b/src/keymap.h
index 072c09348e2..1967025dcb4 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -40,7 +40,6 @@ extern ptrdiff_t current_minor_maps (Lisp_Object **, Lisp_Object **);
extern void initial_define_key (Lisp_Object, int, const char *);
extern void initial_define_lispy_key (Lisp_Object, const char *, const char *);
extern void syms_of_keymap (void);
-extern void keys_of_keymap (void);
typedef void (*map_keymap_function_t)
(Lisp_Object key, Lisp_Object val, Lisp_Object args, void *data);
diff --git a/src/lisp.h b/src/lisp.h
index 5cc735be86c..d259e950dab 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3561,7 +3561,6 @@ extern void swap_in_global_binding (struct Lisp_Symbol *);
/* Defined in cmds.c */
extern void syms_of_cmds (void);
-extern void keys_of_cmds (void);
/* Defined in coding.c. */
extern Lisp_Object detect_coding_system (const unsigned char *, ptrdiff_t,
diff --git a/src/window.c b/src/window.c
index ba8682eed7c..f2862a287d6 100644
--- a/src/window.c
+++ b/src/window.c
@@ -8590,7 +8590,6 @@ keys_of_window (void)
initial_define_key (control_x_map, '<', "scroll-left");
initial_define_key (control_x_map, '>', "scroll-right");
- initial_define_key (global_map, Ctl ('V'), "scroll-up-command");
initial_define_key (meta_map, Ctl ('V'), "scroll-other-window");
initial_define_key (meta_map, 'v', "scroll-down-command");
}