From 01c684396d8455fa68b058b365695bd54794391c Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Thu, 2 May 2019 11:00:25 -0400 Subject: [PATCH] feat: Write story labels when pulling stories Whenever we pull stories from clubhouse, write the labels of those stories as headline tags --- org-clubhouse.el | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/org-clubhouse.el b/org-clubhouse.el index 5d5b78f35..dd5e73ea8 100644 --- a/org-clubhouse.el +++ b/org-clubhouse.el @@ -963,7 +963,7 @@ which labels to set." (defun org-clubhouse--story-to-headline-text (level story) (let ((story-id (alist-get 'id story))) (format - "%s %s %s + "%s %s %s :%s: :PROPERTIES: :clubhouse-id: %s :END: @@ -974,6 +974,11 @@ which labels to set." (org-clubhouse-workflow-state-id-to-todo-keyword (alist-get 'workflow_state_id story)) (alist-get 'name story) + (->> story + (alist-get 'labels) + ->list + (-map (apply-partially #'alist-get 'name)) + (s-join ":")) (org-make-link-string (org-clubhouse-link-to-story story-id) (number-to-string story-id)) @@ -1000,7 +1005,8 @@ which labels to set." (if (equal '((message . "Resource not found.")) story) (message "Story ID not found: %d" story-id) (save-mark-and-excursion - (insert (org-clubhouse--story-to-headline-text level story)))))) + (insert (org-clubhouse--story-to-headline-text level story)) + (org-align-tags))))) (defun org-clubhouse--search-stories (query) (unless (string= "" query) @@ -1024,7 +1030,9 @@ resulting stories at headline level LEVEL." level) (reject-archived story-list) "\n"))) (if (called-interactively-p) - (save-mark-and-excursion (insert text)) + (save-mark-and-excursion + (insert text) + (org-align-all-tags)) text))))) (defun org-clubhouse-prompt-for-story (cb)