Subject: Re: bug#21777: 25.0.50; gud-gdb uses a pager, which is harmful inside emacs

From: Eli Zaretskii <[email-masked]>
Date: Thu, 29 Oct 2015 18:16:02 +0200

> From: Dima Kogan <[email-masked]>
> Date: Wed, 28 Oct 2015 15:57:37 -0700
> Cc: [email-masked]
> 
> Hi. Thanks for replying. Looking at gdb/utils.c, apparently gdb looks at
> the EMACS environment variable, which was set previously but is not
> anymore:
> 
> https://github.com/emacs-mirror/emacs/commit/beaab898968caf8b243a33d24824d430fabc31fc
> 
> This patch in emacs is what broke it. Options:
> 
> 1. revert above patch

That patch fixed a real-life bug, so I don't think reverting it is an
option we should seriously consider.

> 2. patch gdb to look at INSIDE_EMACS not EMACS

That should be done regardless, I will submit a patch to GDB.

> 3. handle this inside emacs, not relying on gdb behavior
> 
> I like 3. Emacs should be responsible for things emacs wants, not
> external applications, even if they're GNU applications.

3 is okay in principle, but you didn't show any specific suggestions.
What did you have in mind?

Please also keep in mind that "M-x gud-gdb" is a legacy command, and
the more modern "M-x gdb" doesn't have that problem.

There's also:

 4. Fix this locally in your GDB init files (using GDB scripting
    facilities).

> Also, it looks like gdb checks EMACS in a few more places, and I haven't
> looked at those yet.

Maybe I'm missing something, but I don't see any additional places
except the one pointed out by Andreas.