Changeset 3024
- Timestamp:
- 2003年03月01日 08時26分20秒 (6 years ago)
- Files:
-
- work/cvs2svn/lisp/ChangeLog.Meadow (modified) (1 diff)
- work/cvs2svn/lisp/international/mw32mci.el (added)
- work/cvs2svn/lisp/loadup.el (modified) (1 diff)
- work/cvs2svn/lisp/mail/sendmail.el (modified) (46 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
work/cvs2svn/lisp/ChangeLog.Meadow
r3012 r3024 1 2003-03-01 MIYOSHI Masanori <miyoshi@boreas.dti.ne.jp> 2 3 * loadup.el: Add international/mw32mci.el. 4 5 * international/mw32mci.el (mw32-mci-add-notify-callback): New 6 function. 7 (mw32-mci-remove-notify-callback): Ditto. 8 (mw32-mci-notify-event-handler): Ditto. 9 (mw32-mci-handle-event): Ditto. 10 (special-event-map): Add mw32-mci-handle-event. 11 (mw32-mci-notify-func): New function. 12 (parse-sound): Ditto. 13 (play-sound): Ditto. 14 15 * mail/sendmail.el (mail-font-lock-keywords): Sync up with 21.3.50. 16 (mail-mode): Ditto. 17 1 18 2003-02-22 MIYOSHI Masanori <miyoshi@boreas.dti.ne.jp> 2 19 work/cvs2svn/lisp/loadup.el
r2523 r3024 158 158 (load "dos-w32") 159 159 (load "w32-fns") 160 (load "international/mw32misc"))) 160 (load "international/mw32misc") 161 (load "international/mw32mci"))) 161 162 (if (eq system-type 'ms-dos) 162 163 (progn work/cvs2svn/lisp/mail/sendmail.el
r1365 r3024 1 ;;; sendmail.el --- mail sending commands for Emacs. 2 3 ;; Copyright (C) 1985, 86, 92, 93, 94, 95, 96 Free Software Foundation, Inc. 1 ;;; sendmail.el --- mail sending commands for Emacs. -*- byte-compile-dynamic: t -*- 2 3 ;; Copyright (C) 1985, 86, 92, 93, 94, 95, 96, 98, 2000, 2001 4 ;; Free Software Foundation, Inc. 4 5 5 6 ;; Maintainer: FSF … … 29 30 30 31 ;;; Code: 31 32 ;;;###autoload 33 (defvar mail-from-style 'angles "\ 32 (eval-when-compile 33 ;; Necessary to avoid recursive `require's. 34 (provide 'sendmail) 35 (require 'rmail) 36 (require 'mailalias)) 37 38 (autoload 'rfc2047-encode-string "rfc2047") 39 40 (defgroup sendmail nil 41 "Mail sending commands for Emacs." 42 :prefix "mail-" 43 :group 'mail) 44 45 ;;;###autoload 46 (defcustom mail-from-style 'angles "\ 34 47 *Specifies how \"From:\" fields look. 35 48 … … 39 52 king@grassland.com (Elvis Parsley) 40 53 If `angles', they look like: 41 Elvis Parsley <king@grassland.com>") 42 43 ;;;###autoload 44 (defvar mail-self-blind nil "\ 54 Elvis Parsley <king@grassland.com> 55 If `system-default', allows the mailer to insert its default From field 56 derived from the envelope-from address. 57 58 In old versions of Emacs, the `system-default' setting also caused 59 Emacs to pass the proper email address from `user-mail-address' 60 to the mailer to specify the envelope-from address. But that is now 61 controlled by a separate variable, `mail-specify-envelope-from'." 62 :type '(choice (const nil) (const parens) (const angles) 63 (const system-default)) 64 :version "20.3" 65 :group 'sendmail) 66 67 ;;;###autoload 68 (defcustom mail-specify-envelope-from nil 69 "*If non-nil, specify the envelope-from address when sending mail. 70 The value used to specify it is whatever is found in 71 `mail-envelope-from', with `user-mail-address' as fallback. 72 73 On most systems, specifying the envelope-from address 74 is a privileged operation." 75 :version "21.1" 76 :type 'boolean 77 :group 'sendmail) 78 79 (defcustom mail-envelope-from nil 80 "*If non-nil, designate the envelope-from address when sending mail. 81 If this is nil while `mail-specify-envelope-from' is non-nil, the 82 content of `user-mail-address' is used." 83 :version "21.1" 84 :type 'boolean 85 :group 'sendmail) 86 87 ;;;###autoload 88 (defcustom mail-self-blind nil "\ 45 89 *Non-nil means insert BCC to self in messages to be sent. 46 90 This is done when the message is initialized, 47 so you can remove or alter the BCC field to override the default.") 48 49 ;;;###autoload 50 (defvar mail-interactive nil "\ 91 so you can remove or alter the BCC field to override the default." 92 :type 'boolean 93 :group 'sendmail) 94 95 ;;;###autoload 96 (defcustom mail-interactive nil "\ 51 97 *Non-nil means when sending a message wait for and display errors. 52 nil means let mailer mail back a message to report errors.") 53 54 ;;;###autoload 55 (defvar mail-yank-ignored-headers "^via:\\|^mail-from:\\|^origin:\\|^status:\\|^remailed\\|^received:\\|^message-id:\\|^summary-line:\\|^to:\\|^subject:\\|^in-reply-to:\\|^return-path:" "\ 56 *Delete these headers from old message when it's inserted in a reply.") 98 nil means let mailer mail back a message to report errors." 99 :type 'boolean 100 :group 'sendmail) 101 102 ;;;###autoload 103 (defcustom mail-yank-ignored-headers "^via:\\|^mail-from:\\|^origin:\\|^status:\\|^remailed\\|^received:\\|^message-id:\\|^summary-line:\\|^to:\\|^subject:\\|^in-reply-to:\\|^return-path:" "\ 104 *Delete these headers from old message when it's inserted in a reply." 105 :type 'regexp 106 :group 'sendmail) 57 107 58 108 ;; Useful to set in site-init.el 59 109 ;;;###autoload 60 (defvar send-mail-function 'sendmail-send-it "\ 61 Function to call to send the current buffer as mail. 62 The headers should be delimited by a line whose contents 63 match the variable `mail-header-separator'.") 64 65 ;;;###autoload 66 (defvar mail-header-separator "--text follows this line--" "\ 67 *Line used to separate headers from text in messages being composed.") 110 (defcustom send-mail-function 'sendmail-send-it 111 "Function to call to send the current buffer as mail. 112 The headers should be delimited by a line which is 113 not a valid RFC822 header or continuation line, 114 that matches the variable `mail-header-separator'. 115 This is used by the default mail-sending commands. See also 116 `message-send-mail-function' for use with the Message package." 117 :type '(radio (function-item sendmail-send-it :tag "Use Sendmail package") 118 (function-item smtpmail-send-it :tag "Use SMTPmail package") 119 (function-item feedmail-send-it :tag "Use Feedmail package") 120 function) 121 :group 'sendmail) 122 123 ;;;###autoload 124 (defcustom mail-header-separator "--text follows this line--" "\ 125 *Line used to separate headers from text in messages being composed." 126 :type 'string 127 :group 'sendmail) 68 128 69 129 ;; Set up mail-header-separator for use as a category text property. … … 77 137 78 138 ;;;###autoload 79 (def varmail-archive-file-name nil "\139 (defcustom mail-archive-file-name nil "\ 80 140 *Name of file to write all outgoing messages in, or nil for none. 81 This can be an inbox file or an Rmail file.") 82 83 ;;;###autoload 84 (defvar mail-default-reply-to nil 141 This can be an inbox file or an Rmail file." 142 :type '(choice file (const nil)) 143 :group 'sendmail) 144 145 ;;;###autoload 146 (defcustom mail-default-reply-to nil 85 147 "*Address to insert as default Reply-to field of outgoing messages. 86 148 If nil, it will be initialized from the REPLYTO environment variable 87 when you first send mail.") 88 89 ;;;###autoload 90 (defvar mail-alias-file nil 149 when you first send mail." 150 :type '(choice (const nil) string) 151 :group 'sendmail) 152 153 ;;;###autoload 154 (defcustom mail-alias-file nil 91 155 "*If non-nil, the name of a file to use instead of `/usr/lib/aliases'. 92 156 This file defines aliases to be expanded by the mailer; this is a different 93 157 feature from that of defining aliases in `.mailrc' to be expanded in Emacs. 94 This variable has no effect unless your system uses sendmail as its mailer.") 95 96 ;;;###autoload 97 (defvar mail-personal-alias-file "~/.mailrc" 158 This variable has no effect unless your system uses sendmail as its mailer." 159 :type '(choice (const nil) file) 160 :group 'sendmail) 161 162 ;;;###autoload 163 (defcustom mail-personal-alias-file "~/.mailrc" 98 164 "*If non-nil, the name of the user's personal mail alias file. 99 165 This file typically should be in same format as the `.mailrc' file used by 100 166 the `Mail' or `mailx' program. 101 This file need not actually exist.") 102 103 (defvar mail-setup-hook nil 167 This file need not actually exist." 168 :type '(choice (const nil) file) 169 :group 'sendmail) 170 171 (defcustom mail-setup-hook nil 104 172 "Normal hook, run each time a new outgoing mail message is initialized. 105 The function `mail-setup' runs this hook.") 173 The function `mail-setup' runs this hook." 174 :type 'hook 175 :options '(fortune-to-signature spook mail-abbrevs-setup) 176 :group 'sendmail) 106 177 107 178 (defvar mail-aliases t … … 116 187 "The modification time of your mail alias file when it was last examined.") 117 188 118 (def varmail-yank-prefix nil189 (defcustom mail-yank-prefix nil 119 190 "*Prefix insert on lines of yanked message being replied to. 120 nil means use indentation.") 121 (defvar mail-indentation-spaces 3 191 nil means use indentation." 192 :type '(choice (const nil) string) 193 :group 'sendmail) 194 195 (defcustom mail-indentation-spaces 3 122 196 "*Number of spaces to insert at the beginning of each cited line. 123 Used by `mail-yank-original' via `mail-indent-citation'.") 197 Used by `mail-yank-original' via `mail-indent-citation'." 198 :type 'integer 199 :group 'sendmail) 124 200 (defvar mail-yank-hooks nil 125 201 "Obsolete hook for modifying a citation just inserted in the mail buffer. … … 131 207 It is semi-obsolete and mail agents should no longer use it.") 132 208 133 (def varmail-citation-hook nil209 (defcustom mail-citation-hook nil 134 210 "*Hook for modifying a citation just inserted in the mail buffer. 135 Each hook function can find the citation between (point) and (mark t). 136 And each hook function should leave point and mark around the citation 137 text as modified. 211 Each hook function can find the citation between (point) and (mark t), 212 and should leave point and mark around the citation text as modified. 213 The hook functions can find the header of the cited message 214 in the variable `mail-citation-header', whether or not this is included 215 in the cited portion of the message. 138 216 139 217 If this hook is entirely empty (nil), a default action is taken 140 instead of no action.") 218 instead of no action." 219 :type 'hook 220 :group 'sendmail) 221 222 (defvar mail-citation-header nil 223 "While running `mail-citation-hook', this variable holds the message header. 224 This enables the hook functions to see the whole message header 225 regardless of what part of it (if any) is included in the cited text.") 226 227 (defcustom mail-citation-prefix-regexp "[ \t]*[-a-z0-9A-Z]*>+[ \t]*\\|[ \t]*" 228 "*Regular expression to match a citation prefix plus whitespace. 229 It should match whatever sort of citation prefixes you want to handle, 230 with whitespace before and after; it should also match just whitespace. 231 The default value matches citations like `foo-bar>' plus whitespace." 232 :type 'regexp 233 :group 'sendmail 234 :version "20.3") 141 235 142 236 (defvar mail-abbrevs-loaded nil) … … 155 249 156 250 ;;;###autoload 157 (def varmail-signature nil251 (defcustom mail-signature nil 158 252 "*Text inserted at end of mail buffer when a message is initialized. 159 If t, it means to insert the contents of the file `mail-signature-file'.") 160 161 (defvar mail-signature-file "~/.signature" 162 "*File containing the text inserted at end of mail buffer.") 253 If t, it means to insert the contents of the file `mail-signature-file'. 254 If a string, that string is inserted. 255 (To make a proper signature, the string should begin with \\n\\n-- \\n, 256 which is the standard way to delimit a signature in a message.) 257 Otherwise, it should be an expression; it is evaluated 258 and should insert whatever you want to insert." 259 :type '(choice (const "None" nil) 260 (const :tag "Use `.signature' file" t) 261 (string :tag "String to insert") 262 (sexp :tag "Expression to evaluate")) 263 :group 'sendmail) 264 (put 'mail-signature 'risky-local-variable t) 265 266 (defcustom mail-signature-file "~/.signature" 267 "*File containing the text inserted at end of mail buffer." 268 :type 'file 269 :group 'sendmail) 163 270 164 271 (defvar mail-reply-action nil) … … 168 275 (put 'mail-send-actions 'permanent-local t) 169 276 170 (def varmail-default-headers nil277 (defcustom mail-default-headers nil 171 278 "*A string containing header lines, to be inserted in outgoing messages. 172 279 It is inserted before you edit the message, 173 so you can edit or delete these lines.") 174 175 (defvar mail-bury-selects-summary t 280 so you can edit or delete these lines." 281 :type '(choice (const nil) string) 282 :group 'sendmail) 283 284 (defcustom mail-bury-selects-summary t 176 285 "*If non-nil, try to show RMAIL summary buffer after returning from mail. 177 286 The functions \\[mail-send-on-exit] or \\[mail-dont-send] select 178 287 the RMAIL summary buffer before returning, if it exists and this variable 179 is non-nil." )180 181 ;; I find that this happens so often, for innocent reasons, 182 ;; that it is not acceptable to bother the user about it -- rms. 183 (def var mail-send-nonascii t288 is non-nil." 289 :type 'boolean 290 :group 'sendmail) 291 292 (defcustom mail-send-nonascii 'mime 184 293 "*Specify whether to allow sending non-ASCII characters in mail. 185 294 If t, that means do allow it. nil means don't allow it. 186 295 `query' means ask the user each time. 296 `mime' means add an appropriate MIME header if none already present. 297 The default is `mime'. 187 298 Including non-ASCII characters in a mail message can be problematical 188 for the recipient, who may not know how to decode them properly.") 299 for the recipient, who may not know how to decode them properly." 300 :type '(choice (const t) (const nil) (const query) (const mime)) 301 :group 'sendmail) 189 302 190 303 ;; Note: could use /usr/ucb/mail instead of sendmail; … … 223 336 (eval-when-compile 224 337 (let* ((cite-chars "[>|}]") 225 (cite-prefix " A-Za-z")338 (cite-prefix "[:alpha:]") 226 339 (cite-suffix (concat cite-prefix "0-9_.@-`'\""))) 227 340 (list '("^\\(To\\|Newsgroups\\):" . font-lock-function-name-face) … … 231 344 ;; Use EVAL to delay in case `mail-header-separator' gets changed. 232 345 '(eval . 233 (cons (concat "^" (regexp-quote mail-header-separator) "$") 234 'font-lock-warning-face)) 346 (let ((separator (if (zerop (length mail-header-separator)) 347 " \\`\\' " 348 (regexp-quote mail-header-separator)))) 349 (cons (concat "^" separator "$") 'font-lock-warning-face))) 235 350 ;; Use MATCH-ANCHORED to effectively anchor the regexp left side. 236 351 `(,cite-chars … … 240 355 "\\(.*\\)") 241 356 (beginning-of-line) (end-of-line) 242 (2 font-lock- reference-face nil t)357 (2 font-lock-constant-face nil t) 243 358 (4 font-lock-comment-face nil t))) 244 '("^\\(X-[A-Za-z0-9-]+\\|In-reply-to\\):.* "359 '("^\\(X-[A-Za-z0-9-]+\\|In-reply-to\\):.*\\(\n[ \t]+.*\\)*$" 245 360 . font-lock-string-face)))) 246 361 "Additional expressions to highlight in Mail mode.") 247 362 248 (defvar mail-send-hook nil249 "Normal hook run before sending mail, in Mail mode.")250 363 251 364 (defun sendmail-sync-aliases () … … 266 379 ;; Don't leave this around from a previous message. 267 380 (kill-local-variable 'buffer-file-coding-system) 268 (kill-local-variable 'enable-multibyte-characters) 381 ;; This doesn't work for enable-multibyte-characters. 382 ;; (kill-local-variable 'enable-multibyte-characters) 383 (set-buffer-multibyte default-enable-multibyte-characters) 269 384 (if current-input-method 270 385 (inactivate-input-method)) … … 281 396 (address-start (point))) 282 397 (insert to "\n") 283 (fill-region-as-paragraph address-start (point-max))) 398 (fill-region-as-paragraph address-start (point-max)) 399 (goto-char (point-max)) 400 (unless (bolp) 401 (newline))) 284 402 (newline)) 285 403 (if cc … … 287 405 (address-start (progn (insert "CC: ") (point)))) 288 406 (insert cc "\n") 289 (fill-region-as-paragraph address-start (point-max)))) 407 (fill-region-as-paragraph address-start (point-max)) 408 (goto-char (point-max)) 409 (unless (bolp) 410 (newline)))) 290 411 (if in-reply-to 291 (let ((fill-prefix "\t")412 (let ((fill-prefix "\t") 292 413 (fill-column 78) 293 414 (address-start (point))) 294 415 (insert "In-reply-to: " in-reply-to "\n") 295 (fill-region-as-paragraph address-start (point-max)))) 416 (fill-region-as-paragraph address-start (point-max)) 417 (goto-char (point-max)) 418 (unless (bolp) 419 (newline)))) 296 420 (insert "Subject: " (or subject "") "\n") 297 421 (if mail-default-headers … … 315 439 (insert "\n\n-- \n") 316 440 (insert-file-contents mail-signature-file)))) 317 (mail-signature 318 (insert mail-signature))) 441 ((stringp mail-signature) 442 (insert mail-signature)) 443 (t 444 (eval mail-signature))) 319 445 (goto-char (point-max)) 320 446 (or (bolp) (newline))) … … 324 450 (run-hooks 'mail-setup-hook)) 325 451 452 (defcustom mail-mode-hook nil 453 "Hook run by Mail mode." 454 :group 'sendmail 455 :type 'hook 456 :options '(footnote-mode)) 457 326 458 ;;;###autoload 327 459 (defun mail-mode () 328 460 "Major mode for editing mail to be sent. 329 461 Like Text Mode but with these additional commands: 330 C-c C-s mail-send (send the message) C-c C-c mail-send-and-exit 331 C-c C-f move to a header field (and create it if there isn't): 332 C-c C-f C-t move to To: C-c C-f C-s move to Subject: 333 C-c C-f C-c move to CC: C-c C-f C-b move to BCC: 334 C-c C-f C-f move to FCC: 335 C-c C-t mail-text (move to beginning of message text). 336 C-c C-w mail-signature (insert `mail-signature-file' file). 337 C-c C-y mail-yank-original (insert current message, in Rmail). 338 C-c C-q mail-fill-yanked-message (fill what was yanked). 339 C-c C-v mail-sent-via (add a Sent-via field for each To or CC)." 462 \\[mail-send] mail-send (send the message) \\[mail-send-and-exit] mail-send-and-exit 463 Here are commands that move to a header field (and create it if there isn't): 464 \\[mail-to] move to To: \\[mail-subject] move to Subject: 465 \\[mail-cc] move to CC: \\[mail-bcc] move to BCC: 466 \\[mail-fcc] move to FCC: \\[mail-reply-to] move to Reply-To: 467 \\[mail-text] mail-text (move to beginning of message text). 468 \\[mail-signature] mail-signature (insert `mail-signature-file' file). 469 \\[mail-yank-original] mail-yank-original (insert current message, in Rmail). 470 \\[mail-fill-yanked-message] mail-fill-yanked-message (fill what was yanked). 471 \\[mail-sent-via] mail-sent-via (add a Sent-via field for each To or CC). 472 Turning on Mail mode runs the normal hooks `text-mode-hook' and 473 `mail-mode-hook' (in that order)." 340 474 (interactive) 341 475 (kill-all-local-variables) … … 349 483 (setq buffer-offer-save t) 350 484 (make-local-variable 'font-lock-defaults) 351 (setq font-lock-defaults '(mail-font-lock-keywords t ))485 (setq font-lock-defaults '(mail-font-lock-keywords t t)) 352 486 (make-local-variable 'paragraph-separate) 353 487 (make-local-variable 'paragraph-start) … … 356 490 (make-local-variable 'fill-paragraph-function) 357 491 (setq fill-paragraph-function 'mail-mode-fill-paragraph) 492 ;; Allow using comment commands to add/remove quoting (this only does 493 ;; anything if mail-yank-prefix is set to a non-nil value). 494 (set (make-local-variable 'comment-start) mail-yank-prefix) 358 495 (make-local-variable 'adaptive-fill-regexp) 359 496 (setq adaptive-fill-regexp 360 (concat "[ \t]*[-a-z0-9A-Z]*>+[ \t]*\\|" adaptive-fill-regexp)) 497 (concat "[ \t]*[-[:alnum:]]+>+[ \t]*\\|" 498 adaptive-fill-regexp)) 361 499 (make-local-variable 'adaptive-fill-first-line-regexp) 362 500 (setq adaptive-fill-first-line-regexp 363 (concat "[ \t]*[-a-z0-9A-Z]*>+[ \t]*\\|" adaptive-fill-first-line-regexp)) 501 (concat "[ \t]*[-[:alnum:]]*>+[ \t]*\\|" 502 adaptive-fill-first-line-regexp)) 364 503 ;; `-- ' precedes the signature. `-----' appears at the start of the 365 504 ;; lines that delimit forwarded messages. … … 367 506 ;; are also sometimes used and should be separators. 368 507 (setq paragraph-start (concat (regexp-quote mail-header-separator) 369 "$\\|[ \t]*[a-z0-9A-Z]*>+[ \t]*$\\|[ \t]*$\\|" 508 "$\\|\t*\\([-|#;>* ]\\|(?[0-9]+[.)]\\)+$" 509 "\\|[ \t]*[[:alnum:]]*>+[ \t]*$\\|[ \t]*$\\|" 510 "-- $\\|---+$\\|" 370 511 page-delimiter)) 371 512 (setq paragraph-separate paragraph-start) 372 513 (run-hooks 'text-mode-hook 'mail-mode-hook)) 373 514 515 516 (defun mail-header-end () 517 "Return the buffer location of the end of headers, as a number." 518 (save-restriction 519 (widen) 520 (save-excursion 521 (rfc822-goto-eoh) 522 (point)))) 523 524 (defun mail-text-start () 525 "Return the buffer location of the start of text, as a number." 526 (save-restriction 527 (widen) 528 (save-excursion 529 (rfc822-goto-eoh) 530 (forward-line 1) 531 (point)))) 532 533 (defun mail-sendmail-delimit-header () 534 "Set up whatever header delimiter convention sendmail will use. 535 Concretely: replace the first blank line in the header with the separator." 536 (rfc822-goto-eoh) 537 (insert mail-header-separator) 538 (point)) 539 540 (defun mail-sendmail-undelimit-header () 541 "Remove header separator to put the message in correct form for sendmail. 542 Leave point at the start of the delimiter line." 543 (rfc822-goto-eoh) 544 (delete-region (point) (progn (end-of-line) (point)))) 545 374 546 (defun mail-mode-auto-fill () 375 547 "Carry out Auto Fill for Mail mode. 376 548 If within the headers, this makes the new lines into continuation lines." 377 (if (< (point) 378 (save-excursion 379 (goto-char (point-min)) 380 (if (re-search-forward 381 (concat "^" (regexp-quote mail-header-separator) "$") 382 nil t) 383 (point) 384 0))) 549 (if (< (point) (mail-header-end)) 385 550 (let ((old-line-start (save-excursion (beginning-of-line) (point)))) 386 551 (if (do-auto-fill) … … 397 562 (defun mail-mode-fill-paragraph (arg) 398 563 ;; Do something special only if within the headers. 399 (if (< (point) 400 (save-excursion 401 (goto-char (point-min)) 402 (if (re-search-forward 403 (concat "^" (regexp-quote mail-header-separator) "$") 404 nil t) 405 (point) 406 0))) 564 (if (< (point) (mail-header-end)) 407 565 (let (beg end fieldname) 408 ( re-search-backward "^[-a-zA-Z]+:" nil 'yes)409 (setq beg (point))566 (when (prog1 (re-search-backward "^[-a-zA-Z]+:" nil 'yes) 567 (setq beg (point))) 410 568 (setq fieldname 411 (downcase (buffer-substring beg (1- (match-end 0)))))569 (downcase (buffer-substring beg (1- (match-end 0)))))) 412 570 (forward-line 1) 413 571 ;; Find continuation lines and get rid of their continuation markers. … … 533 691 (bury-buffer (current-buffer)) 534 692 (if (and (or (window-dedicated-p (frame-selected-window)) 535 ( assq 'mail-dedicated-frame (frame-parameters)))693 (cdr (assq 'mail-dedicated-frame (frame-parameters)))) 536 694 (not (null (delq (selected-frame) (visible-frame-list))))) 537 695 (delete-frame (selected-frame)) … … 555 713 (switch-to-buffer newbuf)))))) 556 714 715 (defcustom mail-send-hook nil 716 "Hook run just before sending mail with `mail-send'." 717 :type 'hook 718 :options '(flyspell-mode-off) 719 :group 'sendmail) 720 557 721 (defun mail-send () 558 722 "Send the message in the current buffer. … … 568 732 (let ((inhibit-read-only t) 569 733 (opoint (point))) 570 (when (and enable-multibyte-characters 571 (not (eq mail-send-nonascii t))) 734 (unless (memq mail-send-nonascii '(t mime)) 572 735 (goto-char (point-min)) 573 736 (skip-chars-forward "\0-\177") … … 579 742 ;; Complain about any invalid line. 580 743 (goto-char (point-min)) 581 (while ( not (looking-at (regexp-quote mail-header-separator)))744 (while (< (point) (mail-header-end)) 582 745 (unless (looking-at "[ \t]\\|.*:\\|$") 583 746 (push-mark opoint) … … 596 759 (setq mail-send-actions (cdr mail-send-actions))) 597 760 (message "Sending...done") 598 ;; If buffer has no file, mark it as unmodified and delete auto save.761 ;; If buffer has no file, mark it as unmodified and delete auto-save. 599 762 (if (not buffer-file-name) 600 763 (progn … … 607 770 ;;;###autoload 608 771 (defvar sendmail-coding-system nil 609 "Coding system to which to encode the mail.") 772 "*Coding system for encoding the outgoing mail. 773 This has higher priority than `default-buffer-file-coding-system' 774 and `default-sendmail-coding-system', 775 but lower priority than the local value of `buffer-file-coding-system'. 776 See also the function `select-message-coding-system'.") 777 778 ;;;###autoload 779 (defvar default-sendmail-coding-system 'iso-latin-1 780 "Default coding system for encoding the outgoing mail. 781 This variable is used only when `sendmail-coding-system' is nil. 782 783 This variable is set/changed by the command set-language-environment. 784 User should not set this variable manually, 785 instead use sendmail-coding-system to get a constant encoding 786 of outgoing mails regardless of the current language environment. 787 See also the function `select-message-coding-system'.") 610 788 611 789 (defun sendmail-send-it () 790 "Send the current mail buffer using the Sendmail package. 791 This is a suitable value for `send-mail-function'. It sends using the 792 external program defined by `sendmail-program'." 612 793 (require 'mail-utils) 613 794 (let ((errbuf (if mail-interactive … … 616 797 (tembuf (generate-new-buffer " sendmail temp")) 617 798 (case-fold-search nil) 618 resend-to-addresses 799 (coding (and (local-variable-p 'buffer-file-coding-system) 800 buffer-file-coding-system)) 801 selected-coding 802 ;;; resend-to-addresses 619 803 delimline 620 804 fcc-was-found 621 805 (mailbuf (current-buffer)) 622 (sendmail-coding-system 623 (if (local-variable-p 'buffer-file-coding-system) 624 buffer-file-coding-system 625 (or sendmail-coding-system 626 default-buffer-file-coding-system 627 'iso-latin-1)))) 806 (program (if (boundp 'sendmail-program) 807 sendmail-program 808 "/usr/lib/sendmail"))) 628 809 (unwind-protect 629 810 (save-excursion … … 631 812 (erase-buffer) 632 813 (insert-buffer-substring mailbuf) 814 (set-buffer-file-coding-system coding) 633 815 (goto-char (point-max)) 634 816 ;; require one newline at the end. … … 636 818 (insert ?\n)) 637 819 ;; Change header-delimiter to be what sendmail expects. 638 (goto-char (point-min)) 639 (re-search-forward 640 (concat "^" (regexp-quote mail-header-separator) "\n")) 641 (replace-match "\n") 642 (backward-char 1) 820 (goto-char (mail-header-end)) 821 (delete-region (point) (progn (end-of-line) (point))) 643 822 (setq delimline (point-marker)) 644 823 (sendmail-sync-aliases) … … 652 831 (goto-char (point-min)) 653 832 (let ((case-fold-search t)) 654 (goto-char (point-min)) 655 (while (re-search-forward "^Resent-\\(to\\|cc\\|bcc\\):" delimline t) 656 (setq resend-to-addresses 657 (save-restriction 658 (narrow-to-region (point) 659 (save-excursion 660 (end-of-line) 661 (point))) 662 (append (mail-parse-comma-list) 663 resend-to-addresses))) 664 ;; Delete Resent-BCC ourselves 665 (if (save-excursion (beginning-of-line) 666 (looking-at "resent-bcc")) 667 (delete-region (save-excursion (beginning-of-line) (point)) 668 (save-excursion (end-of-line) (1+ (point)))))) 833 ;;; (goto-char (point-min)) 834 ;;; (while (re-search-forward "^Resent-\\(to\\|cc\\|bcc\\):" delimline t) 835 ;;; (setq resend-to-addresses 836 ;;; (save-restriction 837 ;;; (narrow-to-region (point) 838 ;;; (save-excursion 839 ;;; (forward-line 1) 840 ;;; (while (looking-at "^[ \t]") 841 ;;; (forward-line 1)) 842 ;;; (point))) 843 ;;; (append (mail-parse-comma-list) 844 ;;; resend-to-addresses))) 845 ;;; ;; Delete Resent-BCC ourselves 846 ;;; (if (save-excursion (beginning-of-line) 847 ;;; (looking-at "resent-bcc")) 848 ;;; (delete-region (save-excursion (beginning-of-line) (point)) 849 ;;; (save-excursion (end-of-line) (1+ (point)))))) 669 850 ;;; Apparently this causes a duplicate Sender. 670 851 ;;; ;; If the From is different than current user, insert Sender. … … 697 878 (fullname (user-full-name)) 698 879 (quote-fullname nil)) 699 (if (string-match "[ \200-\377]" fullname)700 (setq fullname ( mail-quote-printable fullname t)880 (if (string-match "[^\0-\177]" fullname) 881 (setq fullname (rfc2047-encode-string fullname) 701 882 quote-fullname t)) 702 883 (cond ((eq mail-from-style 'angles) … … 744 925 (insert ")\n")) 745 926 ((null mail-from-style) 746 (insert "From: " login "\n"))))) 927 (insert "From: " login "\n")) 928 ((eq mail-from-style 'system-default) 929 nil) 930 (t (error "Invalid value for `mail-from-style'"))))) 931 ;; Possibly add a MIME header for the current coding system 932 (let (charset) 933 (goto-char (point-min)) 934 (and (eq mail-send-nonascii 'mime) 935 (not (re-search-forward "^MIME-version:" delimline t)) 936 (progn (skip-chars-forward "\0-\177") 937 (/= (point) (point-max))) 938 (setq selected-coding (select-message-coding-system)) 939 (setq charset 940 (coding-system-get selected-coding 'mime-charset)) 941 (goto-char delimline) 942 (insert "MIME-version: 1.0\n" 943 "Content-type: text/plain; charset=" 944 (symbol-name charset) "\n" 945 "Content-Transfer-Encoding: 8bit\n"))) 747 946 ;; Insert an extra newline if we need it to work around 748 947 ;; Sun's bug that swallows newlines. … … 765 964 \\|^resent-cc:\\|^resent-bcc:" 766 965 delimline t)) 767 (let ((default-directory "/") 768 (coding-system-for-write sendmail-coding-system)) 769 (apply 'call-process-region 770 (append (list (point-min) (point-max) 771 (if (boundp 'sendmail-program) 772 sendmail-program 773 "/usr/lib/sendmail") 774 nil errbuf nil "-oi") 775 ;; Always specify who from, 776 ;; since some systems have broken sendmails. 777 (list "-f" (user-login-name)) 778 ;;; ;; Don't say "from root" if running under su. 779 ;;; (and (equal (user-real-login-name) "root") 780 ;;; (list "-f" (user-login-name))) 781 (and mail-alias-file 782 (list (concat "-oA" mail-alias-file))) 783 (if mail-interactive 784 ;; These mean "report errors to terminal" 785 ;; and "deliver interactively" 786 '("-oep" "-odi") 787 ;; These mean "report errors by mail" 788 ;; and "deliver in background". 789 '("-oem" "-odb")) 790 ;; Get the addresses from the message 791 ;; unless this is a resend. 792 ;; We must not do that for a resend 793 ;; because we would find the original addresses. 794 ;; For a resend, include the specific addresses. 795 (or resend-to-addresses 796 '("-t"))))) 966 (let* ((default-directory "/") 967 (coding-system-for-write 968 (or selected-coding 969 (select-message-coding-system))) 970 (args 971 (append (list (point-min) (point-max) 972 program 973 nil errbuf nil "-oi") 974 (and mail-specify-envelope-from 975 (list "-f" (or mail-envelope-from 976 user-mail-address))) 977 ;;; ;; Don't say "from root" if running under su. 978 ;;; (and (equal (user-real-login-name) "root") 979 ;;; (list "-f" (user-login-name))) 980 (and mail-alias-file 981 (list (concat "-oA" mail-alias-file))) 982 (if mail-interactive 983 ;; These mean "report errors to terminal" 984 ;; and "deliver interactively" 985 '("-oep" "-odi") 986 ;; These mean "report errors by mail" 987 ;; and "deliver in background". 988 '("-oem" "-odb")) 989 ;;; ;; Get the addresses from the message 990 ;;; ;; unless this is a resend. 991 ;;; ;; We must not do that for a resend 992 ;;; ;; because we would find the original addresses. 993 ;;; ;; For a resend, include the specific addresses. 994 ;;; (or resend-to-addresses 995 '("-t") 996 ;;; ) 997 ) 998 ) 999 (exit-value (apply 'call-process-region args))) 1000 (or (null exit-value) (zerop exit-value) 1001 (error "Sending...failed with exit value %d" exit-value))) 797 1002 (or fcc-was-found 798 1003 (error "No recipients"))) … … 816 1021 (tembuf (generate-new-buffer " rmail output")) 817 1022 (case-fold-search t)) 1023 (unless (markerp header-end) 1024 (error "Value of `header-end' must be a marker")) 818 1025 (save-excursion 819 1026 (goto-char (point-min)) … … 878 1085 (if msg 879 1086 (progn 1087 ;; Append to an ordinary buffer as a 1088 ;; Unix mail message. 880 1089 (rmail-maybe-set-message-counters) 881 1090 (widen) … … 906 1115 ;; Append to the file directly, 907 1116 ;; unless we've already taken care of it. 908 (if (and (not dont-write-the-file) 909 (file-exists-p (car fcc-list)) 910 (mail-file-babyl-p (car fcc-list))) 911 ;; If the file is a Babyl file, 912 ;; convert the message to Babyl format. 913 (let ((coding-system-for-write 914 (or rmail-file-coding-system 915 'emacs-mule))) 916 (save-excursion 917 (set-buffer (get-buffer-create " mail-temp")) 918 (setq buffer-read-only nil) 919 (erase-buffer) 920 (insert "\C-l\n0, unseen,,\n*** EOOH ***\n" 921 "Date: " (mail-rfc822-date) "\n") 922 (insert-buffer-substring curbuf beg2 end) 923 (insert "\n\C-_") 924 (write-region (point-min) (point-max) (car fcc-list) t) 925 (erase-buffer))) 926 (write-region 927 (1+ (point-min)) (point-max) (car fcc-list) t)) 1117 (unless dont-write-the-file 1118 (if (and (file-exists-p (car fcc-list)) 1119 ;; Check that the file isn't empty. We don't 1120 ;; want to insert a newline at the start of an 1121 ;; empty file. 1122 (not (zerop (nth 7 (file-attributes (car fcc-list))))) 1123 (mail-file-babyl-p (car fcc-list))) 1124 ;; If the file is a Babyl file, 1125 ;; convert the message to Babyl format. 1126 (let ((coding-system-for-write 1127 (or rmail-file-coding-system 1128 'emacs-mule))) 1129 (save-excursion 1130 (set-buffer (get-buffer-create " mail-temp")) 1131 (setq buffer-read-only nil) 1132 (erase-buffer) 1133 (insert "\C-l\n0, unseen,,\n*** EOOH ***\n" 1134 "Date: " (mail-rfc822-date) "\n") 1135 (insert-buffer-substring curbuf beg2 end) 1136 (insert "\n\C-_") 1137 (write-region (point-min) (point-max) (car fcc-list) t) 1138 (erase-buffer))) 1139 (write-region 1140 (1+ (point-min)) (point-max) (car fcc-list) t))) 928 1141 (and buffer (not dont-write-the-file) 929 1142 (with-current-buffer buffer … … 936 1149 (interactive) 937 1150 (save-excursion 938 (goto-char (point-min))939 ;; find the header-separator940 (search-forward (concat "\n" mail-header-separator "\n"))941 (forward-line -1)942 1151 ;; put a marker at the end of the header 943 (let ((end ( point-marker))1152 (let ((end (copy-marker (mail-header-end))) 944 1153 (case-fold-search t) 945 1154 to-line) … … 996<
