Store link: Don't error before the first heading in a file
commit206660bc8c02e5025d5f43cd3e5fb36c2fe0c8f3
authorCarsten Dominik <carsten.dominik@gmail.com>
Fri, 4 Sep 2009 11:11:18 +0000 (4 13:11 +0200)
committerCarsten Dominik <carsten.dominik@gmail.com>
Fri, 4 Sep 2009 11:11:18 +0000 (4 13:11 +0200)
treeb74a8cde02ecf21b3ecffa88c15dc67cb1985d48
parentc125359a9bd13baef4a1ecc75aa55e7ee22be562
Store link: Don't error before the first heading in a file

Matt Lundin writes:

> When I call org-remember or org-store-link above the first headline in
> an org buffer, I receive the following error message:
>
>    Before first headline at position 1 in buffer index.org
>
> It seems that either org-remember or org-store-link (or both) calls
> org-back-to-heading in order to grab the relevant heading for
> annotation. As a result, if I try to store a link above the first
> heading, emacs spits out the error message above because there is no
> heading to return to.
>
> Is this the intended behavior? Sometimes I prefer to create a link to
> the file as a whole rather than to a particular headline. E.g., I might
> want to create a todo to organize notes.org, which is not an agenda
> file. In this instance, it does not matter whether org-remember creates
> a link to a particular headline. In fact, I would prefer a link to the
> file as a whole and thus expect to be able to store a link while on the
> first empty line of the file or on #+TITLE.
lisp/ChangeLog
lisp/org.el