Selaa lähdekoodia

C-c C-c renumbers ordered lists again

* lisp/org.el (org-ctrl-c-ctrl-c): Fix a naive structure backup.
  Those must be done with `copy-tree'.

Thanks to Anthony Lander for reporting it.
Nicolas Goaziou 13 vuotta sitten
vanhempi
commit
8c2f226b4d
1 muutettua tiedostoa jossa 8 lisäystä ja 8 poistoa
  1. 8 8
      lisp/org.el

+ 8 - 8
lisp/org.el

@@ -18424,22 +18424,22 @@ 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))))
+	     (firstp (= (org-list-get-top-point struct) (point-at-bol)))
+	     old-struct)
 	(when arg
-	  (setq new-struct (copy-tree struct))
+	  (setq old-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)
-		 (unless (org-list-get-checkbox pos new-struct)
-		   (org-list-set-checkbox pos new-struct "[ ]")))
+		 (unless (org-list-get-checkbox pos struct)
+		   (org-list-set-checkbox pos 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 "[ ]")))
+		(point-at-bol) struct (org-list-prevs-alist struct)))
+	    (org-list-set-checkbox (point-at-bol) struct "[ ]")))
 	(org-list-write-struct
-	 new-struct (org-list-parents-alist new-struct) struct)
+	 struct (org-list-parents-alist struct) old-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))