aboutsummaryrefslogtreecommitdiffstats
path: root/src/keymap.c
diff options
context:
space:
mode:
authorRichard M. Stallman1992-09-11 23:30:25 +0000
committerRichard M. Stallman1992-09-11 23:30:25 +0000
commitce6e5d0b572ab298101d6648fec213155bcbb7d3 (patch)
tree0338b75237ce29f09766e2e567ca006d99d6e763 /src/keymap.c
parent248a26a710ec6401e6eddaccd8446665a261ef5e (diff)
downloademacs-ce6e5d0b572ab298101d6648fec213155bcbb7d3.tar.gz
emacs-ce6e5d0b572ab298101d6648fec213155bcbb7d3.zip
(Fmake_sparse_keymap, Fmake_keymap): New optional arg. Callers changed.
(keymap_table): No longer static.
Diffstat (limited to 'src/keymap.c')
-rw-r--r--src/keymap.c51
1 files changed, 32 insertions, 19 deletions
diff --git a/src/keymap.c b/src/keymap.c
index 89a273db972..954f816b689 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -88,27 +88,40 @@ static void describe_alist ();
88 88
89/* Keymap object support - constructors and predicates. */ 89/* Keymap object support - constructors and predicates. */
90 90
91DEFUN ("make-keymap", Fmake_keymap, Smake_keymap, 0, 0, 0, 91DEFUN ("make-keymap", Fmake_keymap, Smake_keymap, 0, 1, 0,
92 "Construct and return a new keymap, of the form (keymap VECTOR . ALIST).\n\ 92 "Construct and return a new keymap, of the form (keymap VECTOR . ALIST).\n\
93VECTOR is a 128-element vector which holds the bindings for the ASCII\n\ 93VECTOR is a 128-element vector which holds the bindings for the ASCII\n\
94characters. ALIST is an assoc-list which holds bindings for function keys,\n\ 94characters. ALIST is an assoc-list which holds bindings for function keys,\n\
95mouse events, and any other things that appear in the input stream.\n\ 95mouse events, and any other things that appear in the input stream.\n\
96All entries in it are initially nil, meaning \"command undefined\".") 96All entries in it are initially nil, meaning \"command undefined\".\n\n\
97 () 97The optional arg STRING supplies a menu name for the keymap\n\
98in case you use it as a menu with `x-popup-menu'.")
99 (string)
100 Lisp_Object string;
98{ 101{
102 Lisp_Object tail;
103 if (!NILP (string))
104 tail = Fcons (string, Qnil);
105 else
106 tail = Qnil;
99 return Fcons (Qkeymap, 107 return Fcons (Qkeymap,
100 Fcons (Fmake_vector (make_number (DENSE_TABLE_SIZE), Qnil), 108 Fcons (Fmake_vector (make_number (DENSE_TABLE_SIZE), Qnil),
101 Qnil)); 109 tail));
102} 110}
103 111
104DEFUN ("make-sparse-keymap", Fmake_sparse_keymap, Smake_sparse_keymap, 0, 0, 0, 112DEFUN ("make-sparse-keymap", Fmake_sparse_keymap, Smake_sparse_keymap, 0, 1, 0,
105 "Construct and return a new sparse-keymap list.\n\ 113 "Construct and return a new sparse-keymap list.\n\
106Its car is `keymap' and its cdr is an alist of (CHAR . DEFINITION),\n\ 114Its car is `keymap' and its cdr is an alist of (CHAR . DEFINITION),\n\
107which binds the character CHAR to DEFINITION, or (SYMBOL . DEFINITION),\n\ 115which binds the character CHAR to DEFINITION, or (SYMBOL . DEFINITION),\n\
108which binds the function key or mouse event SYMBOL to DEFINITION.\n\ 116which binds the function key or mouse event SYMBOL to DEFINITION.\n\
109Initially the alist is nil.") 117Initially the alist is nil.\n\n\
110 () 118The optional arg STRING supplies a menu name for the keymap\n\
119in case you use it as a menu with `x-popup-menu'.")
120 (string)
121 Lisp_Object string;
111{ 122{
123 if (!NILP (string))
124 return Fcons (Qkeymap, Fcons (string, Qnil));
112 return Fcons (Qkeymap, Qnil); 125 return Fcons (Qkeymap, Qnil);
113} 126}
114 127
@@ -194,7 +207,7 @@ get_keymap (object)
194/* If KEYMAP is a dense keymap, return the vector from its cadr. 207/* If KEYMAP is a dense keymap, return the vector from its cadr.
195 Otherwise, return nil. */ 208 Otherwise, return nil. */
196 209
197static Lisp_Object 210Lisp_Object
198keymap_table (keymap) 211keymap_table (keymap)
199 Lisp_Object keymap; 212 Lisp_Object keymap;
200{ 213{
@@ -464,7 +477,7 @@ the front of KEYMAP.")
464 477
465 if (NILP (cmd)) 478 if (NILP (cmd))
466 { 479 {
467 cmd = Fmake_sparse_keymap (); 480 cmd = Fmake_sparse_keymap (Qnil);
468 store_in_keymap (keymap, c, cmd); 481 store_in_keymap (keymap, c, cmd);
469 } 482 }
470 483
@@ -762,7 +775,7 @@ which is shared with other buffers in the same major mode.")
762 map = current_buffer->keymap; 775 map = current_buffer->keymap;
763 if (NILP (map)) 776 if (NILP (map))
764 { 777 {
765 map = Fmake_sparse_keymap (); 778 map = Fmake_sparse_keymap (Qnil);
766 current_buffer->keymap = map; 779 current_buffer->keymap = map;
767 } 780 }
768 781
@@ -806,7 +819,7 @@ as a function.")
806 Lisp_Object name, mapvar; 819 Lisp_Object name, mapvar;
807{ 820{
808 Lisp_Object map; 821 Lisp_Object map;
809 map = Fmake_sparse_keymap (); 822 map = Fmake_sparse_keymap (Qnil);
810 Ffset (name, map); 823 Ffset (name, map);
811 if (!NILP (mapvar)) 824 if (!NILP (mapvar))
812 Fset (mapvar, map); 825 Fset (mapvar, map);
@@ -1767,32 +1780,32 @@ syms_of_keymap ()
1767 Each one is the value of a Lisp variable, and is also 1780 Each one is the value of a Lisp variable, and is also
1768 pointed to by a C variable */ 1781 pointed to by a C variable */
1769 1782
1770 global_map = Fmake_keymap (); 1783 global_map = Fmake_keymap (Qnil);
1771 Fset (intern ("global-map"), global_map); 1784 Fset (intern ("global-map"), global_map);
1772 1785
1773 meta_map = Fmake_keymap (); 1786 meta_map = Fmake_keymap (Qnil);
1774 Fset (intern ("esc-map"), meta_map); 1787 Fset (intern ("esc-map"), meta_map);
1775 Ffset (intern ("ESC-prefix"), meta_map); 1788 Ffset (intern ("ESC-prefix"), meta_map);
1776 1789
1777 control_x_map = Fmake_keymap (); 1790 control_x_map = Fmake_keymap (Qnil);
1778 Fset (intern ("ctl-x-map"), control_x_map); 1791 Fset (intern ("ctl-x-map"), control_x_map);
1779 Ffset (intern ("Control-X-prefix"), control_x_map); 1792 Ffset (intern ("Control-X-prefix"), control_x_map);
1780 1793
1781 DEFVAR_LISP ("minibuffer-local-map", &Vminibuffer_local_map, 1794 DEFVAR_LISP ("minibuffer-local-map", &Vminibuffer_local_map,
1782 "Default keymap to use when reading from the minibuffer."); 1795 "Default keymap to use when reading from the minibuffer.");
1783 Vminibuffer_local_map = Fmake_sparse_keymap (); 1796 Vminibuffer_local_map = Fmake_sparse_keymap (Qnil);
1784 1797
1785 DEFVAR_LISP ("minibuffer-local-ns-map", &Vminibuffer_local_ns_map, 1798 DEFVAR_LISP ("minibuffer-local-ns-map", &Vminibuffer_local_ns_map,
1786 "Local keymap for the minibuffer when spaces are not allowed."); 1799 "Local keymap for the minibuffer when spaces are not allowed.");
1787 Vminibuffer_local_ns_map = Fmake_sparse_keymap (); 1800 Vminibuffer_local_ns_map = Fmake_sparse_keymap (Qnil);
1788 1801
1789 DEFVAR_LISP ("minibuffer-local-completion-map", &Vminibuffer_local_completion_map, 1802 DEFVAR_LISP ("minibuffer-local-completion-map", &Vminibuffer_local_completion_map,
1790 "Local keymap for minibuffer input with completion."); 1803 "Local keymap for minibuffer input with completion.");
1791 Vminibuffer_local_completion_map = Fmake_sparse_keymap (); 1804 Vminibuffer_local_completion_map = Fmake_sparse_keymap (Qnil);
1792 1805
1793 DEFVAR_LISP ("minibuffer-local-must-match-map", &Vminibuffer_local_must_match_map, 1806 DEFVAR_LISP ("minibuffer-local-must-match-map", &Vminibuffer_local_must_match_map,
1794 "Local keymap for minibuffer input with completion, for exact match."); 1807 "Local keymap for minibuffer input with completion, for exact match.");
1795 Vminibuffer_local_must_match_map = Fmake_sparse_keymap (); 1808 Vminibuffer_local_must_match_map = Fmake_sparse_keymap (Qnil);
1796 1809
1797 current_global_map = global_map; 1810 current_global_map = global_map;
1798 1811
@@ -1820,7 +1833,7 @@ For example, suppose function-key-map binds `ESC O P' to [pf1].\n\
1820Typing `ESC O P' to read-key-sequence would return [pf1]. Typing\n\ 1833Typing `ESC O P' to read-key-sequence would return [pf1]. Typing\n\
1821`C-x ESC O P' would return [?\C-x pf1]. If [pf1] were a prefix\n\ 1834`C-x ESC O P' would return [?\C-x pf1]. If [pf1] were a prefix\n\
1822key, typing `ESC O P x' would return [pf1 x]."); 1835key, typing `ESC O P x' would return [pf1 x].");
1823 Vfunction_key_map = Fmake_sparse_keymap (); 1836 Vfunction_key_map = Fmake_sparse_keymap (Qnil);
1824 1837
1825 Qsingle_key_description = intern ("single-key-description"); 1838 Qsingle_key_description = intern ("single-key-description");
1826 staticpro (&Qsingle_key_description); 1839 staticpro (&Qsingle_key_description);