babel: check properties for language-specific header arguments
* contrib/babel/lisp/org-babel.el (org-babel-params-from-properties): Check for language-specific header arguments (org-babel-parse-src-block-match): Pass lang parameter when checking properties for header args (org-babel-parse-inline-src-block-match): Pass lang parameter when checking properties for header args
This commit is contained in:
parent
59badeeaaf
commit
71cd358e21
|
@ -571,21 +571,27 @@ with C-c C-c."
|
||||||
(goto-char (match-end 0))))
|
(goto-char (match-end 0))))
|
||||||
(unless visited-p (kill-buffer (file-name-nondirectory ,file)))))
|
(unless visited-p (kill-buffer (file-name-nondirectory ,file)))))
|
||||||
|
|
||||||
(defun org-babel-params-from-properties ()
|
(defun org-babel-params-from-properties (&optional lang)
|
||||||
"Return an association list of any source block params which
|
"Return an association list of any source block params which
|
||||||
may be specified in the properties of the current outline entry."
|
may be specified in the properties of the current outline entry."
|
||||||
(save-match-data
|
(save-match-data
|
||||||
(delq nil
|
(let (val sym)
|
||||||
(mapcar
|
(delq nil
|
||||||
(lambda (header-arg)
|
(mapcar
|
||||||
(let ((val (or (condition-case nil
|
(lambda (header-arg)
|
||||||
(org-entry-get (point) header-arg t)
|
(and (setq val
|
||||||
(error nil))
|
(or (condition-case nil
|
||||||
(cdr (assoc header-arg org-file-properties)))))
|
(org-entry-get (point) header-arg t)
|
||||||
(when val
|
(error nil))
|
||||||
;; (message "prop %s=%s" header-arg val) ;; debugging
|
(cdr (assoc header-arg org-file-properties))))
|
||||||
(cons (intern (concat ":" header-arg)) val))))
|
(cons (intern (concat ":" header-arg)) val)))
|
||||||
(mapcar 'symbol-name org-babel-header-arg-names)))))
|
(mapcar
|
||||||
|
'symbol-name
|
||||||
|
(append
|
||||||
|
org-babel-header-arg-names
|
||||||
|
(progn
|
||||||
|
(setq sym (intern (concat "org-babel-header-arg-names:" lang)))
|
||||||
|
(and (boundp sym) (eval sym))))))))))
|
||||||
|
|
||||||
(defun org-babel-parse-src-block-match ()
|
(defun org-babel-parse-src-block-match ()
|
||||||
(let* ((lang (org-babel-clean-text-properties (match-string 1)))
|
(let* ((lang (org-babel-clean-text-properties (match-string 1)))
|
||||||
|
@ -603,7 +609,7 @@ may be specified in the properties of the current outline entry."
|
||||||
(buffer-string)))
|
(buffer-string)))
|
||||||
(org-babel-merge-params
|
(org-babel-merge-params
|
||||||
org-babel-default-header-args
|
org-babel-default-header-args
|
||||||
(org-babel-params-from-properties)
|
(org-babel-params-from-properties lang)
|
||||||
(if (boundp lang-headers) (eval lang-headers) nil)
|
(if (boundp lang-headers) (eval lang-headers) nil)
|
||||||
(org-babel-parse-header-arguments
|
(org-babel-parse-header-arguments
|
||||||
(org-babel-clean-text-properties (or (match-string 3) ""))))
|
(org-babel-clean-text-properties (or (match-string 3) ""))))
|
||||||
|
@ -617,7 +623,7 @@ may be specified in the properties of the current outline entry."
|
||||||
(org-babel-clean-text-properties (match-string 5)))
|
(org-babel-clean-text-properties (match-string 5)))
|
||||||
(org-babel-merge-params
|
(org-babel-merge-params
|
||||||
org-babel-default-inline-header-args
|
org-babel-default-inline-header-args
|
||||||
(org-babel-params-from-properties)
|
(org-babel-params-from-properties lang)
|
||||||
(if (boundp lang-headers) (eval lang-headers) nil)
|
(if (boundp lang-headers) (eval lang-headers) nil)
|
||||||
(org-babel-parse-header-arguments
|
(org-babel-parse-header-arguments
|
||||||
(org-babel-clean-text-properties (or (match-string 4) "")))))))
|
(org-babel-clean-text-properties (or (match-string 4) "")))))))
|
||||||
|
|
Loading…
Reference in New Issue