From: Stefan Monnier <monnier@iro.umontreal.ca>
Date: Tue, 5 Jan 2021 04:11:07 +0000 (-0500)
Subject: * lisp/subr.el (ctl-x-map): Initialize inside the declaration.
X-Git-Tag: emacs-28.0.90~4374
X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5bddc097385c1d9088748ed92abc2370857b2202;p=emacs.git

* lisp/subr.el (ctl-x-map): Initialize inside the declaration.

* src/command.h (control_x_map):
* src/keymap.c (control_x_map): Delete variable.
(syms_of_keymap):
* src/keyboard.c (keys_of_keyboard):
* src/casefiddle.c (keys_of_casefiddle):
* src/window.c (keys_of_window): Move initialization of ctl-x-map to
subr.el.

* src/lisp.h (syms_of_buffer):
* src/buffer.c (keys_of_buffer): Delete function.
* src/emacs.c (main): Don't call it.
---

diff --git a/lisp/subr.el b/lisp/subr.el
index 6187f7ad3c4..206e71ac03b 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1246,23 +1246,34 @@ in a cleaner way with command remapping, like this:
   "Default keymap for ESC (meta) commands.
 The normal global definition of the character ESC indirects to this keymap.")
 
-(defvar ctl-x-map nil
-  "Default keymap for C-x commands.
-The normal global definition of the character C-x indirects to this keymap.")
-
 (defvar ctl-x-4-map (make-sparse-keymap)
   "Keymap for subcommands of C-x 4.")
 (defalias 'ctl-x-4-prefix ctl-x-4-map)
-(define-key ctl-x-map "4" 'ctl-x-4-prefix)
 
 (defvar ctl-x-5-map (make-sparse-keymap)
   "Keymap for frame commands.")
 (defalias 'ctl-x-5-prefix ctl-x-5-map)
-(define-key ctl-x-map "5" 'ctl-x-5-prefix)
 
 (defvar tab-prefix-map (make-sparse-keymap)
   "Keymap for tab-bar related commands.")
-(define-key ctl-x-map "t" tab-prefix-map)
+
+(defvar ctl-x-map
+  (let ((map (make-keymap)))
+    (define-key map "4" 'ctl-x-4-prefix)
+    (define-key map "5" 'ctl-x-5-prefix)
+    (define-key map "t" tab-prefix-map)
+
+    (define-key map "b" #'switch-to-buffer)
+    (define-key map "l" #'kill-buffer)
+    (define-key map "\C-u" #'upcase-region)   (put 'upcase-region   'disabled t)
+    (define-key map "\C-l" #'downcase-region) (put 'downcase-region 'disabled t)
+    (define-key map "<" #'scroll-left)
+    (define-key map ">" #'scroll-right)
+    map)
+  "Default keymap for C-x commands.
+The normal global definition of the character C-x indirects to this keymap.")
+(fset 'Control-X-prefix ctl-x-map)
+(make-obsolete 'Control-X-prefix 'ctl-x-map  "28.1")
 
 (defvar global-map
   (let ((map (make-keymap)))
@@ -1285,8 +1296,8 @@ The normal global definition of the character C-x indirects to this keymap.")
     (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-z"     #'suspend-emacs) ;FIXME: Re-bound later!
+    (define-key map "\C-x\C-z" #'suspend-emacs) ;FIXME: Re-bound later!
     (define-key map "\C-v" #'scroll-up-command)
     (define-key map "\C-]" #'abort-recursive-edit)
     map)
diff --git a/src/buffer.c b/src/buffer.c
index 0a7ff6e6752..71ad5edd527 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -6380,10 +6380,3 @@ nil NORECORD argument since it may lead to infinite recursion.  */);
 
   Fput (intern_c_string ("erase-buffer"), Qdisabled, Qt);
 }
-
-void
-keys_of_buffer (void)
-{
-  initial_define_key (control_x_map, 'b', "switch-to-buffer");
-  initial_define_key (control_x_map, 'k', "kill-buffer");
-}
diff --git a/src/casefiddle.c b/src/casefiddle.c
index a948bb3bc88..42de9722ecd 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -686,11 +686,6 @@ Called with one argument METHOD which can be:
 void
 keys_of_casefiddle (void)
 {
-  initial_define_key (control_x_map, Ctl ('U'), "upcase-region");
-  Fput (intern ("upcase-region"), Qdisabled, Qt);
-  initial_define_key (control_x_map, Ctl ('L'), "downcase-region");
-  Fput (intern ("downcase-region"), Qdisabled, Qt);
-
   initial_define_key (meta_map, 'u', "upcase-word");
   initial_define_key (meta_map, 'l', "downcase-word");
   initial_define_key (meta_map, 'c', "capitalize-word");
diff --git a/src/commands.h b/src/commands.h
index be6f5823bcc..8f9c76b1e2d 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -28,7 +28,6 @@ along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
    initialization; use-global-map doesn't affect these; it sets
    current_global_map instead.  */
 extern Lisp_Object meta_map;
-extern Lisp_Object control_x_map;
 
 /* If not Qnil, this is a switch-frame event which we decided to put
    off until the end of a key sequence.  This should be read as the
diff --git a/src/emacs.c b/src/emacs.c
index 3c293d85edd..18b54dd07ef 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1957,7 +1957,6 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
 #endif
 
       keys_of_casefiddle ();
-      keys_of_buffer ();
       keys_of_keyboard ();
       keys_of_window ();
     }
diff --git a/src/keyboard.c b/src/keyboard.c
index 52d913c537d..bb4d981fe59 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -12388,7 +12388,6 @@ syms_of_keyboard_for_pdumper (void)
 void
 keys_of_keyboard (void)
 {
-  initial_define_key (control_x_map, Ctl ('Z'), "suspend-emacs");
   initial_define_key (meta_map, Ctl ('C'), "exit-recursive-edit");
   initial_define_key (meta_map, 'x', "execute-extended-command");
 
diff --git a/src/keymap.c b/src/keymap.c
index 772ced42ccd..171f9460412 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -62,9 +62,6 @@ Lisp_Object current_global_map;	/* Current global keymap.  */
 Lisp_Object meta_map;		/* The keymap used for globally bound
 				   ESC-prefixed default commands.  */
 
-Lisp_Object control_x_map;	/* The keymap used for globally bound
-				   C-x-prefixed default commands.  */
-
 				/* The keymap used by the minibuf for local
 				   bindings when spaces are allowed in the
 				   minibuf.  */
@@ -3200,10 +3197,6 @@ syms_of_keymap (void)
   Fset (intern_c_string ("esc-map"), meta_map);
   Ffset (intern_c_string ("ESC-prefix"), meta_map);
 
-  control_x_map = Fmake_keymap (Qnil);
-  Fset (intern_c_string ("ctl-x-map"), control_x_map);
-  Ffset (intern_c_string ("Control-X-prefix"), control_x_map);
-
   exclude_keys = pure_list
     (pure_cons (build_pure_c_string ("DEL"), build_pure_c_string ("\\d")),
      pure_cons (build_pure_c_string ("TAB"), build_pure_c_string ("\\t")),
diff --git a/src/lisp.h b/src/lisp.h
index d259e950dab..915ad64f6e1 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -4261,7 +4261,6 @@ extern Lisp_Object get_truename_buffer (Lisp_Object);
 extern void init_buffer_once (void);
 extern void init_buffer (void);
 extern void syms_of_buffer (void);
-extern void keys_of_buffer (void);
 
 /* Defined in marker.c.  */
 
diff --git a/src/window.c b/src/window.c
index f2862a287d6..29d499ccd45 100644
--- a/src/window.c
+++ b/src/window.c
@@ -8587,9 +8587,6 @@ displayed after a scrolling operation to be somewhat inaccurate.  */);
 void
 keys_of_window (void)
 {
-  initial_define_key (control_x_map, '<', "scroll-left");
-  initial_define_key (control_x_map, '>', "scroll-right");
-
   initial_define_key (meta_map, Ctl ('V'), "scroll-other-window");
   initial_define_key (meta_map, 'v', "scroll-down-command");
 }