From: Stefan Monnier Date: Fri, 25 Oct 2002 15:30:20 +0000 (+0000) Subject: (outline-next-heading): Make sure the match-data is correct where returning. X-Git-Tag: ttn-vms-21-2-B4~12725 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=baaec43f3d30175df2183aca2a5965d0303cbbee;p=emacs.git (outline-next-heading): Make sure the match-data is correct where returning. --- diff --git a/lisp/textmodes/outline.el b/lisp/textmodes/outline.el index e3bff3a174e..696e2eb9466 100644 --- a/lisp/textmodes/outline.el +++ b/lisp/textmodes/outline.el @@ -326,9 +326,11 @@ at the end of the buffer." (defun outline-next-heading () "Move to the next (possibly invisible) heading line." (interactive) - (if (re-search-forward (concat "\n\\(?:" outline-regexp "\\)") + ;; Make sure we don't match the heading we're at. + (if (and (bolp) (not (eobp))) (forward-char 1)) + (if (re-search-forward (concat "^\\(?:" outline-regexp "\\)") nil 'move) - (goto-char (1+ (match-beginning 0))))) + (goto-char (match-beginning 0)))) (defun outline-previous-heading () "Move to the previous (possibly invisible) heading line."