Ihor Radchenko <[email protected]> writes:

> Morgan Smith <[email protected]> writes:
>
>>> You removed the wrapper that comments and then comments the heading,
>>> but there is nothing inherently wrong with that approach. The problem
>>> probably lies inside `org-toggle-comment'.
>>
>> TODO keywords should be before the COMMENT keyword.
>>
>> Good:
>> * COMMENT
>> * TODO COMMENT
>>
>> Confusing and not actually a TODO:
>> * COMMENT TODO
>>
>> The problem is that currently org-todo does the following:
>> * COMMENT TODO H -> * DONE COMMENT H
>>
>> It strips the COMMENT so the TODO keyword in the wrong place can be
>> toggled, and then it puts the COMMENT where it is supposed to be.
>>
>> So we are at a crossroads with two options.
>>
>> 1. Follow the established syntax and remove this janky feature.
>
> +1, but my concern is different.
>
> I simply commented on the exact change you did in the patch.
> The underlying problem has nothing to do with org-todo, it is
> org-toggle-comment. Try
>
> * <point>COMMENT TODO
> M-x org-toggle-comment
>
> You will observe COMMENT stripped despite the heading not being
> commented. In other words, there is a bug (or feature) in
> org-toggle-comment.

Strictly speaking, that heading is commented.  From worg org-syntax.org
we have the heading format:

#+begin_example
STARS KEYWORD PRIORITY COMMENT TITLE TAGS
#+end_example

So your example of "* COMMENT TODO" is actually:
STARS    "*"
KEYWORD  ""
PRIORITY ""
COMMENT  "COMMENT"
TITLE    "TODO"
TAGS     ""

So I fail to see any issue with the logic of `org-toggle-comment' here.

> and, additionally, might introduce new bugs because the rest of the
> org-todo code operates under assumption that the heading we work with is
> not commented while todo is being changed.

That is a valid concern.  I'll have to look into that.

Do you want to apply my first two patches while we figure out what to do
about this third one?

Reply via email to