dotfiles/emacs-lisp/org_habit.org
main a5a651dbb9
Large rework and cleanup
Signed-off-by: main <magic_rb@redalder.org>
2022-07-31 11:03:59 +02:00

24 lines
1,018 B
Org Mode

:PROPERTIES:
:ID: 28f65a55-f6b4-4c42-8b15-3e3a353c7c0a
:ROAM_REFS: https://www.reddit.com/r/emacs/comments/3ltjjc/org_reset_task_when_it_repeats
:END:
#+title: Org Habit
#+filetags: emacs-load
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#+BEGIN_SRC emacs-lisp :results none
(require 'org-habit)
#+END_SRC
Setup a function which resets any checkboxes under a ~TODO~ which changes state to ~DONE~. Many thanks to [[https://www.reddit.com/user/davidglasser][davidglasser]], who had this exact same issue and solved it on [[https://www.reddit.com/r/emacs/comments/3ltjjc/org_reset_task_when_it_repeats/cv9gbj6?utm_source=share&utm_medium=web2x&context=3][Reddit]].
#+BEGIN_SRC emacs-lisp
(defun glasser-org-reset-check-on-repeat ()
(when (and (org-get-repeat) (member org-state org-done-keywords))
(org-reset-checkbox-state-subtree)))
(add-hook 'org-after-todo-state-change-hook 'glasser-org-reset-check-on-repeat)
#+END_SRC