(linenum→info "unix/slp.c:2238")

emacs/22.1/src/keymap.c

    1: /* Manipulation of keymaps
    2:    Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995,
    3:                  1998, 1999, 2000, 2001, 2002, 2003, 2004,
    4:                  2005, 2006, 2007 Free Software Foundation, Inc.
    5: 
    6: This file is part of GNU Emacs.
    7: 
    8: GNU Emacs is free software; you can redistribute it and/or modify
    9: it under the terms of the GNU General Public License as published by
   10: the Free Software Foundation; either version 2, or (at your option)
   11: any later version.
   12: 
   13: GNU Emacs is distributed in the hope that it will be useful,
   14: but WITHOUT ANY WARRANTY; without even the implied warranty of
   15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   16: GNU General Public License for more details.
   17: 
   18: You should have received a copy of the GNU General Public License
   19: along with GNU Emacs; see the file COPYING.  If not, write to
   20: the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   21: Boston, MA 02110-1301, USA.  */
   22: 
   23: 
   24: #include <config.h>
   25: #include <stdio.h>
   26: #if HAVE_ALLOCA_H
   27: # include <alloca.h>
   28: #endif
   29: #include "lisp.h"
   30: #include "commands.h"
   31: #include "buffer.h"
   32: #include "charset.h"
   33: #include "keyboard.h"
   34: #include "termhooks.h"
   35: #include "blockinput.h"
   36: #include "puresize.h"
   37: #include "intervals.h"
   38: #include "keymap.h"
   39: #include "window.h"
   40: 
   41: /* The number of elements in keymap vectors.  */
   42: #define DENSE_TABLE_SIZE (0200)
   43: 
   44: /* Actually allocate storage for these variables */
   45: 
   46: Lisp_Object current_global_map; /* Current global keymap */
   47: 
   48: Lisp_Object global_map;         /* default global key bindings */
   49: 
   50: Lisp_Object meta_map;           /* The keymap used for globally bound
   51:                                    ESC-prefixed default commands */
   52: 
   53: Lisp_Object control_x_map;      /* The keymap used for globally bound
   54:                                    C-x-prefixed default commands */
   55: 
   56: /* was MinibufLocalMap */
   57: Lisp_Object Vminibuffer_local_map;
   58:                                 /* The keymap used by the minibuf for local
   59:                                    bindings when spaces are allowed in the
   60:                                    minibuf */
   61: 
   62: /* was MinibufLocalNSMap */
   63: Lisp_Object Vminibuffer_local_ns_map;
   64:                                 /* The keymap used by the minibuf for local
   65:                                    bindings when spaces are not encouraged
   66:                                    in the minibuf */
   67: 
   68: /* keymap used for minibuffers when doing completion */
   69: /* was MinibufLocalCompletionMap */
   70: Lisp_Object Vminibuffer_local_completion_map;
   71: 
   72: /* keymap used for minibuffers when doing completion in filenames */
   73: Lisp_Object Vminibuffer_local_filename_completion_map;
   74: 
   75: /* keymap used for minibuffers when doing completion in filenames
   76:    with require-match*/
   77: Lisp_Object Vminibuffer_local_must_match_filename_map;
   78: 
   79: /* keymap used for minibuffers when doing completion and require a match */
   80: /* was MinibufLocalMustMatchMap */
   81: Lisp_Object Vminibuffer_local_must_match_map;
   82: 
   83: /* Alist of minor mode variables and keymaps.  */
   84: Lisp_Object Vminor_mode_map_alist;
   85: 
   86: /* Alist of major-mode-specific overrides for
   87:    minor mode variables and keymaps.  */
   88: Lisp_Object Vminor_mode_overriding_map_alist;
   89: 
   90: /* List of emulation mode keymap alists.  */
   91: Lisp_Object Vemulation_mode_map_alists;
   92: 
   93: /* Keymap mapping ASCII function key sequences onto their preferred forms.
   94:    Initialized by the terminal-specific lisp files.  See DEFVAR for more
   95:    documentation.  */
   96: Lisp_Object Vfunction_key_map;
   97: 
   98: /* Keymap mapping ASCII function key sequences onto their preferred forms.  */
   99: Lisp_Object Vkey_translation_map;
  100: 
  101: /* A list of all commands given new bindings since a certain time
  102:    when nil was stored here.
  103:    This is used to speed up recomputation of menu key equivalents
  104:    when Emacs starts up.   t means don't record anything here.  */
  105: Lisp_Object Vdefine_key_rebound_commands;
  106: 
  107: Lisp_Object Qkeymapp, Qkeymap, Qnon_ascii, Qmenu_item, Qremap;
  108: 
  109: /* Alist of elements like (DEL . "\d").  */
  110: static Lisp_Object exclude_keys;
  111: 
  112: /* Pre-allocated 2-element vector for Fcommand_remapping to use.  */
  113: static Lisp_Object command_remapping_vector;
  114: 
  115: /* A char with the CHAR_META bit set in a vector or the 0200 bit set
  116:    in a string key sequence is equivalent to prefixing with this
  117:    character.  */
  118: extern Lisp_Object meta_prefix_char;
  119: 
  120: extern Lisp_Object Voverriding_local_map;
  121: 
  122: /* Hash table used to cache a reverse-map to speed up calls to where-is.  */
  123: static Lisp_Object where_is_cache;
  124: /* Which keymaps are reverse-stored in the cache.  */
  125: static Lisp_Object where_is_cache_keymaps;
  126: 
  127: static Lisp_Object store_in_keymap P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
  128: static void fix_submap_inheritance P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
  129: 
  130: static Lisp_Object define_as_prefix P_ ((Lisp_Object, Lisp_Object));
  131: static void describe_command P_ ((Lisp_Object, Lisp_Object));
  132: static void describe_translation P_ ((Lisp_Object, Lisp_Object));
  133: static void describe_map P_ ((Lisp_Object, Lisp_Object,
  134:                               void (*) P_ ((Lisp_Object, Lisp_Object)),
  135:                               int, Lisp_Object, Lisp_Object*, int, int));
  136: static void describe_vector P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
  137:                                  void (*) (Lisp_Object, Lisp_Object), int,
  138:                                  Lisp_Object, Lisp_Object, int *,
  139:                                  int, int, int));
  140: static void silly_event_symbol_error P_ ((Lisp_Object));
  141: ^L
  142: /* Keymap object support - constructors and predicates.                 */
  143: 
  144: DEFUN ("make-keymap", Fmake_keymap, Smake_keymap, 0, 1, 0,
  145:        doc: /* Construct and return a new keymap, of the form (keymap CHARTABLE . ALIST).
  146: CHARTABLE is a char-table that holds the bindings for all characters
  147: without modifiers.  All entries in it are initially nil, meaning
  148: "command undefined".  ALIST is an assoc-list which holds bindings for
  149: function keys, mouse events, and any other things that appear in the
  150: input stream.  Initially, ALIST is nil.
  151: 
  152: The optional arg STRING supplies a menu name for the keymap
  153: in case you use it as a menu with `x-popup-menu'.  */)
  154:      (string)
  155:      Lisp_Object string;
  156: {
  157:   Lisp_Object tail;
  158:   if (!NILP (string))
  159:     tail = Fcons (string, Qnil);
  160:   else
  161:     tail = Qnil;
  162:   return Fcons (Qkeymap,
  163:                 Fcons (Fmake_char_table (Qkeymap, Qnil), tail));
  164: }
  165: 
  166: DEFUN ("make-sparse-keymap", Fmake_sparse_keymap, Smake_sparse_keymap, 0, 1, 0,
  167:        doc: /* Construct and return a new sparse keymap.
  168: Its car is `keymap' and its cdr is an alist of (CHAR . DEFINITION),
  169: which binds the character CHAR to DEFINITION, or (SYMBOL . DEFINITION),
  170: which binds the function key or mouse event SYMBOL to DEFINITION.
  171: Initially the alist is nil.
  172: 
  173: The optional arg STRING supplies a menu name for the keymap
  174: in case you use it as a menu with `x-popup-menu'.  */)
  175:      (string)
  176:      Lisp_Object string;
  177: {
  178:   if (!NILP (string))
  179:     return Fcons (Qkeymap, Fcons (string, Qnil));
  180:   return Fcons (Qkeymap, Qnil);
  181: }
  182: 
  183: /* This function is used for installing the standard key bindings
  184:    at initialization time.
  185: 
  186:    For example:
  187: 
  188:    initial_define_key (control_x_map, Ctl('X'), "exchange-point-and-mark");  */
  189: 
  190: void
  191: initial_define_key (keymap, key, defname)
  192:      Lisp_Object keymap;
  193:      int key;
  194:      char *defname;
  195: {
  196:   store_in_keymap (keymap, make_number (key), intern (defname));
  197: }
  198: 
  199: void
  200: initial_define_lispy_key (keymap, keyname, defname)
  201:      Lisp_Object keymap;
  202:      char *keyname;
  203:      char *defname;
  204: {
  205:   store_in_keymap (keymap, intern (keyname), intern (defname));
  206: }
  207: 
  208: DEFUN ("keymapp", Fkeymapp, Skeymapp, 1, 1, 0,
  209:        doc: /* Return t if OBJECT is a keymap.
  210: 
  211: A keymap is a list (keymap . ALIST),
  212: or a symbol whose function definition is itself a keymap.
  213: ALIST elements look like (CHAR . DEFN) or (SYMBOL . DEFN);
  214: a vector of densely packed bindings for small character codes
  215: is also allowed as an element.  */)
  216:      (object)
  217:      Lisp_Object object;
  218: {
  219:   return (KEYMAPP (object) ? Qt : Qnil);
  220: }
  221: 
  222: DEFUN ("keymap-prompt", Fkeymap_prompt, Skeymap_prompt, 1, 1, 0,
  223:        doc: /* Return the prompt-string of a keymap MAP.
  224: If non-nil, the prompt is shown in the echo-area
  225: when reading a key-sequence to be looked-up in this keymap.  */)
  226:      (map)
  227:      Lisp_Object map;
  228: {
  229:   map = get_keymap (map, 0, 0);
  230:   while (CONSP (map))
  231:     {
  232:       Lisp_Object tem = XCAR (map);
  233:       if (STRINGP (tem))
  234:         return tem;
  235:       map = XCDR (map);
  236:     }
  237:   return Qnil;
  238: }
  239: 
  240: /* Check that OBJECT is a keymap (after dereferencing through any
  241:    symbols).  If it is, return it.
  242: 
  243:    If AUTOLOAD is non-zero and OBJECT is a symbol whose function value
  244:    is an autoload form, do the autoload and try again.
  245:    If AUTOLOAD is nonzero, callers must assume GC is possible.
  246: 
  247:    If the map needs to be autoloaded, but AUTOLOAD is zero (and ERROR
  248:    is zero as well), return Qt.
  249: 
  250:    ERROR controls how we respond if OBJECT isn't a keymap.
  251:    If ERROR is non-zero, signal an error; otherwise, just return Qnil.
  252: 
  253:    Note that most of the time, we don't want to pursue autoloads.
  254:    Functions like Faccessible_keymaps which scan entire keymap trees
  255:    shouldn't load every autoloaded keymap.  I'm not sure about this,
  256:    but it seems to me that only read_key_sequence, Flookup_key, and
  257:    Fdefine_key should cause keymaps to be autoloaded.
  258: 
  259:    This function can GC when AUTOLOAD is non-zero, because it calls
  260:    do_autoload which can GC.  */
  261: 
  262: Lisp_Object
  263: get_keymap (object, error, autoload)
  264:      Lisp_Object object;
  265:      int error, autoload;
  266: {
  267:   Lisp_Object tem;
  268: 
  269:  autoload_retry:
  270:   if (NILP (object))
  271:     goto end;
  272:   if (CONSP (object) && EQ (XCAR (object), Qkeymap))
  273:     return object;
  274: 
  275:   tem = indirect_function (object);
  276:   if (CONSP (tem))
  277:     {
  278:       if (EQ (XCAR (tem), Qkeymap))
  279:         return tem;
  280: 
  281:       /* Should we do an autoload?  Autoload forms for keymaps have
  282:          Qkeymap as their fifth element.  */
  283:       if ((autoload || !error) && EQ (XCAR (tem), Qautoload)
  284:           && SYMBOLP (object))
  285:         {
  286:           Lisp_Object tail;
  287: 
  288:           tail = Fnth (make_number (4), tem);
  289:           if (EQ (tail, Qkeymap))
  290:             {
  291:               if (autoload)
  292:                 {
  293:                   struct gcpro gcpro1, gcpro2;
  294: 
  295:                   GCPRO2 (tem, object);
  296:                   do_autoload (tem, object);
  297:                   UNGCPRO;
  298: 
  299:                   goto autoload_retry;
  300:                 }
  301:               else
  302:                return Qt;
  303:             }
  304:         }
  305:     }
  306: 
  307:  end:
  308:   if (error)
  309:     wrong_type_argument (Qkeymapp, object);
  310:   return Qnil;
  311: }
  312: ^L
  313: /* Return the parent map of KEYMAP, or nil if it has none.
  314:    We assume that KEYMAP is a valid keymap.  */
  315: 
  316: Lisp_Object
  317: keymap_parent (keymap, autoload)
  318:      Lisp_Object keymap;
  319:      int autoload;
  320: {
  321:   Lisp_Object list;
  322: 
  323:   keymap = get_keymap (keymap, 1, autoload);
  324: 
  325:   /* Skip past the initial element `keymap'.  */
  326:   list = XCDR (keymap);
  327:   for (; CONSP (list); list = XCDR (list))
  328:     {
  329:       /* See if there is another `keymap'.  */
  330:       if (KEYMAPP (list))
  331:         return list;
  332:     }
  333: 
  334:   return get_keymap (list, 0, autoload);
  335: }
  336: 
  337: DEFUN ("keymap-parent", Fkeymap_parent, Skeymap_parent, 1, 1, 0,
  338:        doc: /* Return the parent keymap of KEYMAP.  */)
  339:      (keymap)
  340:      Lisp_Object keymap;
  341: {
  342:   return keymap_parent (keymap, 1);
  343: }
  344: 
  345: /* Check whether MAP is one of MAPS parents.  */
  346: int
  347: keymap_memberp (map, maps)
  348:      Lisp_Object map, maps;
  349: {
  350:   if (NILP (map)) return 0;
  351:   while (KEYMAPP (maps) && !EQ (map, maps))
  352:     maps = keymap_parent (maps, 0);
  353:   return (EQ (map, maps));
  354: }
  355: 
  356: /* Set the parent keymap of MAP to PARENT.  */
  357: 
  358: DEFUN ("set-keymap-parent", Fset_keymap_parent, Sset_keymap_parent, 2, 2, 0,
  359:        doc: /* Modify KEYMAP to set its parent map to PARENT.
  360: Return PARENT.  PARENT should be nil or another keymap.  */)
  361:      (keymap, parent)
  362:      Lisp_Object keymap, parent;
  363: {
  364:   Lisp_Object list, prev;
  365:   struct gcpro gcpro1, gcpro2;
  366:   int i;
  367: 
  368:   /* Force a keymap flush for the next call to where-is.
  369:      Since this can be called from within where-is, we don't set where_is_cache
  370:      directly but only where_is_cache_keymaps, since where_is_cache shouldn't
  371:      be changed during where-is, while where_is_cache_keymaps is only used at
  372:      the very beginning of where-is and can thus be changed here without any
  373:      adverse effect.
  374:      This is a very minor correctness (rather than safety) issue.  */
  375:   where_is_cache_keymaps = Qt;
  376: 
  377:   GCPRO2 (keymap, parent);
  378:   keymap = get_keymap (keymap, 1, 1);
  379: 
  380:   if (!NILP (parent))
  381:     {
  382:       parent = get_keymap (parent, 1, 1);
  383: 
  384:       /* Check for cycles.  */
  385:       if (keymap_memberp (keymap, parent))
  386:         error ("Cyclic keymap inheritance");
  387:     }
  388: 
  389:   /* Skip past the initial element `keymap'.  */
  390:   prev = keymap;
  391:   while (1)
  392:     {
  393:       list = XCDR (prev);
  394:       /* If there is a parent keymap here, replace it.
  395:          If we came to the end, add the parent in PREV.  */
  396:       if (!CONSP (list) || KEYMAPP (list))
  397:         {
  398:           /* If we already have the right parent, return now
  399:              so that we avoid the loops below.  */
  400:           if (EQ (XCDR (prev), parent))
  401:             RETURN_UNGCPRO (parent);
  402: 
  403:           CHECK_IMPURE (prev);
  404:           XSETCDR (prev, parent);
  405:           break;
  406:         }
  407:       prev = list;
  408:     }
  409: 
  410:   /* Scan through for submaps, and set their parents too.  */
  411: 
  412:   for (list = XCDR (keymap); CONSP (list); list = XCDR (list))
  413:     {
  414:       /* Stop the scan when we come to the parent.  */
  415:       if (EQ (XCAR (list), Qkeymap))
  416:         break;
  417: 
  418:       /* If this element holds a prefix map, deal with it.  */
  419:       if (CONSP (XCAR (list))
  420:           && CONSP (XCDR (XCAR (list))))
  421:         fix_submap_inheritance (keymap, XCAR (XCAR (list)),
  422:                                 XCDR (XCAR (list)));
  423: 
  424:       if (VECTORP (XCAR (list)))
  425:         for (i = 0; i < XVECTOR (XCAR (list))->size; i++)
  426:           if (CONSP (XVECTOR (XCAR (list))->contents[i]))
  427:             fix_submap_inheritance (keymap, make_number (i),
  428:                                     XVECTOR (XCAR (list))->contents[i]);
  429: 
  430:       if (CHAR_TABLE_P (XCAR (list)))
  431:         {
  432:           Lisp_Object indices[3];
  433: 
  434:           map_char_table (fix_submap_inheritance, Qnil,
  435:                           XCAR (list), XCAR (list),
  436:                           keymap, 0, indices);
  437:         }
  438:     }
  439: 
  440:   RETURN_UNGCPRO (parent);
  441: }
  442: 
  443: /* EVENT is defined in MAP as a prefix, and SUBMAP is its definition.
  444:    if EVENT is also a prefix in MAP's parent,
  445:    make sure that SUBMAP inherits that definition as its own parent.  */
  446: 
  447: static void
  448: fix_submap_inheritance (map, event, submap)
  449:      Lisp_Object map, event, submap;
  450: {
  451:   Lisp_Object map_parent, parent_entry;
  452: 
  453:   /* SUBMAP is a cons that we found as a key binding.
  454:      Discard the other things found in a menu key binding.  */
  455: 
  456:   submap = get_keymap (get_keyelt (submap, 0), 0, 0);
  457: 
  458:   /* If it isn't a keymap now, there's no work to do.  */
  459:   if (!CONSP (submap))
  460:     return;
  461: 
  462:   map_parent = keymap_parent (map, 0);
  463:   if (!NILP (map_parent))
  464:     parent_entry =
  465:       get_keymap (access_keymap (map_parent, event, 0, 0, 0), 0, 0);
  466:   else
  467:     parent_entry = Qnil;
  468: 
  469:   /* If MAP's parent has something other than a keymap,
  470:      our own submap shadows it completely.  */
  471:   if (!CONSP (parent_entry))
  472:     return;
  473: 
  474:   if (! EQ (parent_entry, submap))
  475:     {
  476:       Lisp_Object submap_parent;
  477:       submap_parent = submap;
  478:       while (1)
  479:         {
  480:           Lisp_Object tem;
  481: 
  482:           tem = keymap_parent (submap_parent, 0);
  483: 
  484:           if (KEYMAPP (tem))
  485:             {
  486:               if (keymap_memberp (tem, parent_entry))
  487:                 /* Fset_keymap_parent could create a cycle.  */
  488:                 return;
  489:               submap_parent = tem;
  490:             }
  491:           else
  492:             break;
  493:         }
  494:       Fset_keymap_parent (submap_parent, parent_entry);
  495:     }
  496: }
  497: ^L
  498: /* Look up IDX in MAP.  IDX may be any sort of event.
  499:    Note that this does only one level of lookup; IDX must be a single
  500:    event, not a sequence.
  501: 
  502:    If T_OK is non-zero, bindings for Qt are treated as default
  503:    bindings; any key left unmentioned by other tables and bindings is
  504:    given the binding of Qt.
  505: 
  506:    If T_OK is zero, bindings for Qt are not treated specially.
  507: 
  508:    If NOINHERIT, don't accept a subkeymap found in an inherited keymap.  */
  509: 
  510: Lisp_Object
  511: access_keymap (map, idx, t_ok, noinherit, autoload)
  512:      Lisp_Object map;
  513:      Lisp_Object idx;
  514:      int t_ok;
  515:      int noinherit;
  516:      int autoload;
  517: {
  518:   Lisp_Object val;
  519: 
  520:   /* Qunbound in VAL means we have found no binding yet.  */
  521:   val = Qunbound;
  522: 
  523:   /* If idx is a list (some sort of mouse click, perhaps?),
  524:      the index we want to use is the car of the list, which
  525:      ought to be a symbol.  */
  526:   idx = EVENT_HEAD (idx);
  527: 
  528:   /* If idx is a symbol, it might have modifiers, which need to
  529:      be put in the canonical order.  */
  530:   if (SYMBOLP (idx))
  531:     idx = reorder_modifiers (idx);
  532:   else if (INTEGERP (idx))
  533:     /* Clobber the high bits that can be present on a machine
  534:        with more than 24 bits of integer.  */
  535:     XSETFASTINT (idx, XINT (idx) & (CHAR_META | (CHAR_META - 1)));
  536: 
  537:   /* Handle the special meta -> esc mapping. */
  538:   if (INTEGERP (idx) && XUINT (idx) & meta_modifier)
  539:     {
  540:       /* See if there is a meta-map.  If there's none, there is
  541:          no binding for IDX, unless a default binding exists in MAP.  */
  542:       struct gcpro gcpro1;
  543:       Lisp_Object meta_map;
  544:       GCPRO1 (map);
  545:       /* A strange value in which Meta is set would cause
  546:          infinite recursion.  Protect against that.  */
  547:       if (XINT (meta_prefix_char) & CHAR_META)
  548:         meta_prefix_char = make_number (27);
  549:       meta_map = get_keymap (access_keymap (map, meta_prefix_char,
  550:                                             t_ok, noinherit, autoload),
  551:                              0, autoload);
  552:       UNGCPRO;
  553:       if (CONSP (meta_map))
  554:         {
  555:           map = meta_map;
  556:           idx = make_number (XUINT (idx) & ~meta_modifier);
  557:         }
  558:       else if (t_ok)
  559:         /* Set IDX to t, so that we only find a default binding.  */
  560:         idx = Qt;
  561:       else
  562:         /* We know there is no binding.  */
  563:         return Qnil;
  564:     }
  565: 
  566:   /* t_binding is where we put a default binding that applies,
  567:      to use in case we do not find a binding specifically
  568:      for this key sequence.  */
  569:   {
  570:     Lisp_Object tail;
  571:     Lisp_Object t_binding = Qnil;
  572:     struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
  573: 
  574:     GCPRO4 (map, tail, idx, t_binding);
  575: 
  576:     /* If `t_ok' is 2, both `t' and generic-char bindings are accepted.
  577:        If it is 1, only generic-char bindings are accepted.
  578:        Otherwise, neither are.  */
  579:     t_ok = t_ok ? 2 : 0;
  580: 
  581:     for (tail = XCDR (map);
  582:          (CONSP (tail)
  583:           || (tail = get_keymap (tail, 0, autoload), CONSP (tail)));
  584:          tail = XCDR (tail))
  585:       {
  586:         Lisp_Object binding;
  587: 
  588:         binding = XCAR (tail);
  589:         if (SYMBOLP (binding))
  590:           {
  591:             /* If NOINHERIT, stop finding prefix definitions
  592:                after we pass a second occurrence of the `keymap' symbol.  */
  593:             if (noinherit && EQ (binding, Qkeymap))
  594:               RETURN_UNGCPRO (Qnil);
  595:           }
  596:         else if (CONSP (binding))
  597:           {
  598:             Lisp_Object key = XCAR (binding);
  599: 
  600:             if (EQ (key, idx))
  601:               val = XCDR (binding);
  602:             else if (t_ok
  603:                      && INTEGERP (idx)
  604:                      && (XINT (idx) & CHAR_MODIFIER_MASK) == 0
  605:                      && INTEGERP (key)
  606:                      && (XINT (key) & CHAR_MODIFIER_MASK) == 0
  607:                      && !SINGLE_BYTE_CHAR_P (XINT (idx))
  608:                      && !SINGLE_BYTE_CHAR_P (XINT (key))
  609:                      && CHAR_VALID_P (XINT (key), 1)
  610:                      && !CHAR_VALID_P (XINT (key), 0)
  611:                      && (CHAR_CHARSET (XINT (key))
  612:                          == CHAR_CHARSET (XINT (idx))))
  61