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

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

[elpa] externals/rt-liberation 60ead31 24/72: * rt-liberation-gnus.el: I


From: Stefan Monnier
Subject: [elpa] externals/rt-liberation 60ead31 24/72: * rt-liberation-gnus.el: Improve Gnus integration.
Date: Wed, 5 Aug 2020 11:57:36 -0400 (EDT)

branch: externals/rt-liberation
commit 60ead31b3e556d494a9132ea3a11d24c7fd05949
Author: Yoni Rabkin <yrk@gnu.org>
Commit: Yoni Rabkin <yrk@gnu.org>

    * rt-liberation-gnus.el: Improve Gnus integration.
    
    This moves message signatures and header handling to Gnus, where it is
    supposed to be. The new way of doing things has been documented in the
    friendly manual.
---
 rt-liberation-gnus.el | 45 ++++++++++++++++++++++-----------------------
 1 file changed, 22 insertions(+), 23 deletions(-)

diff --git a/rt-liberation-gnus.el b/rt-liberation-gnus.el
index f809bea..ad39cde 100644
--- a/rt-liberation-gnus.el
+++ b/rt-liberation-gnus.el
@@ -45,11 +45,6 @@
   :type 'string
   :group 'rt-liber-gnus)
 
-(defcustom rt-liber-gnus-answer-headers nil
-  "*Alist of additional message headers."
-  :type 'list
-  :group 'rt-liber-gnus)
-
 (defcustom rt-liber-gnus-provisional-tag "PROVISIONAL"
   "*Subject line text for a provisional response."
   :type 'string
@@ -61,13 +56,6 @@
   :type 'string
   :group 'rt-liber-gnus)
 
-(defcustom rt-liber-gnus-signature
-  "--
-   Regards."
-  "Signature to append to email."
-  :type 'string
-  :group 'rt-liber-gnus)
-
 (defcustom rt-liber-gnus-subject-regexp
   ""
   "Regular expression to capture the ticket number in the subject
@@ -80,6 +68,10 @@ line of an email. For example: \\[company.com 
#\\([0-9].+?\\)\\]"
 (require 'gnus-msg)
 
 
+(defvar rt-liber-gnus-p nil
+  "Non-nil when rt-liberation-gnus is composing a Gnus buffer.")
+
+
 (defun rt-liber-gnus-compose (addr ticket-alist options)
   "Create a Gnus *mail* buffer for the RT email interface.
 ADDR email address.
@@ -90,7 +82,23 @@ OPTIONS association list of options.
        (suppress-subject (cdr (assoc 'suppress-subject options)))
        (top-matter       (cdr (assoc 'top-matter options)))
        (contents         (cdr (assoc 'contents options)))
-       (no-comment       (cdr (assoc 'no-comment options))))
+       (no-comment       (cdr (assoc 'no-comment options)))
+       (rt-liber-gnus-p  t)
+       (comment-start    ">")
+       message-text)
+    ;; prepare the text
+    (with-temp-buffer
+      (when top-matter
+       (insert top-matter))
+      (when contents
+       (newline 2)
+       (insert contents))
+      (when (not no-comment)
+       (comment-region (point-min) (point-max)))
+      (setq message-text (buffer-substring (point-min) (point-max))))
+    ;; launch into gnus and prepare the mail message
+    (when (not (gnus-alive-p))
+      (error "Gnus has been shut down"))
     (gnus-setup-message 'message
       (message-mail
        addr
@@ -100,19 +108,10 @@ OPTIONS association list of options.
               (cond (suppress-subject "")
                     (provisional rt-liber-gnus-provisional-tag)
                     (t (rt-liber-format "Re: %s" ticket-alist))))
-       rt-liber-gnus-answer-headers
        nil
        'switch-to-buffer))
-    (goto-char (point-max))
     (save-excursion
-      (when top-matter (insert top-matter))
-      (let ((start (point)))
-       (when contents (newline 2) (insert contents))
-       (when (not no-comment)
-         (comment-region start (point))))
-      (newline 2)
-      (insert rt-liber-gnus-signature)
-      (newline))))
+      (insert message-text))))
 
 (defun rt-liber-gnus-content-to-string ()
   "Return the current content section as a string"



reply via email to

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