From 8d87b946fcf9af3bb4d0d6979cc3826c1f8115ed Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 1 Sep 2021 17:15:36 -0500 Subject: Fix acdw/org-next-heading-widen --- lisp/acdw-org.el | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lisp/acdw-org.el b/lisp/acdw-org.el index 50a0488..d7137b7 100644 --- a/lisp/acdw-org.el +++ b/lisp/acdw-org.el @@ -370,14 +370,16 @@ instead of the true count." ;;; Next and previous heading, with widening (defun acdw/org-next-heading-widen (arg) (interactive "p") - (let ((point-target (if (> arg 0) - (point-max) - (point-min)))) - (unless (or (org-next-visible-heading arg) ; XXX: this doesn't work!!! ARGH - (/= (point) point-target)) - (when (buffer-narrowed-p) - (widen) - (org-next-visible-heading arg))))) + (let ((current-point (point)) + (point-target (if (> arg 0) (point-max) (point-min)))) + (org-next-visible-heading arg) + (when (and (buffer-narrowed-p) + (= (point) point-target) + (or (and (> arg 0)) + (and (< arg 0) + (= (point) current-point)))) + (widen) + (org-next-visible-heading arg)))) (defun acdw/org-previous-heading-widen (arg) (interactive "p") -- cgit 1.4.1-21-gabe81