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