Subject: bug#62041: 30.0.50; RET bound to `comint-send-input` in C-mode buffer

From: Eli Zaretskii <[email-masked]>
Date: Wed, 08 Mar 2023 16:37:26 +0200

> Cc: Lars Ingebrigtsen <[email-masked]>
> Date: Tue, 07 Mar 2023 18:58:53 -0500
> From:  Stefan Monnier via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
>      % src/emacs -Q src/emacs.c
>      M-x gud-gdb RET
>      gdb --fullname emacs RET
>      b main RET
>      r -Q RET
>      C-x o         (to jump to the `emacs.c` buffer)
>      C-h k RET
> 
> at this last step, `C-h k` is expected to show RET is bound to `newline`
> since we're inside a C mode buffer, but instead it says:
> 
>     RET (translated from <return>) runs the command comint-send-input
>     (found in gud-minor-mode-map), which is an interactive native-compiled
>     Lisp function in ‘comint.el’.
> 
> This seems to be because `gud-minor-mode-map` is defined as having
> `gud-mode-map` as its parent.  `gud-mode-map` is a major mode map for
> a Comint buffer, so it's normal for it to rebind RET to something like
> `comint-send-input`, but it's clearly not right for `gud-minor-mode-map`.
> 
> This seems to come from commit 8bb5c1bfec0929f2ba419e1c503f5acc01c336c2
> but I don't understand why it was done this way.  Was it a plain "typo"?

gud-minor-mode is supposed to show the same Gud menu on the menu bar
as gud-mode, and is also supposed to support mouse clicking on the
fringe to set/unset breakpoints.  I believe this is the reason for the
above; it isn't a typo.  We need a better way of keeping the Gud menu
and the fringe mouse-click bindings without inheriting all the comint
stuff with that.

See also bug#61162, bug#61271, and bug#59605.