From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: org-context at the beginning of a link Date: Fri, 21 Nov 2014 23:37:45 +0100 Message-ID: <87egsw5gee.fsf@nicolasgoaziou.fr> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46718) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xrwp2-0000qZ-Lc for emacs-orgmode@gnu.org; Fri, 21 Nov 2014 17:37:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xrwov-0000vx-TB for emacs-orgmode@gnu.org; Fri, 21 Nov 2014 17:37:00 -0500 Received: from relay5-d.mail.gandi.net ([2001:4b98:c:538::197]:39220) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xrwov-0000vn-Nj for emacs-orgmode@gnu.org; Fri, 21 Nov 2014 17:36:53 -0500 In-Reply-To: (Alan Schmitt's message of "Fri, 21 Nov 2014 08:31:51 -0800") 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: Alan Schmitt Cc: emacs-orgmode Hello, Alan Schmitt writes: > I'm using a function that relies on `org-element-link-parser'. According > to the documentation, the point needs to be at the element of the link > for it to work. Not what you are asking for, but it is probably wrong to call this function directly. If you want to parse something, it's better to use `org-element-context' (or `org-element-at-point' but it doesn't fit here). > I wrote a small function that takes me to the beginning > of a link, but it fails when the point is already at the beginning of > the link. Here is a reproducible recipe showing the problem. > > Open this attached tiny org file: > Start > > [[file:link.org][link]] > > End > > Put the point on the 'i' of "link", for instance by (goto-char 26). > > Look up the context: (org-context). I get ((:link 8 31)) > > Go to the beginning of the link: (goto-char 8) > > Look up the context: (org-context). I get ((:link nil 31)) > > Is there a reason why the context is different at the beginning of the > link? I don't know, but `org-context' is very different from `org-element-context'. You probably mean to use the latter. Regards, -- Nicolas Goaziou