changeset 36405:7fe1b8d8fc44

*** empty log message ***
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 26 Feb 2001 17:07:47 +0000
parents 5bac9d142978
children f5bdd1200e0e
files src/ChangeLog src/keymap.c
diffstat 2 files changed, 43 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon Feb 26 16:40:46 2001 +0000
+++ b/src/ChangeLog	Mon Feb 26 17:07:47 2001 +0000
@@ -1,3 +1,11 @@
+2001-02-26  Stefan Monnier  <monnier@cs.yale.edu>
+
+	* keymap.c (Faccessible_keymaps): Pass `is_metized' to
+	accessible_keymaps_char_table.
+	(accessible_keymaps_char_table): Obey `is_metized'.
+	(where_is_internal, Fwhere_is_internal): Don't confuse int and
+	Lisp_Object.
+
 2001-02-26  Gerd Moellmann  <gerd@gnu.org>
 
 	* dispnew.c: Check HAVE_TERM_H before including term.h.
--- a/src/keymap.c	Mon Feb 26 16:40:46 2001 +0000
+++ b/src/keymap.c	Mon Feb 26 17:07:47 2001 +0000
@@ -1438,7 +1438,7 @@
 
 /* Help functions for describing and documenting keymaps.		*/
 
-static void accessible_keymaps_char_table ();
+static void accessible_keymaps_char_table P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
 
 /* This function cannot GC.  */
 
@@ -1537,7 +1537,8 @@
 	      Lisp_Object indices[3];
 
 	      map_char_table (accessible_keymaps_char_table, Qnil,
-			      elt, Fcons (maps, Fcons (tail, thisseq)),
+			      elt, Fcons (Fcons (maps, is_metized),
+					  Fcons (tail, thisseq)),
 			      0, indices);
 	    }
 	  else if (VECTORP (elt))
@@ -1668,12 +1669,14 @@
      Lisp_Object args, index, cmd;
 {
   Lisp_Object tem;
-  Lisp_Object maps, tail, thisseq;
-
+  Lisp_Object maps, tail, thisseq, is_metized;
+
+  cmd = get_keyelt (cmd, 0);
   if (NILP (cmd))
     return;
 
-  maps = XCAR (args);
+  maps = XCAR (XCAR (args));
+  is_metized = XCDR (XCAR (args));
   tail = XCAR (XCDR (args));
   thisseq = XCDR (XCDR (args));
 
@@ -1685,8 +1688,30 @@
       tem = Frassq (cmd, maps);
       if (NILP (tem))
 	{
-	  tem = append_key (thisseq, index);
-	  nconc2 (tail, Fcons (Fcons (tem, cmd), Qnil));
+	  /* If the last key in thisseq is meta-prefix-char,
+	     turn it into a meta-ized keystroke.  We know
+	     that the event we're about to append is an
+	     ascii keystroke since we're processing a
+	     keymap table.  */
+	  if (is_metized)
+	    {
+	      int meta_bit = meta_modifier;
+	      Lisp_Object last = make_number (XINT (Flength (thisseq)) - 1);
+	      tem = Fcopy_sequence (thisseq);
+	      
+	      Faset (tem, last, make_number (XINT (index) | meta_bit));
+	      
+	      /* This new sequence is the same length as
+		 thisseq, so stick it in the list right
+		 after this one.  */
+	      XCDR (tail)
+		= Fcons (Fcons (tem, cmd), XCDR (tail));
+	    }
+	  else
+	    {
+	      tem = append_key (thisseq, index);
+	      nconc2 (tail, Fcons (Fcons (tem, cmd), Qnil));
+	    }
 	}
     }
 }
@@ -2103,7 +2128,8 @@
 		      && EQ (Faref (this, last), meta_prefix_char));
 
       /* if (nomenus && !ascii_sequence_p (this)) */
-      if (nomenus && XINT (last) >= 0 && !INTEGERP (Faref (this, 0)))
+      if (nomenus && XINT (last) >= 0
+	  && !INTEGERP (Faref (this, make_number (0))))
 	/* If no menu entries should be returned, skip over the
 	   keymaps bound to `menu-bar' and `tool-bar' and other
 	   non-ascii prefixes like `C-down-mouse-2'.  */
@@ -2294,7 +2320,7 @@
 	 Instead of consing, copy definitions to a vector and step
 	 over that vector.  */
       sequences = Fgethash (definition, where_is_cache, Qnil);
-      n = Flength (sequences);
+      n = XINT (Flength (sequences));
       defns = (Lisp_Object *) alloca (n * sizeof *defns);
       for (i = 0; CONSP (sequences); sequences = XCDR (sequences))
 	defns[i++] = XCAR (sequences);