Extract the insert-issue function

This commit is contained in:
Tom Willemsen 2012-10-20 18:55:46 +02:00
parent 0a9e0ee7c9
commit 7fbf663ea5

16
ogi.el
View file

@ -52,12 +52,8 @@
"From alist OBJ get the value of PROP."
`(cdr (assq ',prop ,obj)))
;;;###autoload
(defun ogi-insert (project)
"Insert (new) issues for PROJECT under the current entry."
(interactive "MGet issues for: ")
(goto-char (point-max))
(mapc (lambda (issue)
(defun ogi-insert-entry (issue)
"Insert a single issue into the current buffer, unless it exists."
(let ((id (number-to-string (ogiprop issue id))))
(unless (org-find-entry-with-id id)
(org-insert-heading-after-current)
@ -73,7 +69,13 @@
"-" "_" (ogiprop itm name)))
(ogiprop issue labels)))
(org-entry-put (point) "ID" id))))
(ogi-get project)))
;;;###autoload
(defun ogi-insert (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)))
(provide 'ogi)