From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Redisplay hook error backtraces Date: Thu, 14 Jul 2022 09:01:16 +0000 Message-ID: References: <83edz87ivz.fsf@gnu.org> <83r1375m6x.fsf@gnu.org> <837d4hw5to.fsf@gnu.org> <83ilo0vnwh.fsf@gnu.org> <83fsj4uvjg.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27828"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jul 14 11:04:00 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 1oBulM-00073j-Tq for ged-emacs-devel@m.gmane-mx.org; Thu, 14 Jul 2022 11:04:00 +0200 Original-Received: from localhost ([::1]:48160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBulL-0005pG-3s for ged-emacs-devel@m.gmane-mx.org; Thu, 14 Jul 2022 05:03:59 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40192) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBuin-0004UV-Ui for emacs-devel@gnu.org; Thu, 14 Jul 2022 05:01:22 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:54073 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.90_1) (envelope-from ) id 1oBuil-0005ly-Fr for emacs-devel@gnu.org; Thu, 14 Jul 2022 05:01:21 -0400 Original-Received: (qmail 20274 invoked by uid 3782); 14 Jul 2022 09:01:17 -0000 Original-Received: from acm.muc.de (p4fe15c93.dip0.t-ipconnect.de [79.225.92.147]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 14 Jul 2022 11:01:17 +0200 Original-Received: (qmail 4839 invoked by uid 1000); 14 Jul 2022 09:01:16 -0000 Content-Disposition: inline In-Reply-To: <83fsj4uvjg.fsf@gnu.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de Received-SPF: pass client-ip=193.149.48.1; envelope-from=acm@muc.de; helo=mail.muc.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:292136 Archived-At: Hello, Eli. On Thu, Jul 14, 2022 at 08:12:51 +0300, Eli Zaretskii wrote: > > Date: Wed, 13 Jul 2022 20:12:42 +0000 > > Cc: larsi@gnus.org, monnier@iro.umontreal.ca, emacs-devel@gnu.org > > From: Alan Mackenzie > > > I still don't think I understand why testing redisplaying_p and the > > > new optional variable would not be enough. > > We've got to distinguish between the signals we want to generate > > backtraces for and those we don't. redisplaying_p is not relevant to > > that, I think. For example, we don't want to generate a backtrace > > for a "failed" evaluation of the code generated by `c-safe'. > You want to distinguish errors inside condition-case? More, distinguish the different condition-cases in which errors might occur. > If they are not already marked in some way that allows you to do so, I > think it's better to do it the other way around: bind some variable in > internal_lisp_condition_case before invoking the body. OK, I think I see what you're getting at. But this would mean binding that variable at _every_ condition_case, and needing some way of deciding which way to bind it (an extra argument in every use of internal_lisp_condition_case, perhaps?). Why would this be better than the way I have already implemented? > > > > 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? I think we need the new function safe_run_hooks_2_with_backtrace (see below), since there is currently no "safe" function for hooks with two arguments. But some of the other ones could disappear (see below). > > OK. Perhaps with extra optional arguments, that kind of thing? > Maybe, I don't know. I still think the job of signal_or_quit and > safe_run_hooks is almost the same when you want to collect backtrace, > so too many differences strike me as unexpected. OK, I have an idea. I restore the variable redisplay_lisping back into the code (I took it out last night), binding it to true (or Qt?) at every place in xdisp.c where redisplay calls a Lisp hook. I then test that variable in internal_condition_case_n in place of having the extra bool argument to that function. That would then get rid of the new functions safe_run_hooks_with_backtrace_funcall and safe_run_hooks_with_backtrace. We could also rename safe_run_hooks_2_with_backtrace by removing "_with_backtrace" from the name. What do you think? -- Alan Mackenzie (Nuremberg, Germany).