emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 8ef4314 3/3: * lisp/subr.el (esc-map): Initialize inside declarat


From: Stefan Monnier
Subject: master 8ef4314 3/3: * lisp/subr.el (esc-map): Initialize inside declaration
Date: Mon, 4 Jan 2021 23:44:36 -0500 (EST)

branch: master
commit 8ef4314c44a046e92bcd7dddde26203a9d641f09
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * lisp/subr.el (esc-map): Initialize inside declaration
    
    * src/commands.h (meta_map):
    * src/keymap.c (meta_map): Delete variable.
    (syms_of_keymap): Don't initialize esc-map here.
    (initial_define_key):
    * src/keymap.h (initial_define_key): Delete function.
    
    * src/keyboard.c (keys_of_keyboard): Don't initialize esc-map here.
    
    * src/window.h (keys_of_window):
    * src/window.c (keys_of_window): Delete function.
    * src/lisp.h (keys_of_casefiddle):
    * src/casefiddle.c (keys_of_casefiddle): Delete function.
    * src/emacs.c (main): Don't call them.
---
 lisp/subr.el     | 22 ++++++++++++++++++----
 src/casefiddle.c |  8 --------
 src/commands.h   |  6 ------
 src/emacs.c      |  2 --
 src/keyboard.c   |  3 ---
 src/keymap.c     | 28 ----------------------------
 src/keymap.h     |  1 -
 src/lisp.h       |  1 -
 src/window.c     |  7 -------
 src/window.h     |  1 -
 10 files changed, 18 insertions(+), 61 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index 206e71a..60a7785 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1242,9 +1242,17 @@ 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 esc-map nil
