From 16cda5b42b3ea474ee0fe92eeee377e74808eb8e Mon Sep 17 00:00:00 2001 From: Jean-Martin Archer Date: Sun, 19 Jan 2020 21:57:48 -0800 Subject: find header if not currently at point Creating a single story would fail if the point was not on a header. Now the code tries to find the header for the element at point. --- org-clubhouse.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'org-clubhouse.el') diff --git a/org-clubhouse.el b/org-clubhouse.el index fdfe2d16f8f0..7f0fcec5e2fe 100644 --- a/org-clubhouse.el +++ b/org-clubhouse.el @@ -224,9 +224,11 @@ If set to nil, will never create stories with labels") ;; (org-element-find-headline))))) (defun org-element-find-headline () - (let ((current-elt (org-element-at-point))) - (when (equal 'headline (car current-elt)) - (cadr current-elt)))) + (save-mark-and-excursion + (when (not (outline-on-heading-p)) (org-back-to-heading)) + (let ((current-elt (org-element-at-point))) + (when (equal 'headline (car current-elt)) + (cadr current-elt))))) (defun org-element-extract-clubhouse-id (elt &optional property) (when-let* ((clubhouse-id-link (plist-get elt (or property :CLUBHOUSE-ID)))) -- cgit 1.4.1