emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Cecil Westerhof <cldwesterhof@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: API problem
Date: Wed, 22 Jan 2014 22:57:37 +0100	[thread overview]
Message-ID: <CAG-LmmALsGTnKoiZg=XHi6tX9MZKA+E2b_ztik0PN1_QOuNoOg@mail.gmail.com> (raw)
In-Reply-To: <87r47zvjgb.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1269 bytes --]

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

> Cecil Westerhof <cldwesterhof@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

[-- Attachment #2: Type: text/html, Size: 2043 bytes --]

  reply	other threads:[~2014-01-22 21:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-22 16:37 API problem Cecil Westerhof
2014-01-22 17:03 ` Nicolas Goaziou
     [not found]   ` <CAG-LmmApJwvTvTYZ3cFjb_rLkiX9B_JP3FzTX-D_kW3H1=D6pA@mail.gmail.com>
2014-01-22 20:24     ` Fwd: " Cecil Westerhof
2014-01-22 20:28       ` Cecil Westerhof
2014-01-22 20:40         ` Nicolas Goaziou
2014-01-22 21:57           ` Cecil Westerhof [this message]
2014-01-22 22:23             ` Nicolas Goaziou
2014-01-22 23:52           ` Cecil Westerhof

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAG-LmmALsGTnKoiZg=XHi6tX9MZKA+E2b_ztik0PN1_QOuNoOg@mail.gmail.com' \
    --to=cldwesterhof@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).