2014/1/22 Nicolas Goaziou <n.goaz...@gmail.com>

> Cecil Westerhof <cldwester...@gmail.com> writes:
>
> > I have an org-file wth the folowing:
> > - [ ] A (setq struct (org-list-struct))
> > - [-] B (org-list-get-checkbox 41 struct)
> > - [ ] C (org-list-set-checkbox 41 struct "[X]")
> > - [ ] D (org-list-get-checkbox 41 struct)
> > - [ ] E (org-list-write-struct struct (org-list-parents-alist struct))
> >
> > In A I fill the struct.
> > B displays "[-]"
> > C displays "[X]"
> > D displays "[X]", so the struct is correctly updated.
> > E gives: #<marker in no buffer>
> >
> > What is going wrong here?
>
> See `org-list-write-struct' docstring. Basically, STRUCT doesn't match
> real structure anymore since step C. You need to provide the original
> structure as a third argument so `org-list-write-struct' can modify
> buffer by set difference.
>
>   (let* ((struct (org-list-struct))
>          (old (copy-tree struct)))
>     (org-list-set-checkbox (line-beginning-position) struct "[X]")
>     (org-list-write-struct struct (org-list-parents-alist struct) old))
>

This works, so I can continue.

But one thing I do not understand. When you do an org-list-write-struct,
you want to change the structure. So why is old-struct optional?



-- 
Cecil Westerhof

Reply via email to