Merge branch 'maint'
This commit is contained in:
commit
8b79f8c91b
|
@ -1211,14 +1211,17 @@ When PRINTF is non-nil, use it to format the result."
|
|||
(defun org-columns--summary-checkbox-count (check-boxes _)
|
||||
"Summarize CHECK-BOXES with a check-box cookie."
|
||||
(format "[%d/%d]"
|
||||
(cl-count "[X]" check-boxes :test #'equal)
|
||||
(cl-count-if (lambda (b) (or (equal b "[X]")
|
||||
(string-match-p "\\[\\([1-9]\\)/\\1\\]" b)))
|
||||
check-boxes)
|
||||
(length check-boxes)))
|
||||
|
||||
(defun org-columns--summary-checkbox-percent (check-boxes _)
|
||||
"Summarize CHECK-BOXES with a check-box percent."
|
||||
(format "[%d%%]"
|
||||
(round (* 100.0 (cl-count "[X]" check-boxes :test #'equal))
|
||||
(float (length check-boxes)))))
|
||||
(round (* 100.0 (cl-count-if (lambda (b) (member b '("[X]" "[100%]")))
|
||||
check-boxes))
|
||||
(length check-boxes))))
|
||||
|
||||
(defun org-columns--summary-min (values printf)
|
||||
"Compute the minimum of VALUES.
|
||||
|
|
|
@ -337,6 +337,88 @@
|
|||
** S1
|
||||
:PROPERTIES:
|
||||
:A: [X]
|
||||
:END:"
|
||||
(let ((org-columns-default-format "%A{X%}")) (org-columns))
|
||||
(get-char-property (point) 'org-columns-value-modified))))
|
||||
;; {X/} handles recursive summaries.
|
||||
(should
|
||||
(equal
|
||||
"[1/2]"
|
||||
(org-test-with-temp-text
|
||||
"* H
|
||||
** S1
|
||||
:PROPERTIES:
|
||||
:A: [ ]
|
||||
:END:
|
||||
** S2
|
||||
*** S21
|
||||
:PROPERTIES:
|
||||
:A: [X]
|
||||
:END:
|
||||
*** S22
|
||||
:PROPERTIES:
|
||||
:A: [X]
|
||||
:END:"
|
||||
(let ((org-columns-default-format "%A{X/}")) (org-columns))
|
||||
(get-char-property (point) 'org-columns-value-modified))))
|
||||
(should
|
||||
(equal
|
||||
"[1/2]"
|
||||
(org-test-with-temp-text
|
||||
"* H
|
||||
** S1
|
||||
:PROPERTIES:
|
||||
:A: [X]
|
||||
:END:
|
||||
** S2
|
||||
*** S21
|
||||
:PROPERTIES:
|
||||
:A: [ ]
|
||||
:END:
|
||||
*** S22
|
||||
:PROPERTIES:
|
||||
:A: [ ]
|
||||
:END:"
|
||||
(let ((org-columns-default-format "%A{X/}")) (org-columns))
|
||||
(get-char-property (point) 'org-columns-value-modified))))
|
||||
;; {X%} handles recursive summaries.
|
||||
(should
|
||||
(equal
|
||||
"[50%]"
|
||||
(org-test-with-temp-text
|
||||
"* H
|
||||
** S1
|
||||
:PROPERTIES:
|
||||
:A: [ ]
|
||||
:END:
|
||||
** S2
|
||||
*** S21
|
||||
:PROPERTIES:
|
||||
:A: [X]
|
||||
:END:
|
||||
*** S22
|
||||
:PROPERTIES:
|
||||
:A: [X]
|
||||
:END:"
|
||||
(let ((org-columns-default-format "%A{X%}")) (org-columns))
|
||||
(get-char-property (point) 'org-columns-value-modified))))
|
||||
(should
|
||||
(equal
|
||||
"[50%]"
|
||||
(org-test-with-temp-text
|
||||
"* H
|
||||
** S1
|
||||
:PROPERTIES:
|
||||
:A: [X]
|
||||
:END:
|
||||
** S2
|
||||
*** S21
|
||||
:PROPERTIES:
|
||||
:A: [ ]
|
||||
:END:
|
||||
*** S22
|
||||
:PROPERTIES:
|
||||
:A: [ ]
|
||||
:END:"
|
||||
(let ((org-columns-default-format "%A{X%}")) (org-columns))
|
||||
(get-char-property (point) 'org-columns-value-modified))))
|
||||
|
|
Loading…
Reference in New Issue