emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Enhancements to "minor-mode-map-alist" functionality.


From: Kim F. Storm
Subject: Re: Enhancements to "minor-mode-map-alist" functionality.
Date: 09 May 2002 02:37:29 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50

Richard Stallman <address@hidden> writes:

>     > That may be true, but I'd like to see what the issue is more concretely.
>     > If cua and viper tried to use one alist, what would they have to do
>     > to prevent it from being messed up?  What does "messed up" mean in this
>     > context?
> 
>     Changing the sequence or removing an element from the alist.
>     Even with one list, this may be unlikely to happen in practice, but I
>     don't understand why this is a big issue.
> 
> Adding one list is less change from what we have now.

Below is a patch for adding emulation-mode-map-alists (which is a list
of alists or symbols bound to an alist).  I don't see how this is more
complex than adding a single list (actually, I don't see why this is
considered to be complex at all).

This patch doesn't address the issue of adding more dynamic conditions for
the keymaps in the alists [let's settle one issue at a time].


Index: keymap.c
===================================================================
RCS file: /cvs/emacs/src/keymap.c,v
retrieving revision 1.258
diff -c -r1.258 keymap.c
*** keymap.c    24 Feb 2002 00:23:20 -0000      1.258
--- keymap.c    8 May 2002 23:17:59 -0000
***************
*** 75,80 ****
--- 75,83 ----
     minor mode variables and keymaps.  */
  Lisp_Object Vminor_mode_overriding_map_alist;
  
+ /* List of emulation mode keymap alists.  */
+ Lisp_Object Vemulation_mode_map_alists;
+ 
  /* Keymap mapping ASCII function key sequences onto their preferred forms.
     Initialized by the terminal-specific lisp files.  See DEFVAR for more
     documentation.  */
***************
*** 1278,1292 ****
    int i = 0;
    int list_number = 0;
    Lisp_Object alist, assoc, var, val;
    Lisp_Object lists[2];
  
    lists[0] = Vminor_mode_overriding_map_alist;
    lists[1] = Vminor_mode_map_alist;
  
    for (list_number = 0; list_number < 2; list_number++)
!     for (alist = lists[list_number];
!        CONSP (alist);
!        alist = XCDR (alist))
        if ((assoc = XCAR (alist), CONSP (assoc))
          && (var = XCAR (assoc), SYMBOLP (var))
          && (val = find_symbol_value (var), !EQ (val, Qunbound))
--- 1281,1306 ----
    int i = 0;
    int list_number = 0;
    Lisp_Object alist, assoc, var, val;
+   Lisp_Object emulation_alists;
    Lisp_Object lists[2];
  
+   emulation_alists = Vemulation_mode_map_alists;
    lists[0] = Vminor_mode_overriding_map_alist;
    lists[1] = Vminor_mode_map_alist;
  
    for (list_number = 0; list_number < 2; list_number++)
!     {
!       if (CONSP (emulation_alists))
!       {
!         alist = XCAR (emulation_alists);
!         emulation_alists = XCDR (emulation_alists);
!         if (SYMBOLP (alist))
!           alist = find_symbol_value (alist);
!         list_number = -1;
!       }
!       else
!       alist = lists[list_number];
!     /* FIX INDENTATION OF THIS FOR LOOP 
!        (I didn't do that to avoid cluttering the patch)  */
!     for ( ; CONSP (alist); alist = XCDR (alist))
        if ((assoc = XCAR (alist), CONSP (assoc))
          && (var = XCAR (assoc), SYMBOLP (var))
          && (val = find_symbol_value (var), !EQ (val, Qunbound))
***************
*** 1353,1358 ****
--- 1367,1373 ----
              i++;
            }
        }
+     }
  
    if (modeptr) *modeptr = cmm_modes;
    if (mapptr)  *mapptr  = cmm_maps;
***************
*** 3578,3583 ****
--- 3593,3608 ----
  used the same way (and before `minor-mode-map-alist'); however,
  it is provided for major modes to bind locally.  */);
    Vminor_mode_overriding_map_alist = Qnil;
+ 
+   DEFVAR_LISP ("emulation-mode-map-alists", &Vemulation_mode_map_alists,
+              doc: /* List of keymap alists to use for emulations modes.
+ It is intended for modes or packages using multiple minor-mode keymaps.
+ Each element is a keymap alist just like `minor-mode-map-alist', or a
+ symbol with a variable binding which is a keymap alist, and it
+ is used the same way.  The "active" keymaps in each alist are used before
+ `minor-mode-map-alist' and `minor-mode-overriding-map-alist'.  */); 
+   Vemulation_mode_map_alists = Qnil;
+ 
  
    DEFVAR_LISP ("function-key-map", &Vfunction_key_map,
               doc: /* Keymap mapping ASCII function key sequences onto their 
preferred forms.



-- 
Kim F. Storm <address@hidden> http://www.cua.dk




reply via email to

[Prev in Thread] Current Thread [Next in Thread]