Re: [O] Bug: Feature request: more automatic updating of cookies [8.3.6 (8.3.6-4-g4835be-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160926/)]

2016-10-03 Thread Jorge
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 

Re: [O] Bug: Feature request: more automatic updating of cookies [8.3.6 (8.3.6-4-g4835be-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160926/)]

2016-10-02 Thread Nicolas Goaziou
Hello,

Jorge  writes:

> Paste the following in an Org buffer:
>
> * Cookie_a [0/0] * TODO Dummy_a * Cookie_b [0/1] ** TODO Dummy_b
>
> Within that buffer:
>1. Move point to the line of Dummy_a.
>2. 
> I wished the cookie to be updated to [0/1] but it is not.
>
> Then:
>1. Move point to the line of Dummy_b.
>2. C-c C-x C-w
>3. Move point to the line of Dummy_a at column 0.
>4. C-c C-x C-y
> I wished both cookies to be updated.  They are not.
>
> The manual [[info:org#Checkboxes][says]]:
> Checkbox statistic cookies are updated automatically if you toggle
> checkboxes with `C-c C-c' and make new ones with `M-S-'.  TODO
> statistics cookies update when changing TODO states.  If you delete
> boxes/entries or add/change them by hand, use this command to get things
> back into sync.
>
> 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.

Org provides automatic updating for obvious actions, as explained in the
manual. Doing more would be much work for little benefit.

> The point is that C-u C-c # (to update cookies in the entire buffer) takes
> long enough that I only call it a few times per week.  This means that cookies
> can get out of sync.  Then I try to remember manually invoking C-c # on the
> relevant line every time it goes out of sync, but I sometimes omit it.

We could try to improve speed when updating cookies in a whole buffer.
A detailed profiler report in your situation could help. 

Also, we could add more hooks, if needed, so as to call
`org-update-statistics-cookies' more often.


Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Feature request: more automatic updating of cookies [8.3.6 (8.3.6-4-g4835be-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160926/)]

2016-09-28 Thread Adam Porter
Jorge  writes:

> 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.
>
> The point is that C-u C-c # (to update cookies in the entire buffer) takes
> long enough that I only call it a few times per week.  This means that cookies
> can get out of sync.  Then I try to remember manually invoking C-c # on the
> relevant line every time it goes out of sync, but I sometimes omit it.

Yeah, I have wished for this myself.  It would probably work without too
much overhead to advise the outline-manipulating functions to call
org-update-statistics-cookies afterward.  There might be a few other
functions to advise also to get more complete coverage.