From 5584ffc6c4c4010f7a722fa25d6a669ba0f0f6a9 Mon Sep 17 00:00:00 2001 From: Bastien Date: Sun, 2 May 2021 08:49:53 +0200 Subject: [PATCH] lisp/org.el (org--backward-paragraph-once): Handle corner case * lisp/org.el (org--backward-paragraph-once): Don't throw an error when at the first headline after a single empty line. --- lisp/org.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index ad51ecbb3..49eaccbcd 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -20886,7 +20886,11 @@ See `org-backward-paragraph'." (cond ;; There is a blank line above. Move there. ((and (org-previous-line-empty-p) - (not (org-invisible-p (1- (line-end-position 0))))) + (let ((lep (line-end-position 0))) + ;; When the first headline start at point 2, don't choke while + ;; checking with `org-invisible-p'. + (or (= lep 1) + (not (org-invisible-p (1- (line-end-position 0))))))) (forward-line -1)) ;; At the beginning of the first element within a greater ;; element. Move to the beginning of the greater element.