aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1996-12-07 21:30:17 +0000
committerRichard M. Stallman1996-12-07 21:30:17 +0000
commitd0008a00b2167174792b57052fbbc42fda8c3300 (patch)
treedb87663eb2d072818c8a47f1c8474eefa588ba34
parent1c1dadabf3268c41a7f5e9584d208eeb207f100b (diff)
downloademacs-d0008a00b2167174792b57052fbbc42fda8c3300.tar.gz
emacs-d0008a00b2167174792b57052fbbc42fda8c3300.zip
(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
2844standard mail headers, leaving the `to:' and `subject:' headers blank 2844standard mail headers, leaving the `to:' and `subject:' headers blank
2845by default. 2845by default.
2846 2846
2847COMPOSEFUNC should accept two optional arguments: 2847COMPOSEFUNC should accept several optional arguments--the same
2848TO and SUBJECT. TO specifies a string to insert in the `To:' field, 2848arguments that `compose-mail' takes. See that function's documentation.
2849and SUBJECT specifies a string to insert in the `Subject:' field.
2850 2849
2851SENDFUNC is the command a user would run to send the message. 2850SENDFUNC is the command a user would run to send the message.
2852 2851
@@ -2866,15 +2865,63 @@ The properties used on SYMBOL are `composefunc', `sendfunc',
2866 (put symbol 'abortfunc (or abortfunc 'kill-buffer)) 2865 (put symbol 'abortfunc (or abortfunc 'kill-buffer))
2867 (put symbol 'hookvar (or hookvar 'mail-send-hook))) 2866 (put symbol 'hookvar (or hookvar 'mail-send-hook)))
2868 2867
2868(defun assoc-ignore-case (key alist)
2869 "Like `assoc', but assumes KEY is a string and ignores case when comparing."
2870 (let (element)
2871 (while (and alist (not element))
2872 (if (equal key (downcase (car (car alist))))
2873 (setq element (car alist)))
2874 (setq alist (cdr alist)))
2875 element))
2876
2869(define-mail-user-agent 'sendmail-user-agent 2877(define-mail-user-agent 'sendmail-user-agent
2870 '(lambda (&optional to subject) 2878 '(lambda (&optional to subject other-headers continue
2871 (or (mail nil to subject) 2879 switch-function yank-action send-actions)
2872 (error "Message aborted"))) 2880 (if switch-function
2881 (let ((special-display-buffer-names nil)
2882 (special-display-regexps nil)
2883 (same-window-buffer-names nil)
2884 (same-window-regexps nil))
2885 (funcall switch-function "*mail*")))
2886 (let ((cc (cdr (assoc-ignore-case "cc" other-headers)))
2887 (in-reply-to (cdr (assoc-ignore-case "in-reply-to" other-headers))))
2888 (or (mail continue to subject in-reply-to cc yank-action send-actions)
2889 (error "Message aborted"))))
2873 'mail-send-and-exit) 2890 'mail-send-and-exit)
2874 2891
2875(define-mail-user-agent 'mh-e-user-agent 2892(define-mail-user-agent 'mh-e-user-agent
2876 'mh-smail-batch 'mh-send-letter 'mh-fully-kill-draft 2893 'mh-smail-batch 'mh-send-letter 'mh-fully-kill-draft
2877 'mh-before-send-letter-hook) 2894 'mh-before-send-letter-hook)
2895
2896(defun compose-mail (&optional to subject other-headers continue
2897 switch-function yank-action send-actions)
2898 "Start composing a mail message to send.
2899This uses the user's chosen mail composition package
2900as selected with the variable `mail-user-agent'.
2901The optional arguments TO and SUBJECT specify recipients
2902and the initial Subject field, respectively.
2903
2904OTHER-HEADERS is an alist specifying additional
2905header fields. Elements look like (HEADER . VALUE) where both
2906HEADER and VALUE are strings.
2907
2908CONTINUE, if non-nil, says to continue editing a message already
2909being composed.
2910
2911SWITCH-FUNCTION, if non-nil, is a function to use to
2912switch to and display the buffer used for mail composition.
2913
2914YANK-ACTION, if non-nil, is an action to perform, if and when necessary,
2915to insert the text of the message being replied to.
2916It has the form (FUNCTION . ARGS). Performing the action is done
2917by applying FUNCTION to ARGS.
2918
2919SEND-ACTIONS is a list of actions to call when the message is sent.
2920Each action has the form (FUNCTION . ARGS)."
2921 (interactive)
2922 (let ((function (get mail-user-agent 'composefunc)))
2923 (funcall function to subject other-headers continue
2924 switch-function yank-action send-actions)))
2878 2925
2879(defun set-variable (var val) 2926(defun set-variable (var val)
2880 "Set VARIABLE to VALUE. VALUE is a Lisp object. 2927 "Set VARIABLE to VALUE. VALUE is a Lisp object.