about summary refs log tree commit diff
path: root/org-clubhouse.el
diff options
context:
space:
mode:
authorJean-Martin Archer <jm@jmartin.ca>2020-01-20T05·57-0800
committerGriffin Smith <glittershark@users.noreply.github.com>2020-01-23T15·54-0500
commit16cda5b42b3ea474ee0fe92eeee377e74808eb8e (patch)
tree47bdcbea2293ac02455ba3bd7ca3f77ad97aeeb3 /org-clubhouse.el
parent489b37d17df8b0ffcb4b09d403c60a6be059aa54 (diff)
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.
Diffstat (limited to 'org-clubhouse.el')
-rw-r--r--org-clubhouse.el8
1 files changed, 5 insertions, 3 deletions
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))))