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: Sat, 16 Jul 2022 09:12:48 +0300 Message-ID: <831qulshzz.fsf@gnu.org> References: <83ilo0vnwh.fsf@gnu.org> <83fsj4uvjg.fsf@gnu.org> <83mtdct5ze.fsf@gnu.org> <83bktru74y.fsf@gnu.org> <831quntydt.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34224"; 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 Sat Jul 16 08:13:56 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 1oCb3r-0008h8-QM for ged-emacs-devel@m.gmane-mx.org; Sat, 16 Jul 2022 08:13:55 +0200 Original-Received: from localhost ([::1]:57778 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oCb3q-0004QQ-Ca for ged-emacs-devel@m.gmane-mx.org; Sat, 16 Jul 2022 02:13:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38026) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oCb2u-0003iR-Sh for emacs-devel@gnu.org; Sat, 16 Jul 2022 02:12:57 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:51474) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oCb2t-0008VE-Kl; Sat, 16 Jul 2022 02:12:56 -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=Le1N1tVhVwMKjtpC06SdAJ6DQwOjOm3EuKHyVQL05M8=; b=D8rbIabJz4Tt ZIiO3jaeGcL35a3a8cY8/tcgwdrTjeSoyI/3i+l90Pv2JySnefxyryyHi9PEbZO0NjJ5sVBfzqocF vRhywB//0SeTLPwKw0bpYm4JDY4xF5Zo38LQfX0TYC8l8PbOKas1V4lBWK6OgACIx8Emtykie0DIe B52ILOLYS58sUHdSrLJk7lq8ebnbGEmwbDrWlBSMrFpmmTFc7Gdnq3rTKl9gbfhbMMkTmyE052j0H aAkCs5JdocEuAcd+hL68Ov7pzBExbDYlyTUjsryYtN6Vw2lY31XwhdaELmmuDlFwDDYKJxCkNa/uD 2ONS4eSaDRi4NXDEK5edwg==; Original-Received: from [87.69.77.57] (port=1774 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 1oCb2o-0003xY-IM; Sat, 16 Jul 2022 02:12:55 -0400 In-Reply-To: (message from Alan Mackenzie on Thu, 14 Jul 2022 19:33:09 +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:292199 Archived-At: > Date: Thu, 14 Jul 2022 19:33:09 +0000 > Cc: larsi@gnus.org, monnier@iro.umontreal.ca, emacs-devel@gnu.org > From: Alan Mackenzie > > > > I think I understand what you're saying, now. That a condition-case > > > called from Lisp will not use any of the internal_condition_case* > > > functions. So we could just assume that if i_c_case* triggers, it must be > > > one of the hooks we're interested in that called it. > > > > I don't think that's right. It might well be that Lisp code calls a C > > > primitive function that itself uses an internal_condition_case. In this > > > scenario, we would not want to generate a backtrace for that nested > > > internal_condition_case. > > > And we won't, because redisplaying_p won't be set. > > I don't understand. If redisplay is called normally, it will go through > redisplay_internal which sets redisplaying_p to true. And it will stay > true till the end of redisplay_internal, unless one of two special things > happen: (i) We enter the debugger; (ii) there's a recursive edit. > > I don't see how the new backtrace facility can get any useful information > out of redisplaying_p; if there were a nested internal_condition_case*, > redisplaying_p would still be true, surely? > > What am I missing? My point is that redisplaying_p tells you the code which runs was invoked from redisplay, and that allows you to distinguish calls to internal_condition_case* that are of interest (i.e. should produce a backtrace in the *Backtrace* buffer) from those which aren't of interest. Which was the issue you raised against my suggestion to rely on the fact that Lisp only ever uses a single form of internal_condition_case* functions. To recap: this sub-thread started when you said you don't want to cause all calls to internal_condition_case* to generate backtrace in this new way. To which I suggested to bind a variable in internal_condition_case that would prevent generation of backtrace, relying on redisplaying_p to tell us when the other internal_condition_case* functions are called outside of redisplay.