mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-30 03:27:54 +00:00
babel: matching indexes in lob one-liners
* lisp/ob-lob.el (org-babel-lob-execute): changing indentation to improve line length (org-babel-lob-get-info): now catching indexes passed through lob calls (org-babel-lob-one-liner-regexp): now matches optional indexes into variable results
This commit is contained in:
parent
2d01cb7db1
commit
73d8016e8b
|
@ -61,9 +61,10 @@ If you change the value of this variable then your files may
|
||||||
become unusable by other org-babel users, and vice versa.")
|
become unusable by other org-babel users, and vice versa.")
|
||||||
|
|
||||||
(defconst org-babel-lob-one-liner-regexp
|
(defconst org-babel-lob-one-liner-regexp
|
||||||
(concat "^\\([ \t]*\\)#\\+\\(?:"
|
(concat
|
||||||
(mapconcat #'regexp-quote org-babel-lob-call-aliases "\\|")
|
"^\\([ \t]*\\)#\\+\\(?:"
|
||||||
"\\):[ \t]+\\([^\(\)\n]+\\)\(\\([^\n]*\\)\)[ \t]*\\([^\n]*\\)")
|
(mapconcat #'regexp-quote org-babel-lob-call-aliases "\\|")
|
||||||
|
"\\):[ \t]+\\([^\(\)\n]+\\)\(\\([^\n]*\\)\)\\(\\[.+\\]\\)[ \t]*\\([^\n]*\\)")
|
||||||
"Regexp to match calls to predefined source block functions.")
|
"Regexp to match calls to predefined source block functions.")
|
||||||
|
|
||||||
;; functions for executing lob one-liners
|
;; functions for executing lob one-liners
|
||||||
|
@ -92,10 +93,13 @@ the word 'call'."
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(beginning-of-line 1)
|
(beginning-of-line 1)
|
||||||
(if (looking-at org-babel-lob-one-liner-regexp)
|
(if (looking-at org-babel-lob-one-liner-regexp)
|
||||||
(append (mapcar #'org-babel-clean-text-properties
|
(append
|
||||||
(list (format "%s(%s)" (match-string 2) (match-string 3))
|
(mapcar #'org-babel-clean-text-properties
|
||||||
(match-string 4)))
|
(list
|
||||||
(list (length (match-string 1))))))))
|
(format "%s(%s)%s"
|
||||||
|
(match-string 2) (match-string 3) (match-string 4))
|
||||||
|
(match-string 5)))
|
||||||
|
(list (length (match-string 1))))))))
|
||||||
|
|
||||||
(defun org-babel-lob-execute (info)
|
(defun org-babel-lob-execute (info)
|
||||||
"Execute the lob call specified by INFO."
|
"Execute the lob call specified by INFO."
|
||||||
|
@ -105,7 +109,8 @@ the word 'call'."
|
||||||
(org-babel-params-from-properties)
|
(org-babel-params-from-properties)
|
||||||
(org-babel-parse-header-arguments
|
(org-babel-parse-header-arguments
|
||||||
(org-babel-clean-text-properties
|
(org-babel-clean-text-properties
|
||||||
(concat ":var results=" (mapconcat #'identity (butlast info) " ")))))))
|
(concat ":var results="
|
||||||
|
(mapconcat #'identity (butlast info) " ")))))))
|
||||||
(org-babel-execute-src-block
|
(org-babel-execute-src-block
|
||||||
nil (list "emacs-lisp" "results" params nil nil (nth 2 info)))))
|
nil (list "emacs-lisp" "results" params nil nil (nth 2 info)))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue