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.




[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-27 Thread Jorge
Paste the following in an Org buffer:
--8<---cut here---start->8---
* Cookie_a [0/0]
* TODO Dummy_a
* Cookie_b [0/1]
** TODO Dummy_b
--8<---cut here---end--->8---

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.

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.

Regards

Emacs  : GNU Emacs 25.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.18.9)
 of 2016-09-18
Package: Org-mode version 8.3.6 (8.3.6-4-g4835be-elpaplus @
/home/jorge/.emacs.d/elpa/org-plus-contrib-20160926/)

current state:
==
(setq
 org-tab-first-hook '(org-hide-block-toggle-maybe
org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-default-hook
org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-shell-link-function 'yes-or-no-p
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '(#[nil "\300\301\302\303\304$\207" [org-add-hook
change-major-mode-hook org-show-block-all append local] 5]
#[nil "\300\301\302\303\304$\207" [org-add-hook change-major-mode-hook
org-babel-show-result-all append local]
  5]
org-babel-result-hide-spec org-babel-hide-all-hashes org-eldoc-load)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
org-babel-execute-safely-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-hide-drawers org-cycle-show-empty-lines
 org-optimize-window-after-visibility-change)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 )

-- 
• I am Brazilian.  I hope my English is correct and I welcome corrections.
• Please adopt free formats like PDF, ODF, Org, LaTeX, Opus, WebM and 7z.
• Free (as in free speech) software for Android: https://f-droid.org/