From a7e01675f2c89fb648e528c3efe535ed0b2389f1 Mon Sep 17 00:00:00 2001 From: Aaron Ecay Date: Fri, 19 Sep 2014 14:39:26 -0400 Subject: [PATCH] ob-core.el: Read description lists as lisp lists. * lisp/ob-core.el (org-babel-read-list): Read description lists as lisp lists. This allows description lists to be used as structured input to a babel block. --- lisp/ob-core.el | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index e01c4d2..f1661cb 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -2035,9 +2035,21 @@ following the source block." (org-table-to-lisp))) (defun org-babel-read-list () - "Read the list at `point' into emacs-lisp." - (mapcar (lambda (el) (org-babel-read el 'inhibit-lisp-eval)) - (mapcar #'cadr (cdr (org-list-parse-list))))) + "Read the list at `point' into emacs-lisp. + +The result is a list of strings \(the list items), unless the +input list is a description list. In that case, the result will +be a list of lists; each of the latter lists will have two +elements: the term and the description." + (let* ((parsed (org-list-parse-list)) + (elements (mapcar #'cadr (cdr parsed)))) + (if (eq (car parsed) 'descriptive) + (mapcar (lambda (el) + (let ((s (split-string el " :: "))) + (list (nth 0 s) (mapconcat #'identity (cdr s) " :: ")))) + elements) + (mapcar (lambda (el) (org-babel-read el 'inhibit-lisp-eval)) + elements)))) (defvar org-link-types-re) (defun org-babel-read-link () -- 2.1.0