|
@@ -18390,12 +18390,19 @@ This command does many different things, depending on context:
|
|
|
block-item)
|
|
|
;; Use a light version of `org-toggle-checkbox' to avoid
|
|
|
;; computing list structure twice.
|
|
|
- (org-list-set-checkbox (point-at-bol) struct
|
|
|
- (cond
|
|
|
- ((equal arg '(16)) "[-]")
|
|
|
- ((equal arg '(4)) nil)
|
|
|
- ((equal "[X]" cbox) "[ ]")
|
|
|
- (t "[X]")))
|
|
|
+ (let ((new-box (cond
|
|
|
+ ((equal arg '(16)) "[-]")
|
|
|
+ ((equal arg '(4)) nil)
|
|
|
+ ((equal "[X]" cbox) "[ ]")
|
|
|
+ (t "[X]"))))
|
|
|
+ (if firstp
|
|
|
+ ;; If at first item of sub-list, remove check-box from
|
|
|
+ ;; every item at the same level.
|
|
|
+ (mapc
|
|
|
+ (lambda (pos) (org-list-set-checkbox pos struct new-box))
|
|
|
+ (org-list-get-all-items
|
|
|
+ (point-at-bol) struct (org-list-prevs-alist struct)))
|
|
|
+ (org-list-set-checkbox (point-at-bol) struct new-box)))
|
|
|
;; Replicate `org-list-write-struct', while grabbing a return
|
|
|
;; value from `org-list-struct-fix-box'.
|
|
|
(org-list-struct-fix-ind struct parents 2)
|
|
@@ -18417,9 +18424,20 @@ This command does many different things, depending on context:
|
|
|
;; only if function was called with an argument. Send list only
|
|
|
;; if at top item.
|
|
|
(let* ((struct (org-list-struct))
|
|
|
+ (new-struct struct)
|
|
|
(firstp (= (org-list-get-top-point struct) (point-at-bol))))
|
|
|
- (when arg (org-list-set-checkbox (point-at-bol) struct "[ ]"))
|
|
|
- (org-list-write-struct struct (org-list-parents-alist struct))
|
|
|
+ (when arg
|
|
|
+ (setq new-struct (copy-tree struct))
|
|
|
+ (if firstp
|
|
|
+ ;; If at first item of sub-list, add check-box to every
|
|
|
+ ;; item at the same level.
|
|
|
+ (mapc
|
|
|
+ (lambda (pos) (org-list-set-checkbox pos new-struct "[ ]"))
|
|
|
+ (org-list-get-all-items
|
|
|
+ (point-at-bol) new-struct (org-list-prevs-alist new-struct)))
|
|
|
+ (org-list-set-checkbox (point-at-bol) new-struct "[ ]")))
|
|
|
+ (org-list-write-struct
|
|
|
+ new-struct (org-list-parents-alist new-struct) struct)
|
|
|
(when arg (org-update-checkbox-count-maybe))
|
|
|
(when firstp (org-list-send-list 'maybe))))
|
|
|
((save-excursion (beginning-of-line 1) (looking-at org-dblock-start-re))
|