From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id wCfMHpqmumPKbAEAbAwnHQ (envelope-from ) for ; Sun, 08 Jan 2023 12:18:50 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id kLLLHpqmumNfewEA9RJhRA (envelope-from ) for ; Sun, 08 Jan 2023 12:18:50 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 829613A9F9 for ; Sun, 8 Jan 2023 12:18:49 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pETg7-0000bp-Rw; Sun, 08 Jan 2023 06:17:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pETfw-0000bR-FI for emacs-orgmode@gnu.org; Sun, 08 Jan 2023 06:17:18 -0500 Received: from mail.bundesbrandschatzamt.de ([198.7.63.95]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pETfp-0001VA-9r for emacs-orgmode@gnu.org; Sun, 08 Jan 2023 06:17:12 -0500 Received-SPF: pass (mail.bundesbrandschatzamt.de: authenticated connection) receiver=mail.bundesbrandschatzamt.de; client-ip=91.64.203.22; helo=smtpclient.apple; envelope-from=baron@bundesbrandschatzamt.de; x-software=spfmilter 2.001 http://www.acme.com/software/spfmilter/ with libspf2-1.2.10; Received: from smtpclient.apple (ip5b40cb16.dynamic.kabel-deutschland.de [91.64.203.22]) (authenticated bits=0) by mail.bundesbrandschatzamt.de (8.14.7/8.14.7) with ESMTP id 308BH4U6032429 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 8 Jan 2023 11:17:06 GMT From: Andreas Gerler Message-Id: <94980226-D29A-4969-8640-1143A1979164@bundesbrandschatzamt.de> Content-Type: multipart/signed; boundary="Apple-Mail=_AFEF8533-BD9F-4458-8B08-F9B99E475BE1"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: [O] [PATCH] ob-eval: display error fix Date: Sun, 8 Jan 2023 12:16:54 +0100 In-Reply-To: Cc: emacs-orgmode@gnu.org To: Ruijie Yu References: X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (mail.bundesbrandschatzamt.de [198.7.63.95]); Sun, 08 Jan 2023 11:17:07 +0000 (UTC) X-DCC-MGTINTERNET-Metrics: heimdall.bundesbrandschatzamt.de 1170; Body=2 Fuz1=2 Fuz2=2 Received-SPF: permerror client-ip=198.7.63.95; envelope-from=baron@bundesbrandschatzamt.de; helo=mail.bundesbrandschatzamt.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, T_SPF_PERMERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1673176730; a=rsa-sha256; cv=none; b=sdsRyqPAUeO9sFKJbvooekaV6huNW4zD6BQhOlC0OVO5H1xTxp5YvXmNPyvCcIRPosiu8n mI+OY4fQD7R/hi+T8gpFNy/omc3ZulUDi7xHv/TsZlSwoW71NEnsHf+7FPt0EYsGGr5WxI wJvGTKSD/gkEmJfReDr+jB/rDWkt8jcrmrY6Gx7XzEKS5UX+IGY35GnXxkHIp6R1RtPJ38 ZQOHNhsZgaGxsrAF6gdGtLwgLCxxYkCNzdGdFGefY1inZNCsaJQIyZ7l02/R3vwK4LqjJC NOsLtrJxsK4hLl0nDdw1Eb/pptBik9mXK+401XA2oVJjfde2ws0RGkqrTRXqEw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1673176730; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=ZPB1r2/3D9fa47MTrRuXsJRYxvhPDLUnC/QJVi535+Q=; b=Agk1sgHMIkBR3lPnH4uWRWqKdk0HO6s+Mj8ttRh2nfifg9J/dwEgq+d8U//e05w6eVVt53 qollunqjIP3ARCmiv6gYU/u2JcWbPLq7IqFtlAgIftTqvvDHpXllYd6fSZLgyw8Bf+sTpj UBffA50YjnKguAX9hYqMgWFd5HBl+9syte4S4GWLCNBdJH6vuwSgdNK0hWVFcy3s54IQ0X 20qyOyzz82XUr+xjaaRmIyL/VucFzB7lhrnytf6sEsLhL/ISlEED8JOlQfOFSKEjqHzKkV Ayj14UI9BF1Wo2CEKKHWyg8+FXd6k4TaIQSe2bhiCCNb6H20NJhZjbNTq07Kjw== X-Spam-Score: -5.26 X-Migadu-Queue-Id: 829613A9F9 Authentication-Results: aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=none X-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -5.26 X-TUID: NHXvjV/c2LDd --Apple-Mail=_AFEF8533-BD9F-4458-8B08-F9B99E475BE1 Content-Type: multipart/mixed; boundary="Apple-Mail=_8A031763-6193-4627-9660-421F69A6DEB5" --Apple-Mail=_8A031763-6193-4627-9660-421F69A6DEB5 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii --Apple-Mail=_8A031763-6193-4627-9660-421F69A6DEB5 Content-Disposition: attachment; filename=0001-lisp-ob-eval.el-Display-error-fix.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-lisp-ob-eval.el-Display-error-fix.patch" Content-Transfer-Encoding: quoted-printable =46rom=20db391f4123a62aa214741d6b1eb43b0a1e06f1b9=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Andreas=20Gerler=20= =0ADate:=20Sat,=207=20Jan=202023=20= 14:04:03=20+0100=0ASubject:=20[PATCH]=20*=20lisp/ob-eval.el:=20Display=20= error=20fix=0A=0A*=20lisp/ob-eval.el:=20(org-babel-eval-error-notify):=20= Display=20standard=0Aerror=20only=20if=20command=20exits=20non=20zero.=0A= =0AThe=20problem=20is=20that=20sql=20connections=20might=20give=20= warnings.=0ANow=20the=20information=20is=20available=20in=20the=20= *Org-Babel=20Error*=20buffer=0Awithout=20displaying.=0AIf=20you=20need=20= always=20display=20toggle=20org-babel-eval-error-display-notify.=0A=0A= Signed-off-by:=20Andreas=20Gerler=20=0A= ---=0A=20lisp/ob-eval.el=20|=2011=20++++++++++-=0A=201=20file=20changed,=20= 10=20insertions(+),=201=20deletion(-)=0A=0Adiff=20--git=20= a/lisp/ob-eval.el=20b/lisp/ob-eval.el=0Aindex=206f6edb949..f4659fe96=20= 100644=0A---=20a/lisp/ob-eval.el=0A+++=20b/lisp/ob-eval.el=0A@@=20-36,6=20= +36,12=20@@=0A=20(defvar=20org-babel-error-buffer-name=20"*Org-Babel=20= Error=20Output*")=0A=20(declare-function=20org-babel-temp-file=20= "ob-core"=20(prefix=20&optional=20suffix))=0A=20=0A+(defcustom=20= org-babel-eval-error-display-notify=20nil=0A+=20=20"Display=20= org-babel-eval-errors=20always=20or=20only=20if=20exit=20code=20is=20not=20= 0."=0A+=20=20:group=20'org-babel=0A+=20=20:version=20"29.1"=0A+=20=20= :type=20'boolean)=0A+=0A=20(defun=20org-babel-eval-error-notify=20= (exit-code=20stderr)=0A=20=20=20"Open=20a=20buffer=20to=20display=20= STDERR=20and=20a=20message=20with=20the=20value=20of=20EXIT-CODE."=0A=20=20= =20(let=20((buf=20(get-buffer-create=20org-babel-error-buffer-name)))=0A= @@=20-45,7=20+51,10=20@@=0A=20=20=20=20=20=20=20=20=20(unless=20(bolp)=20= (insert=20"\n"))=0A=20=20=20=20=20=20=20=20=20(insert=20stderr)=0A=20=20=20= =20=20=20=20=20=20(insert=20(format=20"[=20Babel=20evaluation=20exited=20= with=20code=20%S=20]"=20exit-code))))=0A-=20=20=20=20(display-buffer=20= buf))=0A+=20=20=20=20(when=20(or=20org-babel-eval-error-display-notify=0A= +=20=20=20=20=20=20=20=20=20=20=20=20(or=20(not=20(numberp=20exit-code))=0A= +=20=20=20=20=20=20=20=20=20=20=20=20(>=20exit-code=200)))=0A+=20=20=20=20= =20=20=20=20(display-buffer=20buf)))=0A=20=20=20(message=20"Babel=20= evaluation=20exited=20with=20code=20%S"=20exit-code))=0A=20=0A=20(defun=20= org-babel-eval=20(command=20query)=0A--=20=0A2.39.0=0A=0A= --Apple-Mail=_8A031763-6193-4627-9660-421F69A6DEB5 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hi Ruijie, thanks for asking. I combined them now and tested again all variants. Andreas > On 7. Jan 2023, at 22:33, Ruijie Yu via General discussions about = Org-mode. wrote: >=20 >=20 > Hi Andreas, >=20 > - (display-buffer buf)) > + (if org-babel-eval-error-display-notify > + (display-buffer buf) > + (if (or (not (numberp exit-code)) > + (> exit-code 0)) > + (display-buffer buf)))) >=20 > Quick question, does it help or hurt readability if we change this > nested `if' into a `cond' expression? >=20 > Or, alternatively, since both the outer then branch and the inner then > branch are the same expression, maybe we can just combine all three > conditions into a single `or' call? >=20 > Something like >=20 > (when (or org-babel-eval-error-display-notify > (not (numberp exit-code)) > (> exit-code 0)) > (display-buffer buf)) >=20 > Best, >=20 >=20 > RY >=20 --Apple-Mail=_8A031763-6193-4627-9660-421F69A6DEB5-- --Apple-Mail=_AFEF8533-BD9F-4458-8B08-F9B99E475BE1 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIzBAEBCgAdFiEERvQn3i5iUQoCDew4lRrK1qSO/JEFAmO6piYACgkQlRrK1qSO /JEO7hAAtP2SdKJpDStRH31VdFqgYn8evXWH32y4sTb3GP9KHDMhnqF/7hHE7ZwJ +uPi2zL1qXxJyZPbE+Lw8i+lEMbaBd4lNxJANya06W6ubvSenOoovJZ1AD1aCyeW zXFe8MNDmtP5rU9TQBTrBUZdGIU4qc9Xxpmu0O/3e+OxoxXdSQ5wfhScm/zQ1z8z u7EyukVq48jP0gcVDTqb6shDc1YQE6Wi1tmy+OYImhAxWvpm9kBYo1Balw9oh/34 yePCiOtsB1mgnLRg9tih2Uoy1nrrlU4y7kT/oTOy/P5XUSvGOUJ4c42It5nmeBYf YGkOD0svKoEScD+Xl1BZQTW1luBWb6mx4P2HKxEQcQjQFNTT49NvD0voxoN/U355 ITX4RwIQYvRXHDi9Ye15p+wbpv1tztmZd0R0lz5yx/hv0tAkwg4WOGl1HYu8yb8r dDL0ArXBnk+KjozvtXgp6jDxsVqJdHT95V6EgkansQiCClRLwJZ5bAIOvggdbFkx /uj+rkUXkXOkjcvE/Bu8UM2utmtp8yKRp9k9hCc6DRRQSTNCb6CwGy6e3MYEw06k k4wf9RGuq/1YPDQhmz+JnIT0P580Bmka8QiLfisUfJ175E6d7hBz/K1t+azoN5t+ xrcPu1oZH+gaZcG7b0vmkVydbXn667MioJ1NXJYA8I/gmGdVGNo= =QLuI -----END PGP SIGNATURE----- --Apple-Mail=_AFEF8533-BD9F-4458-8B08-F9B99E475BE1--