diff options
| -rw-r--r-- | lisp/simple.el | 59 |
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 | |||
| 2844 | standard mail headers, leaving the `to:' and `subject:' headers blank | 2844 | standard mail headers, leaving the `to:' and `subject:' headers blank |
| 2845 | by default. | 2845 | by default. |
| 2846 | 2846 | ||
| 2847 | COMPOSEFUNC should accept two optional arguments: | 2847 | COMPOSEFUNC should accept several optional arguments--the same |
| 2848 | TO and SUBJECT. TO specifies a string to insert in the `To:' field, | 2848 | arguments that `compose-mail' takes. See that function's documentation. |
| 2849 | and SUBJECT specifies a string to insert in the `Subject:' field. | ||
| 2850 | 2849 | ||
| 2851 | SENDFUNC is the command a user would run to send the message. | 2850 | SENDFUNC 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. | ||
| 2899 | This uses the user's chosen mail composition package | ||
| 2900 | as selected with the variable `mail-user-agent'. | ||
| 2901 | The optional arguments TO and SUBJECT specify recipients | ||
| 2902 | and the initial Subject field, respectively. | ||
| 2903 | |||
| 2904 | OTHER-HEADERS is an alist specifying additional | ||
| 2905 | header fields. Elements look like (HEADER . VALUE) where both | ||
| 2906 | HEADER and VALUE are strings. | ||
| 2907 | |||
| 2908 | CONTINUE, if non-nil, says to continue editing a message already | ||
| 2909 | being composed. | ||
| 2910 | |||
| 2911 | SWITCH-FUNCTION, if non-nil, is a function to use to | ||
| 2912 | switch to and display the buffer used for mail composition. | ||
| 2913 | |||
| 2914 | YANK-ACTION, if non-nil, is an action to perform, if and when necessary, | ||
| 2915 | to insert the text of the message being replied to. | ||
| 2916 | It has the form (FUNCTION . ARGS). Performing the action is done | ||
| 2917 | by applying FUNCTION to ARGS. | ||
| 2918 | |||
| 2919 | SEND-ACTIONS is a list of actions to call when the message is sent. | ||
| 2920 | Each 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. |