From ae0f1c56a7934cde23d30e5481510cbe79562fea Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Mon, 13 Jan 2014 17:58:16 +0100 Subject: [PATCH] Small refactoring * lisp/org.el (org-toggle-item): Do not call `org-list-struct' twice and fix checkboxes after modifying one of them. This patch is relative to 213c2a6aa057b993b0dd461c50a27034fb553faf. --- lisp/org.el | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 3267e7cb6..549f1f8c0 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -20684,13 +20684,11 @@ With a prefix argument ARG, change the region in a single item." (when (< level ref-level) (setq ref-level level)) (replace-match bul t t) (org-indent-line-to (+ start-ind (* delta bul-len))) - (if (or done todo) - (let* ((struct0 (org-list-struct)) - (struct (org-list-struct)) - (parents (org-list-parents-alist struct)) - (item (car (assoc (point) struct)))) - (org-list-set-checkbox item struct (if done "[X]" "[ ]")) - (org-list-struct-apply-struct struct struct0))) + (when (or done todo) + (let ((struct (org-list-struct))) + (org-list-set-checkbox (point) struct (if done "[X]" "[ ]")) + (org-list-write-struct struct + (org-list-parents-alist struct)))) ;; Ensure all text down to END (or SECTION-END) belongs ;; to the newly created item. (let ((section-end (save-excursion