Explorar o código

org-fold--reveal-outline-maybe: Prevent wrong-side-of-point error

* lisp/org-fold.el (org-fold--reveal-outline-maybe): Fix scenario when
point is moved beyond REGION.
Ihor Radchenko %!s(int64=3) %!d(string=hai) anos
pai
achega
2778972509
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      lisp/org-fold.el

+ 3 - 2
lisp/org-fold.el

@@ -958,8 +958,9 @@ This function is intended to be used as :fragile property of
      ;; Never hide level 1 headlines
      (save-excursion
        (goto-char (line-end-position))
-       (when (re-search-forward (rx bol "* ") (cdr region) t)
-         (org-fold-region (match-beginning 0) (line-end-position) nil 'headline)))
+       (unless (>= (point) (cdr region))
+         (when (re-search-forward (rx bol "* ") (cdr region) t)
+           (org-fold-region (match-beginning 0) (line-end-position) nil 'headline))))
      ;; Check the validity of headline
      (unless (let ((case-fold-search t))
 	       (looking-at (rx-to-string