/[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.252 by rms, Fri Dec 28 18:48:46 2001 UTC revision 1.253 by rms, Sat Dec 29 14:54:18 2001 UTC
# Line 115  static void describe_translation P_ ((Li Line 115  static void describe_translation P_ ((Li
115  static void describe_map P_ ((Lisp_Object, Lisp_Object,  static void describe_map P_ ((Lisp_Object, Lisp_Object,
116                                void (*) P_ ((Lisp_Object, Lisp_Object)),                                void (*) P_ ((Lisp_Object, Lisp_Object)),
117                                int, Lisp_Object, Lisp_Object*, int));                                int, Lisp_Object, Lisp_Object*, int));
118    static void silly_event_symbol_error P_ ((Lisp_Object));
119    
120  /* Keymap object support - constructors and predicates.                 */  /* Keymap object support - constructors and predicates.                 */
121    
# Line 1011  the front of KEYMAP.  */) Line 1012  the front of KEYMAP.  */)
1012        if (CONSP (c) && lucid_event_type_list_p (c))        if (CONSP (c) && lucid_event_type_list_p (c))
1013          c = Fevent_convert_list (c);          c = Fevent_convert_list (c);
1014    
1015        if (SYMBOLP (c) && ! NILP (Fassoc (Fsymbol_name (c), exclude_keys)))        if (SYMBOLP (c))
1016          error ("To bind the key %s, use; use \"%s\", not [%s]",          silly_event_symbol_error (c);
                XSYMBOL (c)->name->data,  
                XSTRING (XCDR (Fassoc (Fsymbol_name (c), exclude_keys)))->data,  
                XSYMBOL (c)->name->data);  
1017    
1018        if (INTEGERP (c)        if (INTEGERP (c)
1019            && (XINT (c) & meta_bit)            && (XINT (c) & meta_bit)
# Line 1156  append_key (key_sequence, key) Line 1154  append_key (key_sequence, key)
1154    return Fvconcat (2, args);    return Fvconcat (2, args);
1155  }  }
1156    
1157    /* Given a event type C which is a symbol,
1158       signal an error if is a mistake such as RET or M-RET or C-DEL, etc.  */
1159    
1160    static void
1161    silly_event_symbol_error (c)
1162         Lisp_Object c;
1163    {
1164      Lisp_Object parsed, base, name, assoc;
1165      int modifiers;
1166              
1167      parsed = parse_modifiers (c);
1168      modifiers = (int) XUINT (XCAR (XCDR (parsed)));
1169      base = XCAR (parsed);
1170      name = Fsymbol_name (base);
1171      /* This alist includes elements such as ("RET" . "\\r").  */
1172      assoc = Fassoc (name, exclude_keys);
1173    
1174      if (! NILP (assoc))
1175        {
1176          char new_mods[sizeof ("\\A-\\C-\\H-\\M-\\S-\\s-")];
1177          char *p = new_mods;
1178          Lisp_Object keystring;
1179          if (modifiers & alt_modifier)
1180            { *p++ = '\\'; *p++ = 'A'; *p++ = '-'; }
1181          if (modifiers & ctrl_modifier)
1182            { *p++ = '\\'; *p++ = 'C'; *p++ = '-'; }
1183          if (modifiers & hyper_modifier)
1184            { *p++ = '\\'; *p++ = 'H'; *p++ = '-'; }
1185          if (modifiers & meta_modifier)
1186            { *p++ = '\\'; *p++ = 'M'; *p++ = '-'; }
1187          if (modifiers & shift_modifier)
1188            { *p++ = '\\'; *p++ = 'S'; *p++ = '-'; }
1189          if (modifiers & super_modifier)
1190            { *p++ = '\\'; *p++ = 's'; *p++ = '-'; }
1191          *p = 0;
1192    
1193          c = reorder_modifiers (c);
1194          keystring = concat2 (build_string (new_mods), XCDR (assoc));
1195                    
1196          error ((modifiers & ~meta_modifier
1197                  ? "To bind the key %s, use [?%s], not [%s]"
1198                  : "To bind the key %s, use \"%s\", not [%s]"),
1199                 XSYMBOL (c)->name->data, XSTRING (keystring)->data,
1200                 XSYMBOL (c)->name->data);
1201        }
1202    }
1203    
1204  /* Global, local, and minor mode keymap stuff.                          */  /* Global, local, and minor mode keymap stuff.                          */
1205    

Legend:
Removed from v.1.252  
changed lines
  Added in v.1.253

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