summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-12-07 21:30:17 +0000
committerRichard M. Stallman <rms@gnu.org>1996-12-07 21:30:17 +0000
commit7e48d5cd6c014a81036a5e47d8475400172a0693 (patch)
tree532d752e3d80bb705b6ffb45a05248529b9a6502
parent8f31a904f6542cb2c1321585f06931984dad2332 (diff)
downloademacs-7e48d5cd6c014a81036a5e47d8475400172a0693.tar.gz
(compose-mail): Handle several more args:
other-headers continue switch-function yank-action send-action. (sendmail-user-agent): Rewrite to handle new args. (assoc-ignore-case): New function. (define-mail-user-agent): Doc fix.
-rw-r--r--lisp/simple.el59
1 files changed, 53 insertions, 6 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 17bda77a3c5..e9263328cc2 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2844,9 +2844,8 @@ buffer without requiring user interaction. It should populate the
standard mail headers, leaving the `to:' and `subject:' headers blank
by default.
-COMPOSEFUNC should accept two optional arguments:
-TO and SUBJECT. TO specifies a string to insert in the `To:' field,
-and SUBJECT specifies a string to insert in the `Subject:' field.
+COMPOSEFUNC should accept several optional arguments--the same
+arguments that `compose-mail' takes. See that function's documentation.
SENDFUNC is the command a user would run to send the message.
@@ -2866,15 +2865,63 @@ The properties used on SYMBOL are `composefunc', `sendfunc',
(put symbol 'abortfunc (or abortfunc 'kill-buffer))
(put symbol 'hookvar (or hookvar 'mail-send-hook)))
+(defun assoc-ignore-case (key alist)
+ "Like `assoc', but assumes KEY is a string and ignores case when comparing."
+ (let (element)
+ (while (and alist (not element))
+ (if (equal key (downcase (car (car alist))))
+ (setq element (car alist)))
+ (setq alist (cdr alist)))
+ element))
+
(define-mail-user-agent 'sendmail-user-agent
- '(lambda (&optional to subject)
- (or (mail nil to subject)
- (error "Message aborted")))
+ '(lambda (&optional to subject other-headers continue
+ switch-function yank-action send-actions)
+ (if switch-function
+ (let ((special-display-buffer-names nil)
+ (special-display-regexps nil)
+ (same-window-buffer-names nil)
+ (same-window-regexps nil))
+ (funcall switch-function "*mail*")))
+ (let ((cc (cdr (assoc-ignore-case "cc" other-headers)))
+ (in-reply-to (cdr (assoc-ignore-case "in-reply-to" other-headers))))
+ (or (mail continue to subject in-reply-to cc yank-action send-actions)
+ (error "Message aborted"))))
'mail-send-and-exit)
(define-mail-user-agent 'mh-e-user-agent
'mh-smail-batch 'mh-send-letter 'mh-fully-kill-draft
'mh-before-send-letter-hook)
+
+(defun compose-mail (&optional to subject other-headers continue
+ switch-function yank-action send-actions)
+ "Start composing a mail message to send.
+This uses the user's chosen mail composition package
+as selected with the variable `mail-user-agent'.
+The optional arguments TO and SUBJECT specify recipients
+and the initial Subject field, respectively.
+
+OTHER-HEADERS is an alist specifying additional
+header fields. Elements look like (HEADER . VALUE) where both
+HEADER and VALUE are strings.
+
+CONTINUE, if non-nil, says to continue editing a message already
+being composed.
+
+SWITCH-FUNCTION, if non-nil, is a function to use to
+switch to and display the buffer used for mail composition.
+
+YANK-ACTION, if non-nil, is an action to perform, if and when necessary,
+to insert the text of the message being replied to.
+It has the form (FUNCTION . ARGS). Performing the action is done
+by applying FUNCTION to ARGS.
+
+SEND-ACTIONS is a list of actions to call when the message is sent.
+Each action has the form (FUNCTION . ARGS)."
+ (interactive)
+ (let ((function (get mail-user-agent 'composefunc)))
+ (funcall function to subject other-headers continue
+ switch-function yank-action send-actions)))
(defun set-variable (var val)
"Set VARIABLE to VALUE. VALUE is a Lisp object.