From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Ecay Subject: Re: [RFC] [PATCH] [babel] read description lists as lists of lists Date: Sun, 28 Sep 2014 01:55:51 -0400 Message-ID: <87tx3sl254.fsf@gmail.com> References: <87ha03qv19.fsf@gmail.com> <87ha02a4qg.fsf@nicolasgoaziou.fr> <87d2anougv.fsf@gmail.com> <87tx3weqrv.fsf@nicolasgoaziou.fr> <87oau4my5o.fsf@gmail.com> <877g0qeosp.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XY7Sq-0007k7-I1 for emacs-orgmode@gnu.org; Sun, 28 Sep 2014 01:56:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XY7Sh-0001Mc-Fn for emacs-orgmode@gnu.org; Sun, 28 Sep 2014 01:56:08 -0400 Received: from mail-qc0-x233.google.com ([2607:f8b0:400d:c01::233]:62674) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XY7Sh-0001MQ-B7 for emacs-orgmode@gnu.org; Sun, 28 Sep 2014 01:55:59 -0400 Received: by mail-qc0-f179.google.com with SMTP id x3so442210qcv.10 for ; Sat, 27 Sep 2014 22:55:53 -0700 (PDT) In-Reply-To: <877g0qeosp.fsf@nicolasgoaziou.fr> 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: Nicolas Goaziou , Org-mode Hi Nicolas, 2014ko irailak 26an, Nicolas Goaziou-ek idatzi zuen: >=20 >> Why? Babel=E2=80=99s representation is for babel. >=20 > Which I strongly frown upon. Let=E2=80=99s back up a step. The representation I am targeting with my ch= ange is what babel uses to ship a list off as input to code in a babel block. This code could be emacs lisp, but it could also be R, python, etc. So the question is, how to provide a consistent language-agnostic view of org structure to other languages. The resultant structure doesn=E2=80=99t = hang around inside babel, it just gets handed off to a code block. >=20 >> org-list-parse-list/-to-generic=E2=80=99s is for radio lists (although a= s I=E2=80=99ve >> said this connection seems accidental rather than essential). Babel >> calls org-list-parse-list, but I don=E2=80=99t see why it should be forb= idden >> from doing more processing on the result before passing it along >> (indeed, it already does some processing to remove the list type >> indicators, remove nested structure, etc.). >=20 > It is best to use as much common ground as possible. We should strive to > decrease need for such processing, not the other way. >=20 > As I already stated in my first answer, in the long run, it is the only > sane way to proceed. I agree it is less work to simply tweak Babel right > now and ignore the whole Org ecosystem, but it does no good to Org as > a whole. It=E2=80=99s not work that I=E2=80=99m afraid of: I offered to rewrite both= babel and radio lists in terms of org-elements. Maybe I am insane, as you imply. What I=E2=80=99m afraid of is old and disused sort-of-APIs like org-list-parse-list calcifying and preventing good things from happening to parts of org that people actually use. What if I rewrote org-babel-read-list in terms of org-elements? That would satisfy me wrt. babel, and wouldn=E2=80=99t necessitate disturbing org-list-parse-list, radio lists, or indeed anything outside of babel. >=20 > `org-list-parse-list' handles nested lists just fine. Another advantage > of not re-inventing the wheel in every part of Org. I know. But babel=E2=80=99s processing of parse-list=E2=80=99s output stri= ps the nested structure: #+name: a-list - foo - bar - abc - def - baz #+begin_src emacs-lisp :var lst=3Da-list (pp-to-string lst) #+end_src #+RESULTS: : ("foo" "bar" "baz") That=E2=80=99s because it=E2=80=99s hard to come up with a good representat= ion of a nested list in a language-agnostic way. =E2=80=9CList of strings=E2=80=9D is a st= raightforward datatype in every language babel supports, but not all of them have a convenient =E2=80=9Clabeled n-ary tree with string leaves=E2=80=9D (which y= ou=E2=80=99d need for arbitrarily nested lists). Thanks, --=20 Aaron Ecay