Explorar o código

org-list: Allow check-boxes in description lists

* lisp/org-list.el (org-list-automatic-rules): Allow check-boxes in
  description lists.
(org-list-struct-apply-struct, org-insert-item): Remove rule check.
Nicolas Goaziou %!s(int64=13) %!d(string=hai) anos
pai
achega
e5b5656aa2
Modificáronse 1 ficheiros con 3 adicións e 15 borrados
  1. 3 15
      lisp/org-list.el

+ 3 - 15
lisp/org-list.el

@@ -252,8 +252,6 @@ bullet    when non-nil, cycling bullet do not allow lists at
           to be numbered.
 checkbox  when non-nil, checkbox statistics is updated each time
           you either insert a new checkbox or toggle a checkbox.
-          It also prevents from inserting a checkbox in a
-          description item.
 indent    when non-nil, indenting or outdenting list top-item
           with its subtree will move the whole list and
           outdenting a list whose bullet is * to column 0 will
@@ -1842,7 +1840,6 @@ Initial position of cursor is restored after the changes."
 	 (inlinetask-re (and (featurep 'org-inlinetask)
 			     (org-inlinetask-outline-regexp)))
 	 (item-re (org-item-re))
-	 (box-rule-p (cdr (assq 'checkbox org-list-automatic-rules)))
 	 (shift-body-ind
 	  (function
 	   ;; Shift the indentation between END and BEG by DELTA.
@@ -1881,9 +1878,6 @@ Initial position of cursor is restored after the changes."
 		 (replace-match new-bul nil nil nil 1))
 	       ;; b. Replace checkbox.
 	       (cond
-		((and new-box box-rule-p
-		      (save-match-data (org-at-item-description-p)))
-		 (message "Cannot add a checkbox to a description list item"))
 		((equal (match-string 3) new-box))
 		((and (match-string 3) new-box)
 		 (replace-match new-box nil nil nil 3))
@@ -2199,17 +2193,11 @@ item is invisible."
 	       (prevs (org-list-prevs-alist struct))
 	       ;; If we're in a description list, ask for the new term.
 	       (desc (when (org-list-get-tag itemp struct)
-		       (concat (read-string "Term: ") " :: ")))
-	       ;; Don't insert a checkbox if checkbox rule is applied
-	       ;; and it is a description item.
-	       (checkp (and checkbox
-			    (or (not desc)
-				(not (cdr (assq 'checkbox
-						org-list-automatic-rules)))))))
+		       (concat (read-string "Term: ") " :: "))))
 	  (setq struct
-		(org-list-insert-item pos struct prevs checkp desc))
+		(org-list-insert-item pos struct prevs checkbox desc))
 	  (org-list-write-struct struct (org-list-parents-alist struct))
-	  (when checkp (org-update-checkbox-count-maybe))
+	  (when checkbox (org-update-checkbox-count-maybe))
 	  (looking-at org-list-full-item-re)
 	  (goto-char (match-end 0))
 	  t)))))