[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[mhc:02288] Re: toggle todos

David, thank you for your contribution.

> [ I hope it is OK to write to this list in English. My Nihongo pretty
> much starts and stops at sumimasen and o-kudasai. ]

OK, so is my English. Elisp will do for us instead :-)

> I just started to use mhc, and I like it very much so far.
> Here is a simple addition to allow toggling todo's with "ctrl-C . @".

It works for me, I'll commit it to the CVS in several days, 
if anyone made an objection.

> (define-key mhc-prefix-map "@" 'mhc-todo-toggle-done)
> (defun mhc-todo-toggle-done ()
>   "Toggle between done and not for todo"
>   (interactive)
>   (mhc-modify-file (mhc-summary-filename))
>   (mhc-draft-toggle-done)
>   (mhc-draft-finish)
>   (message ""))
> (defun mhc-draft-toggle-done ()
>   "Set current draft as DONE if not; remove done if there."
>   (interactive)
>   (if  (mhc-draft-in-category-p "todo")
>       (if (mhc-draft-in-category-p "done")
> 	  (mhc-draft-delete-category "done")
> 	(mhc-draft-append-category "Done"))))