/[emacs]/emacs/src/keymap.c
ViewVC logotype

Diff of /emacs/src/keymap.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.301 by monnier, Fri Jan 28 16:25:10 2005 UTC revision 1.302 by rms, Tue Feb 15 06:39:18 2005 UTC
# Line 120  static void describe_command P_ ((Lisp_O Line 120  static void describe_command P_ ((Lisp_O
120  static void describe_translation P_ ((Lisp_Object, Lisp_Object));  static void describe_translation P_ ((Lisp_Object, Lisp_Object));
121  static void describe_map P_ ((Lisp_Object, Lisp_Object,  static void describe_map P_ ((Lisp_Object, Lisp_Object,
122                                void (*) P_ ((Lisp_Object, Lisp_Object)),                                void (*) P_ ((Lisp_Object, Lisp_Object)),
123                                int, Lisp_Object, Lisp_Object*, int));                                int, Lisp_Object, Lisp_Object*, int, int));
124  static void describe_vector P_ ((Lisp_Object, Lisp_Object, Lisp_Object,  static void describe_vector P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
125                                   void (*) (Lisp_Object, Lisp_Object), int,                                   void (*) (Lisp_Object, Lisp_Object), int,
126                                   Lisp_Object, Lisp_Object, int *, int, int));                                   Lisp_Object, Lisp_Object, int *,
127                                     int, int, int));
128  static void silly_event_symbol_error P_ ((Lisp_Object));  static void silly_event_symbol_error P_ ((Lisp_Object));
129    
130  /* Keymap object support - constructors and predicates.                 */  /* Keymap object support - constructors and predicates.                 */
# Line 2834  You type        Translation\n\ Line 2835  You type        Translation\n\
2835    
2836    if (!NILP (Vkey_translation_map))    if (!NILP (Vkey_translation_map))
2837      describe_map_tree (Vkey_translation_map, 0, Qnil, prefix,      describe_map_tree (Vkey_translation_map, 0, Qnil, prefix,
2838                         "Key translations", nomenu, 1, 0);                         "Key translations", nomenu, 1, 0, 0);
2839    
2840    
2841    /* Print the (major mode) local map.  */    /* Print the (major mode) local map.  */
# Line 2847  You type        Translation\n\ Line 2848  You type        Translation\n\
2848    if (!NILP (start1))    if (!NILP (start1))
2849      {      {
2850        describe_map_tree (start1, 1, shadow, prefix,        describe_map_tree (start1, 1, shadow, prefix,
2851                           "\f\nOverriding Bindings", nomenu, 0, 0);                           "\f\nOverriding Bindings", nomenu, 0, 0, 0);
2852        shadow = Fcons (start1, shadow);        shadow = Fcons (start1, shadow);
2853      }      }
2854    else    else
# Line 2868  You type        Translation\n\ Line 2869  You type        Translation\n\
2869        if (!NILP (start1))        if (!NILP (start1))
2870          {          {
2871            describe_map_tree (start1, 1, shadow, prefix,            describe_map_tree (start1, 1, shadow, prefix,
2872                               "\f\n`keymap' Property Bindings", nomenu, 0, 0);                               "\f\n`keymap' Property Bindings", nomenu,
2873                                 0, 0, 0);
2874            shadow = Fcons (start1, shadow);            shadow = Fcons (start1, shadow);
2875          }          }
2876    
# Line 2896  You type        Translation\n\ Line 2898  You type        Translation\n\
2898            p += sizeof (" Minor Mode Bindings") - 1;            p += sizeof (" Minor Mode Bindings") - 1;
2899            *p = 0;            *p = 0;
2900    
2901            describe_map_tree (maps[i], 1, shadow, prefix, title, nomenu, 0, 0);            describe_map_tree (maps[i], 1, shadow, prefix,
2902                                 title, nomenu, 0, 0, 0);
2903            shadow = Fcons (maps[i], shadow);            shadow = Fcons (maps[i], shadow);
2904          }          }
2905    
# Line 2906  You type        Translation\n\ Line 2909  You type        Translation\n\
2909          {          {
2910            if (EQ (start1, XBUFFER (buffer)->keymap))            if (EQ (start1, XBUFFER (buffer)->keymap))
2911              describe_map_tree (start1, 1, shadow, prefix,              describe_map_tree (start1, 1, shadow, prefix,
2912                                 "\f\nMajor Mode Bindings", nomenu, 0, 0);                                 "\f\nMajor Mode Bindings", nomenu, 0, 0, 0);
2913            else            else
2914              describe_map_tree (start1, 1, shadow, prefix,              describe_map_tree (start1, 1, shadow, prefix,
2915                                 "\f\n`local-map' Property Bindings",                                 "\f\n`local-map' Property Bindings",
2916                                 nomenu, 0, 0);                                 nomenu, 0, 0, 0);
2917    
2918            shadow = Fcons (start1, shadow);            shadow = Fcons (start1, shadow);
2919          }          }
2920      }      }
2921    
2922    describe_map_tree (current_global_map, 1, shadow, prefix,    describe_map_tree (current_global_map, 1, shadow, prefix,
2923                       "\f\nGlobal Bindings", nomenu, 0, 1);                       "\f\nGlobal Bindings", nomenu, 0, 1, 0);
2924    
2925    /* Print the function-key-map translations under this prefix.  */    /* Print the function-key-map translations under this prefix.  */
2926    if (!NILP (Vfunction_key_map))    if (!NILP (Vfunction_key_map))
2927      describe_map_tree (Vfunction_key_map, 0, Qnil, prefix,      describe_map_tree (Vfunction_key_map, 0, Qnil, prefix,
2928                         "\f\nFunction key map translations", nomenu, 1, 0);                         "\f\nFunction key map translations", nomenu, 1, 0, 0);
2929    
2930    UNGCPRO;    UNGCPRO;
2931    return Qnil;    return Qnil;
# Line 2943  You type        Translation\n\ Line 2946  You type        Translation\n\
2946     so print strings and vectors differently.     so print strings and vectors differently.
2947    
2948     If ALWAYS_TITLE is nonzero, print the title even if there are no maps     If ALWAYS_TITLE is nonzero, print the title even if there are no maps
2949     to look through.  */     to look through.
2950    
2951       If MENTION_SHADOW is nonzero, then when something is shadowed by SHADOW,
2952       don't omit it; instead, mention it but say it is shadowed.  */
2953    
2954  void  void
2955  describe_map_tree (startmap, partial, shadow, prefix, title, nomenu, transl,  describe_map_tree (startmap, partial, shadow, prefix, title, nomenu, transl,
2956                     always_title)                     always_title, mention_shadow)
2957       Lisp_Object startmap, shadow, prefix;       Lisp_Object startmap, shadow, prefix;
2958       int partial;       int partial;
2959       char *title;       char *title;
2960       int nomenu;       int nomenu;
2961       int transl;       int transl;
2962       int always_title;       int always_title;
2963         int mention_shadow;
2964  {  {
2965    Lisp_Object maps, orig_maps, seen, sub_shadows;    Lisp_Object maps, orig_maps, seen, sub_shadows;
2966    struct gcpro gcpro1, gcpro2, gcpro3;    struct gcpro gcpro1, gcpro2, gcpro3;
# Line 3055  key             binding\n\ Line 3062  key             binding\n\
3062    
3063        describe_map (Fcdr (elt), prefix,        describe_map (Fcdr (elt), prefix,
3064                      transl ? describe_translation : describe_command,                      transl ? describe_translation : describe_command,
3065                      partial, sub_shadows, &seen, nomenu);                      partial, sub_shadows, &seen, nomenu, mention_shadow);
3066    
3067      skip: ;      skip: ;
3068      }      }
# Line 3135  describe_translation (definition, args) Line 3142  describe_translation (definition, args)
3142     PARTIAL, SHADOW, NOMENU are as in `describe_map_tree' above.  */     PARTIAL, SHADOW, NOMENU are as in `describe_map_tree' above.  */
3143    
3144  static void  static void
3145  describe_map (map, prefix, elt_describer, partial, shadow, seen, nomenu)  describe_map (map, prefix, elt_describer, partial, shadow,
3146                  seen, nomenu, mention_shadow)
3147       register Lisp_Object map;       register Lisp_Object map;
3148       Lisp_Object prefix;       Lisp_Object prefix;
3149       void (*elt_describer) P_ ((Lisp_Object, Lisp_Object));       void (*elt_describer) P_ ((Lisp_Object, Lisp_Object));
# Line 3143  describe_map (map, prefix, elt_describer Line 3151  describe_map (map, prefix, elt_describer
3151       Lisp_Object shadow;       Lisp_Object shadow;
3152       Lisp_Object *seen;       Lisp_Object *seen;
3153       int nomenu;       int nomenu;
3154         int mention_shadow;
3155  {  {
3156    Lisp_Object tail, definition, event;    Lisp_Object tail, definition, event;
3157    Lisp_Object tem;    Lisp_Object tem;
# Line 3172  describe_map (map, prefix, elt_describer Line 3181  describe_map (map, prefix, elt_describer
3181            || CHAR_TABLE_P (XCAR (tail)))            || CHAR_TABLE_P (XCAR (tail)))
3182          describe_vector (XCAR (tail),          describe_vector (XCAR (tail),
3183                           prefix, Qnil, elt_describer, partial, shadow, map,                           prefix, Qnil, elt_describer, partial, shadow, map,
3184                           (int *)0, 0, 1);                           (int *)0, 0, 1, mention_shadow);
3185        else if (CONSP (XCAR (tail)))        else if (CONSP (XCAR (tail)))
3186          {          {
3187              int this_shadowed = 0;
3188            event = XCAR (XCAR (tail));            event = XCAR (XCAR (tail));
3189    
3190            /* Ignore bindings whose "prefix" are not really valid events.            /* Ignore bindings whose "prefix" are not really valid events.
# Line 3203  describe_map (map, prefix, elt_describer Line 3213  describe_map (map, prefix, elt_describer
3213            if (!NILP (shadow))            if (!NILP (shadow))
3214              {              {
3215                tem = shadow_lookup (shadow, kludge, Qt);                tem = shadow_lookup (shadow, kludge, Qt);
3216                if (!NILP (tem)) continue;                if (!NILP (tem))
3217                    {
3218                      if (mention_shadow)
3219                        this_shadowed = 1;
3220                      else
3221                        continue;
3222                    }
3223              }              }
3224    
3225            tem = Flookup_key (map, kludge, Qt);            tem = Flookup_key (map, kludge, Qt);
# Line 3223  describe_map (map, prefix, elt_describer Line 3239  describe_map (map, prefix, elt_describer
3239               elt_describer will take care of spacing out far enough               elt_describer will take care of spacing out far enough
3240               for alignment purposes.  */               for alignment purposes.  */
3241            (*elt_describer) (definition, Qnil);            (*elt_describer) (definition, Qnil);
3242    
3243              if (this_shadowed)
3244                {
3245                  SET_PT (PT - 1);
3246                  insert_string ("  (binding currently shadowed)");
3247                  SET_PT (PT + 1);
3248                }
3249          }          }
3250        else if (EQ (XCAR (tail), Qkeymap))        else if (EQ (XCAR (tail), Qkeymap))
3251          {          {
# Line 3261  DESCRIBER is the output function used; n Line 3284  DESCRIBER is the output function used; n
3284    specbind (Qstandard_output, Fcurrent_buffer ());    specbind (Qstandard_output, Fcurrent_buffer ());
3285    CHECK_VECTOR_OR_CHAR_TABLE (vector);    CHECK_VECTOR_OR_CHAR_TABLE (vector);
3286    describe_vector (vector, Qnil, describer, describe_vector_princ, 0,    describe_vector (vector, Qnil, describer, describe_vector_princ, 0,
3287                     Qnil, Qnil, (int *)0, 0, 0);                     Qnil, Qnil, (int *)0, 0, 0, 0);
3288    
3289    return unbind_to (count, Qnil);    return unbind_to (count, Qnil);
3290  }  }
# Line 3303  DESCRIBER is the output function used; n Line 3326  DESCRIBER is the output function used; n
3326  static void  static void
3327  describe_vector (vector, prefix, args, elt_describer,  describe_vector (vector, prefix, args, elt_describer,
3328                   partial, shadow, entire_map,                   partial, shadow, entire_map,
3329                   indices, char_table_depth, keymap_p)                   indices, char_table_depth, keymap_p,
3330                     mention_shadow)
3331       register Lisp_Object vector;       register Lisp_Object vector;
3332       Lisp_Object prefix, args;       Lisp_Object prefix, args;
3333       void (*elt_describer) P_ ((Lisp_Object, Lisp_Object));       void (*elt_describer) P_ ((Lisp_Object, Lisp_Object));
# Line 3313  describe_vector (vector, prefix, args, e Line 3337  describe_vector (vector, prefix, args, e
3337       int *indices;       int *indices;
3338       int char_table_depth;       int char_table_depth;
3339       int keymap_p;       int keymap_p;
3340         int mention_shadow;
3341  {  {
3342    Lisp_Object definition;    Lisp_Object definition;
3343    Lisp_Object tem2;    Lisp_Object tem2;
# Line 3396  describe_vector (vector, prefix, args, e Line 3421  describe_vector (vector, prefix, args, e
3421    
3422    for (i = from; i < to; i++)    for (i = from; i < to; i++)
3423      {      {
3424          int this_shadowed = 0;
3425        QUIT;        QUIT;
3426    
3427        if (CHAR_TABLE_P (vector))        if (CHAR_TABLE_P (vector))
# Line 3455  describe_vector (vector, prefix, args, e Line 3481  describe_vector (vector, prefix, args, e
3481    
3482            tem = shadow_lookup (shadow, kludge, Qt);            tem = shadow_lookup (shadow, kludge, Qt);
3483    
3484            if (!NILP (tem)) continue;            if (!NILP (tem))
3485                {
3486                  if (mention_shadow)
3487                    this_shadowed = 1;
3488                  else
3489                    continue;
3490                }
3491          }          }
3492    
3493        /* Ignore this definition if it is shadowed by an earlier        /* Ignore this definition if it is shadowed by an earlier
# Line 3531  describe_vector (vector, prefix, args, e Line 3563  describe_vector (vector, prefix, args, e
3563            insert ("\n", 1);            insert ("\n", 1);
3564            describe_vector (definition, prefix, args, elt_describer,            describe_vector (definition, prefix, args, elt_describer,
3565                             partial, shadow, entire_map,                             partial, shadow, entire_map,
3566                             indices, char_table_depth + 1, keymap_p);                             indices, char_table_depth + 1, keymap_p,
3567                               mention_shadow);
3568            continue;            continue;
3569          }          }
3570    
# Line 3605  describe_vector (vector, prefix, args, e Line 3638  describe_vector (vector, prefix, args, e
3638           elt_describer will take care of spacing out far enough           elt_describer will take care of spacing out far enough
3639           for alignment purposes.  */           for alignment purposes.  */
3640        (*elt_describer) (definition, args);        (*elt_describer) (definition, args);
3641    
3642          if (this_shadowed)
3643            {
3644              SET_PT (PT - 1);
3645              insert_string ("  (binding currently shadowed)");
3646              SET_PT (PT + 1);
3647            }
3648      }      }
3649    
3650    /* For (sub) char-table, print `defalt' slot at last.  */    /* For (sub) char-table, print `defalt' slot at last.  */

Legend:
Removed from v.1.301  
changed lines
  Added in v.1.302

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26