aboutsummaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/lisp
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2024-10-11 20:30:51 +1100
committerYuchen Pei <id@ypei.org>2024-10-11 20:30:51 +1100
commit67479a0b5f02c51511bd2827a7f3f22e8fc90cf2 (patch)
tree95503989950fb36594b7bd6fd56d00d4598322b4 /emacs/.emacs.d/lisp
parentb1e707d5544da0811f602eed125d8d5e64accd65 (diff)
[emacs] continue org-jira customisation from the previous patch
* emacs/.emacs.d/lisp/my/my-org-jira.el: Override `org-jira-sdk-issue' and `org-jira-sdk-from-data' to include fixversions, affectedversions and relatedissues
Diffstat (limited to 'emacs/.emacs.d/lisp')
-rw-r--r--emacs/.emacs.d/lisp/my/my-org-jira.el88
1 files changed, 88 insertions, 0 deletions
diff --git a/emacs/.emacs.d/lisp/my/my-org-jira.el b/emacs/.emacs.d/lisp/my/my-org-jira.el
index 8f716c3..2502f02 100644
--- a/emacs/.emacs.d/lisp/my/my-org-jira.el
+++ b/emacs/.emacs.d/lisp/my/my-org-jira.el
@@ -28,6 +28,94 @@
(require 'org-jira)
+;;; override `org-jira-sdk-issue'
+(defclass org-jira-sdk-issue (org-jira-sdk-record)
+ ((affected-versions :type string :initarg :affected-versions)
+ (assignee :type (or null string) :initarg :assignee)
+ (components :type string :initarg :components)
+ (fix-versions :type string :initarg :fix-versions)
+ (labels :type string :initarg :labels)
+ (created :type string :initarg :created)
+ (description :type (or null string) :initarg :description)
+ (duedate :type (or null string) :initarg :duedate)
+ (headline :type string :initarg :headline)
+ (id :type string :initarg :id) ; TODO: Probably remove me
+ (issue-id :type string :initarg :issue-id :documentation "The common ID/key, such as EX-1.")
+ (issue-id-int :type string :initarg :issue-id-int :documentation "The internal Jira ID, such as 12345.")
+ (filename :type (or null string) :initarg :filename :documentation "The filename to write issue to.")
+ (priority :type (or null string) :initarg :priority)
+ (proj-key :type string :initarg :proj-key)
+ (related-issues :type string :initarg :related-issues)
+ (reporter :type (or null string) :initarg :reporter)
+ (resolution :type (or null string) :initarg :resolution)
+ (sprint :type (or null string) :initarg :sprint)
+ (start-date :type (or null string) :initarg :start-date)
+ (status :type string :initarg :status)
+ (summary :type string :initarg :summary)
+ (type :type string :initarg :type)
+ (type-id :type string :initarg :type-id)
+ (updated :type string :initarg :updated)
+ (data :initarg :data :documentation "The remote Jira data object (alist).")
+ (hydrate-fn :initform #'jiralib-get-issue :initarg :hydrate-fn))
+ "An issue on the end. ID of the form EX-1, or a numeric such as 10000.")
+
+
+;;; override `org-jira-sdk-from-data'
+(cl-defmethod org-jira-sdk-from-data ((rec org-jira-sdk-issue))
+ ;; (print rec)
+ (cl-flet ((path (keys) (org-jira-sdk-path (oref rec data) keys)))
+ (org-jira-sdk-issue
+ :affected-versions (mapconcat (lambda (c) (org-jira-sdk-path c '(name))) (path '(fields versions)) ", ")
+ :assignee (path '(fields assignee displayName))
+ :components (mapconcat (lambda (c) (org-jira-sdk-path c '(name))) (path '(fields components)) ", ")
+ :fix-versions (mapconcat (lambda (c) (org-jira-sdk-path c '(name))) (path '(fields fixVersions)) ", ")
+ :labels (mapconcat (lambda (c) (format "%s" c)) (mapcar #'identity (path '(fields labels))) ", ")
+ :created (path '(fields created)) ; confirm
+ :description (or (path '(fields description)) "")
+ :duedate (or (path '(fields sprint endDate)) (path '(fields duedate))) ; confirm
+ :filename (path '(fields project key))
+ :headline (path '(fields summary)) ; Duplicate of summary, maybe different.
+ :id (path '(key))
+ :issue-id (path '(key))
+ :issue-id-int (path '(id))
+ :priority (path '(fields priority name))
+ :proj-key (path '(fields project key))
+ :related-issues (mapconcat
+ (lambda (c)
+ (print c)
+ (if (org-jira-sdk-path c '(inwardIssue))
+ (if (equal
+ (org-jira-sdk-path
+ c '(inwardIssue fields status name))
+ "Closed")
+ ""
+ (format "%s: %s %s"
+ (org-jira-sdk-path c '(type inward))
+ (org-jira-sdk-path c '(inwardIssue key))
+ (org-jira-sdk-path c '(inwardIssue fields summary))))
+ (if (equal
+ (org-jira-sdk-path
+ c '(outwardIssue fields status name))
+ "Closed")
+ ""
+ (format "%s: %s %s"
+ (org-jira-sdk-path c '(type outward))
+ (org-jira-sdk-path c '(outwardIssue key))
+ (org-jira-sdk-path c '(outwardIssue fields summary))))))
+ (path '(fields issuelinks)) "; ")
+ :reporter (path '(fields reporter displayName)) ; reporter could be an object of its own slot values
+ :resolution (path '(fields resolution name)) ; confirm
+ :sprint (path '(fields sprint name))
+ :start-date (path '(fields start-date)) ; confirm
+ :status (org-jira-decode (path '(fields status name)))
+ :summary (path '(fields summary))
+ :type (path '(fields issuetype name))
+ :type-id (path '(fields issuetype id))
+ :updated (path '(fields updated)) ; confirm
+ ;; TODO: Remove this
+ ;; :data (oref rec data)
+ )))
+
;; Override `org-jira--render-issue'
;; include issue-id in the headline
(defun my-org-jira--render-issue (Issue)