I have a repeating habit such as:
** TODO some habit
SCHEDULED: <2020-05-22 Fri 08:00 .+1d>
:PROPERTIES:
:STYLE: habit
:CREATED: [2020-05-08 Fri]
:LAST_REPEAT: [2020-05-21 Thu 10:07]
:END:
:LOGBOOK:
- State "DONE" from "TODO" [2020-05-21 Thu 10:07]
CLOCK: [2020-05-21 Thu 10:04]--[2020-05-21 Thu 10:06] => 0:02
:END:
I coded this shortcut, where I commented out my function to clock in and out:
(defun my-org-clock-and-mark-done ()
(interactive)
(message "start")
(org-back-to-heading)
;(my-org-clock-in-and-out nil)
(org-shiftright)
(message "end")
)
The result in the *Messages
buffer is:
start
Entry repeats: SCHEDULED: <2020-05-22 Fri 08:00 .+1d>
end
Note stored
Entry repeats: SCHEDULED: <2020-05-22 Fri 08:00 .+1d>
I suspect that Org mode has a hook that runs after my last line of code, in this case when a repeating cookie is changed, and shows that change message twice.
How can I find and disable that hook?
Update: Following the answer by phils, I added a debugger with (setq debug-on-message "Note stored")
so it catches only the second occurrence. It shows these functions, neither of which I could find in the list of hooks, which I found thanks to Muihlinn's comment. The list of calls is below and has two recursive edits, which I find odd:
org-store-log-note()
org-add-log-note()
recursive-edit()
debug(error ...)
message("%s" #("Entry repeats: SCHEDULED: ..."))
org-store-log-note()
org-add-log-note()
recursive-edit()
debug(error #("Entry repeats: SCHEDULED: ..."))
message("%s" #("Entry repeats: SCHEDULED: ..."))
org-auto-repeat-maybe("DONE")
org-todo(right)
funcall-interactively(org-todo right)
call-interactively(org-todo)
org-shiftright()
org-shiftright-hook
?M-x apropos-variable org hook
describes Org's hooks.org-shiftright-hook
has value ofnil
. Besides, the extra lines appear after an additional line afterorg-shift-right
.M-x apropos-variable RET org hook
, and it's very informative, thanks!