[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/rt-liberation 53e56b7 31/68: * rt-liberation-viewer.el:
From: |
Yoni Rabkin |
Subject: |
[elpa] externals/rt-liberation 53e56b7 31/68: * rt-liberation-viewer.el: history parse |
Date: |
Wed, 16 Dec 2020 12:11:10 -0500 (EST) |
branch: externals/rt-liberation
commit 53e56b798c77ee4f244688490332d6a93d53be81
Author: Yoni Rabkin <yoni@rabkins.net>
Commit: Yoni Rabkin <yoni@rabkins.net>
* rt-liberation-viewer.el: history parse
---
rt-liberation-viewer.el | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/rt-liberation-viewer.el b/rt-liberation-viewer.el
index bc0e15d..359e600 100644
--- a/rt-liberation-viewer.el
+++ b/rt-liberation-viewer.el
@@ -43,6 +43,38 @@
'font-lock-comment-face)))
"Expressions to font-lock for RT ticket viewer.")
+(defun rt-liber-viewer-reduce (section-list f acc)
+ "A Not Invented Here tail-recursive reduce function."
+ (cond ((null (cdr section-list)) acc)
+ (t (rt-liber-viewer-reduce (cdr section-list)
+ f
+ (append acc (list
+ (funcall f
+ (car section-list)
+ (cadr
section-list))))))))
+
+;; According to:
+;; "https://rt-wiki.bestpractical.com/wiki/REST#Ticket_History" is of
+;; the form: "# <n>/<n> (id/<history-id>/total)"
+(defun rt-liber-viewer-parse-history (ticket-history)
+ "Parse the string TICKET-HISTORY."
+ (when (not (stringp ticket-history))
+ (error "invalid ticket-history"))
+ (with-temp-buffer
+ (insert ticket-history)
+ (goto-char (point-min))
+ ;; find history detail sections and procude a list of section
+ ;; (start . end) pairs
+ (let (section-point-list)
+ (while (re-search-forward "^# [0-9]+/[0-9]+ (id/[0-9]+/total)"
(point-max) t)
+ (setq section-point-list (append section-point-list
+ (list (point)))))
+ (when (not section-point-list)
+ (error "no history detail sections found"))
+ (setq section-point-list (append section-point-list
+ (list (point-max)))
+ section-point-list (rt-liber-viewer-reduce section-point-list
#'cons nil))
+ section-point-list)))
(defun rt-liber-display-ticket-history (ticket-alist &optional assoc-browser)
"Display history for ticket.
- [elpa] externals/rt-liberation 3b95e84 40/68: * rt-liberation.el: reformatting, (continued)
- [elpa] externals/rt-liberation 3b95e84 40/68: * rt-liberation.el: reformatting, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation f529257 52/68: * rt-liberation.el: section display, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 35f4cd5 66/68: * doc/developer-release.txt:, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 50eba43 62/68: * rt-liberation-rest.el: formatting, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation b1a1dc6 56/68: * rt-liberation.el: prep for mail, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation d567c59 60/68: * rt-liberation.el: fix n/p in viewer2, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 3376123 63/68: * rt-liberation-rest.el: better user interaction, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation f682e7b 68/68: Merge branch 'master' into externals/rt-liberation, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 0fc4737 09/68: documentation fixes, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation ed929f5 16/68: integrate changes post-ELPA synchronization, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 53e56b7 31/68: * rt-liberation-viewer.el: history parse,
Yoni Rabkin <=
- [elpa] externals/rt-liberation a9786cf 23/68: * NEWS: update, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 1000e89 11/68: * doc/rt-liberation.texinfo: update manual, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 680e177 48/68: * rt-liberation.el: remove leading blank lines, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation cbfb99c 49/68: * rt-liberation.el: start making sense of section types, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation b23df79 50/68: * rt-liberation.el: forward and back section movement, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 1038ecc 53/68: * rt-liberation.el: fill content, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation dacb48c 54/68: * rt-liberation.el: trim down viewer2 key map., Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 3a0dfc3 55/68: * rt-liberation.el: section data, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation a99fc59 59/68: * rt-liberation.el: high recenter, Yoni Rabkin, 2020/12/16