diff options
| author | Paul Eggert | 2011-03-14 08:53:19 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-03-14 08:53:19 -0700 |
| commit | c1141155bab3b9e7b7c7663329715d492bbbccb2 (patch) | |
| tree | 5bd2d8e77159bef422fa0a594f72fb81547ec069 /src | |
| parent | dbbb842771445b0376b95a48a4fae85f37420c62 (diff) | |
| download | emacs-c1141155bab3b9e7b7c7663329715d492bbbccb2.tar.gz emacs-c1141155bab3b9e7b7c7663329715d492bbbccb2.zip | |
* keymap.c: (get_keymap, access_keymap, Fdefine_key, Fwhere_is_internal):
(describe_map_tree):
Rename locals to avoid shadowing.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 3 | ||||
| -rw-r--r-- | src/keymap.c | 57 |
2 files changed, 32 insertions, 28 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5b9e472e4e9..55fa10066ef 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -5,6 +5,9 @@ | |||
| 5 | Now static. | 5 | Now static. |
| 6 | (Fwhere_is_internal): Don't test CONSP (sequences) unnecessarily. | 6 | (Fwhere_is_internal): Don't test CONSP (sequences) unnecessarily. |
| 7 | (DENSE_TABLE_SIZE): Remove; unused. | 7 | (DENSE_TABLE_SIZE): Remove; unused. |
| 8 | (get_keymap, access_keymap, Fdefine_key, Fwhere_is_internal): | ||
| 9 | (describe_map_tree): | ||
| 10 | Rename locals to avoid shadowing. | ||
| 8 | 11 | ||
| 9 | * keyboard.c: Declare functions static if they are not used elsewhere. | 12 | * keyboard.c: Declare functions static if they are not used elsewhere. |
| 10 | (echo_char, echo_dash, cmd_error, top_level_2): | 13 | (echo_char, echo_dash, cmd_error, top_level_2): |
diff --git a/src/keymap.c b/src/keymap.c index a4de89f6a72..06968a0d944 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -188,8 +188,9 @@ when reading a key-sequence to be looked-up in this keymap. */) | |||
| 188 | If the map needs to be autoloaded, but AUTOLOAD is zero (and ERROR | 188 | If the map needs to be autoloaded, but AUTOLOAD is zero (and ERROR |
| 189 | is zero as well), return Qt. | 189 | is zero as well), return Qt. |
| 190 | 190 | ||
| 191 | ERROR controls how we respond if OBJECT isn't a keymap. | 191 | ERROR_IF_NOT_KEYMAP controls how we respond if OBJECT isn't a keymap. |
| 192 | If ERROR is non-zero, signal an error; otherwise, just return Qnil. | 192 | If ERROR_IF_NOT_KEYMAP is non-zero, signal an error; otherwise, |
| 193 | just return Qnil. | ||
| 193 | 194 | ||
| 194 | Note that most of the time, we don't want to pursue autoloads. | 195 | Note that most of the time, we don't want to pursue autoloads. |
| 195 | Functions like Faccessible_keymaps which scan entire keymap trees | 196 | Functions like Faccessible_keymaps which scan entire keymap trees |
| @@ -201,7 +202,7 @@ when reading a key-sequence to be looked-up in this keymap. */) | |||
| 201 | do_autoload which can GC. */ | 202 | do_autoload which can GC. */ |
| 202 | 203 | ||
| 203 | Lisp_Object | 204 | Lisp_Object |
| 204 | get_keymap (Lisp_Object object, int error, int autoload) | 205 | get_keymap (Lisp_Object object, int error_if_not_keymap, int autoload) |
| 205 | { | 206 | { |
| 206 | Lisp_Object tem; | 207 | Lisp_Object tem; |
| 207 | 208 | ||
| @@ -219,7 +220,7 @@ get_keymap (Lisp_Object object, int error, int autoload) | |||
| 219 | 220 | ||
| 220 | /* Should we do an autoload? Autoload forms for keymaps have | 221 | /* Should we do an autoload? Autoload forms for keymaps have |
| 221 | Qkeymap as their fifth element. */ | 222 | Qkeymap as their fifth element. */ |
| 222 | if ((autoload || !error) && EQ (XCAR (tem), Qautoload) | 223 | if ((autoload || !error_if_not_keymap) && EQ (XCAR (tem), Qautoload) |
| 223 | && SYMBOLP (object)) | 224 | && SYMBOLP (object)) |
| 224 | { | 225 | { |
| 225 | Lisp_Object tail; | 226 | Lisp_Object tail; |
| @@ -244,7 +245,7 @@ get_keymap (Lisp_Object object, int error, int autoload) | |||
| 244 | } | 245 | } |
| 245 | 246 | ||
| 246 | end: | 247 | end: |
| 247 | if (error) | 248 | if (error_if_not_keymap) |
| 248 | wrong_type_argument (Qkeymapp, object); | 249 | wrong_type_argument (Qkeymapp, object); |
| 249 | return Qnil; | 250 | return Qnil; |
| 250 | } | 251 | } |
| @@ -465,19 +466,19 @@ access_keymap (Lisp_Object map, Lisp_Object idx, int t_ok, int noinherit, int au | |||
| 465 | /* See if there is a meta-map. If there's none, there is | 466 | /* See if there is a meta-map. If there's none, there is |
| 466 | no binding for IDX, unless a default binding exists in MAP. */ | 467 | no binding for IDX, unless a default binding exists in MAP. */ |
| 467 | struct gcpro gcpro1; | 468 | struct gcpro gcpro1; |
| 468 | Lisp_Object meta_map; | 469 | Lisp_Object event_meta_map; |
| 469 | GCPRO1 (map); | 470 | GCPRO1 (map); |
| 470 | /* A strange value in which Meta is set would cause | 471 | /* A strange value in which Meta is set would cause |
| 471 | infinite recursion. Protect against that. */ | 472 | infinite recursion. Protect against that. */ |
| 472 | if (XINT (meta_prefix_char) & CHAR_META) | 473 | if (XINT (meta_prefix_char) & CHAR_META) |
| 473 | meta_prefix_char = make_number (27); | 474 | meta_prefix_char = make_number (27); |
| 474 | meta_map = get_keymap (access_keymap (map, meta_prefix_char, | 475 | event_meta_map = get_keymap (access_keymap (map, meta_prefix_char, |
| 475 | t_ok, noinherit, autoload), | 476 | t_ok, noinherit, autoload), |
| 476 | 0, autoload); | 477 | 0, autoload); |
| 477 | UNGCPRO; | 478 | UNGCPRO; |
| 478 | if (CONSP (meta_map)) | 479 | if (CONSP (event_meta_map)) |
| 479 | { | 480 | { |
| 480 | map = meta_map; | 481 | map = event_meta_map; |
| 481 | idx = make_number (XUINT (idx) & ~meta_modifier); | 482 | idx = make_number (XUINT (idx) & ~meta_modifier); |
| 482 | } | 483 | } |
| 483 | else if (t_ok) | 484 | else if (t_ok) |
| @@ -1139,10 +1140,10 @@ binding KEY to DEF is added at the front of KEYMAP. */) | |||
| 1139 | int i = ASIZE (def); | 1140 | int i = ASIZE (def); |
| 1140 | while (--i >= 0) | 1141 | while (--i >= 0) |
| 1141 | { | 1142 | { |
| 1142 | Lisp_Object c = AREF (def, i); | 1143 | Lisp_Object defi = AREF (def, i); |
| 1143 | if (CONSP (c) && lucid_event_type_list_p (c)) | 1144 | if (CONSP (defi) && lucid_event_type_list_p (defi)) |
| 1144 | c = Fevent_convert_list (c); | 1145 | defi = Fevent_convert_list (defi); |
| 1145 | ASET (tmp, i, c); | 1146 | ASET (tmp, i, defi); |
| 1146 | } | 1147 | } |
| 1147 | def = tmp; | 1148 | def = tmp; |
| 1148 | } | 1149 | } |
| @@ -2812,9 +2813,9 @@ remapped command in the returned list. */) | |||
| 2812 | seems to be only one menu item to report. */ | 2813 | seems to be only one menu item to report. */ |
| 2813 | if (! NILP (sequence)) | 2814 | if (! NILP (sequence)) |
| 2814 | { | 2815 | { |
| 2815 | Lisp_Object tem; | 2816 | Lisp_Object tem1; |
| 2816 | tem = Faref (sequence, make_number (ASIZE (sequence) - 1)); | 2817 | tem1 = Faref (sequence, make_number (ASIZE (sequence) - 1)); |
| 2817 | if (STRINGP (tem)) | 2818 | if (STRINGP (tem1)) |
| 2818 | Faset (sequence, make_number (ASIZE (sequence) - 1), | 2819 | Faset (sequence, make_number (ASIZE (sequence) - 1), |
| 2819 | build_string ("(any string)")); | 2820 | build_string ("(any string)")); |
| 2820 | } | 2821 | } |
| @@ -3119,13 +3120,13 @@ key binding\n\ | |||
| 3119 | /* Delete from MAPS each element that is for the menu bar. */ | 3120 | /* Delete from MAPS each element that is for the menu bar. */ |
| 3120 | for (list = maps; CONSP (list); list = XCDR (list)) | 3121 | for (list = maps; CONSP (list); list = XCDR (list)) |
| 3121 | { | 3122 | { |
| 3122 | Lisp_Object elt, prefix, tem; | 3123 | Lisp_Object elt, elt_prefix, tem; |
| 3123 | 3124 | ||
| 3124 | elt = XCAR (list); | 3125 | elt = XCAR (list); |
| 3125 | prefix = Fcar (elt); | 3126 | elt_prefix = Fcar (elt); |
| 3126 | if (XVECTOR (prefix)->size >= 1) | 3127 | if (XVECTOR (elt_prefix)->size >= 1) |
| 3127 | { | 3128 | { |
| 3128 | tem = Faref (prefix, make_number (0)); | 3129 | tem = Faref (elt_prefix, make_number (0)); |
| 3129 | if (EQ (tem, Qmenu_bar)) | 3130 | if (EQ (tem, Qmenu_bar)) |
| 3130 | maps = Fdelq (elt, maps); | 3131 | maps = Fdelq (elt, maps); |
| 3131 | } | 3132 | } |
| @@ -3150,10 +3151,10 @@ key binding\n\ | |||
| 3150 | 3151 | ||
| 3151 | for (; CONSP (maps); maps = XCDR (maps)) | 3152 | for (; CONSP (maps); maps = XCDR (maps)) |
| 3152 | { | 3153 | { |
| 3153 | register Lisp_Object elt, prefix, tail; | 3154 | register Lisp_Object elt, elt_prefix, tail; |
| 3154 | 3155 | ||
| 3155 | elt = XCAR (maps); | 3156 | elt = XCAR (maps); |
| 3156 | prefix = Fcar (elt); | 3157 | elt_prefix = Fcar (elt); |
| 3157 | 3158 | ||
| 3158 | sub_shadows = Qnil; | 3159 | sub_shadows = Qnil; |
| 3159 | 3160 | ||
| @@ -3165,8 +3166,8 @@ key binding\n\ | |||
| 3165 | 3166 | ||
| 3166 | /* If the sequence by which we reach this keymap is zero-length, | 3167 | /* If the sequence by which we reach this keymap is zero-length, |
| 3167 | then the shadow map for this keymap is just SHADOW. */ | 3168 | then the shadow map for this keymap is just SHADOW. */ |
| 3168 | if ((STRINGP (prefix) && SCHARS (prefix) == 0) | 3169 | if ((STRINGP (elt_prefix) && SCHARS (elt_prefix) == 0) |
| 3169 | || (VECTORP (prefix) && XVECTOR (prefix)->size == 0)) | 3170 | || (VECTORP (elt_prefix) && XVECTOR (elt_prefix)->size == 0)) |
| 3170 | ; | 3171 | ; |
| 3171 | /* If the sequence by which we reach this keymap actually has | 3172 | /* If the sequence by which we reach this keymap actually has |
| 3172 | some elements, then the sequence's definition in SHADOW is | 3173 | some elements, then the sequence's definition in SHADOW is |
| @@ -3192,12 +3193,12 @@ key binding\n\ | |||
| 3192 | for (tail = orig_maps; !EQ (tail, maps); tail = XCDR (tail)) | 3193 | for (tail = orig_maps; !EQ (tail, maps); tail = XCDR (tail)) |
| 3193 | { | 3194 | { |
| 3194 | Lisp_Object tem; | 3195 | Lisp_Object tem; |
| 3195 | tem = Fequal (Fcar (XCAR (tail)), prefix); | 3196 | tem = Fequal (Fcar (XCAR (tail)), elt_prefix); |
| 3196 | if (!NILP (tem)) | 3197 | if (!NILP (tem)) |
| 3197 | sub_shadows = Fcons (XCDR (XCAR (tail)), sub_shadows); | 3198 | sub_shadows = Fcons (XCDR (XCAR (tail)), sub_shadows); |
| 3198 | } | 3199 | } |
| 3199 | 3200 | ||
| 3200 | describe_map (Fcdr (elt), prefix, | 3201 | describe_map (Fcdr (elt), elt_prefix, |
| 3201 | transl ? describe_translation : describe_command, | 3202 | transl ? describe_translation : describe_command, |
| 3202 | partial, sub_shadows, &seen, nomenu, mention_shadow); | 3203 | partial, sub_shadows, &seen, nomenu, mention_shadow); |
| 3203 | 3204 | ||