1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-29 07:58:21 +00:00

implemented *much* simpler lob one-liner syntax

This commit is contained in:
Eric Schulte 2009-06-14 14:18:58 -07:00
parent fb2dcaf58a
commit f1302d1cca
2 changed files with 4 additions and 19 deletions

View File

@ -29,4 +29,4 @@ plot(data)
| 4 | 16 |
| 5 | 25 |
#+lob:R-plot data=example-R-plot-data
#+lob: R-plot(data=example-R-plot-data)

View File

@ -58,8 +58,7 @@ add files to this list use the `org-babel-lob-ingest' command."
;; functions for executing lob one-liners
(defvar org-babel-lob-one-liner-regexp
"#\\+lob:\\([^ \t\n\r]+\\)\\([ \t]+\\([^\n]+\\)\\)?\n")
(defvar org-babel-lob-one-liner-regexp "#\\+lob:[ \t]+\\([^\n]+\\)\n")
(defun org-babel-lob-execute-maybe ()
"Detect if this is context for a org-babel Library Of Babel
@ -80,24 +79,10 @@ a list of the following form.
(save-excursion
(move-beginning-of-line 1)
(if (looking-at org-babel-lob-one-liner-regexp)
(cons (org-babel-clean-text-properties (match-string 1))
(delq nil (mapcar (lambda (assignment)
(save-match-data
(if (string-match "\\(.+\\)=\\(.+\\)" assignment)
(list (org-babel-clean-text-properties (match-string 1 assignment))
(org-babel-clean-text-properties (match-string 2 assignment)))
nil)))
(split-string (match-string 3)))))))))
(org-babel-clean-text-properties (match-string 1))))))
(defun org-babel-lob-execute (info)
(let ((params (org-babel-parse-header-arguments
(concat ":var results="
(car info)
"("
(mapconcat (lambda (var-spec)
(format "%s=%s" (first var-spec) (second var-spec)))
(cdr info) ", ")
")"))))
(let ((params (org-babel-parse-header-arguments (concat ":var results=" info))))
(org-babel-execute-src-block t (list "emacs-lisp" "results" params))))
(provide 'org-babel-lob)