Function: org-element-babel-call-parser

org-element-babel-call-parser is a byte-compiled function defined in org-element.el.gz.

Signature

(org-element-babel-call-parser LIMIT AFFILIATED)

Documentation

Parse a babel call.

LIMIT bounds the search. AFFILIATED is a list of which car is the buffer position at the beginning of the first affiliated keyword and cdr is a plist of affiliated keywords along with their value.

Return a list whose car is babel-call and cdr is a plist containing :call, :inside-header, :arguments,
:end-header, :begin, :end, :value, :post-blank and
:post-affiliated as keywords.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-element.el.gz
;;; Elements
;;
;; For each element, a parser and an interpreter are also defined.
;; Both follow the same naming convention used for greater elements.
;;
;; Also, as for greater elements, adding a new element type is done
;; through the following steps: implement a parser and an interpreter,
;; tweak `org-element--current-element' so that it recognizes the new
;; type and add that new type to `org-element-all-elements'.


;;;; Babel Call

(defun org-element-babel-call-parser (limit affiliated)
  "Parse a babel call.

LIMIT bounds the search.  AFFILIATED is a list of which car is
the buffer position at the beginning of the first affiliated
keyword and cdr is a plist of affiliated keywords along with
their value.

Return a list whose car is `babel-call' and cdr is a plist
containing `:call', `:inside-header', `:arguments',
`:end-header', `:begin', `:end', `:value', `:post-blank' and
`:post-affiliated' as keywords."
  (save-excursion
    (let* ((begin (car affiliated))
	   (post-affiliated (point))
	   (before-blank (line-beginning-position 2))
	   (value (progn (search-forward ":" before-blank t)
			 (skip-chars-forward " \t")
			 (org-trim
			  (buffer-substring-no-properties
			   (point) (line-end-position)))))
	   (call
	    (or (org-string-nw-p
		 (buffer-substring-no-properties
		  (point) (progn (skip-chars-forward "^[]()" before-blank)
				 (point))))))
	   (inside-header (org-element--parse-paired-brackets ?\[))
	   (arguments (org-string-nw-p
		       (org-element--parse-paired-brackets ?\()))
	   (end-header
	    (org-string-nw-p
	     (org-trim
	      (buffer-substring-no-properties (point) (line-end-position)))))
	   (end (progn (forward-line)
		       (skip-chars-forward " \r\t\n" limit)
		       (if (eobp) (point) (line-beginning-position)))))
      (list 'babel-call
	    (nconc
	     (list :call call
		   :inside-header inside-header
		   :arguments arguments
		   :end-header end-header
		   :begin begin
		   :end end
		   :value value
		   :post-blank (count-lines before-blank end)
		   :post-affiliated post-affiliated)
	     (cdr affiliated))))))