Changeset 3024

Show
Ignore:
Timestamp:
2003年03月01日 08時26分20秒 (6 years ago)
Author:
miyoshi
Message:

* loadup.el: Add international/mw32mci.el.

* international/mw32mci.el (mw32-mci-add-notify-callback): New
function.
(mw32-mci-remove-notify-callback): Ditto.
(mw32-mci-notify-event-handler): Ditto.
(mw32-mci-handle-event): Ditto.
(special-event-map): Add mw32-mci-handle-event.
(mw32-mci-notify-func): New function.
(parse-sound): Ditto.
(play-sound): Ditto.

* mail/sendmail.el (mail-font-lock-keywords): Sync up with 21.3.50.
(mail-mode): Ditto.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • work/cvs2svn/lisp/ChangeLog.Meadow

    r3012 r3024  
     12003-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 
    1182003-02-22  MIYOSHI Masanori  <miyoshi@boreas.dti.ne.jp> 
    219 
  • work/cvs2svn/lisp/loadup.el

    r2523 r3024  
    158158      (load "dos-w32") 
    159159      (load "w32-fns") 
    160       (load "international/mw32misc"))) 
     160      (load "international/mw32misc") 
     161      (load "international/mw32mci"))) 
    161162(if (eq system-type 'ms-dos) 
    162163    (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. 
    45 
    56;; Maintainer: FSF 
     
    2930 
    3031;;; 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 "\ 
    3447*Specifies how \"From:\" fields look. 
    3548 
     
    3952        king@grassland.com (Elvis Parsley) 
    4053If `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> 
     55If `system-default', allows the mailer to insert its default From field 
     56derived from the envelope-from address. 
     57 
     58In old versions of Emacs, the `system-default' setting also caused 
     59Emacs to pass the proper email address from `user-mail-address' 
     60to the mailer to specify the envelope-from address.  But that is now 
     61controlled 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. 
     70The value used to specify it is whatever is found in 
     71`mail-envelope-from', with `user-mail-address' as fallback. 
     72 
     73On most systems, specifying the envelope-from address 
     74is 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. 
     81If this is nil while `mail-specify-envelope-from' is non-nil, the 
     82content 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 "\ 
    4589*Non-nil means insert BCC to self in messages to be sent. 
    4690This 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 "\ 
     91so 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 "\ 
    5197*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.") 
     98nil 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) 
    57107 
    58108;; Useful to set in site-init.el 
    59109;;;###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. 
     112The headers should be delimited by a line which is 
     113not a valid RFC822 header or continuation line, 
     114that matches the variable `mail-header-separator'. 
     115This 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) 
    68128 
    69129;; Set up mail-header-separator for use as a category text property. 
     
    77137 
    78138;;;###autoload 
    79 (defvar mail-archive-file-name nil "\ 
     139(defcustom mail-archive-file-name nil "\ 
    80140*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 
     141This 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 
    85147  "*Address to insert as default Reply-to field of outgoing messages. 
    86148If 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 
     149when you first send mail." 
     150  :type '(choice (const nil) string) 
     151  :group 'sendmail) 
     152 
     153;;;###autoload 
     154(defcustom mail-alias-file nil 
    91155  "*If non-nil, the name of a file to use instead of `/usr/lib/aliases'. 
    92156This file defines aliases to be expanded by the mailer; this is a different 
    93157feature 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" 
     158This 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" 
    98164  "*If non-nil, the name of the user's personal mail alias file. 
    99165This file typically should be in same format as the `.mailrc' file used by 
    100166the `Mail' or `mailx' program. 
    101 This file need not actually exist.") 
    102  
    103 (defvar mail-setup-hook nil 
     167This file need not actually exist." 
     168  :type '(choice (const nil) file) 
     169  :group 'sendmail) 
     170 
     171(defcustom mail-setup-hook nil 
    104172  "Normal hook, run each time a new outgoing mail message is initialized. 
    105 The function `mail-setup' runs this hook.") 
     173The function `mail-setup' runs this hook." 
     174  :type 'hook 
     175  :options '(fortune-to-signature spook mail-abbrevs-setup) 
     176  :group 'sendmail) 
    106177 
    107178(defvar mail-aliases t 
     
    116187  "The modification time of your mail alias file when it was last examined.") 
    117188 
    118 (defvar mail-yank-prefix nil 
     189(defcustom mail-yank-prefix nil 
    119190  "*Prefix insert on lines of yanked message being replied to. 
    120 nil means use indentation.") 
    121 (defvar mail-indentation-spaces 3 
     191nil means use indentation." 
     192  :type '(choice (const nil) string) 
     193  :group 'sendmail) 
     194 
     195(defcustom mail-indentation-spaces 3 
    122196  "*Number of spaces to insert at the beginning of each cited line. 
    123 Used by `mail-yank-original' via `mail-indent-citation'.") 
     197Used by `mail-yank-original' via `mail-indent-citation'." 
     198  :type 'integer 
     199  :group 'sendmail) 
    124200(defvar mail-yank-hooks nil 
    125201  "Obsolete hook for modifying a citation just inserted in the mail buffer. 
     
    131207It is semi-obsolete and mail agents should no longer use it.") 
    132208 
    133 (defvar mail-citation-hook nil 
     209(defcustom mail-citation-hook nil 
    134210  "*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. 
     211Each hook function can find the citation between (point) and (mark t), 
     212and should leave point and mark around the citation text as modified. 
     213The hook functions can find the header of the cited message 
     214in the variable `mail-citation-header', whether or not this is included 
     215in the cited portion of the message. 
    138216 
    139217If this hook is entirely empty (nil), a default action is taken 
    140 instead of no action.") 
     218instead 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. 
     224This enables the hook functions to see the whole message header 
     225regardless 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. 
     229It should match whatever sort of citation prefixes you want to handle, 
     230with whitespace before and after; it should also match just whitespace. 
     231The default value matches citations like `foo-bar>' plus whitespace." 
     232  :type 'regexp 
     233  :group 'sendmail 
     234  :version "20.3") 
    141235 
    142236(defvar mail-abbrevs-loaded nil) 
     
    155249 
    156250;;;###autoload 
    157 (defvar mail-signature nil 
     251(defcustom mail-signature nil 
    158252  "*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.") 
     253If t, it means to insert the contents of the file `mail-signature-file'. 
     254If 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.) 
     257Otherwise, it should be an expression; it is evaluated 
     258and 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) 
    163270 
    164271(defvar mail-reply-action nil) 
     
    168275(put 'mail-send-actions 'permanent-local t) 
    169276 
    170 (defvar mail-default-headers nil 
     277(defcustom mail-default-headers nil 
    171278  "*A string containing header lines, to be inserted in outgoing messages. 
    172279It is inserted before you edit the message, 
    173 so you can edit or delete these lines.") 
    174  
    175 (defvar mail-bury-selects-summary t 
     280so you can edit or delete these lines." 
     281  :type '(choice (const nil) string) 
     282  :group 'sendmail) 
     283 
     284(defcustom mail-bury-selects-summary t 
    176285  "*If non-nil, try to show RMAIL summary buffer after returning from mail. 
    177286The functions \\[mail-send-on-exit] or \\[mail-dont-send] select 
    178287the 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 (defvar mail-send-nonascii t 
     288is non-nil." 
     289  :type 'boolean 
     290  :group 'sendmail) 
     291 
     292(defcustom mail-send-nonascii 'mime 
    184293  "*Specify whether to allow sending non-ASCII characters in mail. 
    185294If t, that means do allow it.  nil means don't allow it. 
    186295`query' means ask the user each time. 
     296`mime' means add an appropriate MIME header if none already present. 
     297The default is `mime'. 
    187298Including non-ASCII characters in a mail message can be problematical 
    188 for the recipient, who may not know how to decode them properly.") 
     299for 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) 
    189302 
    190303;; Note: could use /usr/ucb/mail instead of sendmail; 
     
    223336  (eval-when-compile 
    224337    (let* ((cite-chars "[>|}]") 
    225            (cite-prefix "A-Za-z") 
     338           (cite-prefix "[:alpha:]") 
    226339           (cite-suffix (concat cite-prefix "0-9_.@-`'\""))) 
    227340      (list '("^\\(To\\|Newsgroups\\):" . font-lock-function-name-face) 
     
    231344            ;; Use EVAL to delay in case `mail-header-separator' gets changed. 
    232345            '(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))) 
    235350            ;; Use MATCH-ANCHORED to effectively anchor the regexp left side. 
    236351            `(,cite-chars 
     
    240355                        "\\(.*\\)") 
    241356               (beginning-of-line) (end-of-line) 
    242                (2 font-lock-reference-face nil t) 
     357               (2 font-lock-constant-face nil t) 
    243358               (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]+.*\\)*$
    245360              . font-lock-string-face)))) 
    246361  "Additional expressions to highlight in Mail mode.") 
    247362 
    248 (defvar mail-send-hook nil 
    249   "Normal hook run before sending mail, in Mail mode.") 
    250363  
    251364(defun sendmail-sync-aliases () 
     
    266379  ;; Don't leave this around from a previous message. 
    267380  (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) 
    269384  (if current-input-method 
    270385      (inactivate-input-method)) 
     
    281396              (address-start (point))) 
    282397          (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))) 
    284402      (newline)) 
    285403    (if cc 
     
    287405              (address-start (progn (insert "CC: ") (point)))) 
    288406          (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)))) 
    290411    (if in-reply-to 
    291         (let ((fill-prefix "\t") 
     412       (let ((fill-prefix "\t") 
    292413              (fill-column 78) 
    293414              (address-start (point))) 
    294415          (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)))) 
    296420    (insert "Subject: " (or subject "") "\n") 
    297421    (if mail-default-headers 
     
    315439                 (insert "\n\n-- \n") 
    316440                 (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))) 
    319445    (goto-char (point-max)) 
    320446    (or (bolp) (newline))) 
     
    324450  (run-hooks 'mail-setup-hook)) 
    325451  
     452(defcustom mail-mode-hook nil 
     453  "Hook run by Mail mode." 
     454  :group 'sendmail 
     455  :type 'hook 
     456  :options '(footnote-mode)) 
     457 
    326458;;;###autoload 
    327459(defun mail-mode () 
    328460  "Major mode for editing mail to be sent. 
    329461Like 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 
     463Here 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). 
     472Turning on Mail mode runs the normal hooks `text-mode-hook' and 
     473`mail-mode-hook' (in that order)." 
    340474  (interactive) 
    341475  (kill-all-local-variables) 
     
    349483  (setq buffer-offer-save t) 
    350484  (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)) 
    352486  (make-local-variable 'paragraph-separate) 
    353487  (make-local-variable 'paragraph-start) 
     
    356490  (make-local-variable 'fill-paragraph-function) 
    357491  (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) 
    358495  (make-local-variable 'adaptive-fill-regexp) 
    359496  (setq adaptive-fill-regexp 
    360         (concat "[ \t]*[-a-z0-9A-Z]*>+[ \t]*\\|" adaptive-fill-regexp)) 
     497        (concat "[ \t]*[-[:alnum:]]+>+[ \t]*\\|" 
     498                adaptive-fill-regexp)) 
    361499  (make-local-variable 'adaptive-fill-first-line-regexp) 
    362500  (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)) 
    364503  ;; `-- ' precedes the signature.  `-----' appears at the start of the 
    365504  ;; lines that delimit forwarded messages. 
     
    367506  ;; are also sometimes used and should be separators. 
    368507  (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                                "-- $\\|---+$\\|" 
    370511                                page-delimiter)) 
    371512  (setq paragraph-separate paragraph-start) 
    372513  (run-hooks 'text-mode-hook 'mail-mode-hook)) 
    373514 
     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. 
     535Concretely: 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. 
     542Leave point at the start of the delimiter line." 
     543  (rfc822-goto-eoh) 
     544  (delete-region (point) (progn (end-of-line) (point)))) 
     545 
    374546(defun mail-mode-auto-fill () 
    375547  "Carry out Auto Fill for Mail mode. 
    376548If 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)) 
    385550      (let ((old-line-start (save-excursion (beginning-of-line) (point)))) 
    386551        (if (do-auto-fill) 
     
    397562(defun mail-mode-fill-paragraph (arg) 
    398563  ;; 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)) 
    407565      (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))) 
    410568        (setq fieldname 
    411               (downcase (buffer-substring beg (1- (match-end 0))))) 
     569               (downcase (buffer-substring beg (1- (match-end 0)))))) 
    412570        (forward-line 1) 
    413571        ;; Find continuation lines and get rid of their continuation markers. 
     
    533691    (bury-buffer (current-buffer)) 
    534692    (if (and (or (window-dedicated-p (frame-selected-window)) 
    535                  (assq 'mail-dedicated-frame (frame-parameters))) 
     693                 (cdr (assq 'mail-dedicated-frame (frame-parameters)))) 
    536694             (not (null (delq (selected-frame) (visible-frame-list))))) 
    537695        (delete-frame (selected-frame)) 
     
    555713          (switch-to-buffer newbuf)))))) 
    556714 
     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 
    557721(defun mail-send () 
    558722  "Send the message in the current buffer. 
     
    568732      (let ((inhibit-read-only t) 
    569733            (opoint (point))) 
    570         (when (and enable-multibyte-characters 
    571                    (not (eq mail-send-nonascii t))) 
     734        (unless (memq mail-send-nonascii '(t mime)) 
    572735          (goto-char (point-min)) 
    573736          (skip-chars-forward "\0-\177") 
     
    579742        ;; Complain about any invalid line. 
    580743        (goto-char (point-min)) 
    581         (while (not (looking-at (regexp-quote mail-header-separator))) 
     744        (while (< (point) (mail-header-end)) 
    582745          (unless (looking-at "[ \t]\\|.*:\\|$") 
    583746            (push-mark opoint) 
     
    596759          (setq mail-send-actions (cdr mail-send-actions))) 
    597760        (message "Sending...done") 
    598         ;; If buffer has no file, mark it as unmodified and delete autosave. 
     761        ;; If buffer has no file, mark it as unmodified and delete auto-save. 
    599762        (if (not buffer-file-name) 
    600763            (progn 
     
    607770;;;###autoload 
    608771(defvar sendmail-coding-system nil 
    609   "Coding system to which to encode the mail.") 
     772  "*Coding system for encoding the outgoing mail. 
     773This has higher priority than `default-buffer-file-coding-system' 
     774and `default-sendmail-coding-system', 
     775but lower priority than the local value of `buffer-file-coding-system'. 
     776See 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. 
     781This variable is used only when `sendmail-coding-system' is nil. 
     782 
     783This variable is set/changed by the command set-language-environment. 
     784User should not set this variable manually, 
     785instead use sendmail-coding-system to get a constant encoding 
     786of outgoing mails regardless of the current language environment. 
     787See also the function `select-message-coding-system'.") 
    610788 
    611789(defun sendmail-send-it () 
     790  "Send the current mail buffer using the Sendmail package. 
     791This is a suitable value for `send-mail-function'.  It sends using the 
     792external program defined by `sendmail-program'." 
    612793  (require 'mail-utils) 
    613794  (let ((errbuf (if mail-interactive 
     
    616797        (tembuf (generate-new-buffer " sendmail temp")) 
    617798        (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 
    619803        delimline 
    620804        fcc-was-found 
    621805        (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"))) 
    628809    (unwind-protect 
    629810        (save-excursion 
     
    631812          (erase-buffer) 
    632813          (insert-buffer-substring mailbuf) 
     814          (set-buffer-file-coding-system coding) 
    633815          (goto-char (point-max)) 
    634816          ;; require one newline at the end. 
     
    636818              (insert ?\n)) 
    637819          ;; 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))) 
    643822          (setq delimline (point-marker)) 
    644823          (sendmail-sync-aliases) 
     
    652831          (goto-char (point-min)) 
    653832          (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)))))) 
    669850;;; Apparently this causes a duplicate Sender. 
    670851;;;         ;; If the From is different than current user, insert Sender. 
     
    697878                       (fullname (user-full-name)) 
    698879                       (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
    701882                            quote-fullname t)) 
    702883                  (cond ((eq mail-from-style 'angles) 
     
    744925                         (insert ")\n")) 
    745926                        ((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"))) 
    747946            ;; Insert an extra newline if we need it to work around 
    748947            ;; Sun's bug that swallows newlines. 
     
    765964\\|^resent-cc:\\|^resent-bcc:" 
    766965                                   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))) 
    7971002            (or fcc-was-found 
    7981003                (error "No recipients"))) 
     
    8161021        (tembuf (generate-new-buffer " rmail output")) 
    8171022        (case-fold-search t)) 
     1023    (unless (markerp header-end) 
     1024      (error "Value of `header-end' must be a marker")) 
    8181025    (save-excursion 
    8191026      (goto-char (point-min)) 
     
    8781085                        (if msg 
    8791086                            (progn 
     1087                              ;; Append to an ordinary buffer as a 
     1088                              ;; Unix mail message. 
    8801089                              (rmail-maybe-set-message-counters) 
    8811090                              (widen) 
     
    9061115          ;; Append to the file directly, 
    9071116          ;; 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))) 
    9281141          (and buffer (not dont-write-the-file) 
    9291142               (with-current-buffer buffer 
     
    9361149  (interactive) 
    9371150  (save-excursion 
    938     (goto-char (point-min)) 
    939     ;; find the header-separator 
    940     (search-forward (concat "\n" mail-header-separator "\n")) 
    941     (forward-line -1) 
    9421151    ;; put a marker at the end of the header 
    943     (let ((end (point-marker)) 
     1152    (let ((end (copy-marker (mail-header-end))) 
    9441153          (case-fold-search t) 
    9451154          to-line) 
     
    996<