From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Re: [bug] TODO [/] cookie not updating if list has inline task
Date: Sun, 17 May 2015 15:51:47 +0200 [thread overview]
Message-ID: <87r3qfgvm4.fsf@gmx.us> (raw)
In-Reply-To: 877fs75tzk.fsf@ucl.ac.uk
[-- Attachment #1: Type: text/plain, Size: 499 bytes --]
Hi Eric,
Eric S Fraga <e.fraga@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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0004-Fix-cookie-counter-bug.patch --]
[-- Type: text/x-diff, Size: 2792 bytes --]
From 965aa17b30fd511fbd2f4415104878c52c245550 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@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.fraga@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
next prev parent reply other threads:[~2015-05-17 13:52 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-17 11:22 [bug] TODO [/] cookie not updating if list has inline task Eric S Fraga
2015-05-17 13:08 ` Eric S Fraga
2015-05-17 13:23 ` Eric S Fraga
2015-05-17 13:32 ` Rasmus
2015-05-17 13:51 ` Rasmus [this message]
2015-05-17 18:26 ` Eric S Fraga
2015-05-17 18:27 ` Eric S Fraga
2015-05-17 18:51 ` Nicolas Goaziou
2015-05-17 19:02 ` Rasmus
2015-05-17 21:56 ` Nicolas Goaziou
2015-05-20 8:26 ` e.fraga
2015-06-09 15:09 ` Nicolas Goaziou
2015-06-11 14:40 ` e.fraga
2015-05-17 19:28 ` Eric S Fraga
2015-05-17 19:44 ` Rasmus
2015-05-17 22:05 ` Nicolas Goaziou
2015-05-18 8:16 ` Eric S Fraga
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r3qfgvm4.fsf@gmx.us \
--to=rasmus@gmx.us \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).