texinfo-commits
[Top][All Lists]
Advanced

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

[7947] support "1 menu-digit"


From: gavinsmith0123
Subject: [7947] support "1 menu-digit"
Date: Sat, 2 Sep 2017 09:07:21 -0400 (EDT)

Revision: 7947
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7947
Author:   gavin
Date:     2017-09-02 09:07:20 -0400 (Sat, 02 Sep 2017)
Log Message:
-----------
support "1 menu-digit"

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/infokey.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2017-08-30 20:07:14 UTC (rev 7946)
+++ trunk/ChangeLog     2017-09-02 13:07:20 UTC (rev 7947)
@@ -1,3 +1,9 @@
+2017-09-02  Gavin Smith  <address@hidden>
+
+       * info/infokey.c (compile): Support "1 menu-digit" in .infokey
+       file in case this default binding is disabled for some reason.
+       Clark Wang reported that "1 menu-digit" didn't work.
+
 2017-08-29  Patrice Dumas  <address@hidden>
 
        * autogen.sh: update regeneration of tests makefile fragment to

Modified: trunk/info/infokey.c
===================================================================
--- trunk/info/infokey.c        2017-08-30 20:07:14 UTC (rev 7946)
+++ trunk/info/infokey.c        2017-09-02 13:07:20 UTC (rev 7947)
@@ -440,14 +440,36 @@
                }
              else
                {
+                  int keymap_bind_keyseq (Keymap, int *, KEYMAP_ENTRY *);
+
                  act[alen] = '\0';
                  a = lookup_action (act);
                   if (a == A_info_menu_digit)
                    {
-                      /* It does not make sense for menu-digit to be anything
-                         other than '0' .. '9'. */
-                     syntax_error (filename, lnum,
-                        _("cannot bind key sequence to menu-digit"));
+                      /* Only allow "1 menu-digit".  (This is useful if
+                         this default binding is disabled with "#stop".)
+                         E.g. do not allow "b menu-digit".  */
+                      if (seq[0] != '1' || seq[1] != '\0'
+                          || section != info)
+                        {
+                          syntax_error (filename, lnum,
+                                 _("cannot bind key sequence to menu-digit"));
+                        }
+                      else
+                        {
+                          /* Bind each key from '1' to '9' to 'menu-digit'. */
+                          KEYMAP_ENTRY ke;
+                          int i;
+                      
+                          ke.type = ISFUNC;
+                          ke.value.function = &function_doc_array[a];
+
+                          for (i = '1'; i <= '9'; i++)
+                            {
+                              seq[0] = i;
+                              keymap_bind_keyseq (info_keymap, seq, &ke);
+                            }
+                        }
                    }
                  else if (a == -1)
                    {
@@ -460,8 +482,6 @@
                    }
                   else
                    {
-                      int keymap_bind_keyseq (Keymap, int *, KEYMAP_ENTRY *);
-
                       KEYMAP_ENTRY ke;
                       static InfoCommand invalid_function = { 0 };
                       




reply via email to

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