branch: elpa/dslide commit 015796186f399817faa047aca6565870810f6920 Author: Psionik K <73710933+psioni...@users.noreply.github.com> Commit: Psionik K <73710933+psioni...@users.noreply.github.com>
!fixme Not sure if this is necessary. Shipping my last tested. Signed-off-by: Psionik K <73710933+psioni...@users.noreply.github.com> --- macro-slides.el | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/macro-slides.el b/macro-slides.el index 55f721f1ca..9bd9ee2373 100644 --- a/macro-slides.el +++ b/macro-slides.el @@ -1065,7 +1065,7 @@ their init." (reached-beginning (user-error "No more previous slides!"))))) -(cl-defmethod ms--choose-slide ((obj ms-deck) how &optional point) +(cl-defmethod ms--choose-slide ((obj ms-deck) how) "Set the current slide, according to HOW. Optional POINT allows resolving a slide by walking the tree to find the slide that displays that POINT." @@ -2118,16 +2118,19 @@ TYPE is a list or type symbol." (goto-char (match-beginning 0)) (org-element-at-point)))))))) -(defun ms--root-heading-at-point () +(defun ms--root-heading-at-point (&optional point) "Return the root heading if the point is contained by one. Does not modify the point." - (let* ((element (org-element-at-point)) - (parent (ms--element-root - element 'headline))) - (if (eq 'headline (org-element-type element)) - element - (or parent - (ms--any-heading))))) + (save-excursion + (when point + (goto-char point)) + (let* ((element (org-element-at-point)) + (parent (ms--element-root + element 'headline))) + (if (eq 'headline (org-element-type element)) + element + (or parent + (ms--any-heading)))))) (defun ms--any-heading () "Return any heading that can be found.