changeset 10810:9b418bde9fcf

(Fwhere_is_internal): If FIRSTONLY is not nil or non-ascii, completely ignore menu bindings.
author Richard M. Stallman <rms@gnu.org>
date Thu, 23 Feb 1995 09:07:36 +0000
parents b7824d6a6b36
children 7f9e55cdc349
files src/keymap.c
diffstat 1 files changed, 28 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/keymap.c	Thu Feb 23 09:05:08 1995 +0000
+++ b/src/keymap.c	Thu Feb 23 09:07:36 1995 +0000
@@ -1592,10 +1592,10 @@
 \n\
 If optional 3rd arg FIRSTONLY is non-nil, return the first key sequence found,\n\
 rather than a list of all possible key sequences.\n\
-If FIRSTONLY is t, avoid key sequences which use non-ASCII\n\
-keys and therefore may not be usable on ASCII terminals.  If FIRSTONLY\n\
-is the symbol `non-ascii', return the first binding found, no matter\n\
-what its components.\n\
+If FIRSTONLY is the symbol `non-ascii', return the first binding found,\n\
+no matter what it is.\n\
+If FIRSTONLY has another non-nil value, prefer sequences of ASCII characters,
+and entirely reject menu bindings.\n\
 \n\
 If optional 4th arg NOINDIRECT is non-nil, don't follow indirections\n\
 to other keymaps or slots.  This makes it possible to search for an\n\
@@ -1608,6 +1608,8 @@
   Lisp_Object found, sequence;
   int keymap_specified = !NILP (keymap);
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
+  /* 1 means ignore all menu bindings entirely.  */
+  int nomenus = !NILP (firstonly) && !EQ (firstonly, Qnon_ascii);
 
   if (! keymap_specified)
     {
@@ -1716,7 +1718,28 @@
 
 	  /* Search through indirections unless that's not wanted.  */
 	  if (NILP (noindirect))
-	    binding = get_keyelt (binding, 0);
+	    {
+	      if (nomenus)
+		{
+		  while (1)
+		    {
+		      Lisp_Object map, tem;
+		      /* If the contents are (KEYMAP . ELEMENT), go indirect.  */
+		      map = get_keymap_1 (Fcar_safe (definition), 0, 0);
+		      tem = Fkeymapp (map);
+		      if (!NILP (tem))
+			definition = access_keymap (map, Fcdr (definition), 0, 0);
+		      else
+			break;
+		    }
+		  /* If the contents are (STRING ...), reject.  */
+		  if (CONSP (definition)
+		      && STRINGP (XCONS (definition)->car))
+		    continue;
+		}
+	      else
+		binding = get_keyelt (binding, 0);
+	    }
 
 	  /* End this iteration if this element does not match
 	     the target.  */