From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#38927: [patch] Backtrace printing in non-interactive mode doesn't use cl-prin1 etc. Date: Sat, 29 Feb 2020 09:07:08 -0500 Message-ID: References: <87fteu6kz4.fsf@stefankangas.se> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="108093"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 38927-done@debbugs.gnu.org, Paul Pogonyshev To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 29 15:08:16 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1j82mt-000S2D-RQ for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 29 Feb 2020 15:08:16 +0100 Original-Received: from localhost ([::1]:60818 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j82ms-0006V4-Te for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 29 Feb 2020 09:08:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39818) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j82mh-0006Uu-Uh for bug-gnu-emacs@gnu.org; Sat, 29 Feb 2020 09:08:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j82mg-0001KG-MZ for bug-gnu-emacs@gnu.org; Sat, 29 Feb 2020 09:08:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56607) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j82mg-0001K1-GP for bug-gnu-emacs@gnu.org; Sat, 29 Feb 2020 09:08:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j82mg-0003Ma-8x for bug-gnu-emacs@gnu.org; Sat, 29 Feb 2020 09:08:02 -0500 Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sat, 29 Feb 2020 14:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 38927 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Mail-Followup-To: 38927@debbugs.gnu.org, monnier@iro.umontreal.ca, pogonyshev@gmail.com Original-Received: via spool by 38927-done@debbugs.gnu.org id=D38927.158298524112865 (code D ref 38927); Sat, 29 Feb 2020 14:08:02 +0000 Original-Received: (at 38927-done) by debbugs.gnu.org; 29 Feb 2020 14:07:21 +0000 Original-Received: from localhost ([127.0.0.1]:34347 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j82m0-0003LR-K1 for submit@debbugs.gnu.org; Sat, 29 Feb 2020 09:07:20 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:31338) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j82lz-0003LD-1T for 38927-done@debbugs.gnu.org; Sat, 29 Feb 2020 09:07:19 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 383B31004B3; Sat, 29 Feb 2020 09:07:13 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 44E3D100271; Sat, 29 Feb 2020 09:07:11 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1582985231; bh=nR2TIYpNDYA0YbgFwYBaMIXrE2Qc/4NvKXOZhF9YNOA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=dTMC0OHuR5FO0wGsI30ut6s0aW551zxKCh9HUAzsg/0n6psASJrn/+pWKD+Sju8Xz YQYRiiqPcnLsIlSBmPDqXNltwKJ5wpj8h+a//leItCfDaZnbAc2wkzJJXQ+QDv9ETx hB8CEi1+6TbHGxBRUeVVNIKCkMkOkSNyXz0Kbq599R/VSggV5uq6m6ZTWUY1iRaYWD pToyaOHyeAXJuYXhyI8Jq+oRSA5F2n0JH37mH2z0+n2JcXVJheWuoSkiI8uQe0RrrU Ibs+ktnvo4iBjQpAPgKNXnjAOWwu6a8avculSX3h7s6i89mM0mbvexFfLrOPjB3AYF BvDEu8ad/TUyQ== Original-Received: from pastel (unknown [216.154.50.221]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id A3E6212061D; Sat, 29 Feb 2020 09:07:10 -0500 (EST) In-Reply-To: <87fteu6kz4.fsf@stefankangas.se> (Stefan Kangas's message of "Sat, 29 Feb 2020 06:06:23 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:176674 Archived-At: > Do you have any comments on the below patch? It seems to relate to a > commit of yours, but has unfortunately not received any reply yet. Hmm... looks like the bug tracker was kept out of the discussion. This has been fixed already by 0223a1577c8999b8ea5eb35f39bc68360cbf5221 Stefan > Paul Pogonyshev writes: > >> tags >> >> Backtrace printing in batch mode ignores all customizations, at least: >> - all `cl-print-object' overrides (`debugger-print-function'); >> - `print-level', `print-length' and friends; >> - `debugger-batch-max-lines'. >> >> The reason is this commit: >> >> 7228488effa78dcb75284cb6d247b24804e0e7f5 >> Author: Stefan Monnier >> AuthorDate: 2018-04-02 00:23:20 -0400 >> [...] >> >> * lisp/emacs-lisp/debug.el (debug): Don't hang upon error in initial-frame. >> >> [...] >> + ((and (eq t (framep (selected-frame))) >> + (equal "initial_terminal" (terminal-name))) >> + ;; 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. >> + (message "Error: %S" args) >> [...] >> >> The commit added a "failsafe" mode for (quoting) "initial-frame (where >> `message' just outputs to stdout) so there's no tty or GUI frame". >> This failsafe mode is also erroneously triggered in batch mode. It was >> never meant for it: you can see a couple of uses of `noninteractive' >> in the next `cond' branch, but execution now never gets to it. >> >> Patch attached: >> - don't use this "failsafe" mode when running non-interactively; >> - repair for the latest changes in backtrace generation (apparently, >> before the buffer was not read-only); >> - repair adjustment for `debugger-batch-max-lines' which didn't make >> any sense and didn't achieve what it claimed in the comment. >> >> Paul >> >> From 180f4a4f771696512af31ded93057713a5507147 Mon Sep 17 00:00:00 2001 >> From: Paul Pogonyshev >> Date: Sat, 4 Jan 2020 22:47:24 +0100 >> Subject: [PATCH] Don't apply the special case to non-interactive mode in >> `debug' >> >> --- >> lisp/emacs-lisp/debug.el | 25 +++++++++++++------------ >> 1 file changed, 13 insertions(+), 12 deletions(-) >> >> diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el >> index 3df0ba4a65..b6c58b8c7b 100644 >> --- a/lisp/emacs-lisp/debug.el >> +++ b/lisp/emacs-lisp/debug.el >> @@ -172,7 +172,8 @@ debug >> (inhibit-redisplay >> ;; Don't really try to enter debugger within an eval from redisplay. >> debugger-value) >> - ((and (eq t (framep (selected-frame))) >> + ((and (not noninteractive) >> + (eq t (framep (selected-frame))) >> (equal "initial_terminal" (terminal-name))) >> ;; 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 >> @@ -246,17 +247,17 @@ debug >> (when noninteractive >> ;; If the backtrace is long, save the beginning >> ;; and the end, but discard the middle. >> - (when (> (count-lines (point-min) (point-max)) >> - debugger-batch-max-lines) >> - (goto-char (point-min)) >> - (forward-line (/ 2 debugger-batch-max-lines)) >> - (let ((middlestart (point))) >> - (goto-char (point-max)) >> - (forward-line (- (/ 2 debugger-batch-max-lines) >> - debugger-batch-max-lines)) >> - (delete-region middlestart (point))) >> - (insert "...\n")) >> - (goto-char (point-min)) >> + (let ((inhibit-read-only t)) >> + (when (> (count-lines (point-min) (point-max)) >> + debugger-batch-max-lines) >> + (goto-char (point-min)) >> + (forward-line (/ debugger-batch-max-lines 4)) >> + (let ((middlestart (point))) >> + (goto-char (point-max)) >> + (forward-line (- (/ 2 debugger-batch-max-lines) >> + debugger-batch-max-lines)) >> + (delete-region middlestart (point))) >> + (insert "...\n"))) >> (message "%s" (buffer-string)) >> (kill-emacs -1))) >> (pop-to-buffer