emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Nicolas Goaziou <n.goaziou@gmail.com>
Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org
Subject: Re: Iterate over list with `org-next-item'
Date: Tue, 07 Sep 2010 15:58:31 -0400	[thread overview]
Message-ID: <10431.1283889511@alphaville.usa.hp.com> (raw)
In-Reply-To: Message from Nicolas Goaziou <n.goaziou@gmail.com> of "Tue, 07 Sep 2010 21:33:55 +0200." <871v95l55o.wl%n.goaziou@gmail.com>

Nicolas Goaziou <n.goaziou@gmail.com> wrote:

> > * org.el:
> >   ... 
> 
> > * org-mouse.el:
> 
> >   ...
> 
> 
> > As you can see, the second almost matches what you came up with, but
> > the condition is simpler: the code *uses* the error raised to get
> > out of the (otherwise infinite) loop, so there is no need to check
> > what org-next-item returns.
> 
> I strongly advise against using `org-next-item' in a defun. It is, in
> its actual form, meant for interactive use only.
> 
> You should have a look at `org-get-next-item' and
> `org-get-previous-item' instead. I left a note about it at line 874 in
> org-list.el (yes, I know...).
> 
> There is also `org-apply-on-list' that might be of some help.
> 

OK, thanks for the pointer: makes sense. I hadn't pulled your
reimplementation till just now. Of course, these functions didn't exist
before, so there was no choice - but maybe the few places where
org-next-item is used need to be examined and brought up to snuff, using
your new functions? Even if not strictly necessary, then at least as
examples of good practice for others to follow.

Thanks,
Nick

  reply	other threads:[~2010-09-07 20:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-03  0:47 Iterate over list with `org-next-item' Zachary Young
2010-09-03  2:28 ` Nick Dokos
2010-09-07 19:33   ` Nicolas Goaziou
2010-09-07 19:58     ` Nick Dokos [this message]
2010-09-07 20:14       ` Nicolas Goaziou

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=10431.1283889511@alphaville.usa.hp.com \
    --to=nicholas.dokos@hp.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=n.goaziou@gmail.com \
    /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).