Merge branch 'master' into sql-support

This commit is contained in:
Eric Schulte 2009-08-01 18:24:28 -06:00
commit 9537047b14
3 changed files with 59 additions and 16 deletions

View File

@ -159,7 +159,7 @@ Optionally supply a value for INFO in the form returned by
Optionally supply a value for PARAMS which will be merged with
the header arguments specified at the source code block."
(interactive)
(message "supplied params=%S" params)
;; (message "supplied params=%S" params) ;; debugging
(let* ((info (or info (org-babel-get-src-block-info)))
(lang (first info))
(body (second info))
@ -170,7 +170,7 @@ the header arguments specified at the source code block."
(result-type (fourth processed-params))
(cmd (intern (concat "org-babel-execute:" lang)))
result)
(message "params=%S" params) ;; debugging statement
;; (message "params=%S" params) ;; debugging statement
(unless (member lang org-babel-interpreters)
(error "Language is not in `org-babel-interpreters': %s" lang))
(when arg (setq result-params (cons "silent" result-params)))
@ -247,7 +247,7 @@ concerned with creating elisp versions of results. "
(if (and (member "vector" result-params) (not (listp result)))
(list (list result))
result))
result))
(defun org-babel-execute-buffer (&optional arg)
"Replace EVAL snippets in the entire buffer."
@ -314,6 +314,19 @@ of the following form. (language body header-arguments-alist)"
(save-match-data ,@body)
(goto-char (match-end 0)))))
(defun org-babel-params-from-properties ()
"Return an association list of any source block params which
may be specified in the properties of the current outline entry."
(save-match-data
(delq nil
(mapcar
(lambda (header-arg)
(let ((val (org-entry-get (point) header-arg)))
(when val
;; (message "param-from-property %s=%s" header-arg val) ;; debugging statement
(cons (intern (concat ":" header-arg)) val))))
'("results" "exports" "tangle" "var")))))
(defun org-babel-parse-src-block-match ()
(let* ((lang (org-babel-clean-text-properties (match-string 1)))
(lang-headers (intern (concat "org-babel-default-header-args:" lang))))
@ -321,6 +334,7 @@ of the following form. (language body header-arguments-alist)"
(org-babel-strip-protective-commas (org-babel-clean-text-properties (match-string 4)))
(org-babel-merge-params
org-babel-default-header-args
(org-babel-params-from-properties)
(if (boundp lang-headers) (eval lang-headers) nil)
(org-babel-parse-header-arguments (org-babel-clean-text-properties (or (match-string 3) "")))))))
@ -331,6 +345,7 @@ of the following form. (language body header-arguments-alist)"
(org-babel-strip-protective-commas (org-babel-clean-text-properties (match-string 4)))
(org-babel-merge-params
org-babel-default-inline-header-args
(org-babel-params-from-properties)
(if (boundp lang-headers) (eval lang-headers) nil)
(org-babel-parse-header-arguments (org-babel-clean-text-properties (or (match-string 3) "")))))))

View File

@ -207,7 +207,7 @@ would then be [[#sandbox][the sandbox]].
#+end_src
* Tasks [40/61]
* Tasks [41/61]
** PROPOSED raise elisp error when source-blocks return errors
Not sure how/if this would work, but it may be desirable.
@ -257,18 +257,6 @@ but with preference given to
With a file-local variable setting, yea that makes sense. Maybe
the header should reference the related org-mode file.
** TODO take default values for header args from properties
Use file-wide and subtree wide properties to set default values for
header args.
[DED] One thing I'm finding when working with R is that an org file
may contain many source blocks, but that I just want to evaluate a
subset of them. Typically this is in order to take up where I left
off: I need to recreate a bunch of variables in the session
environment. I'm thinking maybe we want to use a tag-based
mechanism similar to :export: and :noexport: to control evaluation
on a per-subtree basis.
** TODO support for working with =*Org Edit Src Example*= buffers [4/6]
*** STARTED Patch against org source.
I've worked on several related changes to source code edit buffer
@ -1140,6 +1128,36 @@ to the command if BUFF is not given.)
2) The function is called inside of a =write.table= function call
writing the results to a table
3) The table is read using =org-table-import=
** DONE take default values for header args from properties
Use file-wide and subtree wide properties to set default values for
header args.
[DED] One thing I'm finding when working with R is that an org file
may contain many source blocks, but that I just want to evaluate a
subset of them. Typically this is in order to take up where I left
off: I need to recreate a bunch of variables in the session
environment. I'm thinking maybe we want to use a tag-based
mechanism similar to :export: and :noexport: to control evaluation
on a per-subtree basis.
*** test-header with properties
:PROPERTIES:
:tangle: yes
:var: def=8
:END:
Ahh... as is so often the case, just had to wrap
`org-babel-params-from-properties' in a `save-match-data' form.
#+tblname: why-def-props-cause-probs
| 1 | 2 | 3 | 4 |
#+srcname: default-props-implementation
#+begin_src emacs-lisp :tangle no :var my-lis=why-def-props-cause-probs :results silent
(+ (length my-lis) def)
#+end_src
** DONE new reference syntax *inside* source code blocks
This is from an email discussion on the org-mode mailing list with
Sébastien. The goal here is to mimic the source-block reference style

View File

@ -96,3 +96,13 @@ plus_two(holder)
#+begin_src emacs-lisp :tangle no
(setq test-tangle-i-should-not-exist "hopefully I'm not included")
#+end_src
*** Emacs Lisp (not to be tangled)
:PROPERTIES:
:tangle: no
:END:
#+srcname: i-also-shouldnt-be-tangled
#+begin_src emacs-lisp
(setq test-tangle-me-either "i also shouldn't be tangled")
#+end_src