emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/rt-liberation 3a0dfc3 55/68: * rt-liberation.el: sectio


From: Yoni Rabkin
Subject: [elpa] externals/rt-liberation 3a0dfc3 55/68: * rt-liberation.el: section data
Date: Wed, 16 Dec 2020 12:11:15 -0500 (EST)

branch: externals/rt-liberation
commit 3a0dfc30d90346a6d6420b5d000310606777e6af
Author: Yoni Rabkin <yoni@rabkins.net>
Commit: Yoni Rabkin <yoni@rabkins.net>

    * rt-liberation.el: section data
---
 rt-liberation.el | 86 ++++++++++++++++++++++++++++++++------------------------
 1 file changed, 49 insertions(+), 37 deletions(-)

diff --git a/rt-liberation.el b/rt-liberation.el
index 37c20aa..af2eb26 100644
--- a/rt-liberation.el
+++ b/rt-liberation.el
@@ -1340,6 +1340,15 @@ ASSOC-BROWSER if non-nil should be a ticket browser."
             section-point-list))
       section-list)))
 
+(defun rt-liber-viewer2-get-section-data ()
+  "Return the current section data."
+  (let ((section (get-text-property (point) 'rt-liberation-section-data)))
+    (when (not section)
+      (save-excursion
+       (rt-liber-viewer2-previous-section-in)
+       (setq section (get-text-property (point) 'rt-liberation-section-data))))
+    section))
+
 (defun rt-liber-viewer2-format-content (content)
   (with-temp-buffer
     (insert content)
@@ -1380,43 +1389,46 @@ ASSOC-BROWSER if non-nil should be a ticket browser."
        (content   (alist-get 'Content section))
        (oldvalue  (alist-get 'OldValue section))
        (newvalue  (alist-get 'NewValue section))
-       (field     (alist-get 'Field section)))
-    (let ((start (point)))
-      (when (not (or (string= type "CommentEmailRecord")
-                    (string= type "EmailRecord")))
-       (insert
-        (format "Ticket %s by %s, %s (%s) [%s]\n"
-                ticket-id
-                creator
-                (rt-liber-viewer2-vernacular-date date)
-                date
-                (format "%s%s%s"
-                        type
-                        (if (< 0 (length oldvalue))
-                            (concat " " oldvalue)
-                          "")
-                        (if (< 0 (length newvalue))
-                            (concat "->" newvalue)
-                          ""))))
-       (add-text-properties start
-                            (point)
-                             `(font-lock-face rt-liber-ticket-emph-face))
-       (add-text-properties start
-                            (point)
-                             `(rt-liberation-viewer-header t))
-       (cond ((string= type "Status")
-              (insert
-               (format "\n    Status change from %s to %s\n\n" oldvalue 
newvalue)))
-             ((and (string= type "Set")
-                   (string= field "Owner")
-                   (string= oldvalue "10"))
-              (insert
-               (format "\n    Ticket assigned\n\n" oldvalue newvalue)))
-             ;; catch-all
-             (t
-              (insert
-               (format "\n%s\n"
-                       (rt-liber-viewer2-format-content content)))))))))
+       (field     (alist-get 'Field section))
+       (start     (point)))
+    (when (not (or (string= type "CommentEmailRecord")
+                  (string= type "EmailRecord")))
+      (insert
+       (format "Ticket %s by %s, %s (%s) [%s]\n"
+              ticket-id
+              creator
+              (rt-liber-viewer2-vernacular-date date)
+              date
+              (format "%s%s%s"
+                      type
+                      (if (< 0 (length oldvalue))
+                          (concat " " oldvalue)
+                        "")
+                      (if (< 0 (length newvalue))
+                          (concat "->" newvalue)
+                        ""))))
+      (add-text-properties start
+                          (point)
+                           `(font-lock-face rt-liber-ticket-emph-face))
+      (add-text-properties start
+                          (point)
+                           `(rt-liberation-viewer-header t))
+      (add-text-properties start
+                          (point)
+                          `(rt-liberation-section-data ,section))
+      (cond ((string= type "Status")
+            (insert
+             (format "\n    Status change from %s to %s\n\n" oldvalue 
newvalue)))
+           ((and (string= type "Set")
+                 (string= field "Owner")
+                 (string= oldvalue "10"))
+            (insert
+             (format "\n    Ticket assigned\n\n" oldvalue newvalue)))
+           ;; catch-all
+           (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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]