On 2 October 2016 at 06:20, Nicolas Goaziou wrote:
>> I request the feature of Org automatically updating cookies when using
>> structure editing commands such as C-c C-x C-w, C-c C-x C-y, ,
>> and friends. This could be governed by a user option.
>
> I don't think we should do that. This would slow down many commands.
> Also we cannot cover all uses cases (e.g., selecting a tree, C-w, C-y
> elsewhere) so we cannot guarantee that cookies are always up-to-date, so
> you ultimately need to intervene manually.
I would find it useful Org updating the statistics cookies after all relevant
Org editing commands even if the cookies are not updated after non-Org commands
(e.g. C-w, C-y).
> Org provides automatic updating for obvious actions, as explained in the
> manual. Doing more would be much work for little benefit.
I imagined it would be a relatively quick task. Maybe my assumption was wrong.
I still write this follow-up email, and possibly other follow-ups if
appropriate, but in the end I understand that the developers tend to have a
better picture than me of the cost/benefit of potential new features.
> We could try to improve speed when updating cookies in a whole buffer.
> A detailed profiler report in your situation could help.
I sent the profiler report below. But still, the requested feature would be
more convenient.
> Also, we could add more hooks, if needed, so as to call
> `org-update-statistics-cookies' more often.
That would satisfy me. But a question: I normally configure hooks via calls to
add-hook and am satisfied with it, but I worry about newbies: can hooks be
safely configured via Customize? What if the hook is empty by default for the
current Org version, then the user customizes it to
('#org-update-statistics-cookies), then the next Org version adds another
function to the default value of the hook, and this is not reflected in the
user's configuration, which would remain just
('#org-update-statistics-cookies)? They would be deprived of the benefits of
the new function and would not even know about it.
Now the profiling report of C-u C-c # in a 192 kB buffer, with a large number
of statistics cookies and
#+PROPERTY: COOKIE_DATA recursive
[profiler-profile "24.3" cpu #s(hash-table size 217 test equal
rehash-size 1.5 rehash-threshold 0.8 data ([profiler-format-percent
"#" profiler-calltree-walk profiler-calltree-walk
profiler-calltree-walk profiler-calltree-walk profiler-calltree-walk
profiler-calltree-compute-percentages profiler-calltree-build
profiler-report-render-calltree-1 profiler-report-rerender-calltree
profiler-report-render-calltree profiler-report-setup-buffer
profiler-report-profile-other-window profiler-report-cpu
profiler-report] 4 [redisplay sit-for execute-extended-command
smex-read-and-run smex funcall-interactively call-interactively
command-execute nil nil nil nil nil nil nil nil] 38 [sit-for
execute-extended-command smex-read-and-run smex funcall-interactively
call-interactively command-execute nil nil nil nil nil nil nil nil
nil] 10 [nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
nil] 952 [profiler-report-toggle-entry funcall-interactively
call-interactively command-execute nil nil nil nil nil nil nil nil nil
nil nil nil] 6 [profiler-format profiler-report-line-format
profiler-report-insert-calltree mapc
profiler-report-insert-calltree-children profiler-report-expand-entry
profiler-report-expand-entry profiler-report-toggle-entry
funcall-interactively call-interactively command-execute nil nil nil
nil nil] 4 [profiler-report-line-format
profiler-report-insert-calltree mapc
profiler-report-insert-calltree-children profiler-report-expand-entry
profiler-report-expand-entry profiler-report-toggle-entry
funcall-interactively call-interactively command-execute nil nil nil
nil nil nil] 4 [scroll-up-command funcall-interactively
call-interactively command-execute nil nil nil nil nil nil nil nil nil
nil nil nil] 28 [line-move-visual line-move next-line
funcall-interactively call-interactively command-execute nil nil nil
nil nil nil nil nil nil nil] 44 [framep-on-display display-graphic-p
if eval redisplay_internal\ \(C\ function\) nil nil nil nil nil nil
nil nil nil nil nil] 2 [line-move next-line funcall-interactively
call-interactively command-execute nil nil nil nil nil nil nil nil nil
nil nil] 2 [mapc profiler-report-insert-calltree-children
profiler-report-expand-entry profiler-report-toggle-entry
funcall-interactively call-interactively command-execute nil nil nil
nil nil nil nil nil nil] 4 [window-inside-pixel-edges
window-screen-lines line-move-partial line-move next-line
funcall-interactively call-interactively command-execute nil nil nil
nil nil nil nil nil] 3 [line-move-partial line-move next-line
funcall-interactively call-interactively command-execute nil nil nil
nil nil nil nil nil nil nil] 3 [run-hook-with-args-until-success
called-interactively-p next-line funcall-interactively
call-interactively