diff options
| author | Stefan Monnier | 2001-11-19 22:46:37 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2001-11-19 22:46:37 +0000 |
| commit | d55627cca4c7f07d2dab2037b740a1b2a29de125 (patch) | |
| tree | 8c0d838d8c29b124ae7c7ee78802954fed35045e /src | |
| parent | f0bd0cddbbb89eb5de63651895e0e1211f7f8e25 (diff) | |
| download | emacs-d55627cca4c7f07d2dab2037b740a1b2a29de125.tar.gz emacs-d55627cca4c7f07d2dab2037b740a1b2a29de125.zip | |
(Fdescribe_vector): Add `describer' parameter.
(describe_command, describe_translation): Add dummy second param.
(describe_map): Call elt_describer with two arguments.
(describe_vector_princ): Add `fun' parameter.
Call it instead of the hardcoded `princ'.
(describe_vector): Add arg `args'.
Pass it as a new second argument to elt_describer.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keymap.c | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/src/keymap.c b/src/keymap.c index a8e43391d7b..02f7c75edab 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -55,7 +55,7 @@ Lisp_Object Vminibuffer_local_map; | |||
| 55 | minibuf */ | 55 | minibuf */ |
| 56 | 56 | ||
| 57 | /* was MinibufLocalNSMap */ | 57 | /* was MinibufLocalNSMap */ |
| 58 | Lisp_Object Vminibuffer_local_ns_map; | 58 | Lisp_Object Vminibuffer_local_ns_map; |
| 59 | /* The keymap used by the minibuf for local | 59 | /* The keymap used by the minibuf for local |
| 60 | bindings when spaces are not encouraged | 60 | bindings when spaces are not encouraged |
| 61 | in the minibuf */ | 61 | in the minibuf */ |
| @@ -107,10 +107,10 @@ static Lisp_Object store_in_keymap P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); | |||
| 107 | static void fix_submap_inheritance P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); | 107 | static void fix_submap_inheritance P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); |
| 108 | 108 | ||
| 109 | static Lisp_Object define_as_prefix P_ ((Lisp_Object, Lisp_Object)); | 109 | static Lisp_Object define_as_prefix P_ ((Lisp_Object, Lisp_Object)); |
| 110 | static void describe_command P_ ((Lisp_Object)); | 110 | static void describe_command P_ ((Lisp_Object, Lisp_Object)); |
| 111 | static void describe_translation P_ ((Lisp_Object)); | 111 | static void describe_translation P_ ((Lisp_Object, Lisp_Object)); |
| 112 | static void describe_map P_ ((Lisp_Object, Lisp_Object, | 112 | static void describe_map P_ ((Lisp_Object, Lisp_Object, |
| 113 | void (*) P_ ((Lisp_Object)), | 113 | void (*) P_ ((Lisp_Object, Lisp_Object)), |
| 114 | int, Lisp_Object, Lisp_Object*, int)); | 114 | int, Lisp_Object, Lisp_Object*, int)); |
| 115 | 115 | ||
| 116 | /* Keymap object support - constructors and predicates. */ | 116 | /* Keymap object support - constructors and predicates. */ |
| @@ -1932,7 +1932,7 @@ push_key_description (c, p, force_multibyte) | |||
| 1932 | p += CHAR_STRING (c, p); | 1932 | p += CHAR_STRING (c, p); |
| 1933 | } | 1933 | } |
| 1934 | 1934 | ||
| 1935 | return p; | 1935 | return p; |
| 1936 | } | 1936 | } |
| 1937 | 1937 | ||
| 1938 | /* This function cannot GC. */ | 1938 | /* This function cannot GC. */ |
| @@ -2033,7 +2033,7 @@ push_text_char_description (c, p) | |||
| 2033 | } | 2033 | } |
| 2034 | else | 2034 | else |
| 2035 | *p++ = c; | 2035 | *p++ = c; |
| 2036 | return p; | 2036 | return p; |
| 2037 | } | 2037 | } |
| 2038 | 2038 | ||
| 2039 | /* This function cannot GC. */ | 2039 | /* This function cannot GC. */ |
| @@ -2751,8 +2751,8 @@ key binding\n\ | |||
| 2751 | static int previous_description_column; | 2751 | static int previous_description_column; |
| 2752 | 2752 | ||
| 2753 | static void | 2753 | static void |
| 2754 | describe_command (definition) | 2754 | describe_command (definition, args) |
| 2755 | Lisp_Object definition; | 2755 | Lisp_Object definition, args; |
| 2756 | { | 2756 | { |
| 2757 | register Lisp_Object tem1; | 2757 | register Lisp_Object tem1; |
| 2758 | int column = current_column (); | 2758 | int column = current_column (); |
| @@ -2788,8 +2788,8 @@ describe_command (definition) | |||
| 2788 | } | 2788 | } |
| 2789 | 2789 | ||
| 2790 | static void | 2790 | static void |
| 2791 | describe_translation (definition) | 2791 | describe_translation (definition, args) |
| 2792 | Lisp_Object definition; | 2792 | Lisp_Object definition, args; |
| 2793 | { | 2793 | { |
| 2794 | register Lisp_Object tem1; | 2794 | register Lisp_Object tem1; |
| 2795 | 2795 | ||
| @@ -2820,7 +2820,7 @@ static void | |||
| 2820 | describe_map (map, keys, elt_describer, partial, shadow, seen, nomenu) | 2820 | describe_map (map, keys, elt_describer, partial, shadow, seen, nomenu) |
| 2821 | register Lisp_Object map; | 2821 | register Lisp_Object map; |
| 2822 | Lisp_Object keys; | 2822 | Lisp_Object keys; |
| 2823 | void (*elt_describer) P_ ((Lisp_Object)); | 2823 | void (*elt_describer) P_ ((Lisp_Object, Lisp_Object)); |
| 2824 | int partial; | 2824 | int partial; |
| 2825 | Lisp_Object shadow; | 2825 | Lisp_Object shadow; |
| 2826 | Lisp_Object *seen; | 2826 | Lisp_Object *seen; |
| @@ -2863,7 +2863,7 @@ describe_map (map, keys, elt_describer, partial, shadow, seen, nomenu) | |||
| 2863 | if (VECTORP (XCAR (tail)) | 2863 | if (VECTORP (XCAR (tail)) |
| 2864 | || CHAR_TABLE_P (XCAR (tail))) | 2864 | || CHAR_TABLE_P (XCAR (tail))) |
| 2865 | describe_vector (XCAR (tail), | 2865 | describe_vector (XCAR (tail), |
| 2866 | elt_prefix, elt_describer, partial, shadow, map, | 2866 | elt_prefix, Qnil, elt_describer, partial, shadow, map, |
| 2867 | (int *)0, 0); | 2867 | (int *)0, 0); |
| 2868 | else if (CONSP (XCAR (tail))) | 2868 | else if (CONSP (XCAR (tail))) |
| 2869 | { | 2869 | { |
| @@ -2917,7 +2917,7 @@ describe_map (map, keys, elt_describer, partial, shadow, seen, nomenu) | |||
| 2917 | /* Print a description of the definition of this character. | 2917 | /* Print a description of the definition of this character. |
| 2918 | elt_describer will take care of spacing out far enough | 2918 | elt_describer will take care of spacing out far enough |
| 2919 | for alignment purposes. */ | 2919 | for alignment purposes. */ |
| 2920 | (*elt_describer) (definition); | 2920 | (*elt_describer) (definition, Qnil); |
| 2921 | } | 2921 | } |
| 2922 | else if (EQ (XCAR (tail), Qkeymap)) | 2922 | else if (EQ (XCAR (tail), Qkeymap)) |
| 2923 | { | 2923 | { |
| @@ -2935,25 +2935,26 @@ describe_map (map, keys, elt_describer, partial, shadow, seen, nomenu) | |||
| 2935 | } | 2935 | } |
| 2936 | 2936 | ||
| 2937 | static void | 2937 | static void |
| 2938 | describe_vector_princ (elt) | 2938 | describe_vector_princ (elt, fun) |
| 2939 | Lisp_Object elt; | 2939 | Lisp_Object elt, fun; |
| 2940 | { | 2940 | { |
| 2941 | Findent_to (make_number (16), make_number (1)); | 2941 | Findent_to (make_number (16), make_number (1)); |
| 2942 | Fprinc (elt, Qnil); | 2942 | call1 (fun, elt); |
| 2943 | Fterpri (Qnil); | 2943 | Fterpri (Qnil); |
| 2944 | } | 2944 | } |
| 2945 | 2945 | ||
| 2946 | DEFUN ("describe-vector", Fdescribe_vector, Sdescribe_vector, 1, 1, 0, | 2946 | DEFUN ("describe-vector", Fdescribe_vector, Sdescribe_vector, 1, 2, 0, |
| 2947 | doc: /* Insert a description of contents of VECTOR. | 2947 | doc: /* Insert a description of contents of VECTOR. |
| 2948 | This is text showing the elements of vector matched against indices. */) | 2948 | This is text showing the elements of vector matched against indices. */) |
| 2949 | (vector) | 2949 | (vector, describer) |
| 2950 | Lisp_Object vector; | 2950 | Lisp_Object vector, describer; |
| 2951 | { | 2951 | { |
| 2952 | int count = specpdl_ptr - specpdl; | 2952 | int count = specpdl_ptr - specpdl; |
| 2953 | 2953 | if (NILP (describer)) | |
| 2954 | describer = intern ("princ"); | ||
| 2954 | specbind (Qstandard_output, Fcurrent_buffer ()); | 2955 | specbind (Qstandard_output, Fcurrent_buffer ()); |
| 2955 | CHECK_VECTOR_OR_CHAR_TABLE (vector); | 2956 | CHECK_VECTOR_OR_CHAR_TABLE (vector); |
| 2956 | describe_vector (vector, Qnil, describe_vector_princ, 0, | 2957 | describe_vector (vector, Qnil, describer, describe_vector_princ, 0, |
| 2957 | Qnil, Qnil, (int *)0, 0); | 2958 | Qnil, Qnil, (int *)0, 0); |
| 2958 | 2959 | ||
| 2959 | return unbind_to (count, Qnil); | 2960 | return unbind_to (count, Qnil); |
| @@ -2987,15 +2988,17 @@ This is text showing the elements of vector matched against indices. */) | |||
| 2987 | 2988 | ||
| 2988 | When describing a sub-char-table, INDICES is a list of | 2989 | When describing a sub-char-table, INDICES is a list of |
| 2989 | indices at higher levels in this char-table, | 2990 | indices at higher levels in this char-table, |
| 2990 | and CHAR_TABLE_DEPTH says how many levels down we have gone. */ | 2991 | and CHAR_TABLE_DEPTH says how many levels down we have gone. |
| 2992 | |||
| 2993 | ARGS is simply passed as the second argument to ELT_DESCRIBER. */ | ||
| 2991 | 2994 | ||
| 2992 | void | 2995 | void |
| 2993 | describe_vector (vector, elt_prefix, elt_describer, | 2996 | describe_vector (vector, elt_prefix, args, elt_describer, |
| 2994 | partial, shadow, entire_map, | 2997 | partial, shadow, entire_map, |
| 2995 | indices, char_table_depth) | 2998 | indices, char_table_depth) |
| 2996 | register Lisp_Object vector; | 2999 | register Lisp_Object vector; |
| 2997 | Lisp_Object elt_prefix; | 3000 | Lisp_Object elt_prefix, args; |
| 2998 | void (*elt_describer) P_ ((Lisp_Object)); | 3001 | void (*elt_describer) P_ ((Lisp_Object, Lisp_Object)); |
| 2999 | int partial; | 3002 | int partial; |
| 3000 | Lisp_Object shadow; | 3003 | Lisp_Object shadow; |
| 3001 | Lisp_Object entire_map; | 3004 | Lisp_Object entire_map; |
| @@ -3088,7 +3091,7 @@ describe_vector (vector, elt_prefix, elt_describer, | |||
| 3088 | else | 3091 | else |
| 3089 | definition = get_keyelt (AREF (vector, i), 0); | 3092 | definition = get_keyelt (AREF (vector, i), 0); |
| 3090 | 3093 | ||
| 3091 | if (NILP (definition)) continue; | 3094 | if (NILP (definition)) continue; |
| 3092 | 3095 | ||
| 3093 | /* Don't mention suppressed commands. */ | 3096 | /* Don't mention suppressed commands. */ |
| 3094 | if (SYMBOLP (definition) && partial) | 3097 | if (SYMBOLP (definition) && partial) |
| @@ -3204,7 +3207,7 @@ describe_vector (vector, elt_prefix, elt_describer, | |||
| 3204 | if (CHAR_TABLE_P (vector) && SUB_CHAR_TABLE_P (definition)) | 3207 | if (CHAR_TABLE_P (vector) && SUB_CHAR_TABLE_P (definition)) |
| 3205 | { | 3208 | { |
| 3206 | insert ("\n", 1); | 3209 | insert ("\n", 1); |
| 3207 | describe_vector (definition, elt_prefix, elt_describer, | 3210 | describe_vector (definition, elt_prefix, args, elt_describer, |
| 3208 | partial, shadow, entire_map, | 3211 | partial, shadow, entire_map, |
| 3209 | indices, char_table_depth + 1); | 3212 | indices, char_table_depth + 1); |
| 3210 | continue; | 3213 | continue; |
| @@ -3277,7 +3280,7 @@ describe_vector (vector, elt_prefix, elt_describer, | |||
| 3277 | /* Print a description of the definition of this character. | 3280 | /* Print a description of the definition of this character. |
| 3278 | elt_describer will take care of spacing out far enough | 3281 | elt_describer will take care of spacing out far enough |
| 3279 | for alignment purposes. */ | 3282 | for alignment purposes. */ |
| 3280 | (*elt_describer) (definition); | 3283 | (*elt_describer) (definition, args); |
| 3281 | } | 3284 | } |
| 3282 | 3285 | ||
| 3283 | /* For (sub) char-table, print `defalt' slot at last. */ | 3286 | /* For (sub) char-table, print `defalt' slot at last. */ |
| @@ -3285,7 +3288,7 @@ describe_vector (vector, elt_prefix, elt_describer, | |||
| 3285 | { | 3288 | { |
| 3286 | insert (" ", char_table_depth * 2); | 3289 | insert (" ", char_table_depth * 2); |
| 3287 | insert_string ("<<default>>"); | 3290 | insert_string ("<<default>>"); |
| 3288 | (*elt_describer) (XCHAR_TABLE (vector)->defalt); | 3291 | (*elt_describer) (XCHAR_TABLE (vector)->defalt, args); |
| 3289 | } | 3292 | } |
| 3290 | 3293 | ||
| 3291 | UNGCPRO; | 3294 | UNGCPRO; |