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>
This commit is contained in:
parent
eecee22665
commit
14878f3f9a
|
@ -2989,24 +2989,27 @@ Otherwise return nil."
|
||||||
(defun org-babel-import-elisp-from-file (file-name &optional separator)
|
(defun org-babel-import-elisp-from-file (file-name &optional separator)
|
||||||
"Read the results located at FILE-NAME into an elisp table.
|
"Read the results located at FILE-NAME into an elisp table.
|
||||||
If the table is trivial, then return it as a scalar."
|
If the table is trivial, then return it as a scalar."
|
||||||
(save-window-excursion
|
(let ((result
|
||||||
(let ((result
|
(with-temp-buffer
|
||||||
(with-temp-buffer
|
(condition-case err
|
||||||
(condition-case err
|
(progn
|
||||||
(progn
|
(org-table-import file-name separator)
|
||||||
(org-table-import file-name separator)
|
(delete-file file-name)
|
||||||
(delete-file file-name)
|
(delq nil
|
||||||
(delq nil
|
(mapcar (lambda (row)
|
||||||
(mapcar (lambda (row)
|
(and (not (eq row 'hline))
|
||||||
(and (not (eq row 'hline))
|
(mapcar #'org-babel-string-read row)))
|
||||||
(mapcar #'org-babel-string-read row)))
|
(org-table-to-lisp))))
|
||||||
(org-table-to-lisp))))
|
(error
|
||||||
(error (message "Error reading results: %s" err) nil)))))
|
(display-warning 'org-babel
|
||||||
(pcase result
|
(format "Error reading results: %S" err)
|
||||||
(`((,scalar)) scalar)
|
:error)
|
||||||
(`((,_ ,_ . ,_)) result)
|
nil)))))
|
||||||
(`(,scalar) scalar)
|
(pcase result
|
||||||
(_ result)))))
|
(`((,scalar)) scalar)
|
||||||
|
(`((,_ ,_ . ,_)) result)
|
||||||
|
(`(,scalar) scalar)
|
||||||
|
(_ result))))
|
||||||
|
|
||||||
(defun org-babel-string-read (cell)
|
(defun org-babel-string-read (cell)
|
||||||
"Strip nested \"s from around strings."
|
"Strip nested \"s from around strings."
|
||||||
|
|
Loading…
Reference in New Issue