summaryrefslogtreecommitdiff
path: root/lisp/ob-table.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/ob-table.el')
-rw-r--r--lisp/ob-table.el53
1 files changed, 27 insertions, 26 deletions
diff --git a/lisp/ob-table.el b/lisp/ob-table.el
index 8b3e36d..c71bb87 100644
--- a/lisp/ob-table.el
+++ b/lisp/ob-table.el
@@ -60,7 +60,7 @@ character and replace it with ellipses."
(concat (substring string 0 (match-beginning 0))
(if (match-string 1 string) "...")) string))
-(defmacro sbe (source-block &rest variables)
+(defmacro sbe (source-block &rest variables) ;FIXME: Namespace prefix!
"Return the results of calling SOURCE-BLOCK with VARIABLES.
Each element of VARIABLES should be a two
element list, whose first element is the name of the variable and
@@ -85,6 +85,7 @@ as shown in the example below.
| 1 | 2 | :file nothing.png | nothing.png |
#+TBLFM: @1$4='(sbe test-sbe $3 (x $1) (y $2))"
+ (declare (debug (form form)))
(let* ((header-args (if (stringp (car variables)) (car variables) ""))
(variables (if (stringp (car variables)) (cdr variables) variables)))
(let* (quote
@@ -107,31 +108,31 @@ as shown in the example below.
variables)))
(unless (stringp source-block)
(setq source-block (symbol-name source-block)))
- ((lambda (result)
- (org-babel-trim (if (stringp result) result (format "%S" result))))
- (if (and source-block (> (length source-block) 0))
- (let ((params
- (eval `(org-babel-parse-header-arguments
- (concat
- ":var results="
- ,source-block
- "[" ,header-args "]"
- "("
- (mapconcat
- (lambda (var-spec)
- (if (> (length (cdr var-spec)) 1)
- (format "%S='%S"
- (car var-spec)
- (mapcar #'read (cdr var-spec)))
- (format "%S=%s"
- (car var-spec) (cadr var-spec))))
- ',variables ", ")
- ")")))))
- (org-babel-execute-src-block
- nil (list "emacs-lisp" "results" params)
- '((:results . "silent"))))
- "")))))
-(def-edebug-spec sbe (form form))
+ (let ((result
+ (if (and source-block (> (length source-block) 0))
+ (let ((params
+ ;; FIXME: Why `eval'?!?!?
+ (eval `(org-babel-parse-header-arguments
+ (concat
+ ":var results="
+ ,source-block
+ "[" ,header-args "]"
+ "("
+ (mapconcat
+ (lambda (var-spec)
+ (if (> (length (cdr var-spec)) 1)
+ (format "%S='%S"
+ (car var-spec)
+ (mapcar #'read (cdr var-spec)))
+ (format "%S=%s"
+ (car var-spec) (cadr var-spec))))
+ ',variables ", ")
+ ")")))))
+ (org-babel-execute-src-block
+ nil (list "emacs-lisp" "results" params)
+ '((:results . "silent"))))
+ "")))
+ (org-babel-trim (if (stringp result) result (format "%S" result)))))))
(provide 'ob-table)