[Top][All Lists]

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

Re: Input for TTY menus

From: Eli Zaretskii
Subject: Re: Input for TTY menus
Date: Sat, 19 Oct 2013 12:43:34 +0300

> Date: Sat, 19 Oct 2013 10:35:20 +0300
> From: Eli Zaretskii <address@hidden>
> Cc: address@hidden, address@hidden, address@hidden
> > From: Stefan Monnier <address@hidden>
> > Cc: chad <address@hidden>, address@hidden, address@hidden
> > Date: Fri, 18 Oct 2013 16:04:54 -0400
> > 
> > But the tty-menu code should also correctly handle an empty menu.
> > E.g. if I do:
> > 
> > emacs -Q -nw
> > M-: (global-set-key [menu-bar test] '(menu-item "Test" (keymap "Test"))) RET
> > f10
> > 
> > then f10 just tells me "Empty menu" and doesn't let me move to
> > another menu.
> I'd appreciate if you or someone else could fix this, or describe the
> solution in enough detail that I could do it myself.  Keymaps and
> input in general is an area in Emacs where I know very little, and I
> already spent a disproportional amount of time on that aspect of the
> menus (for comparison, the display aspects of the menus started
> working within 2 working days of the code completion).

I can propose the following kludge-around:

=== modified file 'src/term.c'
--- src/term.c  2013-10-17 06:42:21 +0000
+++ src/term.c  2013-10-19 09:37:15 +0000
@@ -3607,8 +3607,8 @@ tty_menu_show (struct frame *f, int x, i
   if (menu_items_used <= MENU_ITEMS_PANE_LENGTH)
-      *error_name = "Empty menu";
-      return Qnil;
+      tty_menu_new_item_coords (f, TTYM_NEXT, &x, &y);
+      return Fcons (make_number (x), make_number (y));
   /* Make the menu on that window.  */

The problem with this is that this change arbitrarily switches to the
next menu-bar menu, which means that if you use C-b or left-arrow to
move backwards through the menu-bar items, you will be "stuck" when
you get to the empty menu item.  IOW, you can only move past such an
empty menu while moving forward (C-f or right-arrow).

However, if this is deemed "good enough", I will install it.

Btw, what does the non-toolkit menu do with this situation on X, when
triggered by F10?  Doesn't it behave the same?

reply via email to

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