From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: API problem Date: Wed, 22 Jan 2014 21:40:36 +0100 Message-ID: <87r47zvjgb.fsf@gmail.com> References: <8738kgvthz.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:32885) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W64b0-0001jj-RX for emacs-orgmode@gnu.org; Wed, 22 Jan 2014 15:40:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W64as-00068X-AU for emacs-orgmode@gnu.org; Wed, 22 Jan 2014 15:40:22 -0500 Received: from mail-wi0-x22b.google.com ([2a00:1450:400c:c05::22b]:60291) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W64as-00068L-16 for emacs-orgmode@gnu.org; Wed, 22 Jan 2014 15:40:14 -0500 Received: by mail-wi0-f171.google.com with SMTP id cc10so6153516wib.4 for ; Wed, 22 Jan 2014 12:40:13 -0800 (PST) In-Reply-To: (Cecil Westerhof's message of "Wed, 22 Jan 2014 21:28:11 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Cecil Westerhof Cc: emacs-orgmode@gnu.org Cecil Westerhof 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: # > > 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)) Regards, -- Nicolas Goaziou