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:
parent
2e4bcfc50d
commit
693dda67e6
|
@ -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,6 +1294,17 @@ 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* ((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
|
||||
|
@ -1311,6 +1322,7 @@ may be specified in the properties of the current outline entry."
|
|||
(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) ""))))
|
||||
|
|
Loading…
Reference in New Issue