From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Backtrace printing in batch mode ignores all customizations Date: Tue, 14 Jan 2020 17:41:41 +0200 Message-ID: <83h80y59l6.fsf@gnu.org> References: Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="17774"; mail-complaints-to="usenet@blaine.gmane.org" Cc: pogonyshev@gmail.com, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jan 14 16:42:48 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1irOL9-0004EO-D7 for ged-emacs-devel@m.gmane-mx.org; Tue, 14 Jan 2020 16:42:47 +0100 Original-Received: from localhost ([::1]:42396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irOL8-0005Xo-4S for ged-emacs-devel@m.gmane-mx.org; Tue, 14 Jan 2020 10:42:46 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44500) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irOJw-0004KR-4W for emacs-devel@gnu.org; Tue, 14 Jan 2020 10:41:33 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:47606) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1irOJv-0005GU-ST; Tue, 14 Jan 2020 10:41:31 -0500 Original-Received: from [176.228.60.248] (port=1138 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1irOJu-0002a9-Qo; Tue, 14 Jan 2020 10:41:31 -0500 In-reply-to: (message from Stefan Monnier on Mon, 13 Jan 2020 14:23:09 -0500) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:244246 Archived-At: > From: Stefan Monnier > Cc: Paul Pogonyshev , Emacs developers > > Date: Mon, 13 Jan 2020 14:23:09 -0500 > > Paul writes: > > Here is a proposed patch that unifies the two print-backtrace-and-quit > > cases (batch mode and the failsafe). The patch is large mostly because > > of required reindenting, in fact only 15-20 lines are changed. > > Looks good to me, thank you for doing it. > Eli, do you think this can go into `emacs-27`? Yes, I think so. But I have a question and a request: > + (let ((only-backtrace (or noninteractive > + ;; If we're in the initial-frame (where `message' just > + ;; outputs to stdout) so there's no tty or GUI frame to > + ;; display the backtrace and interact with it: just dump a > + ;; backtrace to stdout. This happens for example while > + ;; handling an error in code from early-init.el with > + ;; --debug-init. > + (and (eq t (framep (selected-frame))) > + (equal "initial_terminal" (terminal-name))))) Paul said earlier that the latter condition, which tests terminal-name, is always correct in batch mode. If that is indeed so, then why do we need to test noninteractive as well? it's redundant, no? And the request is to add a comment explaining the semantics of only-backtrace. Not how it is set -- this is clear from the code, -- but what does it mean in terms of the code after that which uses the value. Because I don't think the name is descriptive enough, and the value is tested more than once below. Btw, I'd be much happier if the condition didn't rely on low-level implementation details such as the actual name of the initial terminal, nor on when exactly during startup that terminal gets deleted. I think it would be much cleaner to set a variable at the right place in startup.el (AFAIU, after we call frame-initialize), and test it in debug.el. I realize that this condition was copied from the code we already had in debug.el, but maybe on master we should use a cleaner solution. Thanks. P.S. One other situation where this should be tested is in the daemon mode.