aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2019-07-30 16:14:10 -0400
committerStefan Monnier2019-07-30 16:14:10 -0400
commitf7cf9199abf53ed17a751e995e519488bb0b591b (patch)
tree4c92a0afeb5dacf66e2a92bc1808822fc052946d
parent01739625704aaaea6831cef459a4a53171689513 (diff)
downloademacs-f7cf9199abf53ed17a751e995e519488bb0b591b.tar.gz
emacs-f7cf9199abf53ed17a751e995e519488bb0b591b.zip
* lisp/mail/sendmail.el (sendmail-send-it): Add FIXMEs.
Remove redundant :groups in the file, as well.
-rw-r--r--lisp/mail/sendmail.el100
1 files changed, 37 insertions, 63 deletions
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index 291efab961e..1da33a43eb8 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -39,7 +39,6 @@
39(defcustom mail-setup-with-from t 39(defcustom mail-setup-with-from t
40 "Non-nil means insert `From:' field when setting up the message." 40 "Non-nil means insert `From:' field when setting up the message."
41 :type 'boolean 41 :type 'boolean
42 :group 'sendmail
43 :version "22.1") 42 :version "22.1")
44 43
45(defcustom sendmail-program 44(defcustom sendmail-program
@@ -51,7 +50,6 @@
51 (t "sendmail"))) 50 (t "sendmail")))
52 "Program used to send messages." 51 "Program used to send messages."
53 :version "24.1" ; add executable-find, remove fakemail 52 :version "24.1" ; add executable-find, remove fakemail
54 :group 'mail
55 :type 'file) 53 :type 'file)
56 54
57;;;###autoload 55;;;###autoload
@@ -72,8 +70,7 @@ Otherwise, most addresses look like `angles', but they look like
72 (const parens) 70 (const parens)
73 (const angles) 71 (const angles)
74 (const default)) 72 (const default))
75 :version "27.1" 73 :version "27.1")
76 :group 'sendmail)
77(make-obsolete-variable 74(make-obsolete-variable
78 'mail-from-style 75 'mail-from-style
79 "only the `angles' value is valid according to RFC2822." "27.1" 'set) 76 "only the `angles' value is valid according to RFC2822." "27.1" 'set)
@@ -89,8 +86,7 @@ privileged operation. This variable affects sendmail and
89smtpmail -- if you use feedmail to send mail, see instead the 86smtpmail -- if you use feedmail to send mail, see instead the
90variable `feedmail-deduce-envelope-from'." 87variable `feedmail-deduce-envelope-from'."
91 :version "21.1" 88 :version "21.1"
92 :type 'boolean 89 :type 'boolean)
93 :group 'sendmail)
94 90
95(defcustom mail-envelope-from nil 91(defcustom mail-envelope-from nil
96 "If non-nil, designate the envelope-from address when sending mail. 92 "If non-nil, designate the envelope-from address when sending mail.
@@ -102,16 +98,14 @@ being sent is used), or nil (in which case the value of
102 :version "21.1" 98 :version "21.1"
103 :type '(choice (string :tag "From-name") 99 :type '(choice (string :tag "From-name")
104 (const :tag "Use From: header from message" header) 100 (const :tag "Use From: header from message" header)
105 (const :tag "Use `user-mail-address'" nil)) 101 (const :tag "Use `user-mail-address'" nil)))
106 :group 'sendmail)
107 102
108;;;###autoload 103;;;###autoload
109(defcustom mail-self-blind nil 104(defcustom mail-self-blind nil
110 "Non-nil means insert Bcc to self in messages to be sent. 105 "Non-nil means insert Bcc to self in messages to be sent.
111This is done when the message is initialized, 106This is done when the message is initialized,
112so you can remove or alter the Bcc field to override the default." 107so you can remove or alter the Bcc field to override the default."
113 :type 'boolean 108 :type 'boolean)
114 :group 'sendmail)
115 109
116;;;###autoload 110;;;###autoload
117(defcustom mail-interactive t 111(defcustom mail-interactive t
@@ -122,8 +116,7 @@ so you can remove or alter the Bcc field to override the default."
122 "Non-nil means when sending a message wait for and display errors. 116 "Non-nil means when sending a message wait for and display errors.
123Otherwise, let mailer send back a message to report errors." 117Otherwise, let mailer send back a message to report errors."
124 :type 'boolean 118 :type 'boolean
125 :version "23.1" ; changed from nil to t 119 :version "23.1") ; changed from nil to t
126 :group 'sendmail)
127 120
128(defcustom mail-yank-ignored-headers 121(defcustom mail-yank-ignored-headers
129 (concat "^" 122 (concat "^"
@@ -138,7 +131,6 @@ Otherwise, let mailer send back a message to report errors."
138 ":") 131 ":")
139 "Delete these headers from old message when it's inserted in a reply." 132 "Delete these headers from old message when it's inserted in a reply."
140 :type 'regexp 133 :type 'regexp
141 :group 'sendmail
142 :version "23.1") 134 :version "23.1")
143 135
144;; Useful to set in site-init.el 136;; Useful to set in site-init.el
@@ -147,7 +139,7 @@ Otherwise, let mailer send back a message to report errors."
147 ;; Assume smtpmail is the preferred choice if it's already configured. 139 ;; Assume smtpmail is the preferred choice if it's already configured.
148 (if (and (boundp 'smtpmail-smtp-server) 140 (if (and (boundp 'smtpmail-smtp-server)
149 smtpmail-smtp-server) 141 smtpmail-smtp-server)
150 'smtpmail-send-it 'sendmail-query-once) 142 #'smtpmail-send-it #'sendmail-query-once)
151 "Function to call to send the current buffer as mail. 143 "Function to call to send the current buffer as mail.
152The headers should be delimited by a line which is 144The headers should be delimited by a line which is
153not a valid RFC 822 (or later) header or continuation line, 145not a valid RFC 822 (or later) header or continuation line,
@@ -160,14 +152,12 @@ This is used by the default mail-sending commands. See also
160 (function-item feedmail-send-it :tag "Use Feedmail package") 152 (function-item feedmail-send-it :tag "Use Feedmail package")
161 (function-item mailclient-send-it :tag "Use Mailclient package") 153 (function-item mailclient-send-it :tag "Use Mailclient package")
162 function) 154 function)
163 :version "24.1" 155 :version "24.1")
164 :group 'sendmail)
165 156
166;;;###autoload 157;;;###autoload
167(defcustom mail-header-separator (purecopy "--text follows this line--") 158(defcustom mail-header-separator (purecopy "--text follows this line--")
168 "Line used to separate headers from text in messages being composed." 159 "Line used to separate headers from text in messages being composed."
169 :type 'string 160 :type 'string)
170 :group 'sendmail)
171 161
172;; Set up mail-header-separator for use as a category text property. 162;; Set up mail-header-separator for use as a category text property.
173(put 'mail-header-separator 'rear-nonsticky '(category)) 163(put 'mail-header-separator 'rear-nonsticky '(category))
@@ -183,16 +173,14 @@ This is used by the default mail-sending commands. See also
183 "Name of file to write all outgoing messages in, or nil for none. 173 "Name of file to write all outgoing messages in, or nil for none.
184This is normally an mbox file, but for backwards compatibility may also 174This is normally an mbox file, but for backwards compatibility may also
185be a Babyl file." 175be a Babyl file."
186 :type '(choice file (const nil)) 176 :type '(choice file (const nil)))
187 :group 'sendmail)
188 177
189;;;###autoload 178;;;###autoload
190(defcustom mail-default-reply-to nil 179(defcustom mail-default-reply-to nil
191 "Address to insert as default Reply-To field of outgoing messages. 180 "Address to insert as default Reply-To field of outgoing messages.
192If nil, it will be initialized from the REPLYTO environment variable 181If nil, it will be initialized from the REPLYTO environment variable
193when you first send mail." 182when you first send mail."
194 :type '(choice (const nil) string) 183 :type '(choice (const nil) string))
195 :group 'sendmail)
196 184
197(defcustom mail-alias-file nil 185(defcustom mail-alias-file nil
198 "If non-nil, the name of a file to use instead of the sendmail default. 186 "If non-nil, the name of a file to use instead of the sendmail default.
@@ -201,8 +189,7 @@ feature from that of defining aliases in `.mailrc' to be expanded in Emacs.
201This variable has no effect unless your system uses sendmail as its mailer. 189This variable has no effect unless your system uses sendmail as its mailer.
202The default file is defined in sendmail's configuration file, e.g. 190The default file is defined in sendmail's configuration file, e.g.
203`/etc/aliases'." 191`/etc/aliases'."
204 :type '(choice (const :tag "Sendmail default" nil) file) 192 :type '(choice (const :tag "Sendmail default" nil) file))
205 :group 'sendmail)
206 193
207;;;###autoload 194;;;###autoload
208(defcustom mail-personal-alias-file (purecopy "~/.mailrc") 195(defcustom mail-personal-alias-file (purecopy "~/.mailrc")
@@ -210,15 +197,13 @@ The default file is defined in sendmail's configuration file, e.g.
210This file typically should be in same format as the `.mailrc' file used by 197This file typically should be in same format as the `.mailrc' file used by
211the `Mail' or `mailx' program. 198the `Mail' or `mailx' program.
212This file need not actually exist." 199This file need not actually exist."
213 :type '(choice (const nil) file) 200 :type '(choice (const nil) file))
214 :group 'sendmail)
215 201
216;;;###autoload 202;;;###autoload
217(defcustom mail-setup-hook nil 203(defcustom mail-setup-hook nil
218 "Normal hook, run each time a new outgoing message is initialized." 204 "Normal hook, run each time a new outgoing message is initialized."
219 :type 'hook 205 :type 'hook
220 :options '(fortune-to-signature spook mail-abbrevs-setup) 206 :options '(fortune-to-signature spook mail-abbrevs-setup))
221 :group 'sendmail)
222 207
223;;;###autoload 208;;;###autoload
224(defvar mail-aliases t 209(defvar mail-aliases t
@@ -236,15 +221,13 @@ The alias definitions in the file have this form:
236(defcustom mail-yank-prefix "> " 221(defcustom mail-yank-prefix "> "
237 "Prefix insert on lines of yanked message being replied to. 222 "Prefix insert on lines of yanked message being replied to.
238If this is nil, use indentation, as specified by `mail-indentation-spaces'." 223If this is nil, use indentation, as specified by `mail-indentation-spaces'."
239 :type '(choice (const nil) string) 224 :type '(choice (const nil) string))
240 :group 'sendmail)
241 225
242;;;###autoload 226;;;###autoload
243(defcustom mail-indentation-spaces 3 227(defcustom mail-indentation-spaces 3
244 "Number of spaces to insert at the beginning of each cited line. 228 "Number of spaces to insert at the beginning of each cited line.
245Used by `mail-yank-original' via `mail-indent-citation'." 229Used by `mail-yank-original' via `mail-indent-citation'."
246 :type 'integer 230 :type 'integer)
247 :group 'sendmail)
248 231
249;;;###autoload 232;;;###autoload
250(defcustom mail-citation-hook nil 233(defcustom mail-citation-hook nil
@@ -257,8 +240,7 @@ in the cited portion of the message.
257 240
258If this hook is entirely empty (nil), a default action is taken 241If this hook is entirely empty (nil), a default action is taken
259instead of no action." 242instead of no action."
260 :type 'hook 243 :type 'hook)
261 :group 'sendmail)
262 244
263(defvar mail-citation-header nil 245(defvar mail-citation-header nil
264 "While running `mail-citation-hook', this variable holds the message header. 246 "While running `mail-citation-hook', this variable holds the message header.
@@ -273,7 +255,6 @@ It should match whatever sort of citation prefixes you want to handle,
273with whitespace before and after; it should also match just whitespace. 255with whitespace before and after; it should also match just whitespace.
274The default value matches citations like `foo-bar>' plus whitespace." 256The default value matches citations like `foo-bar>' plus whitespace."
275 :type 'regexp 257 :type 'regexp
276 :group 'sendmail
277 :version "24.1") 258 :version "24.1")
278 259
279(defvar mail-abbrevs-loaded nil) 260(defvar mail-abbrevs-loaded nil)
@@ -380,15 +361,13 @@ and should insert whatever you want to insert."
380 :type '(choice (const :tag "None" nil) 361 :type '(choice (const :tag "None" nil)
381 (const :tag "Use `.signature' file" t) 362 (const :tag "Use `.signature' file" t)
382 (string :tag "String to insert") 363 (string :tag "String to insert")
383 (sexp :tag "Expression to evaluate")) 364 (sexp :tag "Expression to evaluate")))
384 :group 'sendmail)
385(put 'mail-signature 'risky-local-variable t) 365(put 'mail-signature 'risky-local-variable t)
386 366
387;;;###autoload 367;;;###autoload
388(defcustom mail-signature-file (purecopy "~/.signature") 368(defcustom mail-signature-file (purecopy "~/.signature")
389 "File containing the text inserted at end of mail buffer." 369 "File containing the text inserted at end of mail buffer."
390 :type 'file 370 :type 'file)
391 :group 'sendmail)
392 371
393;;;###autoload 372;;;###autoload
394(defcustom mail-default-directory (purecopy "~/") 373(defcustom mail-default-directory (purecopy "~/")
@@ -398,7 +377,6 @@ This directory is used for auto-save files of Mail mode buffers.
398Note that Message mode does not use this variable; it auto-saves 377Note that Message mode does not use this variable; it auto-saves
399in `message-auto-save-directory'." 378in `message-auto-save-directory'."
400 :type '(directory :tag "Directory") 379 :type '(directory :tag "Directory")
401 :group 'sendmail
402 :version "22.1") 380 :version "22.1")
403 381
404(defvar mail-reply-action nil) 382(defvar mail-reply-action nil)
@@ -411,16 +389,14 @@ in `message-auto-save-directory'."
411 "A string containing header lines, to be inserted in outgoing messages. 389 "A string containing header lines, to be inserted in outgoing messages.
412It can contain newlines, and should end in one. It is inserted 390It can contain newlines, and should end in one. It is inserted
413before you edit the message, so you can edit or delete the lines." 391before you edit the message, so you can edit or delete the lines."
414 :type '(choice (const nil) string) 392 :type '(choice (const nil) string))
415 :group 'sendmail)
416 393
417(defcustom mail-bury-selects-summary t 394(defcustom mail-bury-selects-summary t
418 "If non-nil, try to show Rmail summary buffer after returning from mail. 395 "If non-nil, try to show Rmail summary buffer after returning from mail.
419The functions \\[mail-send-on-exit] or \\[mail-dont-send] select 396The functions \\[mail-send-on-exit] or \\[mail-dont-send] select
420the Rmail summary buffer before returning, if it exists and this variable 397the Rmail summary buffer before returning, if it exists and this variable
421is non-nil." 398is non-nil."
422 :type 'boolean 399 :type 'boolean)
423 :group 'sendmail)
424 400
425(defcustom mail-send-nonascii 'mime 401(defcustom mail-send-nonascii 'mime
426 "Specify whether to allow sending non-ASCII characters in mail. 402 "Specify whether to allow sending non-ASCII characters in mail.
@@ -430,14 +406,12 @@ If t, that means do allow it. nil means don't allow it.
430The default is `mime'. 406The default is `mime'.
431Including non-ASCII characters in a mail message can be problematical 407Including non-ASCII characters in a mail message can be problematical
432for the recipient, who may not know how to decode them properly." 408for the recipient, who may not know how to decode them properly."
433 :type '(choice (const t) (const nil) (const query) (const mime)) 409 :type '(choice (const t) (const nil) (const query) (const mime)))
434 :group 'sendmail)
435 410
436(defcustom mail-use-dsn nil 411(defcustom mail-use-dsn nil
437 "Ask MTA for notification of failed, delayed or successful delivery. 412 "Ask MTA for notification of failed, delayed or successful delivery.
438Note that only some MTAs (currently only recent versions of Sendmail) 413Note that only some MTAs (currently only recent versions of Sendmail)
439support Delivery Status Notification." 414support Delivery Status Notification."
440 :group 'sendmail
441 :type '(repeat (radio (const :tag "Failure" failure) 415 :type '(repeat (radio (const :tag "Failure" failure)
442 (const :tag "Delay" delay) 416 (const :tag "Delay" delay)
443 (const :tag "Success" success))) 417 (const :tag "Success" success)))
@@ -506,7 +480,7 @@ This also saves the value of `send-mail-function' via Customize."
506 ;; If send-mail-function is already setup, we're incorrectly called 480 ;; If send-mail-function is already setup, we're incorrectly called
507 ;; a second time, probably because someone's using an old value 481 ;; a second time, probably because someone's using an old value
508 ;; of send-mail-function. 482 ;; of send-mail-function.
509 (if (not (eq send-mail-function 'sendmail-query-once)) 483 (if (not (eq send-mail-function #'sendmail-query-once))
510 (funcall send-mail-function) 484 (funcall send-mail-function)
511 (let ((function (sendmail-query-user-about-smtp))) 485 (let ((function (sendmail-query-user-about-smtp)))
512 (funcall function) 486 (funcall function)
@@ -571,8 +545,8 @@ This also saves the value of `send-mail-function' via Customize."
571 545
572;;;###autoload 546;;;###autoload
573(define-mail-user-agent 'sendmail-user-agent 547(define-mail-user-agent 'sendmail-user-agent
574 'sendmail-user-agent-compose 548 #'sendmail-user-agent-compose
575 'mail-send-and-exit) 549 #'mail-send-and-exit)
576 550
577;;;###autoload 551;;;###autoload
578(defun sendmail-user-agent-compose (&optional to subject other-headers 552(defun sendmail-user-agent-compose (&optional to subject other-headers
@@ -687,7 +661,6 @@ This also saves the value of `send-mail-function' via Customize."
687 "Hook run by Mail mode. 661 "Hook run by Mail mode.
688When composing a mail, this runs immediately after creating, or 662When composing a mail, this runs immediately after creating, or
689switching to, the `*mail*' buffer. See also `mail-setup-hook'." 663switching to, the `*mail*' buffer. See also `mail-setup-hook'."
690 :group 'sendmail
691 :type 'hook 664 :type 'hook
692 :options '(footnote-mode)) 665 :options '(footnote-mode))
693 666
@@ -724,10 +697,8 @@ Turning on Mail mode runs the normal hooks `text-mode-hook' and
724 (make-local-variable 'font-lock-defaults) 697 (make-local-variable 'font-lock-defaults)
725 (setq font-lock-defaults '(mail-font-lock-keywords t t)) 698 (setq font-lock-defaults '(mail-font-lock-keywords t t))
726 (make-local-variable 'paragraph-separate) 699 (make-local-variable 'paragraph-separate)
727 (make-local-variable 'normal-auto-fill-function) 700 (setq-local normal-auto-fill-function #'mail-mode-auto-fill)
728 (setq normal-auto-fill-function 'mail-mode-auto-fill) 701 (setq-local fill-paragraph-function #'mail-mode-fill-paragraph)
729 (make-local-variable 'fill-paragraph-function)
730 (setq fill-paragraph-function 'mail-mode-fill-paragraph)
731 ;; Allow using comment commands to add/remove quoting (this only does 702 ;; Allow using comment commands to add/remove quoting (this only does
732 ;; anything if mail-yank-prefix is set to a non-nil value). 703 ;; anything if mail-yank-prefix is set to a non-nil value).
733 (set (make-local-variable 'comment-start) mail-yank-prefix) 704 (set (make-local-variable 'comment-start) mail-yank-prefix)
@@ -880,16 +851,14 @@ Prefix arg means don't delete this window."
880(defcustom mail-send-hook nil 851(defcustom mail-send-hook nil
881 "Hook run just before sending a message." 852 "Hook run just before sending a message."
882 :type 'hook 853 :type 'hook
883 :options '(flyspell-mode-off) 854 :options '(flyspell-mode-off))
884 :group 'sendmail)
885 855
886;;;###autoload 856;;;###autoload
887(defcustom mail-mailing-lists nil 857(defcustom mail-mailing-lists nil
888"List of mailing list addresses the user is subscribed to. 858"List of mailing list addresses the user is subscribed to.
889The variable is used to trigger insertion of the \"Mail-Followup-To\" 859The variable is used to trigger insertion of the \"Mail-Followup-To\"
890header when sending a message to a mailing list." 860header when sending a message to a mailing list."
891 :type '(repeat string) 861 :type '(repeat string))
892 :group 'sendmail)
893 862
894(declare-function mml-to-mime "mml" ()) 863(declare-function mml-to-mime "mml" ())
895 864
@@ -938,7 +907,7 @@ the user from the mailer."
938 (push e l))) 907 (push e l)))
939 (split-string new-header-values 908 (split-string new-header-values
940 ",[[:space:]]+" t)) 909 ",[[:space:]]+" t))
941 (mapconcat 'identity l ", ")) 910 (mapconcat #'identity l ", "))
942 "\n")) 911 "\n"))
943 ;; Add Mail-Reply-To if none yet 912 ;; Add Mail-Reply-To if none yet
944 (unless (mail-fetch-field "mail-reply-to") 913 (unless (mail-fetch-field "mail-reply-to")
@@ -1185,6 +1154,9 @@ Return non-nil if and only if some part of the header is encoded."
1185This is a suitable value for `send-mail-function'. It sends using the 1154This is a suitable value for `send-mail-function'. It sends using the
1186external program defined by `sendmail-program'." 1155external program defined by `sendmail-program'."
1187 (require 'mail-utils) 1156 (require 'mail-utils)
1157 ;; FIXME: A lot of the work done here seems out-of-place (e.g. it should
1158 ;; happen regardless of the method used to send, whether via SMTP of
1159 ;; /usr/bin/sendmail or anything else).
1188 (let ((errbuf (if mail-interactive 1160 (let ((errbuf (if mail-interactive
1189 (generate-new-buffer " sendmail errors") 1161 (generate-new-buffer " sendmail errors")
1190 0)) 1162 0))
@@ -1222,6 +1194,8 @@ external program defined by `sendmail-program'."
1222 (expand-mail-aliases (point-min) delimline)) 1194 (expand-mail-aliases (point-min) delimline))
1223 (goto-char (point-min)) 1195 (goto-char (point-min))
1224 ;; Ignore any blank lines in the header 1196 ;; Ignore any blank lines in the header
1197 ;; FIXME: mail-header-end should have stopped at an empty line,
1198 ;; so the regexp below should never match before delimline!
1225 (while (and (re-search-forward "\n\n\n*" delimline t) 1199 (while (and (re-search-forward "\n\n\n*" delimline t)
1226 (< (point) delimline)) 1200 (< (point) delimline))
1227 (replace-match "\n")) 1201 (replace-match "\n"))
@@ -1346,11 +1320,11 @@ external program defined by `sendmail-program'."
1346 '("-t") 1320 '("-t")
1347 ) 1321 )
1348 (if mail-use-dsn 1322 (if mail-use-dsn
1349 (list "-N" (mapconcat 'symbol-name 1323 (list "-N" (mapconcat #'symbol-name
1350 mail-use-dsn ","))) 1324 mail-use-dsn ",")))
1351 ) 1325 )
1352 ) 1326 )
1353 (exit-value (apply 'call-process-region args))) 1327 (exit-value (apply #'call-process-region args)))
1354 (cond ((or (null exit-value) (eq 0 exit-value))) 1328 (cond ((or (null exit-value) (eq 0 exit-value)))
1355 ((numberp exit-value) 1329 ((numberp exit-value)
1356 (setq error t) 1330 (setq error t)
@@ -1818,7 +1792,7 @@ If the current line has `mail-yank-prefix', insert it on the new line."
1818 (or (bolp) (newline)) 1792 (or (bolp) (newline))
1819 (goto-char start)))) 1793 (goto-char start))))
1820 1794
1821(define-obsolete-function-alias 'mail-attach-file 'mail-insert-file "24.1") 1795(define-obsolete-function-alias 'mail-attach-file #'mail-insert-file "24.1")
1822 1796
1823(declare-function mml-attach-file "mml" 1797(declare-function mml-attach-file "mml"
1824 (file &optional type description disposition)) 1798 (file &optional type description disposition))