vim-orgmode icon indicating copy to clipboard operation
vim-orgmode copied to clipboard

Introduce TODO class to reduce complexity in plugins and liborgmode

Open sotte opened this issue 13 years ago • 4 comments

A TODO class (and maybe a 'TODO-workflow' class) would reduce the complexity of some plugins and some classes in liborgmode.

Single responsibility principle ...

sotte avatar Sep 08 '11 22:09 sotte

Would you give an example for the functionality of that class?

jceb avatar Sep 11 '11 19:09 jceb

The functionality is pretty limited (but that's rather good). It would only give you the current TODO state and allow to iterate over the next/previous states/sets of states with a nice interface. There shouldn't be a reason to index a list of todos with three indices (like in line 103) just to figure out what TODO is next.

We basically would extract and disassemble the _get_next_state() from the TODO plugin and create a tiny stupid class.

Something like this.


class Todo():
    def next_state(self):
        pass
    def prev_state(self):
        pass
    def is_current_state_done(self):
        pass
    def __str__(self):
        pass

Nowhere else in orgmode we have to find out if a todo is already done or if it needs an action.

What do you think?

sotte avatar Sep 12 '11 19:09 sotte

Agreed.

jceb avatar Sep 13 '11 17:09 jceb

I just found this issue and I think it's generally a good idea.

However, the "is_current_state_done" method proposed by @sotte assumes too much: There doesn't have to be a DONE state, as they can be named whatever you want. Maybe we should call this a "terminal" state (or is org-mode strict about it? I didn't check).

Furthermore, this class actually needs to know which states are available; should we initialize this class somewhere or should it fetch this information by itself?

This question is quite important as I'd like to implement support for the #+SEQ_TODO attribute. (As described here http://orgmode.org/manual/Per_002dfile-keywords.html#Per_002dfile-keywords )

Shurakai avatar Jul 02 '15 09:07 Shurakai