emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: emacs-org list <emacs-orgmode@gnu.org>
Subject: Re: Lexical binding bug in org-list.el?
Date: Sun, 08 Nov 2015 15:57:20 +0100	[thread overview]
Message-ID: <878u688rov.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <87a8qpts31.fsf@gmail.com> (Aaron Ecay's message of "Sat, 07 Nov 2015 21:30:58 +0000")

Aaron Ecay <aaronecay@gmail.com> writes:

> I don’t think we should unit-test only public API functions.

I didn't say that. However, I wouldn't write tests for "--" functions.

> Indeed, I find it easier to write unit tests for small functions,
> since I don’t have to construct a lot of extra context to exercise all
> the corner cases.

That's not my point. However I'd rather spent my time elsewhere than
writing tests for worker functions.

>>> In view of this, do you think it would be desirable in the long term to
>>> refactor code like this into top-level functions?
>> 
>> No, I don't. I see no reason to pollute name space with these very
>> specific functions.
>
> I’m not sure I get it – interned symbols are cheap, and with the new-ish
> double-dash convention for private functions users/downstream developers
> can be pretty sure they don’t need to worry about them.

I see no reason to define at top level a worker function with a very
limited scope. Much like let bindings I find it much clearer to keep the
scope of a function as close as possible to its real use, as long as the
function isn't too large. If one day, it is deemed useful in another
function, then it can be lifted to top level.

Anyway, this we're really nitpicking. There's nothing fundamentally
wrong in either choice.

>>   - change `org-list-parse-list' to provide a simpler output and update
>>     Babel should to use that new output.

So the new output could be

  plain-list = (type item+)
  type = ordered | unordered | descriptive
  item = ((text|plain-list)+)

Thus,

  1. first item
     + sub-item one
     + [X] sub-item two
     more text in first item
  2. [@3] last item

is parsed as

  (ordered
   ("first item"
    (unordered
     ("sub-item one")
     ("[X] sub-item two"))
    "more text in first item")
   ("[@3] last item"))

The slightly tricky part is taking care of the indentation when text
contains more than one line.

Also, for completeness, a descriptive list, e.g.,

  - tag :: text

would be simply parsed as

  (descriptive ("tag :: text"))

The objective is to make this syntax easy to create programmatically,
e.g. for Babel. Making something out of it would be the goal of
`org-list-to-generic'.

WDYT?

>>   - re-implement `org-list-to-subtree' using directly Elements, or even
>>     string massaging.
>
> OK, these both sound do-able.

Meanwhile, I fixed the current issue. It is as ugly as before, but at
least, no error is thrown anymore.

>>   - start a poll on the ML to guess the potential user base for radio
>>     lists. Depending on the results, we might either deprecate the whole
>>     thing, as you suggest, or implement in a more powerful and clean
>>     way. Note that first item implies `org-list-to-generic' should be
>>     updated to handle new output for `org-list-parse-list'.

Having slept over the idea, I think we could simply update
`org-list-to-generic' to be more robust and be done with it. I can
implement it in a couple of hours (and debug it in a couple of
months...).


Regards,

  reply	other threads:[~2015-11-08 14:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-06 19:43 Lexical binding bug in org-list.el? Kaushal Modi
2015-11-06 19:47 ` Kaushal Modi
2015-11-06 20:45   ` Aaron Ecay
2015-11-06 21:13     ` Kaushal Modi
2015-11-07  0:20     ` Nicolas Goaziou
2015-11-07 11:54       ` Aaron Ecay
2015-11-07 16:48         ` Nicolas Goaziou
2015-11-07 21:30           ` Aaron Ecay
2015-11-08 14:57             ` Nicolas Goaziou [this message]
2015-11-08 19:55               ` Aaron Ecay
2015-11-09 15:23                 ` Kaushal Modi
2015-11-11  9:33                 ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878u688rov.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).