summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2013-07-26 17:48:51 (GMT)
committer Eric Schulte <schulte.eric@gmail.com>2013-07-27 00:53:13 (GMT)
commit3142297d69f6063221215757a3ba9c74adcf3e43 (patch)
tree8126bd0482c941e476210accda13971636382e4b
parent08cffc1c241bdf47b2132d7db98bcad34789f3d3 (diff)
downloadorg-mode-3142297d69f6063221215757a3ba9c74adcf3e43.zip
org-mode-3142297d69f6063221215757a3ba9c74adcf3e43.tar.gz
delete colnames/rownames for replaced variables
Thanks to Rick Frankel for help debugging this problem. * lisp/ob-core.el (org-babel-merge-params): When merging parameters, if a variable is replaced with a new value, then delete colnames/rownames for the original value of that variable.
-rw-r--r--lisp/ob-core.el40
1 files changed, 29 insertions, 11 deletions
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index b213c2a..c2722db 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2269,7 +2269,8 @@ parameters when merging lists."
new-params))
result-params)
output)))
- params results exports tangle noweb cache vars shebang comments padline)
+ params results exports tangle noweb cache vars shebang comments padline
+ clearnames)
(mapc
(lambda (plist)
@@ -2286,21 +2287,25 @@ parameters when merging lists."
(setq vars
(append
(if (member name (mapcar #'car vars))
- (delq nil
- (mapcar
- (lambda (p)
- (unless (equal (car p) name) p))
- vars))
+ (progn
+ (push name clearnames)
+ (delq nil
+ (mapcar
+ (lambda (p)
+ (unless (equal (car p) name) p))
+ vars)))
vars)
(list (cons name pair))))
;; if no name is given and we already have named variables
;; then assign to named variables in order
(if (and vars (nth variable-index vars))
- (prog1 (setf (cddr (nth variable-index vars))
- (concat (symbol-name
- (car (nth variable-index vars)))
- "=" (cdr pair)))
- (incf variable-index))
+ (let ((name (car (nth variable-index vars))))
+ (push name clearnames) ; clear out colnames
+ ; and rownames
+ ; for replace vars
+ (prog1 (setf (cddr (nth variable-index vars))
+ (concat (symbol-name name) "=" (cdr pair)))
+ (incf variable-index)))
(error "Variable \"%s\" must be assigned a default value"
(cdr pair))))))
(:results
@@ -2347,6 +2352,19 @@ parameters when merging lists."
plists)
(setq vars (reverse vars))
(while vars (setq params (cons (cons :var (cddr (pop vars))) params)))
+ ;; clear out col-names and row-names for replaced variables
+ (mapc
+ (lambda (name)
+ (mapc
+ (lambda (param)
+ (setf (cdr (assoc param params))
+ (remove-if (lambda (pair) (equal (car pair) name))
+ (cdr (assoc param params))))
+ (setf params (remove-if (lambda (pair) (and (equal (car pair) param)
+ (null (cdr pair))))
+ params)))
+ (list :colname-names :rowname-names)))
+ clearnames)
(mapc
(lambda (hd)
(let ((key (intern (concat ":" (symbol-name hd))))