texinfo-commits
[Top][All Lists]
Advanced

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

[5688] show right key sequence for commands


From: Gavin D. Smith
Subject: [5688] show right key sequence for commands
Date: Sat, 28 Jun 2014 20:53:25 +0000

Revision: 5688
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5688
Author:   gavin
Date:     2014-06-28 20:53:23 +0000 (Sat, 28 Jun 2014)
Log Message:
-----------
show right key sequence for commands

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-06-28 19:18:44 UTC (rev 5687)
+++ trunk/ChangeLog     2014-06-28 20:53:23 UTC (rev 5688)
@@ -38,6 +38,11 @@
 
        * info/doc.h (DocInfoCmd): Macro removed.  Uses updated.
 
+       * info/infomap.c (add_function_keyseq): Don't override already recorded
+       key sequences.
+       (default_emacs_like_info_keys, default_vi_like_info_keys): Put
+       preferred sequence to display first.
+
 2014-06-28  Gavin Smith  <address@hidden>
 
        * info/infokey.h:

Modified: trunk/info/infomap.c
===================================================================
--- trunk/info/infomap.c        2014-06-28 19:18:44 UTC (rev 5687)
+++ trunk/info/infomap.c        2014-06-28 20:53:23 UTC (rev 5688)
@@ -49,19 +49,27 @@
 static void
 add_function_keyseq (InfoCommand *function, int *keyseq, Keymap rootmap)
 {
-  FUNCTION_KEYSEQ *ks;
+  FUNCTION_KEYSEQ *ks, *k;
   int len;
 
   if (function == NULL ||
       function == InfoCmd (info_do_lowercase_version) ||
       function == InfoCmd (ea_insert))
     return;
-  ks = xmalloc  (sizeof (FUNCTION_KEYSEQ));
+
+  /* If there is already a key sequence recorded for this key map,
+     don't do anything. */
+  for (k = function->keys; k; k = k->next)
+    if (k->map == rootmap)
+      return;
+
+  ks = xmalloc (sizeof (FUNCTION_KEYSEQ));
   ks->next = function->keys;
   ks->map = rootmap;
   for (len = 0; keyseq[len]; len++);
   ks->keyseq = xmalloc ((len + 1) * sizeof (int));
   memcpy (ks->keyseq, keyseq, (len + 1) * sizeof (int));
+
   function->keys = ks;
 }
 
@@ -130,6 +138,20 @@
 
 static int default_emacs_like_info_keys[] =
 {
+  /* Favoured command bindings come first.  We want help to
+     report q, not C-x C-c, etc.  */
+  'H', NUL,                       A_info_get_help_window,
+  'q', NUL,                       A_info_quit,
+  KEY_UP_ARROW, NUL,              A_info_prev_line,
+  KEY_DOWN_ARROW, NUL,            A_info_next_line,
+  SPC, NUL,                       A_info_scroll_forward,
+  KEY_DELETE, NUL,                A_info_scroll_backward,
+  KEY_HOME, NUL,                  A_info_beginning_of_node,
+  KEY_END, NUL,                   A_info_end_of_node,
+  '{', NUL,                       A_info_search_previous,
+  '}', NUL,                       A_info_search_next,
+  CONTROL('g'), NUL,              A_info_abort_key,
+
   TAB, NUL,                       A_info_move_to_next_xref,
   LFD, NUL,                       A_info_select_reference_this_line,
   RET, NUL,                       A_info_select_reference_this_line,
@@ -170,7 +192,6 @@
   'g', NUL,                       A_info_goto_node,
   'G', NUL,                       A_info_menu_sequence,
   'h', NUL,                       A_info_get_info_help_node,
-  'H', NUL,                       A_info_get_help_window,
   'i', NUL,                       A_info_index_search,
   'I', NUL,                       A_info_virtual_index,
   'l', NUL,                       A_info_history_node,
@@ -184,6 +205,7 @@
   'S', NUL,                       A_info_search_case_sensitively,
   't', NUL,                       A_info_top_node,
   'u', NUL,                       A_info_up_node,
+  'x', NUL,                       A_info_delete_window,
   KEYMAP_META('0'), NUL,                 A_info_add_digit_to_numeric_arg,
   KEYMAP_META('1'), NUL,                 A_info_add_digit_to_numeric_arg,
   KEYMAP_META('2'), NUL,                 A_info_add_digit_to_numeric_arg,
@@ -228,9 +250,6 @@
   KEY_PAGE_DOWN, NUL,           A_info_scroll_forward,
   KEY_RIGHT_ARROW, NUL,         A_info_forward_char,
   KEY_LEFT_ARROW, NUL,          A_info_backward_char,
-  KEY_HOME, NUL,                A_info_beginning_of_node,
-  KEY_END, NUL,                 A_info_end_of_node,
-  KEY_DELETE, NUL,              A_info_scroll_backward,
   
   ESC, KEY_PAGE_UP, NUL,        A_info_scroll_other_window_backward,
   ESC, KEY_PAGE_DOWN, NUL,      A_info_scroll_other_window,
@@ -240,15 +259,6 @@
   ESC, KEY_LEFT_ARROW, NUL,     A_info_backward_word,
   KEY_BACK_TAB, NUL,            A_info_move_to_prev_xref,
   
-  /* We want help to report q, not C-x C-c, etc.  */
-  'q', NUL,                       A_info_quit,
-  'x', NUL,                       A_info_delete_window,
-  SPC, NUL,                       A_info_scroll_forward,
-  '{', NUL,                       A_info_search_previous,
-  '}', NUL,                       A_info_search_next,
-  CONTROL('g'), NUL,              A_info_abort_key,
-  KEY_UP_ARROW, NUL,    A_info_prev_line,
-  KEY_DOWN_ARROW, NUL,  A_info_next_line,
 };
 
 
@@ -315,6 +325,15 @@
 
 static int default_vi_like_info_keys[] =
 {
+  /* We want help to report q, not C-x C-c, etc.  */
+  'q', NUL,                       A_info_quit,
+  'x', NUL,                       A_info_delete_window,
+  SPC, NUL,                       A_info_scroll_forward,
+  '{', NUL,                       A_info_search_previous,
+  '}', NUL,                       A_info_search_next,
+  KEY_UP_ARROW, NUL,    A_info_up_line,
+  KEY_DOWN_ARROW, NUL,  A_info_down_line,
+
   '0', NUL,                       A_info_add_digit_to_numeric_arg,
   '1', NUL,                       A_info_add_digit_to_numeric_arg,
   '2', NUL,                       A_info_add_digit_to_numeric_arg,
@@ -463,14 +482,6 @@
   ESC, KEY_LEFT_ARROW, NUL,     A_info_beginning_of_node,
   CONTROL('x'), KEY_DELETE, NUL,A_ea_backward_kill_line,
   
-  /* We want help to report q, not C-x C-c, etc.  */
-  'q', NUL,                       A_info_quit,
-  'x', NUL,                       A_info_delete_window,
-  SPC, NUL,                       A_info_scroll_forward,
-  '{', NUL,                       A_info_search_previous,
-  '}', NUL,                       A_info_search_next,
-  KEY_UP_ARROW, NUL,    A_info_up_line,
-  KEY_DOWN_ARROW, NUL,  A_info_down_line,
 };
 
 




reply via email to

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