emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Alan Schmitt <alan.schmitt@polytechnique.org>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: org-context at the beginning of a link
Date: Fri, 21 Nov 2014 23:37:45 +0100	[thread overview]
Message-ID: <87egsw5gee.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <m2h9xsjz0o.fsf@polytechnique.org> (Alan Schmitt's message of "Fri, 21 Nov 2014 08:31:51 -0800")

Hello,

Alan Schmitt <alan.schmitt@polytechnique.org> 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

  reply	other threads:[~2014-11-21 22:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-21 16:31 org-context at the beginning of a link Alan Schmitt
2014-11-21 22:37 ` Nicolas Goaziou [this message]
2014-11-22 15:23   ` Alan Schmitt

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=87egsw5gee.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=alan.schmitt@polytechnique.org \
    --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).