|
@@ -301,12 +301,13 @@ concerned with creating elisp versions of results. "
|
|
|
|
|
|
(defun org-babel-get-src-block-info (&optional header-vars-only)
|
|
|
"Get information of the current source block.
|
|
|
-Returns a list (language body header-arguments-alist switches
|
|
|
-name). Unless HEADER-VARS-ONLY is non-nil, any variable
|
|
|
+Returns a list
|
|
|
+ (language body header-arguments-alist switches name function-args).
|
|
|
+Unless HEADER-VARS-ONLY is non-nil, any variable
|
|
|
references provided in 'function call style' (i.e. in a
|
|
|
parenthesised argument list following the src block name) are
|
|
|
added to the header-arguments-alist."
|
|
|
- (let ((case-fold-search t) head info)
|
|
|
+ (let ((case-fold-search t) head info args)
|
|
|
(if (setq head (org-babel-where-is-src-block-head))
|
|
|
(save-excursion
|
|
|
(goto-char head)
|
|
@@ -314,12 +315,18 @@ added to the header-arguments-alist."
|
|
|
(forward-line -1)
|
|
|
(when (looking-at "#\\+srcname:[ \t]*\\([^ ()\f\t\n\r\v]+\\)\\(\(\\(.*\\)\)\\|\\)")
|
|
|
(setq info (append info (list (org-babel-clean-text-properties (match-string 1)))))
|
|
|
+ ;; Note that e.g. "name()" and "name( )" result in ((:var . "")).
|
|
|
+ ;; We maintain that behaviour, and the resulting non-nil sixth
|
|
|
+ ;; element is relied upon in org-babel-exp-code to detect a functional-style
|
|
|
+ ;; block in those cases. However, "name" without any
|
|
|
+ ;; parentheses would result in the same thing, so we
|
|
|
+ ;; explicitly avoid that.
|
|
|
+ (if (setq args (match-string 3))
|
|
|
+ (setq info (append info (list (mapcar (lambda (ref) (cons :var ref))
|
|
|
+ (org-babel-ref-split-args args))))))
|
|
|
(unless header-vars-only
|
|
|
(setf (third info)
|
|
|
- (org-babel-merge-params
|
|
|
- (mapcar (lambda (ref) (cons :var ref))
|
|
|
- (org-babel-ref-split-args (match-string 3)))
|
|
|
- (third info)))))
|
|
|
+ (org-babel-merge-params (sixth info) (third info)))))
|
|
|
info)
|
|
|
(if (save-excursion ;; inline source block
|
|
|
(re-search-backward "[ \f\t\n\r\v]" nil t)
|