]> git.bundesbrandschatzamt.de Git - emacsconfig.git/commitdiff
ob-eval: display error fix
authorAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Sat, 7 Jan 2023 13:31:28 +0000 (14:31 +0100)
committerAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Sun, 8 Jan 2023 11:18:22 +0000 (12:18 +0100)
as sent as a patch to orgmode.

Signed-off-by: Andreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
elpa/org-9.6/ob-eval.el

index b379264e1489e24a0510ee0d0539d6d5f385a1aa..f4659fe96051e8b59b7dd3a193f265073fd70e9d 100644 (file)
@@ -1,6 +1,6 @@
 ;;; ob-eval.el --- Babel Functions for External Code Evaluation -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2023 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research, comint
 (defvar org-babel-error-buffer-name "*Org-Babel Error Output*")
 (declare-function org-babel-temp-file "ob-core" (prefix &optional suffix))
 
+(defcustom org-babel-eval-error-display-notify nil
+  "Display org-babel-eval-errors always or only if exit code is not 0."
+  :group 'org-babel
+  :version "29.1"
+  :type 'boolean)
+
 (defun org-babel-eval-error-notify (exit-code stderr)
   "Open a buffer to display STDERR and a message with the value of EXIT-CODE."
-  (if (> exit-code 0)
-      (let ((buf (get-buffer-create org-babel-error-buffer-name)))
+  (let ((buf (get-buffer-create org-babel-error-buffer-name)))
     (with-current-buffer buf
       (goto-char (point-max))
       (save-excursion
         (unless (bolp) (insert "\n"))
         (insert stderr)
         (insert (format "[ Babel evaluation exited with code %S ]" exit-code))))
-    (display-buffer buf)))
+    (when (or org-babel-eval-error-display-notify
+            (or (not (numberp exit-code))
+            (> exit-code 0)))
+        (display-buffer buf)))
   (message "Babel evaluation exited with code %S" exit-code))
 
 (defun org-babel-eval (command query)