From ab7eff9d9c0968392bd9783d72c56a4023bd10be Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Sun, 23 Oct 2022 12:21:15 +0800 Subject: [PATCH] org-babel-eval-error-notify: Avoid uninformative empty error buffer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lisp/ob-eval.el (org-babel-eval-error-notify): When STDERR is empty, display the exit code in the error buffer rather than empty buffer. Reported-by: Rudolf Adamkovič Link: https://orgmode.org/list/m2czakgpk8.fsf@me.com --- lisp/ob-eval.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/ob-eval.el b/lisp/ob-eval.el index 74d935879..fa27d98a9 100644 --- a/lisp/ob-eval.el +++ b/lisp/ob-eval.el @@ -39,7 +39,11 @@ (let ((buf (get-buffer-create org-babel-error-buffer-name))) (with-current-buffer buf (goto-char (point-max)) - (save-excursion (insert stderr))) + (save-excursion + (insert + (if (string-empty-p stderr) + (format "[ Babel evaluation exited with code %S ]" exit-code) + stderr)))) (display-buffer buf)) (message "Babel evaluation exited with code %S" exit-code))