1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-22 07:09:47 +00:00

ob-core: allow language specific header arguments in properties

* lisp/ob-core.el (org-babel-insert-header-arg,
  org-babel-parse-src-block-match): Replace `if' with empty else part
  by `when' for readability.  (org-babel-params-from-properties):
  Inquire for language specific and default header properties.
  Language specific header properties take precedence over default
  header properties and old-style header property specifications.

This allows for header arguments to be specified as
properties (including inheritance).

#+PROPERTY: header-args :cache "no"
#+PROPERTY: header-args:R :session "*R-property*"

:PROPERTIES:
:header-args:   :cache "yes"
:header-args:R: :session "*R-drawer*"
:END:
This commit is contained in:
Achim Gratz 2013-06-07 22:19:38 +02:00
parent 2e4bcfc50d
commit 693dda67e6

View File

@ -766,7 +766,7 @@ arguments and pop open the results in a preview buffer."
(lang-headers (intern (concat "org-babel-header-args:" lang)))
(headers (org-babel-combine-header-arg-lists
org-babel-common-header-args-w-values
(if (boundp lang-headers) (eval lang-headers) nil)))
(when (boundp lang-headers) (eval lang-headers))))
(arg (org-icompleting-read
"Header Arg: "
(mapcar
@ -1294,23 +1294,35 @@ portions of results lines."
Return an association list of any source block params which
may be specified in the properties of the current outline entry."
(save-match-data
(let (val sym)
(org-babel-parse-multiple-vars
(delq nil
(mapcar
(lambda (header-arg)
(and (setq val (org-entry-get (point) header-arg t))
(cons (intern (concat ":" header-arg))
(org-babel-read val))))
(mapcar
#'symbol-name
(mapcar
#'car
(org-babel-combine-header-arg-lists
org-babel-common-header-args-w-values
(progn
(setq sym (intern (concat "org-babel-header-args:" lang)))
(and (boundp sym) (eval sym))))))))))))
(let* ((lang-props
(save-match-data
(org-babel-parse-header-arguments
(org-entry-get (point) (concat "header-args:" lang)
'inherit))))
(default-props
(save-match-data
(org-babel-parse-header-arguments
(org-entry-get (point) "header-args"
'inherit))))
(props
(let (val sym)
(org-babel-parse-multiple-vars
(delq nil
(mapcar
(lambda (header-arg)
(and (setq val (org-entry-get (point) header-arg t))
(cons (intern (concat ":" header-arg))
(org-babel-read val))))
(mapcar
#'symbol-name
(mapcar
#'car
(org-babel-combine-header-arg-lists
org-babel-common-header-args-w-values
(progn
(setq sym (intern (concat "org-babel-header-args:" lang)))
(and (boundp sym) (eval sym))))))))))))
(org-babel-merge-params props default-props lang-props))))
(defvar org-src-preserve-indentation)
(defun org-babel-parse-src-block-match ()
@ -1338,7 +1350,7 @@ may be specified in the properties of the current outline entry."
(buffer-string)))
(org-babel-merge-params
org-babel-default-header-args
(if (boundp lang-headers) (eval lang-headers) nil)
(when (boundp lang-headers) (eval lang-headers))
(org-babel-params-from-properties lang)
(org-babel-parse-header-arguments
(org-no-properties (or (match-string 4) ""))))