summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoni Rabkin <yrk@gnu.org>2014-12-04 18:11:04 -0500
committerYoni Rabkin <yrk@gnu.org>2014-12-04 18:11:04 -0500
commit60ead31b3e556d494a9132ea3a11d24c7fd05949 (patch)
tree2e237e00f4fd92165e2dc30387a3b066dfeeed41
parentf0cf810d40d85cd78d11438a7d2236163caace78 (diff)
* 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.
-rw-r--r--rt-liberation-gnus.el45
1 files 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"