[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/rt-liberation b1a1dc6 56/68: * rt-liberation.el: prep f
From: |
Yoni Rabkin |
Subject: |
[elpa] externals/rt-liberation b1a1dc6 56/68: * rt-liberation.el: prep for mail |
Date: |
Wed, 16 Dec 2020 12:11:15 -0500 (EST) |
branch: externals/rt-liberation
commit b1a1dc690b2baaef9058882668d9945217e53353
Author: Yoni Rabkin <yoni@rabkins.net>
Commit: Yoni Rabkin <yoni@rabkins.net>
* rt-liberation.el: prep for mail
---
rt-liberation.el | 45 +++++++++++++++++++++++++++++++++++++--------
1 file changed, 37 insertions(+), 8 deletions(-)
diff --git a/rt-liberation.el b/rt-liberation.el
index af2eb26..b364839 100644
--- a/rt-liberation.el
+++ b/rt-liberation.el
@@ -1350,19 +1350,19 @@ ASSOC-BROWSER if non-nil should be a ticket browser."
section))
(defun rt-liber-viewer2-format-content (content)
+ "Wrangle RT's content format."
(with-temp-buffer
(insert content)
-
(goto-char (point-min))
(if (re-search-forward "^This transaction appears to have no content"
(point-max) t)
- ""
- ;; remove leading blank lines
+ "" ; make no content mean... no content
+ ;; trim leading blank lines
(save-excursion
(goto-char (point-min))
(re-search-forward "[[:graph:]]" (point-max) t)
(forward-line -1)
(flush-lines "^[[:space:]]+$" (point-min) (point)))
- ;; remove trailing blank lines
+ ;; trim trailing blank lines
(save-excursion
(goto-char (point-max))
(re-search-backward "[[:graph:]]" (point-min) t)
@@ -1381,8 +1381,25 @@ ASSOC-BROWSER if non-nil should be a ticket browser."
(buffer-substring (point-min)
(point-max)))))
+(defun rt-liber-viewer2-clean-content (section)
+ "Format section content for email."
+ (with-temp-buffer
+ (insert (rt-liber-viewer2-format-content
+ (alist-get 'Content section)))
+ (goto-char (point-min))
+ (while (re-search-forward "^ " (point-max) t)
+ (replace-match ""))
+ ;; fill
+ (let ((paragraph-separate ">[[:space:]]+$"))
+ (fill-region (point-min)
+ (point-max)))
+ ;; finally
+ (buffer-substring (point-min)
+ (point-max))))
+
(defun rt-liber-viewer2-display-section (section)
- (let ((ticket-id (alist-get 'Ticket section))
+ (let ((start (point))
+ (ticket-id (alist-get 'Ticket section))
(creator (alist-get 'Creator section))
(date (alist-get 'Created section))
(type (alist-get 'Type section))
@@ -1390,7 +1407,8 @@ ASSOC-BROWSER if non-nil should be a ticket browser."
(oldvalue (alist-get 'OldValue section))
(newvalue (alist-get 'NewValue section))
(field (alist-get 'Field section))
- (start (point)))
+ (s-content (rt-liber-viewer2-format-content
+ (alist-get 'Content section))))
(when (not (or (string= type "CommentEmailRecord")
(string= type "EmailRecord")))
(insert
@@ -1427,8 +1445,7 @@ ASSOC-BROWSER if non-nil should be a ticket browser."
;; catch-all
(t
(insert
- (format "\n%s\n"
- (rt-liber-viewer2-format-content content))))))))
+ (format "\n%s\n" s-content)))))))
(defun rt-liber-viewer2-display-history (contents)
(let ((section-list (rt-liber-viewer-parse-history contents)))
@@ -1495,6 +1512,18 @@ ASSOC-BROWSER if non-nil should be a ticket browser."
(goto-char prev)
(forward-line -1))))
+(defun rt-liber-viewer2-answer ()
+ (interactive)
+ (let ((section (rt-liber-viewer2-get-section-data)))
+ (when (not section)
+ (error "no section found"))
+ (if (not (featurep 'rt-liberation-gnus))
+ (error "rt-liberation-gnus feature not found")
+ (rt-liber-gnus-compose
+ rt-liber-gnus-address
+ rt-liber-ticket-local
+ `((contents . ,(rt-liber-viewer2-clean-content section)))))))
+
(defconst rt-liber-viewer2-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "q") 'rt-liber-viewer2-mode-quit)
- [elpa] externals/rt-liberation d964a92 67/68: * rt-liberation.el: bump to 2.01, (continued)
- [elpa] externals/rt-liberation d964a92 67/68: * rt-liberation.el: bump to 2.01, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation d6441dc 03/68: * rt-liberation-report.el: fix error, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 05176e8 13/68: * rt-liberation.el: version bump, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 0be03c5 12/68: * doc/gpl.texi: fix compilation warning, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 7269205 07/68: * rt-liberation.el: remove cl and cl-lib requirement, Yoni Rabkin, 2020/12/16
- [elpa] externals/rt-liberation 45275d3 36/68: splitting aside code for viewer2, Yoni Rabkin, 2020/12/16
- [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 <=
- [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, 2020/12/16
- [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