From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Iterate over list with `org-next-item' Date: Tue, 07 Sep 2010 15:58:31 -0400 Message-ID: <10431.1283889511@alphaville.usa.hp.com> References: <9637.1283480887@gamaville.dokosmarshall.org> <871v95l55o.wl%n.goaziou@gmail.com> Reply-To: nicholas.dokos@hp.com Return-path: Received: from [140.186.70.92] (port=39069 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ot4Me-0000pN-S1 for emacs-orgmode@gnu.org; Tue, 07 Sep 2010 16:01:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ot4JP-0004dd-On for emacs-orgmode@gnu.org; Tue, 07 Sep 2010 15:58:36 -0400 Received: from g1t0028.austin.hp.com ([15.216.28.35]:15912) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ot4JP-0004dM-Ll for emacs-orgmode@gnu.org; Tue, 07 Sep 2010 15:58:35 -0400 In-Reply-To: Message from Nicolas Goaziou of "Tue, 07 Sep 2010 21:33:55 +0200." <871v95l55o.wl%n.goaziou@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nicolas Goaziou Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org Nicolas Goaziou 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