Subject: bug#15575: 24.3.50; New tty menus crash Emacs

From: Eli Zaretskii <[email-masked]>
Date: Fri, 11 Oct 2013 17:17:08 +0300

> Date: Fri, 11 Oct 2013 13:42:37 +0200
> From: martin rudalics <[email-masked]>
> CC: [email-masked], [email-masked]
> 
>  >> Since I never work with -nw I have no idea how to debug this.
>  >
>  > Because -nw takes control of the screen, or because you don't think
>  > you are familiar enough with the internals in the -nw case?
>  >
>  > If the former, I can tell you the tricks I use.
> 
> The former.  I'm used to debug emacs from another emacs but with -nw
> this seems impossible.  And in a cmd.exe window emacs takes control of
> the window as you say.

You can overcome this in one of 2 ways:

  . start "emacs -Q -nw", then attach the debugger to it with 
    "gdb -p PID", set any breakpoints and type "continue"

  . start the debugger first, then do this:

    (gdb) set new-console on
    (gdb) run -Q -nw

The "set new-console on" command causes a new console to be created by
GDB before it runs the program attached to that console.

> What do you use to get back to the debugger?

I hope the above answers also this question (which I don't fully
understand).

> A minor nitpick: When I mouse-open the Tools menu and, with that menu
> open, mouse-click the Emacs-Lisp menu, the Tools menu is still around.
> Any simple way to close all open menus when opening a new one?

This is a known bug for which I have no solution, see the comments in
menu-bar.el where tty-menu-navigation-map is being constructed.  (The
menu item you mention is put on the menu bar by a minor mode.)