From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Redisplay hook error backtraces Date: Wed, 13 Jul 2022 22:00:14 +0300 Message-ID: <83ilo0vnwh.fsf@gnu.org> References: <83o7yg9f0w.fsf@gnu.org> <83r1396lvr.fsf@gnu.org> <83edz87ivz.fsf@gnu.org> <83r1375m6x.fsf@gnu.org> <837d4hw5to.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36722"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jul 13 21:02:24 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oBhct-0009ND-NC for ged-emacs-devel@m.gmane-mx.org; Wed, 13 Jul 2022 21:02:23 +0200 Original-Received: from localhost ([::1]:49956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBhcs-0000lq-MD for ged-emacs-devel@m.gmane-mx.org; Wed, 13 Jul 2022 15:02:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBhay-0008NI-Eg for emacs-devel@gnu.org; Wed, 13 Jul 2022 15:00:24 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:55598) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBhax-0004ah-CF; Wed, 13 Jul 2022 15:00:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=xxzafP892+aC74nqTGjZuGYxJh7faJKkkfQUxQTwKS8=; b=LhH/6CyaEjfV lx7MPNituoaiRXeY1Q79ZEpuf5HVChqL+GpC8WQMZ9Uu1PukxGAw6UixIEHafLCkIjEzLvd8JEjvL wVDOdeIEMa5rF8R/nBtuEBxPK+OwnVhK/iPkHftYJ/5dgRMb0xswJKy7qjc6bw86thC75i88N9gtx 2Ck36CqxAxdamZdu9s+ru716ovav519EUZ0I+3wEJ3ONJgPHm5YeOY25BPy6ua0oGYbRUkRng7NKf WCUo1IXldKFokgp8kvk2/nLQiN1E6kmgmiHwCszP5kSzOXBdd7hDbtPidcHmcYNF+xWBBQXHpUr5Q OVfPRCLzBViNcoqYAJ7G+A==; Original-Received: from [87.69.77.57] (port=4985 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBhaw-0005KJ-Q5; Wed, 13 Jul 2022 15:00:23 -0400 In-Reply-To: (message from Alan Mackenzie on Wed, 13 Jul 2022 18:41:01 +0000) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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.io gmane.emacs.devel:292110 Archived-At: > Date: Wed, 13 Jul 2022 18:41:01 +0000 > Cc: larsi@gnus.org, monnier@iro.umontreal.ca, emacs-devel@gnu.org > From: Alan Mackenzie > > The problem is that other signals go through the same C code in > signal_and_quit, for example "smaller" condition-cases. We do not want > to generate backtraces for these routine condition-cases which simply get > handled by their Lisp code. redisplay_deep_handler records the "deepest" > pending condition-case, and only if the variable `h' matches that deepest > condition case do we have an error that we want to output a backtrace for. I still don't think I understand why testing redisplaying_p and the new optional variable would not be enough. > > And what is the test of backtrace_yet about? > > When a backtrace is being generated, it first erases *Backtrace*. We > only want to do that for the first backtrace generated by the current > command. So backtrace_yet records whether we've already generated a BT > in this command. It is reset to false in the command loop. > > This ensures that the user sees that first backtrace, which is > likely to be the most interesting one. Unless she has configured > backtrace-last-error to do something different. > > As an alternative to this complicated configuration, perhaps we could > just erase *Backtrace* for the first BT, then write any further BTs to > *Backtrace*, too. Either that, or erase it every time. I think anything more complex is over-engineered. > > I still hope this could be done more elegantly and with fewer changes > > to infrastructure. > > You mean, all the changes in eval.c and keyboard.c? I think the changes > to internal_condition_case_n are essential to the patch, and I honestly > don't think it can be done much more elegantly, but I'm open to > suggestions. Can we discuss how to implement it without introducing a special handler and without adding new safe_run_hooks_* functions?