Re: [O] [bug] TODO [/] cookie not updating if list has inline task

2015-06-11 Thread e.fraga
On Tuesday,  9 Jun 2015 at 17:09, Nicolas Goaziou wrote:
 e.fr...@ucl.ac.uk writes:

 coming back to my original problem: is there a consensus on how
 inline
 tasks should be treated within lists?  Inline means to me that they
 should not break up a list... but I would like this resolved if
 possible.

 Fixed in a4cc9d82d8069741be64c55f35f9d3ad7e2663d5. Thank you.

and thanks again!
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.4.1, Org release_8.3beta-802-g7e4228.dirty



Re: [O] [bug] TODO [/] cookie not updating if list has inline task

2015-06-09 Thread Nicolas Goaziou
e.fr...@ucl.ac.uk writes:

 coming back to my original problem: is there a consensus on how inline
 tasks should be treated within lists?  Inline means to me that they
 should not break up a list... but I would like this resolved if
 possible.

Fixed in a4cc9d82d8069741be64c55f35f9d3ad7e2663d5. Thank you.

Regards,



Re: [O] [bug] TODO [/] cookie not updating if list has inline task

2015-05-20 Thread e.fraga
Hello again,

coming back to my original problem: is there a consensus on how inline
tasks should be treated within lists?  Inline means to me that they
should not break up a list... but I would like this resolved if
possible.

For the moment, Rasmus's patch works for me...

Thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.4.1, Org release_8.3beta-790-gb719c1.dirty



Re: [O] [bug] TODO [/] cookie not updating if list has inline task

2015-05-18 Thread Eric S Fraga
On Sunday, 17 May 2015 at 21:44, Rasmus wrote:
 Eric S Fraga e.fr...@ucl.ac.uk writes:

 I'm not sure I understand what is misleading about the above?  The note
 is indeed intended to belong to the first item on the list.

 The misleading part, IMO, is that it is not obvious whether the
 inlinetasks belong to the list item or not.  Normally something that
 belong to the item in indented, which is not possible here.

I guess, for me, the inline part of the name indicates that this
element is always part of the surrounding element?  Of course, this
doesn't mean the parser treats it as such and it looks like it doesn't.

 However, we are starting to see that inline tasks are indeed a bit of
 kludge and impact on org structures significantly so maybe we can remove
 this capability once inline annotations, as discussed in another thread,
 are implemented?

 FWIW, I did not like the syntax Nicolas suggested in that thread.  It
 reminded me too much of *XML (which is also true with inlinetasks BTW).
 [I, did, however, only add a star to the thread rather than replying].

I'm not too bothered with the syntax.  I can get used to (almost)
anything.  However, as I and others have commented in the inline
annotations thread, there is some worry about the syntax become too
overbearing in the attempt to have it do too much.

Back to inline tasks in lists, for the checkbox use case, I can easily
use special environments instead of inline tasks.  In general, however,
I would still like to be able to use inline tasks within lists.

Thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.4.1, Org release_8.3beta-1136-g0e7062



Re: [O] [bug] TODO [/] cookie not updating if list has inline task

2015-05-17 Thread Nicolas Goaziou
Rasmus ras...@gmx.us writes:

 You shouldn't use `org-next-visible-heading' as statistics cookie
 updates shouldn't depend on current visibility.

 That's why I used org-with-wide-buffer.

This is orthogonal. `o-w-w-b' is about narrowing. `o-n-v-h' ignores
inlinetasks.

 But perhaps a better solution would be an org-next-heading or
 whatever, that considered inlinetasks.

I'm not sure what you mean. `outline-next-heading'?

 Also, the problem is more subtle: you have to check if you're within an
 inlinetask, in which case you don't want to use
 `org-with-limited-levels' or not.

 Is that saying that org-with-wide-buffer is no good here?

I'm saying `org-next-visible-heading', or, more precisely,
`org-with-limited-levels' is no good here. See `org-get-property-block'
for an example.


Regards,



Re: [O] [bug] TODO [/] cookie not updating if list has inline task

