about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2020-05-08T17·38-0400
committerGriffin Smith <root@gws.fyi>2020-05-08T17·38-0400
commitf00c22a49af3798c8a4be6d1831b5142ff56a19e (patch)
treea33e3e1b07ef4fc5a7f676fec8421a543db7ae4b
parent24be24077c8c4e12b043fb8d927d699b41264ec9 (diff)
Don't create stories in reverse order
org-clubhouse-get-headlines-in-region was returning elements in reverse
order, causing stories to be created in reverse order when multiple were
created in a region with org-clubhouse-create-story. Just reversing the
list at the end should fix that.
-rw-r--r--org-clubhouse.el5
1 files changed, 2 insertions, 3 deletions
diff --git a/org-clubhouse.el b/org-clubhouse.el
index 072899ecd96e..884c8d288f2b 100644
--- a/org-clubhouse.el
+++ b/org-clubhouse.el
@@ -174,10 +174,9 @@ If set to nil, will never create stories with labels")
 
 (defun org-clubhouse-collect-headlines (beg end)
   "Collects the headline at point or the headlines in a region. Returns a list."
-  (setq test-headlines
   (if (and beg end)
       (org-clubhouse-get-headlines-in-region beg end)
-      (list (org-element-find-headline)))))
+    (list (org-element-find-headline))))
 
 
 (defun org-clubhouse-get-headlines-in-region (beg end)
@@ -208,7 +207,7 @@ If set to nil, will never create stories with labels")
         (let ((before (point)))
           (org-forward-heading-same-level 1)
           (setq before-end (and (not (eq before (point))) (< (point) end)))))
-      headlines)))
+      (reverse headlines))))
 
 ;;;
 ;;; Org-element interaction