snosov1 / toc-org

toc-org is an Emacs utility to have an up-to-date table of contents in the org files without exporting (useful primarily for readme files on GitHub)
GNU General Public License v3.0
287 stars 29 forks source link

Custom additional keywords for TODO are not stripped with todo:nil on OPTIONS #48

Closed ryukinix closed 6 years ago

ryukinix commented 6 years ago

Description

Custom wide additional keywords for TODO are persisting even when todo:nill is setted to OPTIONS on local buffer.

Behavior

When todo:nil is defined on #+OPTIONS I still got the custom keywords on my TOC: IN-PROGRESS and WAITING. But the keywords TODO and DONE are stripped as expected.

#+STARTUP: showall align
#+OPTIONS: todo:nil tasks:all tags:nil
#+EXCLUDE_TAGS: TOC_3

* Sumário                                                             :TOC_3:
:PROPERTIES:
:CUSTOM_ID: toc-org
:END:
- [[#task1][Task1]]
- [[#task3][Task3]]
- [[#in-progress-task2][IN-PROGRESS Task2]]
- [[#waiting-task3][WAITING Task3]]

* DONE Task1
  CLOSED: [2017-09-08 Fri 01:46]
* TODO Task3
* IN-PROGRESS Task2
* WAITING Task3

Expected

All the keywords are stripped from the headings.

#+STARTUP: showall align
#+OPTIONS: todo:nil tasks:all tags:nil
#+EXCLUDE_TAGS: TOC_3

* Sumário                                                             :TOC_3:
:PROPERTIES:
:CUSTOM_ID: toc-org
:END:
- [[#task1][Task1]]
- [[#task3][Task3]]
- [[#in-progress-task2][Task2]]
- [[#waiting-task3][Task3]]

* DONE Task1
  CLOSED: [2017-09-08 Fri 01:46]
* TODO Task3
* IN-PROGRESS Task2
* WAITING Task3

I'm missing something? Sorry for that. Great package, by the way.

Suggestion: Stripped TODO keywords defined on org-todo-keywords should be read to strip when todo:nil is set. On my case, I have on my init setup this:

;; add more tags for TODO list on org-mode
(setq org-todo-keywords
      '((sequence "TODO" "IN-PROGRESS" "WAITING" "DONE")))
snosov1 commented 6 years ago

Hey!

This package lives on a strangely shaped overlap area of emacs org-mode and github's implementation of org files parsing. So, the reason for this behavior is that github only recognizes 2 words - TODO and DONE as "special". At least this was the case when I last checked.

Obviously, there's no way for github to know about your emacs-lisp settings, such as

;; add more tags for TODO list on org-mode
(setq org-todo-keywords
      '((sequence "TODO" "IN-PROGRESS" "WAITING" "DONE")))

But it's possible that the support for things like

  #+TODO: TODO FEEDBACK VERIFY | DONE CANCELED

was added recently.

I, probably, won't be able to look into that for a week or so, but I'll get back to it when I have a chance. (Obviously, I would accept a reasonable PR if you want to dig into this yourself).

ryukinix commented 6 years ago

Thanks for the great answer, I understand about the time consuming. I'm not available too, if I would can dig into the code, I would.

But even using only just one word for each keyword and defining into the buffer (as you suggested) I got the same behavior.

#+STARTUP: showall align
#+OPTIONS: todo:nil tasks:all tags:nil
#+EXCLUDE_TAGS: TOC_3
#+TODO: CANCER TODO | DONE

* Sumário                                                             :TOC_3:
:PROPERTIES:
:CUSTOM_ID: toc-org
:END:
- [[#task1][Task1]]
- [[#task3][Task3]]
- [[#cancer-task2][CANCER Task2]]
- [[#cancer-task3][CANCER Task3]]

* DONE Task1
  CLOSED: [2017-09-08 Fri 01:46]
* TODO Task3
* CANCER Task2
* CANCER Task3
snosov1 commented 6 years ago

Apparently, as I anticipated, this is handled properly in current version, see

  1. https://github.com/snosov1/org-toc/blob/master/README.org as an example
  2. https://github.com/wallyqs/org-ruby/blob/master/lib/org-ruby/parser.rb#L459 - parsing of #+TODO line and extending the custom regexp list

Ok, this package needs to handle this as well. As mentioned, will do when I get a chance. Thanks!

snosov1 commented 6 years ago

https://github.com/snosov1/toc-org/pull/50 here you go, sir! Please, give it a try!