org-footnote: don't move point for unsuccessful search of the next footnote

* lisp/org-footnote.el (org-footnote-next-reference-or-definition): if
  no more footnote is found, be sure to go back to the original
  position. Otherwise, point might be left on a footnote-like element
  that has been dished out.
This commit is contained in:
Nicolas Goaziou 2011-07-29 21:06:38 +02:00
parent 9ff7f80f51
commit 520bd1feac
1 changed files with 2 additions and 1 deletions

View File

@ -295,10 +295,11 @@ LIMIT is the buffer position bounding the search.
Return value is a list like those provided by
`org-footnote-at-reference-p' or `org-footnote-at-definition-p'.
If no footnote is found, return nil."
(let* (ref)
(let* (ref (origin (point)))
(catch 'exit
(while t
(unless (re-search-forward org-footnote-re limit t)
(goto-char origin)
(throw 'exit nil))
;; Beware: with [1]-like footnotes point will be just after
;; the closing square bracket.