+(defvar esc-map
+  (let ((map (make-keymap)))
+    (define-key map "u" #'upcase-word)
+    (define-key map "l" #'downcase-word)
+    (define-key map "c" #'capitalize-word)
+    (define-key map "x" #'execute-extended-command)
+    map)
   "Default keymap for ESC (meta) commands.
 The normal global definition of the character ESC indirects to this keymap.")
+(fset 'ESC-prefix esc-map)
+(make-obsolete 'ESC-prefix 'esc-map "28.1")
 
 (defvar ctl-x-4-map (make-sparse-keymap)
   "Keymap for subcommands of C-x 4.")
@@ -1273,7 +1281,7 @@ The normal global definition of the character ESC 
indirects to this keymap.")
   "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")
+(make-obsolete 'Control-X-prefix 'ctl-x-map "28.1")
 
 (defvar global-map
   (let ((map (make-keymap)))
@@ -1296,10 +1304,16 @@ 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-x\C-z" #'suspend-emacs) ;FIXME: Re-bound later!
-    (define-key map "\C-v" #'scroll-up-command)
-    (define-key map "\C-]" #'abort-recursive-edit)
+
+    (define-key map "\C-v"    #'scroll-up-command)
+    (define-key map "\M-v"    #'scroll-down-command)
+    (define-key map "\M-\C-v" #'scroll-other-window)
+
+    (define-key map "\M-\C-c" #'exit-recursive-edit)
+    (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
diff --git a/src/casefiddle.c b/src/casefiddle.c
index 42de972..a7a2541 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -682,11 +682,3 @@ Called with one argument METHOD which can be:
   defsubr (&Sdowncase_word);
   defsubr (&Scapitalize_word);
 }
-
-void
-keys_of_casefiddle (void)
-{
-  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 8f9c76b..2205ebf 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -23,12 +23,6 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 
 #define Ctl(c) ((c)&037)
 
-/* Define the names of keymaps, just so people can refer to them in
-   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 meta_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
    next command input, after any Vunread_command_events.
diff --git a/src/emacs.c b/src/emacs.c
index 18b54dd..69d1082 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1956,9 +1956,7 @@ Using an Emacs configured with --with-x-toolkit=lucid 
does not have this problem
       syms_of_json ();
 #endif
 
-      keys_of_casefiddle ();
       keys_of_keyboard ();
-      keys_of_window ();
     }
   else
     {
diff --git a/src/keyboard.c b/src/keyboard.c
index bb4d981..9ee4c4f 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -12388,9 +12388,6 @@ syms_of_keyboard_for_pdumper (void)
 void
 keys_of_keyboard (void)
 {
-  initial_define_key (meta_map, Ctl ('C'), "exit-recursive-edit");
-  initial_define_key (meta_map, 'x', "execute-extended-command");
-
   initial_define_lispy_key (Vspecial_event_map, "delete-frame",
                            "handle-delete-frame");
 #ifdef HAVE_NTGUI
diff --git a/src/keymap.c b/src/keymap.c
index 171f946..37270f5 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -59,17 +59,6 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 
 Lisp_Object current_global_map;        /* Current global keymap.  */
 
-Lisp_Object meta_map;          /* The keymap used for globally bound
-                                  ESC-prefixed default commands.  */
-
-                               /* The keymap used by the minibuf for local
-                                  bindings when spaces are allowed in the
-                                  minibuf.  */
-
-                               /* The keymap used by the minibuf for local
-                                  bindings when spaces are not encouraged
-                                  in the minibuf.  */
-
 /* Alist of elements like (DEL . "\d").  */
 static Lisp_Object exclude_keys;
 
@@ -135,19 +124,6 @@ in case you use it as a menu with `x-popup-menu'.  */)
   return list1 (Qkeymap);
 }
 
-/* This function is used for installing the standard key bindings
-   at initialization time.
-
-   For example:
-
-   initial_define_key (control_x_map, Ctl('X'), "exchange-point-and-mark");  */
-
-void
-initial_define_key (Lisp_Object keymap, int key, const char *defname)
-{
-  store_in_keymap (keymap, make_fixnum (key), intern_c_string (defname));
-}
-
 void
 initial_define_lispy_key (Lisp_Object keymap, const char *keyname, const char 
*defname)
 {
@@ -3193,10 +3169,6 @@ syms_of_keymap (void)
   current_global_map = Qnil;
   staticpro (&current_global_map);
 
-  meta_map = Fmake_keymap (Qnil);
-  Fset (intern_c_string ("esc-map"), meta_map);
-  Ffset (intern_c_string ("ESC-prefix"), meta_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/keymap.h b/src/keymap.h
index 1967025..f417301 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -37,7 +37,6 @@ extern char *push_key_description (EMACS_INT, char *);
 extern Lisp_Object access_keymap (Lisp_Object, Lisp_Object, bool, bool, bool);
 extern Lisp_Object get_keymap (Lisp_Object, bool, bool);
 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);
 
diff --git a/src/lisp.h b/src/lisp.h
index 915ad64..ca0eb51 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -4357,7 +4357,6 @@ extern void syms_of_callint (void);
 /* Defined in casefiddle.c.  */
 
 extern void syms_of_casefiddle (void);
-extern void keys_of_casefiddle (void);
 
 /* Defined in casetab.c.  */
 
diff --git a/src/window.c b/src/window.c
index 29d499c..58204c1 100644
--- a/src/window.c
+++ b/src/window.c
@@ -8583,10 +8583,3 @@ displayed after a scrolling operation to be somewhat 
inaccurate.  */);
   defsubr (&Swindow_parameter);
   defsubr (&Sset_window_parameter);
 }
-
-void
-keys_of_window (void)
-{
-  initial_define_key (meta_map, Ctl ('V'), "scroll-other-window");
-  initial_define_key (meta_map, 'v', "scroll-down-command");
-}
diff --git a/src/window.h b/src/window.h
index 1f94fc0..332cb30 100644
--- a/src/window.h
+++ b/src/window.h
@@ -1202,7 +1202,6 @@ extern bool window_outdated (struct window *);
 extern void init_window_once (void);
 extern void init_window (void);
 extern void syms_of_window (void);
-extern void keys_of_window (void);
 /* Move cursor to row/column position VPOS/HPOS, pixel coordinates
    Y/X. HPOS/VPOS are window-relative row and column numbers and X/Y
    are window-relative pixel positions.  This is always done during



reply via email to

[Prev in Thread] Current Thread [Next in Thread]