summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2020-05-21 04:16:40 +0000
committerKyle Meyer <kyle@kyleam.com>2020-05-24 11:56:43 -0400
commit14878f3f9ad72de5d8cf543c44f4f7bedbe0daf6 (patch)
treedb3053b271899affc88f4d3a2f16881cbe729e80
parenteecee226659d210938427a235a0cdba8455fa142 (diff)
downloadorg-mode-14878f3f9ad72de5d8cf543c44f4f7bedbe0daf6.tar.gz
ob-core: Display warning on failure to read results
* lisp/ob-core.el (org-babel-import-elisp-from-file): Show handled errors with display-warning rather than a message because the latter is quickly overridden by subsequent messages, making it difficult if not impossible for the user to spot. The scope of the save-window-excursion call would need to be reduced for the display-warning buffer to be shown, but nothing appears to change the window configuration, so just drop the save-window-excursion call. Reported-by: Greg Minshall <minshall@umich.edu> <2449663.1588516024@apollo2.minshall.org>
-rw-r--r--lisp/ob-core.el39
1 files changed, 21 insertions, 18 deletions
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 2471857..a61877e 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2989,24 +2989,27 @@ Otherwise return nil."
(defun org-babel-import-elisp-from-file (file-name &optional separator)
"Read the results located at FILE-NAME into an elisp table.
If the table is trivial, then return it as a scalar."
- (save-window-excursion
- (let ((result
- (with-temp-buffer
- (condition-case err
- (progn
- (org-table-import file-name separator)
- (delete-file file-name)
- (delq nil
- (mapcar (lambda (row)
- (and (not (eq row 'hline))
- (mapcar #'org-babel-string-read row)))
- (org-table-to-lisp))))
- (error (message "Error reading results: %s" err) nil)))))
- (pcase result
- (`((,scalar)) scalar)
- (`((,_ ,_ . ,_)) result)
- (`(,scalar) scalar)
- (_ result)))))
+ (let ((result
+ (with-temp-buffer
+ (condition-case err
+ (progn
+ (org-table-import file-name separator)
+ (delete-file file-name)
+ (delq nil
+ (mapcar (lambda (row)
+ (and (not (eq row 'hline))
+ (mapcar #'org-babel-string-read row)))
+ (org-table-to-lisp))))
+ (error
+ (display-warning 'org-babel
+ (format "Error reading results: %S" err)
+ :error)
+ nil)))))
+ (pcase result
+ (`((,scalar)) scalar)
+ (`((,_ ,_ . ,_)) result)
+ (`(,scalar) scalar)
+ (_ result))))
(defun org-babel-string-read (cell)
"Strip nested \"s from around strings."