From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cecil Westerhof Subject: Re: API problem Date: Wed, 22 Jan 2014 21:28:11 +0100 Message-ID: References: <8738kgvthz.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c35acaaff76804f094f664 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W64PF-0005Ab-Oc for emacs-orgmode@gnu.org; Wed, 22 Jan 2014 15:28:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W64PE-0002fs-Br for emacs-orgmode@gnu.org; Wed, 22 Jan 2014 15:28:13 -0500 Received: from mail-qa0-x231.google.com ([2607:f8b0:400d:c00::231]:64046) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W64PE-0002fk-4z for emacs-orgmode@gnu.org; Wed, 22 Jan 2014 15:28:12 -0500 Received: by mail-qa0-f49.google.com with SMTP id w8so1080568qac.22 for ; Wed, 22 Jan 2014 12:28:11 -0800 (PST) In-Reply-To: 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: emacs-orgmode@gnu.org --001a11c35acaaff76804f094f664 Content-Type: text/plain; charset=ISO-8859-1 2014/1/22 Cecil Westerhof > 2014/1/22 Nicolas Goaziou > >> > To solve a problem I have the following line in an org file: >> > - [ ] B (org-list-set-checkbox (line-beginning-position) >> > (org-list-struct) "[X]") ITEM STRUCT CHECKBOX (org-list-send-item >> > (line-beginning-position) 'end (org-list-struct)) ITEM DEST STRUCT >> > >> > Executing the org-list-send-item brings the entry to the end of the >> list, >> > but executing org-list-set-checkbox does nothing. What am I doing >> > wrong? >> >> `org-list-set-checkbox' modifies the structure, i.e., the internal list >> representation. It doesn't modify the buffer. You would have to apply >> the new structure to the buffer with `org-list-write-struct'. >> > > Just started today to want to do some thing, so I am a tabula rasa. ;-) > > > >> Anyway, it's much simpler to use `org-toggle-checkbox'. >> > > That goes wrong when there is a marked region. I only want to set the > current checkbox. > > So I have to work out how to use org-list-wrte-struct. > 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? -- Cecil Westerhof --001a11c35acaaff76804f094f664 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
2014= /1/22 Cecil Westerhof <cldwesterhof@gmail.com>
2014/1/22 Nicolas Goaziou <n.goaziou@gmail.com><= /span>
> To solve a problem I have the following line in an org file:
> =A0 =A0 =A0 =A0 - [ ] B (org-list-set-checkbox (line-beginning-positio= n)
> (org-list-struct) "[X]") ITEM STRUCT CHECKBOX (org-list-send= -item
> (line-beginning-position) 'end (org-list-struct)) ITEM DEST STRUCT=
>
> Executing the org-list-send-item brings the entry to the end of the li= st,
> but executing org-list-set-checkbox does nothing. What am I doing
> wrong?

`org-list-set-checkbox' modifies the structure, i.e., the interna= l list
representation. It doesn't modify the buffer. You would have to apply the new structure to the buffer with `org-list-write-struct'.

Just started today to want to do some thing, so I am a tabula ra= sa. ;-)

=A0
Anyway, it's much simpler to use `org-toggle-checkbox'.

That goes wrong when there is a marked region. I only want to set = the current checkbox.
=A0
So I = have to work out how to use org-list-wrte-struct.
<= /div>

I have an org-file wth the folowing:
- [ ] A (setq struct (org-list-stru= ct))
- [-] B (org-list-get-checkbox 41 struct)
- [ ] C (org-list-set-= checkbox 41 struct "[X]")
- [ ] D (org-list-get-checkbox 41 st= ruct)
- [ ] E (org-list-write-struct struct (org-list-parents-alist struct))
<= br>
In A I fill the struct.
B displays "[-]"
C displays "[X]"
D displ= ays "[X]", so the struct is correctly updated.
E gives: #<marker in no buffer>

What is goin= g wrong here?

--
Cecil Westerhof
--001a11c35acaaff76804f094f664--