Hi Org, On 2025-03-02 at 06:07 -08, Ken Mankoff <mank...@gmail.com> wrote... > On 2025-03-01 at 22:38 -05, Ken Mankoff <mank...@gmail.com> wrote... >> I'm getting an error in *Messages* when I try to generate a monthly >> clocktable report. If I remove ":step month" then there is no problem. >> >> The error is: org-dblock-write:clocktable: Search failed: "^[ >> ]*#\\+END:" > > I did some debugging with the help of a recent post I saw here > https://emacsredux.com/blog/2025/02/03/debugging-emacs-commands/ > > And it seems like line 3061 of org-clock.el is the cause. It is > currently this line from commit 100edaccd1 (Nicolas Goaziou > 2018-10-13). > > (let ((case-fold-search t)) (re-search-forward "^[ \t]*#\\+END:")) > > I have not seen "#+END:" (with the colon) used in Org. Drawers end > with :end:, but this code is not for a drawer. Anyway, if I remove the > ":" then the bug goes away.
Digging into this a bit more, there is no bug (beyond me), but there is room for improvement. The clock table works in most cases with an "#+END" or an "#+END:". It requires "#+END:" (with colon) if generating multiple tables with the ":step" option. Working at any time with only "#+END" (no colon) may be a bug? If there is no "#+END" or "#+END:" then an error is thrown. #+BEGIN: clocktable :scope file :tstart "2025-01-01" :tend "2026-01-01" Error: 'C-c C-c' can do nothing useful here. #+BEGIN: clocktable :scope file :tstart "2025-01-01" :tend "2026-01-01" #+END Works #+BEGIN: clocktable :scope file :tstart "2025-01-01" :tend "2026-01-01" #+END: Works #+BEGIN: clocktable :scope file :tstart "2025-01-01" :tend "2026-01-01" :step month :stepskip0 t #+END Does not work #+BEGIN: clocktable :scope file :tstart "2025-01-01" :tend "2026-01-01" :step month :stepskip0 t #+END: Works. I think an improvement might be to report something more useful than "'C-c C-c' can do nothing useful here". If "#+END:" (with colon) is not found, then it should report "'C-c C-c' did not find #+END:" or something like that. I have not yet found where in the code to make this change, or even fail (with current generic message) if "#+END" is found but not "#+END:". -k.