I have a repeating habit such as:

** TODO some habit
SCHEDULED: <2020-05-22 Fri 08:00 .+1d>
:STYLE: habit
:CREATED:  [2020-05-08 Fri]
:LAST_REPEAT: [2020-05-21 Thu 10:07]
- 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

I coded this shortcut, where I commented out my function to clock in and out:

(defun my-org-clock-and-mark-done ()
  (message "start")
  ;(my-org-clock-in-and-out nil)
  (message "end")

The result in the *Messages buffer is:

Entry repeats: SCHEDULED: <2020-05-22 Fri 08:00 .+1d> 
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:

  debug(error ...)
  message("%s" #("Entry repeats: SCHEDULED: ..."))
  debug(error #("Entry repeats: SCHEDULED: ..."))
  message("%s" #("Entry repeats: SCHEDULED: ..."))
  funcall-interactively(org-todo right)
  • 2
    have you checked org-shiftright-hook?
    – Muihlinn
    Commented May 21, 2020 at 10:33
  • 1
    M-x apropos-variable org hook describes Org's hooks.
    – Drew
    Commented May 21, 2020 at 15:42
  • @Muihlinn org-shiftright-hook has value of nil. Besides, the extra lines appear after an additional line after org-shift-right.
    – emonigma
    Commented May 22, 2020 at 20:28
  • @Drew I belive it's M-x apropos-variable RET org hook, and it's very informative, thanks!
    – emonigma
    Commented May 22, 2020 at 20:30

2 Answers 2


For this particular case...

In that call to org-auto-repeat-maybe we see this:

(when org-log-repeat
  (if (or (memq 'org-add-log-note (default-value 'post-command-hook))
          (memq 'org-add-log-note post-command-hook))
      ;; We are already setup for some record.
      (when (eq org-log-repeat 'note)
        ;; Make sure we take a note, not only a time stamp.
        (setq org-log-note-how 'note))
    ;; Set up for taking a record.
    (org-add-log-setup 'state
                       (or done-word (car org-done-keywords))

Where org-log-repeat is a user option (see which).

org-add-log-setup does this:

(add-hook 'post-command-hook 'org-add-log-note 'append))

And org-add-log-note removes itself from the hook when it runs:

(defun org-add-log-note (&optional _purpose)
  "Pop up a window for taking a note, and add this note later."
  (remove-hook 'post-command-hook 'org-add-log-note)

So if org-log-repeat is non-nil, post-command-hook will be running org-add-log-note.

  • This removes the second notification (with Note stored and Entry repeats...) and also the state change from being logged in the logbook drawer. Can the first happend without the second?
    – emonigma
    Commented May 25, 2020 at 13:09
  • 1
    I honestly don't know what any of this stuff is for, so I'm not in a position to recommend any changes. I'm just pointing you to the mechanisms behind it.
    – phils
    Commented May 25, 2020 at 20:09
  • I fixed the problem with code similar to the mechanism: add another post-command-hook after calling org-shiftright, then removing it from the called function. This way, my code is the last to run and stays displayed in the mini-buffer.
    – emonigma
    Commented May 27, 2020 at 11:04

M-: (setq debug-on-message "Entry repeats: SCHEDULED")

The stack traces should show you what is causing each instance of that message.

See C-hig (elisp)Using Debugger for help on the debugger.

When you're done, M-: (setq debug-on-message nil)

  • I updated the question after running this debugger.
    – emonigma
    Commented May 22, 2020 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.