Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2015-08-10 23:24:06 +02:00
commit a0c634ba3c
2 changed files with 16 additions and 7 deletions

View File

@ -2527,17 +2527,20 @@ With optional prefix argument ALL, do this for the whole buffer."
(let* ((container (let* ((container
(org-element-lineage (org-element-lineage
context context
'(drawer center-block dynamic-block inlinetask plain-list '(drawer center-block dynamic-block inlinetask item
quote-block special-block verse-block))) quote-block special-block verse-block)))
(beg (if container (org-element-property :begin container) (beg (if container
(org-element-property :contents-begin container)
(save-excursion (save-excursion
(org-with-limited-levels (outline-previous-heading)) (org-with-limited-levels
(outline-previous-heading))
(point))))) (point)))))
(or (cdr (assq beg cache)) (or (cdr (assq beg cache))
(save-excursion (save-excursion
(goto-char beg) (goto-char beg)
(let ((end (let ((end
(if container (org-element-property :end container) (if container
(org-element-property :contents-end container)
(save-excursion (save-excursion
(org-with-limited-levels (outline-next-heading)) (org-with-limited-levels (outline-next-heading))
(point)))) (point))))
@ -2556,9 +2559,9 @@ With optional prefix argument ALL, do this for the whole buffer."
(let ((count (let ((count
(funcall count-boxes (funcall count-boxes
(and (eq (org-element-type container) (and (eq (org-element-type container)
'plain-list) 'item)
(org-element-property (org-element-property
:contents-begin container)) :begin container))
structs structs
recursivep))) recursivep)))
(push (cons beg count) cache) (push (cons beg count) cache)

View File

@ -813,7 +813,7 @@
(org-test-with-temp-text "* [%]\n- [X] item" (org-test-with-temp-text "* [%]\n- [X] item"
(org-update-checkbox-count) (org-update-checkbox-count)
(buffer-string)))) (buffer-string))))
;; From a list. ;; From a list or a sub-list.
(should (should
(string-match "\\[0/1\\]" (string-match "\\[0/1\\]"
(org-test-with-temp-text "- [/]\n - [ ] item" (org-test-with-temp-text "- [/]\n - [ ] item"
@ -829,6 +829,12 @@
(org-test-with-temp-text "- [%]\n - [X] item" (org-test-with-temp-text "- [%]\n - [X] item"
(org-update-checkbox-count) (org-update-checkbox-count)
(buffer-string)))) (buffer-string))))
(should
(string-match
"\\[1/1\\]"
(org-test-with-temp-text "- [ ] item 1\n- [ ] item 2 [/]\n - [X] sub 1"
(org-update-checkbox-count)
(buffer-string))))
;; Count do not apply to sub-lists unless count is not hierarchical. ;; Count do not apply to sub-lists unless count is not hierarchical.
;; This state can be achieved with COOKIE_DATA node property set to ;; This state can be achieved with COOKIE_DATA node property set to
;; "recursive". ;; "recursive".