From 520bd1feac30dedfbb7532cd2b685adbfc00a801 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Fri, 29 Jul 2011 21:06:38 +0200 Subject: [PATCH] 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. --- lisp/org-footnote.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el index 9a92bd5db..6fadd28ab 100644 --- a/lisp/org-footnote.el +++ b/lisp/org-footnote.el @@ -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.