diff --git a/ogi.el b/ogi.el index 637ca38..7e1452b 100644 --- a/ogi.el +++ b/ogi.el @@ -28,6 +28,9 @@ ;;; Code: +(defvar ogi--project nil + "Container for the name of the project we're fetching.") + (defun ogi-get (project) "Get a list of open issues for PROJECT." (let* ((url-request-extra-headers @@ -68,14 +71,26 @@ (replace-regexp-in-string "-" "_" (ogiprop itm name))) (ogiprop issue labels))) - (org-entry-put (point) "ID" id)))) + (org-entry-put (point) "ID" id) + (org-entry-put (point) "GH_PROJECT" ogi--project) + + (let* ((milestone (ogiprop issue milestone)) + (title (ogiprop milestone title)) + (due-on (ogiprop milestone due_on))) + (when title + (org-entry-put (point) "MILESTONE" title) + (when due-on + (message due-on) + (org-deadline + nil (replace-regexp-in-string "[TZ]" " " due-on)))))))) ;;;###autoload -(defun ogi-insert (project) +(defun ogi-get-for (project) "Insert (new) issues for PROJECT under the current entry." (interactive "MGet issues for: ") (goto-char (point-max)) - (mapc #'ogi-insert-entry (ogi-get project))) + (let ((ogi--project project)) + (mapc #'ogi-insert-entry (ogi-get project)))) (provide 'ogi)