2015-05-17 Thread Nicolas Goaziou
Rasmus ras...@gmx.us writes:

 FWIW, I did not like the syntax Nicolas suggested in that thread.  It
 reminded me too much of *XML (which is also true with inlinetasks
 BTW).

Well, that's sad. It brings interesting features you cannot have with
link-like syntax.


Regards,



[O] [bug] TODO [/] cookie not updating if list has inline task

2015-05-17 Thread Eric S Fraga
Hello,

I often use checkbox lists for particular tasks.  If any of the list
items has an inline task (whether a task or not), the updating of the
[/] cookie in the headline does not work.  Attached is an example.

Backtrace is also attached.

Thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-1147-g0e5069
#+TITLE: examplebug.org
#+AUTHOR:Eric S Fraga
#+options: tex:dvipng
* TODO [0/2] to do cookies not updating
- [ ] the first task
  
*** This is something to note
*** END

- [ ] another list of tasks
Debugger entered--Lisp error: (error Invalid search bound (wrong side of 
point))
  re-search-forward(^[ ]*\\([-+*]\\|\\([0-9]+\\|[A-Za-z]\\)[.)]\\)[
]+\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\][   ]*\\)?\\(\\[[- 
X]\\]\\) 141 move)
  funcall(re-search-forward ^[ 
]*\\([-+*]\\|\\([0-9]+\\|[A-Za-z]\\)[.)]\\)[
]+\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\][   ]*\\)?\\(\\[[- 
X]\\]\\) 141 move)
  (if (funcall search re bound noerr) nil (throw (quote exit) (and (goto-char 
(if (memq noerr (quote (t nil))) origin bound)) nil)))
  (while t (if (funcall search re bound noerr) nil (throw (quote exit) (and 
(goto-char (if (memq noerr (quote ...)) origin bound)) nil))) (if 
(org-list-in-valid-context-p) (progn (throw (quote exit) (point)
  (let ((origin (point))) (while t (if (funcall search re bound noerr) nil 
(throw (quote exit) (and (goto-char (if (memq noerr ...) origin bound)) nil))) 
(if (org-list-in-valid-context-p) (progn (throw (quote exit) (point))
  (catch (quote exit) (let ((origin (point))) (while t (if (funcall search re 
bound noerr) nil (throw (quote exit) (and (goto-char (if ... origin bound)) 
nil))) (if (org-list-in-valid-context-p) (progn (throw (quote exit) 
(point)))
  org-list-search-generic(re-search-forward ^[ 
]*\\([-+*]\\|\\([0-9]+\\|[A-Za-z]\\)[.)]\\)[
]+\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\][   ]*\\)?\\(\\[[- 
X]\\]\\) 141 move)
  org-list-search-forward(^[   ]*\\([-+*]\\|\\([0-9]+\\|[A-Za-z]\\)[.)]\\)[
]+\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\][   ]*\\)?\\(\\[[- 
X]\\]\\) 141 move)
  (while (org-list-search-forward box-re backup-end (quote move)) (let* 
((struct (org-list-struct)) (bottom (org-list-get-bottom-point struct))) (setq 
structs-bak (cons struct structs-bak)) (goto-char bottom)))
  (cond ((and (org-at-heading-p) (string-match \\todo\\ (downcase (or 
(org-entry-get nil COOKIE_DATA)  (throw (quote skip) nil)) ((and 
(org-at-heading-p) (= (save-excursion (outline-next-heading) (point)) 
backup-end)) (funcall count-boxes nil structs-bak recursivep)) 
((org-at-heading-p) (setq backup-end (save-excursion (outline-next-heading) 
(point)) structs-bak nil) (while (org-list-search-forward box-re backup-end 
(quote move)) (let* ((struct (org-list-struct)) (bottom 
(org-list-get-bottom-point struct))) (setq structs-bak (cons struct 
structs-bak)) (goto-char bottom))) (funcall count-boxes nil structs-bak 
recursivep)) ((and (org-at-item-p) ( (point-at-bol) backup-end) (not (nth 2 
(org-list-context (funcall count-boxes (point-at-bol) structs-bak 
recursivep)) ((org-at-item-p) (let ((struct (org-list-struct))) (setq 
backup-end (org-list-get-bottom-point struct) structs-bak (list struct))) 
(funcall count-boxes (point-at-bol) structs-bak recursivep)) (t (throw (quote 
skip) nil)))
  (list (match-beginning 1) (match-end 1) (match-string 2) (cond ((and 
(org-at-heading-p) (string-match \\todo\\ (downcase (or (org-entry-get nil 
COOKIE_DATA)  (throw (quote skip) nil)) ((and (org-at-heading-p) (= 
(save-excursion (outline-next-heading) (point)) backup-end)) (funcall 
count-boxes nil structs-bak recursivep)) ((org-at-heading-p) (setq backup-end 
(save-excursion (outline-next-heading) (point)) structs-bak nil) (while 
(org-list-search-forward box-re backup-end (quote move)) (let* ((struct 
(org-list-struct)) (bottom (org-list-get-bottom-point struct))) (setq 
structs-bak (cons struct structs-bak)) (goto-char bottom))) (funcall 
count-boxes nil structs-bak recursivep)) ((and (org-at-item-p) ( 
(point-at-bol) backup-end) (not (nth 2 (org-list-context (funcall 
count-boxes (point-at-bol) structs-bak recursivep)) ((org-at-item-p) (let 
((struct (org-list-struct))) (setq backup-end (org-list-get-bottom-point 
struct) structs-bak (list struct))) (funcall count-boxes (point-at-bol) 
structs-bak recursivep)) (t (throw (quote skip) nil
  (cons (list (match-beginning 1) (match-end 1) (match-string 2) (cond ((and 
(org-at-heading-p) (string-match \\todo\\ (downcase (or ...  (throw 
(quote skip) nil)) ((and (org-at-heading-p) (= (save-excursion 
(outline-next-heading) (point)) backup-end)) (funcall count-boxes nil 
structs-bak recursivep)) ((org-at-heading-p) (setq backup-end (save-excursion 
(outline-next-heading) (point)) structs-bak nil) (while 
(org-list-search-forward box-re backup-end (quote move)) (let* ((struct ...) 
(bottom 

Re: [O] [bug] TODO [/] cookie not updating if list has inline task

2015-05-17 Thread Nicolas Goaziou
Hello,

Rasmus ras...@gmx.us writes:

 Can you try the attached patch?  It seems to work on my system, but
 probably more cleanup should be made wrt the old outline-functions.
 +   (org-with-wide-buffer
 +(org-next-visible-heading 1)
 +(point)

You shouldn't use `org-next-visible-heading' as statistics cookie
updates shouldn't depend on current visibility. Also, the problem is
more subtle: you have to check if you're within an inlinetask, in which
case you don't want to use `org-with-limited-levels' or not.

Anyway, we could fix it in another way. Eric's example,

  - [ ] the first task

  *** This is something to note
  *** END

  - [ ] another list of tasks

is misleading because it's really the same list, i.e., inlinetasks are
allowed in items, so This is something to note belongs to the first
task.

So, our option is to simply dis-allow inlinetasks in plain lists. That
would also solve the issue.

WDYT?


Regards,

-- 
Nicolas Goaziou



Re: [O] [bug] TODO [/] cookie not updating if list has inline task

2015-05-17 Thread Rasmus
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Hello,

 Rasmus ras...@gmx.us writes:

 Can you try the attached patch?  It seems to work on my system, but
 probably more cleanup should be made wrt the old outline-functions.
 +  (org-with-wide-buffer
 +   (org-next-visible-heading 1)
 +   (point)

 You shouldn't use `org-next-visible-heading' as statistics cookie
 updates shouldn't depend on current visibility.

That's why I used org-with-wide-buffer.  But perhaps a better solution
would be an org-next-heading or whatever, that considered inlinetasks.

 Also, the problem is more subtle: you have to check if you're within an
 inlinetask, in which case you don't want to use
 `org-with-limited-levels' or not.

Is that saying that org-with-wide-buffer is no good here?

 Anyway, we could fix it in another way. Eric's example,

   - [ ] the first task
 
   *** This is something to note
   *** END

   - [ ] another list of tasks

 is misleading because it's really the same list, i.e., inlinetasks are
 allowed in items, so This is something to note belongs to the first
 task.

 So, our option is to simply dis-allow inlinetasks in plain lists. That
 would also solve the issue.

It solves the problem, unless Eric wants inlinetasks in his list.  The
solution in my other patch recognized both checkboxes.

 WDYT?

I haven't needed inlinetasks in lists.  So I don't care much.  Better wait
for Eric's opinion.

—Rasmus

-- 
I feel emotional landscapes they puzzle me



Re: [O] [bug] TODO [/] cookie not updating if list has inline task

2015-05-17 Thread Eric S Fraga
On Sunday, 17 May 2015 at 20:51, Nicolas Goaziou wrote:

[...]

 Anyway, we could fix it in another way. Eric's example,

   - [ ] the first task
 
   *** This is something to note
   *** END

   - [ ] another list of tasks

 is misleading because it's really the same list, i.e., inlinetasks are
 allowed in items, so This is something to note belongs to the first
 task.

I'm not sure I understand what is misleading about the above?  The note
is indeed intended to belong to the first item on the list.

 So, our option is to simply dis-allow inlinetasks in plain lists. That
 would also solve the issue.

I wouldn't be too keen on this option at the moment.  I use inline tasks
in lists all the time.

However, we are starting to see that inline tasks are indeed a bit of
kludge and impact on org structures significantly so maybe we can remove
this capability once inline annotations, as discussed in another thread,
are implemented?

Thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-1147-g0e5069



Re: [O] [bug] TODO [/] cookie not updating if list has inline task

2015-05-17 Thread Eric S Fraga
On Sunday, 17 May 2015 at 15:51, Rasmus wrote:
 Hi Eric,

[...]

 Can you try the attached patch?  It seems to work on my system, but
 probably more cleanup should be made wrt the old outline-functions.

Hi Rasmus,

your patch eems to work just fine.  I haven't done exhaustive testing
but no error is encountered and the count is updated correctly.

Thanks!

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-1147-g0e5069



Re: [O] [bug] TODO [/] cookie not updating if list has inline task

2015-05-17 Thread Eric S Fraga
eems -- seems

(must learn to read my emails before I C-c C-c... ;-)
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-1147-g0e5069



Re: [O] [bug] TODO [/] cookie not updating if list has inline task

2015-05-17 Thread Rasmus
Eric S Fraga e.fr...@ucl.ac.uk writes:

 I'm not sure I understand what is misleading about the above?  The note
 is indeed intended to belong to the first item on the list.

The misleading part, IMO, is that it is not obvious whether the
inlinetasks belong to the list item or not.  Normally something that
belong to the item in indented, which is not possible here.

 However, we are starting to see that inline tasks are indeed a bit of
 kludge and impact on org structures significantly so maybe we can remove
 this capability once inline annotations, as discussed in another thread,
 are implemented?

FWIW, I did not like the syntax Nicolas suggested in that thread.  It
reminded me too much of *XML (which is also true with inlinetasks BTW).
[I, did, however, only add a star to the thread rather than replying].

—Rasmus

-- 
I hear there's rumors on the, uh, Internets. . .



Re: [O] [bug] TODO [/] cookie not updating if list has inline task

2015-05-17 Thread Eric S Fraga
Please ignore my bug report for the moment.  org works if I don't invoke
any of my customisations.  I have obviously set something that makes the
updating of the cookie fail.  Not sure what, mind you... Any suggestions
welcome, of course.

Sorry for the noise.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-1147-g0e5069



Re: [O] [bug] TODO [/] cookie not updating if list has inline task

2015-05-17 Thread Eric S Fraga
Mind you, having played around with emacs -Q and my test file, I have
run into another bug.  If I specify org-indent in the startup options, I
get a very strange indentation.  See attached screenshot.  I wonder if
this is related to my problem?

Thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-1147-g0e5069


Re: [O] [bug] TODO [/] cookie not updating if list has inline task

2015-05-17 Thread Rasmus
Eric S Fraga e.fr...@ucl.ac.uk writes:

 Mind you, having played around with emacs -Q and my test file, I have
 run into another bug.  If I specify org-indent in the startup options, I
 get a very strange indentation.  See attached screenshot.  I wonder if
 this is related to my problem?

Probably 'cause you havne't loaded org-inlinetask.  Or you toggled
org-indent-mode before.  Perhaps org-inlinetasks should be intelligently
loaded if it seems like an inlinetaks is present.

-- 
Sådan en god dansk lagereddike kan man slet ikke bruge mere




Re: [O] [bug] TODO [/] cookie not updating if list has inline task

2015-05-17 Thread Rasmus
Hi Eric,

Eric S Fraga e.fr...@ucl.ac.uk writes:

 I often use checkbox lists for particular tasks.  If any of the list
 items has an inline task (whether a task or not), the updating of the
 [/] cookie in the headline does not work.  Attached is an example.

 Backtrace is also attached.

Thanks.

Can you try the attached patch?  It seems to work on my system, but
probably more cleanup should be made wrt the old outline-functions.

—Rasmus

-- 
This space is left intentionally blank
From 965aa17b30fd511fbd2f4415104878c52c245550 Mon Sep 17 00:00:00 2001
From: Rasmus ras...@gmx.us
Date: Sun, 17 May 2015 15:48:40 +0200
Subject: [PATCH 4/4] Fix cookie counter bug

* org.el (org-update-statistics-cookies):
* org-list.el (org-update-checkbox-count): Do not use
  outline-next-heading.

Reported-by: Eric S Fraga e.fr...@ucl.ac.uk
http://permalink.gmane.org/gmane.emacs.orgmode/97594
---
 lisp/org-list.el | 12 
 lisp/org.el  |  8 
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/lisp/org-list.el b/lisp/org-list.el
index d18dff1..4950e05 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -2476,7 +2476,9 @@ With optional prefix argument ALL, do this for the whole buffer.
 		  (cons (point-min) (point-max))
 		(cons (or (ignore-errors (org-back-to-heading t) (point))
 			  (point-min))
-			  (save-excursion (outline-next-heading) (point)
+			  (org-with-wide-buffer
+			   (org-next-visible-heading 1)
+			   (point)
 	  (count-boxes
 	   (function
 	;; Return number of checked boxes and boxes of all types
@@ -2534,15 +2536,17 @@ With optional prefix argument ALL, do this for the whole buffer.
 	   ;; in STRUCTS-BAK.  This should only happen when
 	   ;; heading has more than one cookie on it.
 	   ((and (org-at-heading-p)
-		 (= (save-excursion (outline-next-heading) (point))
+		 (= (org-with-wide-buffer (org-next-visible-heading 1)
+	   (point))
 			 backup-end))
 		(funcall count-boxes nil structs-bak recursivep))
 	   ;; Cookie is at a fresh heading.  Grab structure of
 	   ;; every list containing a checkbox between point and
 	   ;; next headline, and save them in STRUCTS-BAK.
 	   ((org-at-heading-p)
-		(setq backup-end (save-excursion
-   (outline-next-heading) (point))
+		(setq backup-end (org-with-wide-buffer
+  (org-next-visible-heading 1)
+  (point))
 		  structs-bak nil)
 		(while (org-list-search-forward box-re backup-end 'move)
 		  (let* ((struct (org-list-struct))
diff --git a/lisp/org.el b/lisp/org.el
index 0c3e61c..996b9d6 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12867,10 +12867,10 @@ This should be called with the cursor in a line with a statistics cookie.
 	(if (not (org-at-heading-p))
 	(org-update-checkbox-count)
 	  (setq l1 (org-outline-level))
-	  (setq end (save-excursion
-		  (outline-next-heading)
-		  (if (org-at-heading-p) (setq l2 (org-outline-level)))
-		  (point)))
+	  (setq end (org-with-wide-buffer
+		 (org-next-visible-heading 1)
+		 (if (org-at-heading-p) (setq l2 (org-outline-level)))
+		 (point)))
 	  (if (and (save-excursion
 		 (re-search-forward
 		  ^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) \\[[- X]\\] end t))
-- 
2.4.1