Merge branch 'master' into gnuplot

Conflicts:
	org-babel.org
moved org-babel-merge-results into anonymous function in flet

correctly handling exclusive :exports params
This commit is contained in:
Eric Schulte 2009-07-18 14:24:02 -06:00
commit 62d6601b6e
2 changed files with 81 additions and 48 deletions

View File

@ -476,48 +476,48 @@ non-nil."
elements of PLISTS override the values of previous element. This
takes into account some special considerations for certain
parameters when merging lists."
(let (params results vars var ref)
(mapc (lambda (plist)
(mapc (lambda (pair)
(case (car pair)
(:var
;; we want only one specification per variable
(when (string-match "^\\([^= \f\t\n\r\v]+\\)[ \t]*=[ \t]*\\([^\f\n\r\v]+\\)$" (cdr pair))
;; TODO: When is this not true?
(setq var (intern (match-string 1 (cdr pair)))
ref (match-string 2 (cdr pair))
vars (cons (cons var ref) (assq-delete-all var vars)))))
(:results
;; maintain list of unique :results specifications
(setq results (org-babel-merge-results results (split-string (cdr pair)))))
(t
;; replace: this covers e.g. :session
(setq params (cons pair (assq-delete-all (car pair) params))))))
plist))
plists)
(let (params results exports vars var ref)
(flet ((e-merge (exclusive-groups &rest result-params)
;; maintain exclusivity of mutually exclusive parameters
(let (output)
(mapc (lambda (new-params)
(mapc (lambda (new-param)
(mapc (lambda (exclusive-group)
(when (member new-param exclusive-group)
(mapcar (lambda (excluded-param)
(setq output (delete excluded-param output)))
exclusive-group)))
exclusive-groups)
(setq output (org-uniquify (cons new-param output))))
new-params))
result-params)
output)))
(mapc (lambda (plist)
(mapc (lambda (pair)
(case (car pair)
(:var
;; we want only one specification per variable
(when (string-match "^\\([^= \f\t\n\r\v]+\\)[ \t]*=[ \t]*\\([^\f\n\r\v]+\\)$" (cdr pair))
;; TODO: When is this not true?
(setq var (intern (match-string 1 (cdr pair)))
ref (match-string 2 (cdr pair))
vars (cons (cons var ref) (assq-delete-all var vars)))))
(:results
(setq results (e-merge '(("file" "vector" "scalar")
("replace" "silent"))
results (split-string (cdr pair)))))
(:exports
(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))))))
plist))
plists))
(setq vars (mapcar (lambda (pair) (format "%s=%s" (car pair) (cdr pair))) vars))
(while vars (setq params (cons (cons :var (pop vars)) params)))
(cons (cons :results (mapconcat 'identity results " ")) params)))
(defun org-babel-merge-results (&rest result-params)
"Combine all result parameter lists in RESULT-PARAMS taking
into account the fact that some groups of result params are
mutually exclusive."
(let ((exclusive-groups '(("file" "vector" "scalar")
("replace" "silent")))
output)
(mapc (lambda (new-params)
(mapc (lambda (new-param)
(mapc (lambda (exclusive-group)
(when (member new-param exclusive-group)
(mapcar (lambda (excluded-param)
(setq output (delete excluded-param output)))
exclusive-group)))
exclusive-groups)
(setq output (org-uniquify (cons new-param output))))
new-params))
result-params)
output))
(cons (cons :exports (mapconcat 'identity exports " "))
(cons (cons :results (mapconcat 'identity results " "))
params))))
(defun org-babel-clean-text-properties (text)
"Strip all properties from text return."

View File

@ -83,10 +83,15 @@ cd ~ && du -sc * |grep -v total
| 1264 | "tools" |
#+srcname: directory-pie
#+begin_src R :var dirs = directories
#+begin_src R :var dirs = directories :session R-pie-example
pie(dirs[,1], labels = dirs[,2])
#+end_src
*** operations in/on tables
#+tblname: grades-table
@ -199,7 +204,7 @@ would then be [[#sandbox][the sandbox]].
#+end_src
* Tasks [30/50]
* Tasks [31/51]
** PROPOSED optional timestamp for output
Add option to place an (inactive) timestamp at the #+resname, to
record when that output was generated.
@ -228,6 +233,13 @@ would then be [[#sandbox][the sandbox]].
output. Sometimes one will want to see stdout just to check
everything looks OK, and then fold it away.
I'm addressing this in branch 'examplizing-output'.
Yea, that makes sense. (either that or allow folding of large
blocks escaped with =:=).
Proposed cutoff of 10 lines, we can save this value in a user
customizable variable.
** TODO make tangle files read-only?
With a file-local variable setting, yea that makes sense. Maybe
the header should reference the related org-mode file.
@ -876,6 +888,15 @@ $0
[[file:snippets/org-mode/sb][sb -- snippet]]
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 allow default header arguments by language
org-babel-default-header-args:lang-name
@ -2059,7 +2080,17 @@ to specify a file holding the results
(see [[* file result types][file result types]])
* Bugs [19/30]
* Bugs [20/31]
** TODO prompt characters appearing in output with R
#+begin_src R :session *R* :results output
x <- 6
y <- 8
3
#+end_src
#+resname:
: > [1] 3
** TODO o-b-execute-subtree overwrites heading when subtree is folded
*** Example
Try M-x org-babel-execute-subtree with the subtree folded and
@ -2096,11 +2127,6 @@ even a third"
#+end_src
#+resname: multi-line-string-output
** TODO cursor movement when evaluating source blocks
E.g. the pie chart example. Despite the save-window-excursion in
org-babel-execute:R. (I never learned how to do this properly: org-R
jumps all over the place...)
** PROPOSED external shell execution can't isolate return values
I have no idea how to do this as of yet. The result is that when
@ -2195,6 +2221,13 @@ b=5
set this automatically, and we are SOL without a regexp to match
the prompt.
** DONE cursor movement when evaluating source blocks
E.g. the pie chart example. Despite the save-window-excursion in
org-babel-execute:R. (I never learned how to do this properly: org-R
jumps all over the place...)
I don't see this now [ded]
** DONE LoB: calls fail if reference has single character name
commit 21d058869df1ff23f4f8cc26f63045ac9c0190e2
**** This doesn't work