[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/rt-liberation ec9245d 37/68: * rt-liberation-viewer.el:
From: |
Yoni Rabkin |
Subject: |
[elpa] externals/rt-liberation ec9245d 37/68: * rt-liberation-viewer.el: start work on formatting |
Date: |
Wed, 16 Dec 2020 12:11:11 -0500 (EST) |
branch: externals/rt-liberation
commit ec9245dcfaffc686167aa298dc964ea2be3fa803
Author: Yoni Rabkin <yoni@rabkins.net>
Commit: Yoni Rabkin <yoni@rabkins.net>
* rt-liberation-viewer.el: start work on formatting
---
rt-liberation-viewer.el | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
diff --git a/rt-liberation-viewer.el b/rt-liberation-viewer.el
index c5a75c2..e07186d 100644
--- a/rt-liberation-viewer.el
+++ b/rt-liberation-viewer.el
@@ -171,6 +171,51 @@ ASSOC-BROWSER if non-nil should be a ticket browser."
section-point-list))
section-list)))
+(defun rt-liber-viewer2-format-content (content)
+ (with-temp-buffer
+ (insert content)
+
+ ;; Convert the 9 leading whitespaces from RT's comment lines.
+ (goto-char (point-min))
+ (insert " ")
+ (while (re-search-forward "^ " (point-max) t)
+ (replace-match " "))
+
+ (fill-region (point-min)
+ (point-max))
+
+ (buffer-substring (point-min)
+ (point-max))))
+
+(defun rt-liber-viewer2-display-section (section)
+ (let ((ticket-id (alist-get 'Ticket section))
+ (creator (alist-get 'Creator section))
+ (date (alist-get 'Created section))
+ (type (alist-get 'Type section))
+ (content (alist-get 'Content section)))
+ (insert
+ (format "Ticket %s by %s on %s (-N- days ago) (%s)\n"
+ ticket-id
+ creator
+ date
+ type))
+ (cond ((or (string= type "Status")
+ (string= type "CustomField")
+ ;; (string= type "EmailRecord")
+ (string= type "Set"))
+ 'nop-for-now)
+ (t (insert
+ (format "\n%s\n"
+ (rt-liber-viewer2-format-content content)))))))
+
+(defun rt-liber-viewer2-display-history (contents)
+ (let ((section-list (rt-liber-viewer-parse-history contents)))
+ (mapc
+ (lambda (section)
+ (rt-liber-viewer2-display-section section))
+ section-list)))
+
+;; Before release: move this back to the top
(defconst rt-liber-viewer2-font-lock-keywords
(let ((header-regexp (regexp-opt '("id: ")
t)))
@@ -191,7 +236,7 @@ ASSOC-BROWSER if non-nil should be a ticket browser."
(with-current-buffer new-ticket-buffer
(let ((inhibit-read-only t))
(erase-buffer)
- (insert "watch this space for further development")
+ (rt-liber-viewer2-display-history contents)
(goto-char (point-min))
(rt-liber-viewer2-mode)
(set
- [elpa] externals/rt-liberation 84ce235 10/68: Syncronize with Stefan's changes, (continued)
- [elpa] externals/rt-liberation 84ce235 10/68: Syncronize with Stefan's changes, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 2e9b1f3 01/68: * rt-liberation.el: remove old cli code, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 133559f 18/68: * dir: fix info listing issues take 2, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 700d45e 21/68: * doc/developer-release.txt: update documentation, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 4e4cb06 14/68: add manual to ELPA, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation f586e7d 27/68: * doc/rt-liber.texinfo: update manual, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation a5d7634 26/68: * doc/developer-release.txt: add compile comment, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation b2f3f57 02/68: * doc/rt-liberation.texinfo: update documentation, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 12d16aa 28/68: Add lexical binding declaration, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation ab6c820 33/68: * rt-liberation-viewer.el:, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation ec9245d 37/68: * rt-liberation-viewer.el: start work on formatting,
Yoni Rabkin <=
- [elpa] externals/rt-liberation 4097a1c 24/68: * rt-liberation-rest.el: new function rt-liber-rest-auth, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 1995685 04/68: * rt-liberation-rest.el: fix undefined variable, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 0ee9eba 29/68: New file: rt-liberation-viewer, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 79104c6 42/68: * rt-liberation.el:, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 73a2ba0 47/68: * rt-liberation.el: find sections, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 95553c6 51/68: * rt-liberation.el: vernacular time delta, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation fd1e4a9 61/68: * rt-liberation.el: add jump to last section, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation e72ecd8 65/68: * doc/developer-release.txt:, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 9902111 19/68: * dir: shorten the name of the info file, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 6098e23 25/68: * rt-liberation-rest.el: add requirement, Yoni Rabkin, 2020/12/16