I am constantly getting frustrated with the GDB comint-mode buffer when using GUD. Somehow my cursor always ends up straying from the bottom of the buffer, and then my input is not interpreted how I would expect.

Is there a way that I can make comint buffers behave more like term-mode so that my keys get sent to the underlying process?

I realize that I will have to manually allow my debugging keys, but that should be easy because I use the function keys almost exclusively when debugging.

  • Would it be enough to rebind the movement keys or are there other ways your cursor might end up straying from the bottom?
    – user2005
    Oct 30, 2014 at 5:23
  • @rekado It often happens when I scroll up to look at the output of the prior command and then scroll back down. term-mode is really good about forcing all input to be at the prompt. It also prevents deletion of the prompt, which is something that happens more than I care to admit. Perhaps a better way to phrase my request is "Can I make a term-mode buffer receive comint commands?"
    – nispio
    Oct 30, 2014 at 15:25
  • You want comint to behave like term-char-mode. term-mode also has a term-line-mode, where line are sent to the process. This is not just a matter of language, actually : you can activate term-char-mode in a comint buffer. It is probably not a supported way of operating comint, it will not work for everything (for example getting completion candidates from the underlying process this way is messy at best), but maybe it will solve your particular issues, it is worth trying.
    – T. Verron
    May 29, 2015 at 11:50

1 Answer 1


I'm not sure if this will help, but realgud doesn't have to use comint (although it can). It also works inside eshell. For use with gdb, You have to run "set annotate 1" to get it to track source-code lines, after running "M-x set-track-mode".

realgud is available from Melpa. At some point it will be in GNU Emacs Elpa.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.