From mboxrd@z Thu Jan 1 00:00:00 1970 From: Titus von der Malsburg Subject: Re: Bug: Bug: org-in-item-p indicates point is in list when it isn't [8.3.3 (release_8.3.3-529-gfed40e @ /home/malsburg/usr/share/emacs/site-lisp/org/)] [9.0.5 (9.0.5-elpa @ /home/malsburg/.emacs.d/elpa/org-20170210/)] Date: Sun, 21 May 2017 16:37:59 +0200 Message-ID: <87shjy2s3c.fsf@posteo.de> References: <87tw4e33cs.fsf@posteo.de> <87a866iczo.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47473) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dCRzj-00017N-GA for emacs-orgmode@gnu.org; Sun, 21 May 2017 10:38:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dCRzg-0003E1-Bn for emacs-orgmode@gnu.org; Sun, 21 May 2017 10:38:07 -0400 Received: from mout02.posteo.de ([185.67.36.66]:56906) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dCRzg-0003Dg-5A for emacs-orgmode@gnu.org; Sun, 21 May 2017 10:38:04 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 9463620A0F for ; Sun, 21 May 2017 16:38:01 +0200 (CEST) In-reply-to: <87a866iczo.fsf@nicolasgoaziou.fr> 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" To: Nicolas Goaziou Cc: emacs-orgmode@gnu.org On 2017-05-21 Sun 12:57, Nicolas Goaziou wrote: > Hello, > > Titus von der Malsburg writes: > >> In the example below, when I place the cursor on =E2=80=9CItem 2=E2=80= =9D and then do >> (org-end-of-item-list), the cursor is correctly placed at the beginnin= g >> of line 4. However, when I then say (org-in-item-p), I get something >> non-nil. When I move the cursor to the beginning of line 5, I still g= et >> non-nil for (org-in-item-p). The expected result is nil on line 4 and >> 5. If (org-in-item-p) gives non-nil, (org-end-of-item-list) has >> obviously not moved us to the end of the list. I think >> (org-end-of-item-list) is doing the right thing but (org-in-item-p) >> doesn=E2=80=99t. > > I don't see any bug. Blank lines after a plain list still belong to the > plain list, so `org-in-item-p' is correct. > > Indeed, `org-end-of-item-list' moves to the end of the last item No, it does not move us to the end of the item. That=E2=80=99s precisely= the problem. org-in-item-p returns non-nil even for positions after the poin= t to which org-end-of-item-list takes us. > instead > of the very end of the list, but I consider it to be a feature, e.g., > when you need to exchange two items in the list. > > You may want to explain what is bothering you in this results. The documentation of org-end-of-item-list says: Go to the end of the current list or sublist. However, when I call this function and then move the point one line further down in the example, org-in-item-p still says I=E2=80=99m in the list. It logically follows that org-end-of-item-list did not take me to the end of the list, contrary to what the documentation says. It may be convenient that org-end-of-item-list doesn=E2=80=99t take us to= the very end of the list (in my use case it=E2=80=99s not), but that behavior= is clearly neither consistent with the name of the function nor with its documentation. According to the documentation, org=E2=80=93end-of-item-l= ist should take us to the last position where org-in-item-p returns non-nil. Since it doesn=E2=80=99t, there is a bug, either in the impleme= ntation or in the documentation. > Also, I suggest to use `org-element-at-point' instead. Thanks. In the meantime, I had found org-list-struct which also solves my problem. Titus