Re: Empty headline titles unsupported: Bug?

2021-09-29 Thread Bastien
Hi Ihor, Ihor Radchenko writes: > Yet, why not simply alter the headline parser a little bit to support > empty titles + tag? Such headlines are used in some of the tests. See > the attached patch. I've now applied this patch -- let's not close the discussion though, and keep in mind Nicolas

Re: Empty headline titles unsupported: Bug?

2021-09-27 Thread Nicolas Goaziou
Hello, Bastien writes: > Ihor Radchenko writes: > >> Yet, why not simply alter the headline parser a little bit to support >> empty titles + tag? Such headlines are used in some of the tests. See >> the attached patch. > > I'm in favor of this change... > > Nicolas Goaziou writes: > >>

Re: Empty headline titles unsupported: Bug?

2021-09-26 Thread Tom Gillespie
Hi Bastien, I am strongly in favor of this change. It simplifies the grammar significantly, and from my work on the laundry lexer and parser, I'm 99% certain that the current behavior is a bug that is the result of gobbling the space after the stars in the headline. The correct implementation

Re: Empty headline titles unsupported: Bug?

2021-09-26 Thread Bastien
Hi all, Ihor Radchenko writes: > Yet, why not simply alter the headline parser a little bit to support > empty titles + tag? Such headlines are used in some of the tests. See > the attached patch. I'm in favor of this change... Nicolas Goaziou writes: > Because, as I wrote, this is

Re: Empty headline titles unsupported: Bug?

2021-05-29 Thread Ihor Radchenko
Tom Gillespie writes: > Hi Ihor, > Yes, happy to put my test cases into the org element cases and > visa versa. Patches welcome ;)

Re: Empty headline titles unsupported: Bug?

2021-05-29 Thread David Masterson
Ihor Radchenko writes: > David Masterson writes: >> Testing the usefulness of extensions to the grammar before they're added >> to the grammar..? > > For simple cases, there is org-element-update-syntax. Otherwise, you > will probably better use the usual patch/new feature workflow and modify >

Re: Empty headline titles unsupported: Bug?

2021-05-29 Thread Tom Gillespie
Hi Ihor, Yes, happy to put my test cases into the org element cases and visa versa. My long term plan is to come up with a set of test cases that are unambiguous and potentially ambiguous so that we can determine the expected behavior in those cases, so this is a great first step. Best, Tom

Re: Empty headline titles unsupported: Bug?

2021-05-29 Thread Ihor Radchenko
David Masterson writes: > Testing the usefulness of extensions to the grammar before they're added > to the grammar..? For simple cases, there is org-element-update-syntax. Otherwise, you will probably better use the usual patch/new feature workflow and modify the parsers directly. Best, Ihor

Re: Empty headline titles unsupported: Bug?

2021-05-29 Thread Ihor Radchenko
Tom Gillespie writes: > Hi David, > Laundry produces a full s-expression representation of the org > parse tree (though it is still evolving). I haven't added a pass that > converts it to some Racket internal representation (probably will be > structs). If you get it installed and put #lang

Re: Empty headline titles unsupported: Bug?

2021-05-29 Thread Tom Gillespie
Hi David, Laundry produces a full s-expression representation of the org parse tree (though it is still evolving). I haven't added a pass that converts it to some Racket internal representation (probably will be structs). If you get it installed and put #lang org at the top of an org file you

Re: Empty headline titles unsupported: Bug?

2021-05-29 Thread David Masterson
Tom Gillespie writes: > Hi all, > Here is the 4th (or so) iteration of the grammar for titles that > I think deals with most of the issues in this thread along with a > bunch of nasty test cases. The previous attempts can be inspected in > the git history, but long story short, it is

Re: Empty headline titles unsupported: Bug?

2021-05-27 Thread Tom Gillespie
Hi all, Here is the 4th (or so) iteration of the grammar for titles that I think deals with most of the issues in this thread along with a bunch of nasty test cases. The previous attempts can be inspected in the git history, but long story short, it is extremely hard to find a grammar that

Re: Empty headline titles unsupported: Bug?

2021-05-27 Thread David Masterson
Ihor Radchenko writes: > David Masterson writes: > >> Could an extensible pre-hook that runs a list of functions take care of >> the inconsistencies where each function recognizes one change to the >> standard grammar and adjusts the input accordingly? > > Could you elaborate? For now, this

Re: Empty headline titles unsupported: Bug?

2021-05-26 Thread Ihor Radchenko
David Masterson writes: > Could an extensible pre-hook that runs a list of functions take care of > the inconsistencies where each function recognizes one change to the > standard grammar and adjusts the input accordingly? Could you elaborate? For now, this sounds like unnecessary

Re: Empty headline titles unsupported: Bug?

2021-05-26 Thread David Masterson
Tim Cross writes: > David Masterson writes: >> But having undefined behaviors is limiting on the portability of Org >> because people are unwilling to pick it up and attempt to (say) create a >> (partial) Org for other platforms (iPhone, Android, etc.). > This is very much a secondary

Re: Empty headline titles unsupported: Bug?

2021-05-26 Thread David Masterson
Ihor Radchenko writes: > Nicolas Goaziou writes: > >> Currently, what Org does in this situation is unimportant, because the >> behaviour is simply undefined, which is, IMO, tolerable. If we decide to >> define it, it needs to be documented. > > I agree that currently there is no urgent need to

Re: Empty headline titles unsupported: Bug?

2021-05-26 Thread Ihor Radchenko
Nicolas Goaziou writes: > Currently, what Org does in this situation is unimportant, because the > behaviour is simply undefined, which is, IMO, tolerable. If we decide to > define it, it needs to be documented. I agree that currently there is no urgent need to decide on this, but there

