/[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.258 by kfstorm, Sun Feb 24 00:23:20 2002 UTC revision 1.259 by kfstorm, Fri May 10 07:03:20 2002 UTC
# Line 75  Lisp_Object Vminor_mode_map_alist; Line 75  Lisp_Object Vminor_mode_map_alist;
75     minor mode variables and keymaps.  */     minor mode variables and keymaps.  */
76  Lisp_Object Vminor_mode_overriding_map_alist;  Lisp_Object Vminor_mode_overriding_map_alist;
77    
78    /* List of emulation mode keymap alists.  */
79    Lisp_Object Vemulation_mode_map_alists;
80    
81  /* Keymap mapping ASCII function key sequences onto their preferred forms.  /* Keymap mapping ASCII function key sequences onto their preferred forms.
82     Initialized by the terminal-specific lisp files.  See DEFVAR for more     Initialized by the terminal-specific lisp files.  See DEFVAR for more
83     documentation.  */     documentation.  */
# Line 1278  current_minor_maps (modeptr, mapptr) Line 1281  current_minor_maps (modeptr, mapptr)
1281    int i = 0;    int i = 0;
1282    int list_number = 0;    int list_number = 0;
1283    Lisp_Object alist, assoc, var, val;    Lisp_Object alist, assoc, var, val;
1284      Lisp_Object emulation_alists;
1285    Lisp_Object lists[2];    Lisp_Object lists[2];
1286    
1287      emulation_alists = Vemulation_mode_map_alists;
1288    lists[0] = Vminor_mode_overriding_map_alist;    lists[0] = Vminor_mode_overriding_map_alist;
1289    lists[1] = Vminor_mode_map_alist;    lists[1] = Vminor_mode_map_alist;
1290    
1291    for (list_number = 0; list_number < 2; list_number++)    for (list_number = 0; list_number < 2; list_number++)
1292      for (alist = lists[list_number];      {
1293           CONSP (alist);        if (CONSP (emulation_alists))
1294           alist = XCDR (alist))          {
1295        if ((assoc = XCAR (alist), CONSP (assoc))            alist = XCAR (emulation_alists);
1296            && (var = XCAR (assoc), SYMBOLP (var))            emulation_alists = XCDR (emulation_alists);
1297            && (val = find_symbol_value (var), !EQ (val, Qunbound))            if (SYMBOLP (alist))
1298            && !NILP (val))              alist = find_symbol_value (alist);
1299          {            list_number = -1;
1300            Lisp_Object temp;          }
1301          else
1302            /* If a variable has an entry in Vminor_mode_overriding_map_alist,          alist = lists[list_number];
              and also an entry in Vminor_mode_map_alist,  
              ignore the latter.  */  
           if (list_number == 1)  
             {  
               val = assq_no_quit (var, lists[0]);  
               if (!NILP (val))  
                 continue;  
             }  
1303    
1304            if (i >= cmm_size)        for ( ; CONSP (alist); alist = XCDR (alist))
1305              {          if ((assoc = XCAR (alist), CONSP (assoc))
1306                Lisp_Object *newmodes, *newmaps;              && (var = XCAR (assoc), SYMBOLP (var))
1307                && (val = find_symbol_value (var), !EQ (val, Qunbound))
1308                && !NILP (val))
1309              {
1310                Lisp_Object temp;
1311    
1312                /* Use malloc/realloc here.  See the comment above              /* If a variable has an entry in Vminor_mode_overriding_map_alist,
1313                   this function.  */                 and also an entry in Vminor_mode_map_alist,
1314                if (cmm_maps)                 ignore the latter.  */
1315                  {              if (list_number == 1)
1316                    BLOCK_INPUT;                {
1317                    cmm_size *= 2;                  val = assq_no_quit (var, lists[0]);
1318                    newmodes                  if (!NILP (val))
1319                      = (Lisp_Object *) realloc (cmm_modes,                    continue;
1320                                                  cmm_size * sizeof *newmodes);                }
                   newmaps  
                     = (Lisp_Object *) realloc (cmm_maps,  
                                                 cmm_size * sizeof *newmaps);  
                   UNBLOCK_INPUT;  
                 }  
               else  
                 {  
                   BLOCK_INPUT;  
                   cmm_size = 30;  
                   newmodes  
                     = (Lisp_Object *) malloc (cmm_size * sizeof *newmodes);  
                   newmaps  
                     = (Lisp_Object *) malloc (cmm_size * sizeof *newmaps);  
                   UNBLOCK_INPUT;  
                 }  
1321    
1322                if (newmodes)              if (i >= cmm_size)
1323                  cmm_modes = newmodes;                {
1324                if (newmaps)                  Lisp_Object *newmodes, *newmaps;
1325                  cmm_maps = newmaps;  
1326                    /* Use malloc/realloc here.  See the comment above
1327                       this function.  */
1328                    if (cmm_maps)
1329                      {
1330                        BLOCK_INPUT;
1331                        cmm_size *= 2;
1332                        newmodes
1333                          = (Lisp_Object *) realloc (cmm_modes,
1334                                                     cmm_size * sizeof *newmodes);
1335                        newmaps
1336                          = (Lisp_Object *) realloc (cmm_maps,
1337                                                     cmm_size * sizeof *newmaps);
1338                        UNBLOCK_INPUT;
1339                      }
1340                    else
1341                      {
1342                        BLOCK_INPUT;
1343                        cmm_size = 30;
1344                        newmodes
1345                          = (Lisp_Object *) malloc (cmm_size * sizeof *newmodes);
1346                        newmaps
1347                          = (Lisp_Object *) malloc (cmm_size * sizeof *newmaps);
1348                        UNBLOCK_INPUT;
1349                      }
1350    
1351                    if (newmodes)
1352                      cmm_modes = newmodes;
1353                    if (newmaps)
1354                      cmm_maps = newmaps;
1355                                
1356                if (newmodes == NULL || newmaps == NULL)                  if (newmodes == NULL || newmaps == NULL)
1357                  break;                    break;
1358              }                }
1359    
1360            /* Get the keymap definition--or nil if it is not defined.  */              /* Get the keymap definition--or nil if it is not defined.  */
1361            temp = internal_condition_case_1 (Findirect_function,              temp = internal_condition_case_1 (Findirect_function,
1362                                              XCDR (assoc),                                                XCDR (assoc),
1363                                              Qerror, current_minor_maps_error);                                                Qerror, current_minor_maps_error);
1364            if (!NILP (temp))              if (!NILP (temp))
1365              {                {
1366                cmm_modes[i] = var;                  cmm_modes[i] = var;
1367                cmm_maps [i] = temp;                  cmm_maps [i] = temp;
1368                i++;                  i++;
1369              }                }
1370          }            }
1371        }
1372    
1373    if (modeptr) *modeptr = cmm_modes;    if (modeptr) *modeptr = cmm_modes;
1374    if (mapptr)  *mapptr  = cmm_maps;    if (mapptr)  *mapptr  = cmm_maps;
# Line 3579  used the same way (and before `minor-mod Line 3595  used the same way (and before `minor-mod
3595  it is provided for major modes to bind locally.  */);  it is provided for major modes to bind locally.  */);
3596    Vminor_mode_overriding_map_alist = Qnil;    Vminor_mode_overriding_map_alist = Qnil;
3597    
3598      DEFVAR_LISP ("emulation-mode-map-alists", &Vemulation_mode_map_alists,
3599                   doc: /* List of keymap alists to use for emulations modes.
3600    It is intended for modes or packages using multiple minor-mode keymaps.
3601    Each element is a keymap alist just like `minor-mode-map-alist', or a
3602    symbol with a variable binding which is a keymap alist, and it is used
3603    the same way.  The "active" keymaps in each alist are used before
3604    `minor-mode-map-alist' and `minor-mode-overriding-map-alist'.  */);
3605      Vemulation_mode_map_alists = Qnil;
3606    
3607    
3608    DEFVAR_LISP ("function-key-map", &Vfunction_key_map,    DEFVAR_LISP ("function-key-map", &Vfunction_key_map,
3609                 doc: /* Keymap mapping ASCII function key sequences onto their preferred forms.                 doc: /* Keymap mapping ASCII function key sequences onto their preferred forms.
3610  This allows Emacs to recognize function keys sent from ASCII  This allows Emacs to recognize function keys sent from ASCII

Legend:
Removed from v.1.258  
changed lines
  Added in v.1.259

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