From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Ecay Subject: [RFC] [PATCH] [babel] read description lists as lists of lists Date: Fri, 19 Sep 2014 15:17:54 -0400 Message-ID: <87ha03qv19.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49666) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XV3h5-0003tI-Pb for emacs-orgmode@gnu.org; Fri, 19 Sep 2014 15:18:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XV3gw-0003oZ-NP for emacs-orgmode@gnu.org; Fri, 19 Sep 2014 15:18:11 -0400 Received: from mail-qc0-x235.google.com ([2607:f8b0:400d:c01::235]:65512) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XV3gw-0003oG-Hs for emacs-orgmode@gnu.org; Fri, 19 Sep 2014 15:18:02 -0400 Received: by mail-qc0-f181.google.com with SMTP id r5so3680643qcx.12 for ; Fri, 19 Sep 2014 12:17:57 -0700 (PDT) Received: from localhost (levyvlan538.1887.apn.wlan.wireless-pennnet.upenn.edu. [128.91.183.96]) by mx.google.com with ESMTPSA id i6sm2053949qge.37.2014.09.19.12.17.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Sep 2014 12:17:55 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org-mode --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello all, The attached patch makes babel read description lists as lists of the following format: (("term" "description") ...). The present default is to simply read in the text of each list item, yielding: ("term :: description" ...). Of course, it=E2=80=99s possible to interconvert between the two formats, b= ut I think the greater structure of this proposal makes things easier for babel authors. (Another way of thinking of the proposal is that it treats description lists like two-column tables.) What do people think? Thanks, --=20 Aaron Ecay --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-ob-core.el-Read-description-lists-as-lisp-lists.patch >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 --=-=-=--