emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Felipe Lema <felipelema@mortemale.org>
To: yantar92@gmail.com, emacs-orgmode@gnu.org
Subject: Re: Report error in scheme evaluation
Date: Mon, 27 Dec 2021 22:03:09 -0300	[thread overview]
Message-ID: <19770238.jTK1MqpFJm@felipe-thinkpad-x200> (raw)

[-- Attachment #1: Type: text/plain, Size: 172 bytes --]

I just realized I was un-CCed out of the thread

Here's the updated patch with the requested changes (actually single one)

Lemme know if I'm missing anything else.

Felipe

[-- Attachment #2: org-babel-scheme-show-error-in-buffer_updated_req.diff --]
[-- Type: text/x-patch, Size: 2025 bytes --]

diff --git a/lisp/org/ob-scheme.el b/lisp/org/ob-scheme.el
index f4836b23fe..8720bd099e 100644
--- a/lisp/org/ob-scheme.el
+++ b/lisp/org/ob-scheme.el
@@ -39,6 +39,7 @@
 
 ;;; Code:
 (require 'ob)
+(require 'subr-x)
 (require 'geiser nil t)
 (require 'geiser-impl nil t)
 (defvar geiser-repl--repl)             ; Defined in geiser-repl.el
@@ -58,6 +59,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 +182,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)

             reply	other threads:[~2021-12-28  1:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-28  1:03 Felipe Lema [this message]
2022-04-30  8:11 ` Report error in scheme evaluation Ihor Radchenko
2022-04-30 10:35   ` Neil Jerram
2022-05-04  2:52     ` Felipe Lema
  -- strict thread matches above, loose matches on Subject: below --
2021-12-21 19:58 Felipe Lema
2021-12-21 23:07 ` Rudolf Adamkovič
2021-12-22  5:27   ` Felipe Lema
2021-12-23 21:01     ` Rudolf Adamkovič
2021-12-22 14:54 ` Ihor Radchenko
2021-12-22 16:56   ` Felipe Lema
2021-12-22 14:58 ` Ihor Radchenko
2021-12-22 16:34 ` Max Nikulin
2021-12-22 17:04   ` Ihor Radchenko
2022-09-12 11:27 ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19770238.jTK1MqpFJm@felipe-thinkpad-x200 \
    --to=felipelema@mortemale.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).