diff options
| author | Miles Bader | 2005-02-18 00:41:50 +0000 |
|---|---|---|
| committer | Miles Bader | 2005-02-18 00:41:50 +0000 |
| commit | 8d46efcc0f2045a1e5a2739c55ba6a88fbf4bcfc (patch) | |
| tree | bc968a02587d51199537bb335d5494e756e35fdf /src/keymap.c | |
| parent | 8589dc17f80450f5773a2d449fa6d94c9bb04fe3 (diff) | |
| parent | 9b516537a9899900647d4eae5ec8778e6837ad3c (diff) | |
| download | emacs-8d46efcc0f2045a1e5a2739c55ba6a88fbf4bcfc.tar.gz emacs-8d46efcc0f2045a1e5a2739c55ba6a88fbf4bcfc.zip | |
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-15
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-95
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-96
Move Gnus images into etc/images
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-97
- miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-105
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-14
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-15
Update from CVS: lisp/imap.el (imap-log): Doc fix.
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-16
Merge from emacs--cvs-trunk--0
Diffstat (limited to 'src/keymap.c')
| -rw-r--r-- | src/keymap.c | 77 |
1 files changed, 58 insertions, 19 deletions
diff --git a/src/keymap.c b/src/keymap.c index 2977b4dec09..3aaecf1a5d7 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -121,10 +121,11 @@ static void describe_command P_ ((Lisp_Object, Lisp_Object)); | |||
| 121 | static void describe_translation P_ ((Lisp_Object, Lisp_Object)); | 121 | static void describe_translation P_ ((Lisp_Object, Lisp_Object)); |
| 122 | static void describe_map P_ ((Lisp_Object, Lisp_Object, | 122 | static void describe_map P_ ((Lisp_Object, Lisp_Object, |
| 123 | void (*) P_ ((Lisp_Object, Lisp_Object)), | 123 | void (*) P_ ((Lisp_Object, Lisp_Object)), |
| 124 | int, Lisp_Object, Lisp_Object*, int)); | 124 | int, Lisp_Object, Lisp_Object*, int, int)); |
| 125 | static void describe_vector P_ ((Lisp_Object, Lisp_Object, Lisp_Object, | 125 | static void describe_vector P_ ((Lisp_Object, Lisp_Object, Lisp_Object, |
| 126 | void (*) (Lisp_Object, Lisp_Object), int, | 126 | void (*) (Lisp_Object, Lisp_Object), int, |
| 127 | Lisp_Object, Lisp_Object, int *, int, int)); | 127 | Lisp_Object, Lisp_Object, int *, |
| 128 | int, int, int)); | ||
| 128 | static void silly_event_symbol_error P_ ((Lisp_Object)); | 129 | static void silly_event_symbol_error P_ ((Lisp_Object)); |
| 129 | 130 | ||
| 130 | /* Keymap object support - constructors and predicates. */ | 131 | /* Keymap object support - constructors and predicates. */ |
| @@ -2853,7 +2854,7 @@ You type Translation\n\ | |||
| 2853 | 2854 | ||
| 2854 | if (!NILP (Vkey_translation_map)) | 2855 | if (!NILP (Vkey_translation_map)) |
| 2855 | describe_map_tree (Vkey_translation_map, 0, Qnil, prefix, | 2856 | describe_map_tree (Vkey_translation_map, 0, Qnil, prefix, |
| 2856 | "Key translations", nomenu, 1, 0); | 2857 | "Key translations", nomenu, 1, 0, 0); |
| 2857 | 2858 | ||
| 2858 | 2859 | ||
| 2859 | /* Print the (major mode) local map. */ | 2860 | /* Print the (major mode) local map. */ |
| @@ -2866,7 +2867,7 @@ You type Translation\n\ | |||
| 2866 | if (!NILP (start1)) | 2867 | if (!NILP (start1)) |
| 2867 | { | 2868 | { |
| 2868 | describe_map_tree (start1, 1, shadow, prefix, | 2869 | describe_map_tree (start1, 1, shadow, prefix, |
| 2869 | "\f\nOverriding Bindings", nomenu, 0, 0); | 2870 | "\f\nOverriding Bindings", nomenu, 0, 0, 0); |
| 2870 | shadow = Fcons (start1, shadow); | 2871 | shadow = Fcons (start1, shadow); |
| 2871 | } | 2872 | } |
| 2872 | else | 2873 | else |
| @@ -2887,7 +2888,8 @@ You type Translation\n\ | |||
| 2887 | if (!NILP (start1)) | 2888 | if (!NILP (start1)) |
| 2888 | { | 2889 | { |
| 2889 | describe_map_tree (start1, 1, shadow, prefix, | 2890 | describe_map_tree (start1, 1, shadow, prefix, |
| 2890 | "\f\n`keymap' Property Bindings", nomenu, 0, 0); | 2891 | "\f\n`keymap' Property Bindings", nomenu, |
| 2892 | 0, 0, 0); | ||
| 2891 | shadow = Fcons (start1, shadow); | 2893 | shadow = Fcons (start1, shadow); |
| 2892 | } | 2894 | } |
| 2893 | 2895 | ||
| @@ -2915,7 +2917,8 @@ You type Translation\n\ | |||
| 2915 | p += sizeof (" Minor Mode Bindings") - 1; | 2917 | p += sizeof (" Minor Mode Bindings") - 1; |
| 2916 | *p = 0; | 2918 | *p = 0; |
| 2917 | 2919 | ||
| 2918 | describe_map_tree (maps[i], 1, shadow, prefix, title, nomenu, 0, 0); | 2920 | describe_map_tree (maps[i], 1, shadow, prefix, |
| 2921 | title, nomenu, 0, 0, 0); | ||
| 2919 | shadow = Fcons (maps[i], shadow); | 2922 | shadow = Fcons (maps[i], shadow); |
| 2920 | } | 2923 | } |
| 2921 | 2924 | ||
| @@ -2925,23 +2928,23 @@ You type Translation\n\ | |||
| 2925 | { | 2928 | { |
| 2926 | if (EQ (start1, XBUFFER (buffer)->keymap)) | 2929 | if (EQ (start1, XBUFFER (buffer)->keymap)) |
| 2927 | describe_map_tree (start1, 1, shadow, prefix, | 2930 | describe_map_tree (start1, 1, shadow, prefix, |
| 2928 | "\f\nMajor Mode Bindings", nomenu, 0, 0); | 2931 | "\f\nMajor Mode Bindings", nomenu, 0, 0, 0); |
| 2929 | else | 2932 | else |
| 2930 | describe_map_tree (start1, 1, shadow, prefix, | 2933 | describe_map_tree (start1, 1, shadow, prefix, |
| 2931 | "\f\n`local-map' Property Bindings", | 2934 | "\f\n`local-map' Property Bindings", |
| 2932 | nomenu, 0, 0); | 2935 | nomenu, 0, 0, 0); |
| 2933 | 2936 | ||
| 2934 | shadow = Fcons (start1, shadow); | 2937 | shadow = Fcons (start1, shadow); |
| 2935 | } | 2938 | } |
| 2936 | } | 2939 | } |
| 2937 | 2940 | ||
| 2938 | describe_map_tree (current_global_map, 1, shadow, prefix, | 2941 | describe_map_tree (current_global_map, 1, shadow, prefix, |
| 2939 | "\f\nGlobal Bindings", nomenu, 0, 1); | 2942 | "\f\nGlobal Bindings", nomenu, 0, 1, 0); |
| 2940 | 2943 | ||
| 2941 | /* Print the function-key-map translations under this prefix. */ | 2944 | /* Print the function-key-map translations under this prefix. */ |
| 2942 | if (!NILP (Vfunction_key_map)) | 2945 | if (!NILP (Vfunction_key_map)) |
| 2943 | describe_map_tree (Vfunction_key_map, 0, Qnil, prefix, | 2946 | describe_map_tree (Vfunction_key_map, 0, Qnil, prefix, |
| 2944 | "\f\nFunction key map translations", nomenu, 1, 0); | 2947 | "\f\nFunction key map translations", nomenu, 1, 0, 0); |
| 2945 | 2948 | ||
| 2946 | UNGCPRO; | 2949 | UNGCPRO; |
| 2947 | return Qnil; | 2950 | return Qnil; |
| @@ -2962,17 +2965,21 @@ You type Translation\n\ | |||
| 2962 | so print strings and vectors differently. | 2965 | so print strings and vectors differently. |
| 2963 | 2966 | ||
| 2964 | If ALWAYS_TITLE is nonzero, print the title even if there are no maps | 2967 | If ALWAYS_TITLE is nonzero, print the title even if there are no maps |
| 2965 | to look through. */ | 2968 | to look through. |
| 2969 | |||
| 2970 | If MENTION_SHADOW is nonzero, then when something is shadowed by SHADOW, | ||
| 2971 | don't omit it; instead, mention it but say it is shadowed. */ | ||
| 2966 | 2972 | ||
| 2967 | void | 2973 | void |
| 2968 | describe_map_tree (startmap, partial, shadow, prefix, title, nomenu, transl, | 2974 | describe_map_tree (startmap, partial, shadow, prefix, title, nomenu, transl, |
| 2969 | always_title) | 2975 | always_title, mention_shadow) |
| 2970 | Lisp_Object startmap, shadow, prefix; | 2976 | Lisp_Object startmap, shadow, prefix; |
| 2971 | int partial; | 2977 | int partial; |
| 2972 | char *title; | 2978 | char *title; |
| 2973 | int nomenu; | 2979 | int nomenu; |
| 2974 | int transl; | 2980 | int transl; |
| 2975 | int always_title; | 2981 | int always_title; |
| 2982 | int mention_shadow; | ||
| 2976 | { | 2983 | { |
| 2977 | Lisp_Object maps, orig_maps, seen, sub_shadows; | 2984 | Lisp_Object maps, orig_maps, seen, sub_shadows; |
| 2978 | struct gcpro gcpro1, gcpro2, gcpro3; | 2985 | struct gcpro gcpro1, gcpro2, gcpro3; |
| @@ -3074,7 +3081,7 @@ key binding\n\ | |||
| 3074 | 3081 | ||
| 3075 | describe_map (Fcdr (elt), prefix, | 3082 | describe_map (Fcdr (elt), prefix, |
| 3076 | transl ? describe_translation : describe_command, | 3083 | transl ? describe_translation : describe_command, |
| 3077 | partial, sub_shadows, &seen, nomenu); | 3084 | partial, sub_shadows, &seen, nomenu, mention_shadow); |
| 3078 | 3085 | ||
| 3079 | skip: ; | 3086 | skip: ; |
| 3080 | } | 3087 | } |
| @@ -3154,7 +3161,8 @@ describe_translation (definition, args) | |||
| 3154 | PARTIAL, SHADOW, NOMENU are as in `describe_map_tree' above. */ | 3161 | PARTIAL, SHADOW, NOMENU are as in `describe_map_tree' above. */ |
| 3155 | 3162 | ||
| 3156 | static void | 3163 | static void |
| 3157 | describe_map (map, prefix, elt_describer, partial, shadow, seen, nomenu) | 3164 | describe_map (map, prefix, elt_describer, partial, shadow, |
| 3165 | seen, nomenu, mention_shadow) | ||
| 3158 | register Lisp_Object map; | 3166 | register Lisp_Object map; |
| 3159 | Lisp_Object prefix; | 3167 | Lisp_Object prefix; |
| 3160 | void (*elt_describer) P_ ((Lisp_Object, Lisp_Object)); | 3168 | void (*elt_describer) P_ ((Lisp_Object, Lisp_Object)); |
| @@ -3162,6 +3170,7 @@ describe_map (map, prefix, elt_describer, partial, shadow, seen, nomenu) | |||
| 3162 | Lisp_Object shadow; | 3170 | Lisp_Object shadow; |
| 3163 | Lisp_Object *seen; | 3171 | Lisp_Object *seen; |
| 3164 | int nomenu; | 3172 | int nomenu; |
| 3173 | int mention_shadow; | ||
| 3165 | { | 3174 | { |
| 3166 | Lisp_Object tail, definition, event; | 3175 | Lisp_Object tail, definition, event; |
| 3167 | Lisp_Object tem; | 3176 | Lisp_Object tem; |
| @@ -3191,9 +3200,10 @@ describe_map (map, prefix, elt_describer, partial, shadow, seen, nomenu) | |||
| 3191 | || CHAR_TABLE_P (XCAR (tail))) | 3200 | || CHAR_TABLE_P (XCAR (tail))) |
| 3192 | describe_vector (XCAR (tail), | 3201 | describe_vector (XCAR (tail), |
| 3193 | prefix, Qnil, elt_describer, partial, shadow, map, | 3202 | prefix, Qnil, elt_describer, partial, shadow, map, |
| 3194 | (int *)0, 0, 1); | 3203 | (int *)0, 0, 1, mention_shadow); |
| 3195 | else if (CONSP (XCAR (tail))) | 3204 | else if (CONSP (XCAR (tail))) |
| 3196 | { | 3205 | { |
| 3206 | int this_shadowed = 0; | ||
| 3197 | event = XCAR (XCAR (tail)); | 3207 | event = XCAR (XCAR (tail)); |
| 3198 | 3208 | ||
| 3199 | /* Ignore bindings whose "prefix" are not really valid events. | 3209 | /* Ignore bindings whose "prefix" are not really valid events. |
| @@ -3222,7 +3232,13 @@ describe_map (map, prefix, elt_describer, partial, shadow, seen, nomenu) | |||
| 3222 | if (!NILP (shadow)) | 3232 | if (!NILP (shadow)) |
| 3223 | { | 3233 | { |
| 3224 | tem = shadow_lookup (shadow, kludge, Qt); | 3234 | tem = shadow_lookup (shadow, kludge, Qt); |
| 3225 | if (!NILP (tem)) continue; | 3235 | if (!NILP (tem)) |
| 3236 | { | ||
| 3237 | if (mention_shadow) | ||
| 3238 | this_shadowed = 1; | ||
| 3239 | else | ||
| 3240 | continue; | ||
| 3241 | } | ||
| 3226 | } | 3242 | } |
| 3227 | 3243 | ||
| 3228 | tem = Flookup_key (map, kludge, Qt); | 3244 | tem = Flookup_key (map, kludge, Qt); |
| @@ -3242,6 +3258,13 @@ describe_map (map, prefix, elt_describer, partial, shadow, seen, nomenu) | |||
| 3242 | elt_describer will take care of spacing out far enough | 3258 | elt_describer will take care of spacing out far enough |
| 3243 | for alignment purposes. */ | 3259 | for alignment purposes. */ |
| 3244 | (*elt_describer) (definition, Qnil); | 3260 | (*elt_describer) (definition, Qnil); |
| 3261 | |||
| 3262 | if (this_shadowed) | ||
| 3263 | { | ||
| 3264 | SET_PT (PT - 1); | ||
| 3265 | insert_string (" (binding currently shadowed)"); | ||
| 3266 | SET_PT (PT + 1); | ||
| 3267 | } | ||
| 3245 | } | 3268 | } |
| 3246 | else if (EQ (XCAR (tail), Qkeymap)) | 3269 | else if (EQ (XCAR (tail), Qkeymap)) |
| 3247 | { | 3270 | { |
| @@ -3280,7 +3303,7 @@ DESCRIBER is the output function used; nil means use `princ'. */) | |||
| 3280 | specbind (Qstandard_output, Fcurrent_buffer ()); | 3303 | specbind (Qstandard_output, Fcurrent_buffer ()); |
| 3281 | CHECK_VECTOR_OR_CHAR_TABLE (vector); | 3304 | CHECK_VECTOR_OR_CHAR_TABLE (vector); |
| 3282 | describe_vector (vector, Qnil, describer, describe_vector_princ, 0, | 3305 | describe_vector (vector, Qnil, describer, describe_vector_princ, 0, |
| 3283 | Qnil, Qnil, (int *)0, 0, 0); | 3306 | Qnil, Qnil, (int *)0, 0, 0, 0); |
| 3284 | 3307 | ||
| 3285 | return unbind_to (count, Qnil); | 3308 | return unbind_to (count, Qnil); |
| 3286 | } | 3309 | } |
| @@ -3323,7 +3346,8 @@ DESCRIBER is the output function used; nil means use `princ'. */) | |||
| 3323 | static void | 3346 | static void |
| 3324 | describe_vector (vector, prefix, args, elt_describer, | 3347 | describe_vector (vector, prefix, args, elt_describer, |
| 3325 | partial, shadow, entire_map, | 3348 | partial, shadow, entire_map, |
| 3326 | indices, char_table_depth, keymap_p) | 3349 | indices, char_table_depth, keymap_p, |
| 3350 | mention_shadow) | ||
| 3327 | register Lisp_Object vector; | 3351 | register Lisp_Object vector; |
| 3328 | Lisp_Object prefix, args; | 3352 | Lisp_Object prefix, args; |
| 3329 | void (*elt_describer) P_ ((Lisp_Object, Lisp_Object)); | 3353 | void (*elt_describer) P_ ((Lisp_Object, Lisp_Object)); |
| @@ -3333,6 +3357,7 @@ describe_vector (vector, prefix, args, elt_describer, | |||
| 3333 | int *indices; | 3357 | int *indices; |
| 3334 | int char_table_depth; | 3358 | int char_table_depth; |
| 3335 | int keymap_p; | 3359 | int keymap_p; |
| 3360 | int mention_shadow; | ||
| 3336 | { | 3361 | { |
| 3337 | Lisp_Object definition; | 3362 | Lisp_Object definition; |
| 3338 | Lisp_Object tem2; | 3363 | Lisp_Object tem2; |
| @@ -3377,6 +3402,7 @@ describe_vector (vector, prefix, args, elt_describer, | |||
| 3377 | 3402 | ||
| 3378 | for (i = from; i < to; i++) | 3403 | for (i = from; i < to; i++) |
| 3379 | { | 3404 | { |
| 3405 | int this_shadowed = 0; | ||
| 3380 | int range_beg, range_end; | 3406 | int range_beg, range_end; |
| 3381 | Lisp_Object val; | 3407 | Lisp_Object val; |
| 3382 | 3408 | ||
| @@ -3412,7 +3438,13 @@ describe_vector (vector, prefix, args, elt_describer, | |||
| 3412 | 3438 | ||
| 3413 | tem = shadow_lookup (shadow, kludge, Qt); | 3439 | tem = shadow_lookup (shadow, kludge, Qt); |
| 3414 | 3440 | ||
| 3415 | if (!NILP (tem)) continue; | 3441 | if (!NILP (tem)) |
| 3442 | { | ||
| 3443 | if (mention_shadow) | ||
| 3444 | this_shadowed = 1; | ||
| 3445 | else | ||
| 3446 | continue; | ||
| 3447 | } | ||
| 3416 | } | 3448 | } |
| 3417 | 3449 | ||
| 3418 | /* Ignore this definition if it is shadowed by an earlier | 3450 | /* Ignore this definition if it is shadowed by an earlier |
| @@ -3477,6 +3509,13 @@ describe_vector (vector, prefix, args, elt_describer, | |||
| 3477 | elt_describer will take care of spacing out far enough | 3509 | elt_describer will take care of spacing out far enough |
| 3478 | for alignment purposes. */ | 3510 | for alignment purposes. */ |
| 3479 | (*elt_describer) (definition, args); | 3511 | (*elt_describer) (definition, args); |
| 3512 | |||
| 3513 | if (this_shadowed) | ||
| 3514 | { | ||
| 3515 | SET_PT (PT - 1); | ||
| 3516 | insert_string (" (binding currently shadowed)"); | ||
| 3517 | SET_PT (PT + 1); | ||
| 3518 | } | ||
| 3480 | } | 3519 | } |
| 3481 | 3520 | ||
| 3482 | if (CHAR_TABLE_P (vector) && ! NILP (XCHAR_TABLE (vector)->defalt)) | 3521 | if (CHAR_TABLE_P (vector) && ! NILP (XCHAR_TABLE (vector)->defalt)) |