org-forward-heading-same-level: Do not rely on match-data from `org-back-to-heading'

* lisp/org.el (org-forward-heading-same-level): Use
`org-current-level' instead of relying upon `org-back-to-heading' to
set match data.

Reported-by: Nick Dokos <ndokos@gmail.com>
Link: https://orgmode.org/list/87352hk0nt.fsf@alphaville.usersys.redhat.com
This commit is contained in:
Ihor Radchenko 2023-06-24 15:33:59 +03:00
parent 57bb9cada3
commit 0a842cc94b
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 1 additions and 1 deletions

View File

@ -20659,7 +20659,7 @@ non-nil it will also look at invisible ones."
(if backward? (goto-char (point-min)) (outline-next-heading))
(org-back-to-heading invisible-ok)
(unless backward? (end-of-line)) ;do not match current headline
(let ((level (- (match-end 0) (match-beginning 0) 1))
(let ((level (org-current-level))
(f (if backward? #'re-search-backward #'re-search-forward))
(count (if arg (abs arg) 1))
(result (point)))