Re: Empty headline titles unsupported: Bug?

2021-05-25 Thread Tim Cross
David Masterson writes: > Nicolas Goaziou writes: > >> Sebastian Miele writes: > >>> Sebastian Miele writes: David Masterson writes: > Sebastian Miele writes: >> Currently org-syntax.org says that "TITLE can be made of any >> character but a new line. Though, it will

Re: Empty headline titles unsupported: Bug?

2021-05-25 Thread David Masterson
Nicolas Goaziou writes: > Sebastian Miele writes: >> Sebastian Miele writes: >>>David Masterson writes: Sebastian Miele writes: > Currently org-syntax.org says that "TITLE can be made of any > character but a new line. Though, it will match after every other > part have

Re: Empty headline titles unsupported: Bug?

2021-05-25 Thread Nicolas Goaziou
Hello, Sebastian Miele writes: > Sebastian Miele writes: >>David Masterson writes: >>> Sebastian Miele writes: Currently org-syntax.org says that "TITLE can be made of any character but a new line. Though, it will match after every other part have been matched." This does

Re: Empty headline titles unsupported: Bug?

2021-05-25 Thread Sebastian Miele
Sebastian Miele writes: >David Masterson writes: >> Sebastian Miele writes: >>> Currently org-syntax.org says that "TITLE can be made of any >>> character but a new line. Though, it will match after every other >>> part have been matched." This does not reflect the currently >>> effective

Re: Empty headline titles unsupported: Bug?

2021-05-25 Thread Sebastian Miele
Hi David and all, David Masterson writes: > Sebastian Miele writes: >> Currently org-syntax.org says that "TITLE can be made of any >> character but a new line. Though, it will match after every other >> part have been matched." This does not reflect the currently >> effective behavior that

Re: Empty headline titles unsupported: Bug?

2021-05-24 Thread David Masterson
Sebastian Miele writes: > Sebastian Miele writes: >> #+BEGIN_EXAMPLE >> ,* A >> ,* :B: >> ,* C >> #+END_EXAMPLE >> >> org-element-parse-buffer and org-match-sparse-tree make the second >> headline have title ":B:" and no tags. > > Currently org-syntax.org says that "TITLE can be made of any

Re: Empty headline titles unsupported: Bug?

2021-05-24 Thread Sebastian Miele
Ihor Radchenko writes: > Either way is fine while it is consistent. I just tried to test some > edge cases with existing org-element code: > > * TODO COMMENT :tag: > > org-element-at-point returns :raw-value "". > > * TODO :tag: > > :raw-value ":tag:" Concerning tags, it is the expected behavior

Re: Empty headline titles unsupported: Bug?

2021-05-24 Thread Sebastian Miele
Sebastian Miele writes: > #+BEGIN_EXAMPLE > ,* A > ,* :B: > ,* C > #+END_EXAMPLE > > org-element-parse-buffer and org-match-sparse-tree make the second > headline have title ":B:" and no tags. Currently org-syntax.org says that "TITLE can be made of any character but a new line. Though, it

Re: Empty headline titles unsupported: Bug?

2021-05-24 Thread Sebastian Miele
Nicolas Goaziou writes: > You cannot distinguish the following two cases: > > * :mytag: > * :myheadline: In my opinion, the cleanest solution would be to allow not only tags specifications of one or more tags, but also the tags specification ":" of zero tags in the headline. Then in *

Re: Empty headline titles unsupported: Bug?

2021-05-23 Thread Ihor Radchenko
Nicolas Goaziou writes: >>> I suggest to not tag emptiness. `org-set-tags' could raise an error in >>> this case. >> >> Of course, we can go the other way around and recognise "* :myheadline:" >> as non-empty headline with no tags. > > There is no spoon^W way. Or, no way is satisfactory. "Don't

Re: Empty headline titles unsupported: Bug?

2021-05-23 Thread Nicolas Goaziou
Ihor Radchenko writes: > Actually, my patch would solve the existing inconsistency. > Org mode already puts tag fontification on :tag: in "* :tag:" headline; > org-get-tags returns ("tag") on such headline; org-set-tags sets the > :tag: on "*" headline making it look like "* :tag:" (which is

Re: Empty headline titles unsupported: Bug?

2021-05-23 Thread Ihor Radchenko
Nicolas Goaziou writes: > Because, as I wrote, this is ambiguous. You cannot distinguish the > following two cases: > > * :mytag: > * :myheadline: Makes sense. > So, your patch would only move the problem elsewhere. Actually, my patch would solve the existing inconsistency. Org mode

Re: Empty headline titles unsupported: Bug?

2021-05-23 Thread Nicolas Goaziou
Hello, Ihor Radchenko writes: >> However, empty headline + tags is ambiguous. The right solution is to >> disambiguate it by inserting "something" as the headline you want to >> tag, like a non-breaking space. > > Yet, why not simply alter the headline parser a little bit to support > empty

Re: Empty headline titles unsupported: Bug?

2021-05-22 Thread Ihor Radchenko
Nicolas Goaziou writes: > Empty headline titles are supported, and "org-syntax.org" makes it > clear. > > However, empty headline + tags is ambiguous. The right solution is to > disambiguate it by inserting "something" as the headline you want to > tag, like a non-breaking space. Yet, why not

Re: Empty headline titles unsupported: Bug?

2021-05-22 Thread Nicolas Goaziou
Hello, Sebastian Miele writes: > worg/dev/org-syntax.org is not clear about whether the title of a > headline is allowed to be empty. I occasionally (would like to) use > headlines with empty titles, e.g., when a tag in some headline already > provides all necessary information, and an