From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id gB7hDD8ywmFYPQEAgWs5BA (envelope-from ) for ; Tue, 21 Dec 2021 20:59:59 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id OIVYCD8ywmFiTwAAbx9fmQ (envelope-from ) for ; Tue, 21 Dec 2021 19:59:59 +0000 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 E976D25AAF for ; Tue, 21 Dec 2021 20:59:58 +0100 (CET) Received: from localhost ([::1]:60554 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzlIj-0002YB-Lp for larch@yhetil.org; Tue, 21 Dec 2021 14:59:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40256) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzlI1-0002VS-Ur for emacs-orgmode@gnu.org; Tue, 21 Dec 2021 14:59:14 -0500 Received: from devianza.investici.org ([198.167.222.108]:39715) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzlHz-0007G5-Bc for emacs-orgmode@gnu.org; Tue, 21 Dec 2021 14:59:13 -0500 Received: from mx2.investici.org (unknown [127.0.0.1]) by devianza.investici.org (Postfix) with ESMTP id 4JJS2T6l22z6vH1 for ; Tue, 21 Dec 2021 19:58:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mortemale.org; s=stigmate; t=1640116737; bh=TVqy9gFnjtmQs7TaW+c13hKbG862EdSseLnCImjyi1w=; h=From:To:Subject:Date:From; b=RpIE/LMxuWFSqHRh4UcX/Gr8IKDQEgRrXdB6dPZAIF42h2suJtSL2HGIbZbxL9muv 5c2peNH/MOF9xFXrrllhaD/jIDd6rmeZefZBuuNVrsZmgYB3UYoG46zHeWGKcL0sfZ 0oUXnUpKdzS6ANtVn5dN5u9kB9myD1pLtiTnLMU8= Received: from [198.167.222.108] (mx2.investici.org [198.167.222.108]) (Authenticated sender: felipelema@mortemale.org) by localhost (Postfix) with ESMTPSA id 4JJS2T31qVz6vGy for ; Tue, 21 Dec 2021 19:58:57 +0000 (UTC) From: Felipe Lema To: emacs-orgmode@gnu.org Subject: Report error in scheme evaluation Date: Tue, 21 Dec 2021 16:58:52 -0300 Message-ID: <4237997.1UI0SyaRfJ@felipe-thinkpad-x200> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart3682733.k3LaEa0P3J" Content-Transfer-Encoding: 7Bit Received-SPF: pass client-ip=198.167.222.108; envelope-from=felipelema@mortemale.org; helo=devianza.investici.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1640116799; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=TVqy9gFnjtmQs7TaW+c13hKbG862EdSseLnCImjyi1w=; b=YH4xQVRhWrJFyUkCCGDlM2Jtu+jUD+2FkaxtbHX8NVAhzld6n3V3wY4/dUywZt2netRe12 pK/ruA+NzjvIrfhTCM3hPNOT9s02QfuNE/9tmoSTegMmvvR9jTByI2lqvGKYUqBmGv8zD9 kdmup6lBt21L3lGUdpqOi2L/vSawcd8Ia9xXr3HbKavrXzIcyTQp2w15OA6XxGTXgCj1lC DIq6kLEjOj5N90Buph9BuVjNYww8fv3JOL9jtefJUSs9q7KJVTNRGpdBAVDHu+SAsJgxzd IRY7kq5JsPjNgbTFmG+b4kxgVR62SmKM2v7LClbxsjUEaBDOlaLBD0Fco2nbag== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1640116799; a=rsa-sha256; cv=none; b=I+ax76xFxmr9yzhZZdyD+oCkhmqhTqxZU+zTVBefzgJnl80rZERhPS/FEizJg4pKWN4EED GOqNEjB4K+MkPBcMGWGDoEMXf4d30QAM+uPgWX5EPkmYwFvE5Hjn6V1f1p28ZJTOB8bTFZ qX3yaZqfrhj6O+ODjSvNscLgDboRqxnvuXF5zU9l4aGR+vl8cjn0slofj17qVp+k+cMt1p zm/x3g31oSWIl/z/kybfSkfke6F3Dn+HweyaQ4B6ZCAsCpr2fJ0xl8g2VKwhCj0VGIaH/z hrhYeqhc0ASuzwctsKvRtrGy1J5pW4/auD/9ETUeJ9ePQx6NOf3pyo3b+eJ2mw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=mortemale.org header.s=stigmate header.b="RpIE/LMx"; dmarc=pass (policy=reject) header.from=mortemale.org; 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" X-Migadu-Spam-Score: -4.73 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=mortemale.org header.s=stigmate header.b="RpIE/LMx"; dmarc=pass (policy=reject) header.from=mortemale.org; 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" X-Migadu-Queue-Id: E976D25AAF X-Spam-Score: -4.73 X-Migadu-Scanner: scn0.migadu.com X-TUID: 2AxZG8gh0cRJ This is a multi-part message in MIME format. --nextPart3682733.k3LaEa0P3J Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sup, y'all I started using guile with Org Babel and I was a little confused that errors weren't being reported. The attached patch will report the error the same way as python evaluation does. Actually, most of the code was taken from ob-python.el Let me know if I'm missing anything so this can be merged. It is correct to report errors this way, right? Felipe --nextPart3682733.k3LaEa0P3J Content-Disposition: attachment; filename="org-babel-scheme-show-error-in-buffer.diff" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="org-babel-scheme-show-error-in-buffer.diff" report error in scheme dialect evaluation to user * ob-scheme.el (org-babel-scheme-execute-with-geiser): paste error into `org-babel-error-buffer-name` and setup buffer to compilation-mode diff --git a/lisp/org/ob-scheme.el b/lisp/org/ob-scheme.el index f4836b23fe..2828464bb5 100644 --- a/lisp/org/ob-scheme.el +++ b/lisp/org/ob-scheme.el @@ -58,6 +58,7 @@ geiser-repl-window-allow-split (declare-function geiser-repl-exit "ext:geiser-repl" (&optional arg)) (declare-function geiser-eval--retort-output "ext:geiser-eval" (ret)) (declare-function geiser-eval--retort-result-str "ext:geiser-eval" (ret prefix)) +(declare-function geiser-eval--retort-error "ext:geiser-eval" (ret)) (defcustom org-babel-scheme-null-to 'hline "Replace `null' and empty lists in scheme tables with this before returning." @@ -180,8 +181,20 @@ org-babel-scheme-execute-with-geiser (setq result (if output (or (geiser-eval--retort-output ret) "Geiser Interpreter produced no output") - (geiser-eval--retort-result-str ret ""))))) - (when (not repl) + (geiser-eval--retort-result-str ret ""))) + (when-let* ((err (geiser-eval--retort-error ret))) + ;; there was an error, report it! + (org-babel-eval-error-notify + -1 ;; filler value, anything non-zero should do + (geiser-eval--retort-output ret)) + (save-excursion + (when (get-buffer org-babel-error-buffer-name) + (with-current-buffer org-babel-error-buffer-name + (unless (derived-mode-p 'compilation-mode) + (compilation-mode)) + ;; Compilation-mode enforces read-only, but Babel expects the buffer modifiable. + (setq buffer-read-only nil))))))) + (when (not repl) (save-current-buffer (set-buffer repl-buffer) (geiser-repl-exit)) (set-process-query-on-exit-flag (get-buffer-process repl-buffer) nil) --nextPart3682733.k3LaEa0P3J--