correctly handling exclusive :exports params

This commit is contained in:
Eric Schulte 2009-07-18 14:24:02 -06:00
parent 44ff72261c
commit fcfe110fef
2 changed files with 20 additions and 7 deletions

View File

@ -476,8 +476,9 @@ non-nil."
elements of PLISTS override the values of previous element. This elements of PLISTS override the values of previous element. This
takes into account some special considerations for certain takes into account some special considerations for certain
parameters when merging lists." parameters when merging lists."
(let (params results vars var ref) (let (params results exports vars var ref)
(flet ((e-merge (exclusive-groups &rest result-params) (flet ((e-merge (exclusive-groups &rest result-params)
;; maintain exclusivity of mutually exclusive parameters
(let (output) (let (output)
(mapc (lambda (new-params) (mapc (lambda (new-params)
(mapc (lambda (new-param) (mapc (lambda (new-param)
@ -502,18 +503,21 @@ parameters when merging lists."
ref (match-string 2 (cdr pair)) ref (match-string 2 (cdr pair))
vars (cons (cons var ref) (assq-delete-all var vars))))) vars (cons (cons var ref) (assq-delete-all var vars)))))
(:results (:results
;; maintain list of unique :results specifications
(setq results (e-merge '(("file" "vector" "scalar") (setq results (e-merge '(("file" "vector" "scalar")
("replace" "silent")) ("replace" "silent"))
results (split-string (cdr pair))))) results (split-string (cdr pair)))))
(t (:exports
;; replace: this covers e.g. :session (setq exports (e-merge '(("code" "results" "both"))
exports (split-string (cdr pair)))))
(t ;; replace: this covers e.g. :session
(setq params (cons pair (assq-delete-all (car pair) params)))))) (setq params (cons pair (assq-delete-all (car pair) params))))))
plist)) plist))
plists)) plists))
(setq vars (mapcar (lambda (pair) (format "%s=%s" (car pair) (cdr pair))) vars)) (setq vars (mapcar (lambda (pair) (format "%s=%s" (car pair) (cdr pair))) vars))
(while vars (setq params (cons (cons :var (pop vars)) params))) (while vars (setq params (cons (cons :var (pop vars)) params)))
(cons (cons :results (mapconcat 'identity results " ")) params))) (cons (cons :exports (mapconcat 'identity exports " "))
(cons (cons :results (mapconcat 'identity results " "))
params))))
(defun org-babel-clean-text-properties (text) (defun org-babel-clean-text-properties (text)
"Strip all properties from text return." "Strip all properties from text return."

View File

@ -204,7 +204,7 @@ would then be [[#sandbox][the sandbox]].
#+end_src #+end_src
* Tasks [30/50] * Tasks [31/51]
** PROPOSED optional timestamp for output ** PROPOSED optional timestamp for output
Add option to place an (inactive) timestamp at the #+resname, to Add option to place an (inactive) timestamp at the #+resname, to
record when that output was generated. record when that output was generated.
@ -888,6 +888,15 @@ $0
[[file:snippets/org-mode/sb][sb -- snippet]] [[file:snippets/org-mode/sb][sb -- snippet]]
waiting for guidance from those more familiar with yasnippets waiting for guidance from those more familiar with yasnippets
** DONE exclusive =exports= params
#+srcname: implement-export-exclusivity
#+begin_src ruby
:this_is_a_test
#+end_src
#+resname:
: :this_is_a_test
** DONE LoB: allow output in buffer ** DONE LoB: allow output in buffer
** DONE allow default header arguments by language ** DONE allow default header arguments by language
org-babel-default-header-args:lang-name org-babel-default-header-args:lang-name