summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2014-01-13 17:58:16 +0100
committerNicolas Goaziou <n.goaziou@gmail.com>2014-01-13 17:58:16 +0100
commitae0f1c56a7934cde23d30e5481510cbe79562fea (patch)
tree333facbdbafcc0f87dbd199b484a6d1edbe55125
parent6ea3dee45d4c5cd4c52849b5236317f6012536f9 (diff)
downloadorg-mode-ae0f1c56a7934cde23d30e5481510cbe79562fea.tar.gz
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.
-rw-r--r--lisp/org.el12
1 files changed, 5 insertions, 7 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 3267e7c..549f1f8 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