|
|
@@ -151,21 +151,23 @@ form. (language body header-arguments-alist)"
|
|
|
current source block. With optional argument REPLACE replace any
|
|
|
existing results currently located after the source block."
|
|
|
(if replace (litorgy-remove-result (listp result)))
|
|
|
- (when (and (stringp result)
|
|
|
- (not (or (string-equal (substring result -1) "\n")
|
|
|
- (string-equal (substring result -1) "\r"))))
|
|
|
- (setq result (concat result "\n")))
|
|
|
- (save-excursion
|
|
|
- (re-search-forward "^#\\+end_src" nil t) (open-line 1) (forward-char 2)
|
|
|
- (if (stringp result)
|
|
|
- (litorgy-examplize-region (point) (progn (insert result) (point)))
|
|
|
- (progn
|
|
|
- (insert ;; for now lets assume the result is a table if it's not a string
|
|
|
- (concat (orgtbl-to-orgtbl
|
|
|
- (if (consp (car result)) result (list result))
|
|
|
- '(:fmt (lambda (cell) (format "%S" cell)))) "\n"))
|
|
|
- (forward-line -1)
|
|
|
- (org-cycle)))))
|
|
|
+ (if (= (length result) 0)
|
|
|
+ (message "no result returned by source block")
|
|
|
+ (when (and (stringp result)
|
|
|
+ (not (or (string-equal (substring result -1) "\n")
|
|
|
+ (string-equal (substring result -1) "\r"))))
|
|
|
+ (setq result (concat result "\n")))
|
|
|
+ (save-excursion
|
|
|
+ (re-search-forward "^#\\+end_src" nil t) (open-line 1) (forward-char 2)
|
|
|
+ (if (stringp result)
|
|
|
+ (litorgy-examplize-region (point) (progn (insert result) (point)))
|
|
|
+ (progn
|
|
|
+ (insert ;; for now lets assume the result is a table if it's not a string
|
|
|
+ (concat (orgtbl-to-orgtbl
|
|
|
+ (if (consp (car result)) result (list result))
|
|
|
+ '(:fmt (lambda (cell) (format "%S" cell)))) "\n"))
|
|
|
+ (forward-line -1)
|
|
|
+ (org-cycle))))))
|
|
|
|
|
|
(defun litorgy-remove-result (&optional table)
|
|
|
"Remove the result following the current source block. If
|