diff options
author | Jean-Martin Archer <jm@jmartin.ca> | 2020-01-20T05·57-0800 |
---|---|---|
committer | Griffin Smith <glittershark@users.noreply.github.com> | 2020-01-23T15·54-0500 |
commit | 16cda5b42b3ea474ee0fe92eeee377e74808eb8e (patch) | |
tree | 47bdcbea2293ac02455ba3bd7ca3f77ad97aeeb3 | |
parent | 489b37d17df8b0ffcb4b09d403c60a6be059aa54 (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.
-rw-r--r-- | org-clubhouse.el | 8 |
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)))) |