/[emacs]/emacs/lisp/mail/sendmail.el
ViewVC logotype

Diff of /emacs/lisp/mail/sendmail.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.296 by cyd, Tue Nov 29 23:54:47 2005 UTC revision 1.297 by monnier, Mon Dec 5 17:07:54 2005 UTC
# Line 49  Line 49 
49    :version "22.1")    :version "22.1")
50    
51  ;;;###autoload  ;;;###autoload
52  (defcustom mail-from-style 'angles "\  (defcustom mail-from-style 'angles
53  *Specifies how \"From:\" fields look.    "Specifies how \"From:\" fields look.
54    
55  If `nil', they contain just the return address like:  If `nil', they contain just the return address like:
56          king@grassland.com          king@grassland.com
# Line 72  controlled by a separate variable, `mail Line 72  controlled by a separate variable, `mail
72    
73  ;;;###autoload  ;;;###autoload
74  (defcustom mail-specify-envelope-from nil  (defcustom mail-specify-envelope-from nil
75    "*If non-nil, specify the envelope-from address when sending mail.    "If non-nil, specify the envelope-from address when sending mail.
76  The value used to specify it is whatever is found in  The value used to specify it is whatever is found in
77  the variable `mail-envelope-from', with `user-mail-address' as fallback.  the variable `mail-envelope-from', with `user-mail-address' as fallback.
78    
# Line 85  variable `feedmail-deduce-envelope-from' Line 85  variable `feedmail-deduce-envelope-from'
85    :group 'sendmail)    :group 'sendmail)
86    
87  (defcustom mail-envelope-from nil  (defcustom mail-envelope-from nil
88    "*If non-nil, designate the envelope-from address when sending mail.    "If non-nil, designate the envelope-from address when sending mail.
89  This only has an effect if `mail-specify-envelope-from' is non-nil.  This only has an effect if `mail-specify-envelope-from' is non-nil.
90  The value should be either a string, or the symbol `header' (in  The value should be either a string, or the symbol `header' (in
91  which case the contents of the \"From\" header of the message  which case the contents of the \"From\" header of the message
# Line 98  being sent is used), or nil (in which ca Line 98  being sent is used), or nil (in which ca
98    :group 'sendmail)    :group 'sendmail)
99    
100  ;;;###autoload  ;;;###autoload
101  (defcustom mail-self-blind nil "\  (defcustom mail-self-blind nil
102  *Non-nil means insert BCC to self in messages to be sent.    "Non-nil means insert BCC to self in messages to be sent.
103  This is done when the message is initialized,  This is done when the message is initialized,
104  so you can remove or alter the BCC field to override the default."  so you can remove or alter the BCC field to override the default."
105    :type 'boolean    :type 'boolean
106    :group 'sendmail)    :group 'sendmail)
107    
108  ;;;###autoload  ;;;###autoload
109  (defcustom mail-interactive nil "\  (defcustom mail-interactive nil
110  *Non-nil means when sending a message wait for and display errors.    "Non-nil means when sending a message wait for and display errors.
111  nil means let mailer mail back a message to report errors."  nil means let mailer mail back a message to report errors."
112    :type 'boolean    :type 'boolean
113    :group 'sendmail)    :group 'sendmail)
114    
115  ;;;###autoload  ;;;###autoload
116  (defcustom mail-yank-ignored-headers "^via:\\|^mail-from:\\|^origin:\\|^status:\\|^remailed\\|^received:\\|^message-id:\\|^summary-line:\\|^to:\\|^subject:\\|^in-reply-to:\\|^return-path:\\|^mail-reply-to:\\|^mail-followup-to:" "\  (defcustom mail-yank-ignored-headers
117  *Delete these headers from old message when it's inserted in a reply."    (concat "^"
118              (regexp-opt '("via" "mail-from" "origin" "status" "remailed"
119                            "received" "message-id" "summary-line" "to" "subject"
120                            "in-reply-to" "return-path" "mail-reply-to"
121                            "mail-followup-to") "\\(?:")
122              ":")
123      "Delete these headers from old message when it's inserted in a reply."
124    :type 'regexp    :type 'regexp
125    :group 'sendmail)    :group 'sendmail)
126    
127  ;; Useful to set in site-init.el  ;; Useful to set in site-init.el
128  ;;;###autoload  ;;;###autoload
129  (defcustom send-mail-function  (defcustom send-mail-function
130    (if (and window-system (memq system-type '(darwin windows-nt)))    (if (and window-system (memq system-type '(darwin windows-nt)))
131        'mailclient-send-it        'mailclient-send-it
132      'sendmail-send-it)      'sendmail-send-it)
# Line 138  This is used by the default mail-sending Line 144  This is used by the default mail-sending
144    :group 'sendmail)    :group 'sendmail)
145    
146  ;;;###autoload  ;;;###autoload
147  (defcustom mail-header-separator "--text follows this line--" "\  (defcustom mail-header-separator "--text follows this line--"
148  *Line used to separate headers from text in messages being composed."    "Line used to separate headers from text in messages being composed."
149    :type 'string    :type 'string
150    :group 'sendmail)    :group 'sendmail)
151    
152  ;; Set up mail-header-separator for use as a category text property.  ;; Set up mail-header-separator for use as a category text property.
153  (put 'mail-header-separator 'rear-nonsticky '(category))  (put 'mail-header-separator 'rear-nonsticky '(category))
154  ;;; This was a nice idea, for preventing accidental modification of  ;; This was a nice idea, for preventing accidental modification of
155  ;;; the separator.   But I found it also prevented or obstructed  ;; the separator.   But I found it also prevented or obstructed
156  ;;; certain deliberate operations, such as copying the separator line  ;; certain deliberate operations, such as copying the separator line
157  ;;; up to the top to send myself a copy of an already sent outgoing message  ;; up to the top to send myself a copy of an already sent outgoing message
158  ;;; and other things.  So I turned it off.  --rms.  ;; and other things.  So I turned it off.  --rms.
159  ;;;(put 'mail-header-separator 'read-only t)  ;;(put 'mail-header-separator 'read-only t)
160    
161  ;;;###autoload  ;;;###autoload
162  (defcustom mail-archive-file-name nil "\  (defcustom mail-archive-file-name nil
163  *Name of file to write all outgoing messages in, or nil for none.    "Name of file to write all outgoing messages in, or nil for none.
164  This can be an inbox file or an Rmail file."  This can be an inbox file or an Rmail file."
165    :type '(choice file (const nil))    :type '(choice file (const nil))
166    :group 'sendmail)    :group 'sendmail)
167    
168  ;;;###autoload  ;;;###autoload
169  (defcustom mail-default-reply-to nil  (defcustom mail-default-reply-to nil
170    "*Address to insert as default Reply-to field of outgoing messages.    "Address to insert as default Reply-to field of outgoing messages.
171  If nil, it will be initialized from the REPLYTO environment variable  If nil, it will be initialized from the REPLYTO environment variable
172  when you first send mail."  when you first send mail."
173    :type '(choice (const nil) string)    :type '(choice (const nil) string)
# Line 169  when you first send mail." Line 175  when you first send mail."
175    
176  ;;;###autoload  ;;;###autoload
177  (defcustom mail-alias-file nil  (defcustom mail-alias-file nil
178    "*If non-nil, the name of a file to use instead of `/usr/lib/aliases'.    "If non-nil, the name of a file to use instead of `/usr/lib/aliases'.
179  This file defines aliases to be expanded by the mailer; this is a different  This file defines aliases to be expanded by the mailer; this is a different
180  feature from that of defining aliases in `.mailrc' to be expanded in Emacs.  feature from that of defining aliases in `.mailrc' to be expanded in Emacs.
181  This variable has no effect unless your system uses sendmail as its mailer."  This variable has no effect unless your system uses sendmail as its mailer."
# Line 178  This variable has no effect unless your Line 184  This variable has no effect unless your
184    
185  ;;;###autoload  ;;;###autoload
186  (defcustom mail-personal-alias-file "~/.mailrc"  (defcustom mail-personal-alias-file "~/.mailrc"
187    "*If non-nil, the name of the user's personal mail alias file.    "If non-nil, the name of the user's personal mail alias file.
188  This file typically should be in same format as the `.mailrc' file used by  This file typically should be in same format as the `.mailrc' file used by
189  the `Mail' or `mailx' program.  the `Mail' or `mailx' program.
190  This file need not actually exist."  This file need not actually exist."
# Line 207  The alias definitions in the file have t Line 213  The alias definitions in the file have t
213    
214  ;;;###autoload  ;;;###autoload
215  (defcustom mail-yank-prefix nil  (defcustom mail-yank-prefix nil
216    "*Prefix insert on lines of yanked message being replied to.    "Prefix insert on lines of yanked message being replied to.
217  nil means use indentation."  nil means use indentation."
218    :type '(choice (const nil) string)    :type '(choice (const nil) string)
219    :group 'sendmail)    :group 'sendmail)
220    
221  ;;;###autoload  ;;;###autoload
222  (defcustom mail-indentation-spaces 3  (defcustom mail-indentation-spaces 3
223    "*Number of spaces to insert at the beginning of each cited line.    "Number of spaces to insert at the beginning of each cited line.
224  Used by `mail-yank-original' via `mail-indent-citation'."  Used by `mail-yank-original' via `mail-indent-citation'."
225    :type 'integer    :type 'integer
226    :group 'sendmail)    :group 'sendmail)
# Line 230  It is semi-obsolete and mail agents shou Line 236  It is semi-obsolete and mail agents shou
236    
237  ;;;###autoload  ;;;###autoload
238  (defcustom mail-citation-hook nil  (defcustom mail-citation-hook nil
239    "*Hook for modifying a citation just inserted in the mail buffer.    "Hook for modifying a citation just inserted in the mail buffer.
240  Each hook function can find the citation between (point) and (mark t),  Each hook function can find the citation between (point) and (mark t),
241  and should leave point and mark around the citation text as modified.  and should leave point and mark around the citation text as modified.
242  The hook functions can find the header of the cited message  The hook functions can find the header of the cited message
# Line 249  regardless of what part of it (if any) i Line 255  regardless of what part of it (if any) i
255    
256  ;;;###autoload  ;;;###autoload
257  (defcustom mail-citation-prefix-regexp "[ \t]*[-a-z0-9A-Z]*>+[ \t]*\\|[ \t]*"  (defcustom mail-citation-prefix-regexp "[ \t]*[-a-z0-9A-Z]*>+[ \t]*\\|[ \t]*"
258    "*Regular expression to match a citation prefix plus whitespace.    "Regular expression to match a citation prefix plus whitespace.
259  It should match whatever sort of citation prefixes you want to handle,  It should match whatever sort of citation prefixes you want to handle,
260  with whitespace before and after; it should also match just whitespace.  with whitespace before and after; it should also match just whitespace.
261  The default value matches citations like `foo-bar>' plus whitespace."  The default value matches citations like `foo-bar>' plus whitespace."
# Line 258  The default value matches citations like Line 264  The default value matches citations like
264    :version "20.3")    :version "20.3")
265    
266  (defvar mail-abbrevs-loaded nil)  (defvar mail-abbrevs-loaded nil)
267  (defvar mail-mode-map nil)  (defvar mail-mode-map
268      (let ((map (make-sparse-keymap)))
269        (define-key map "\M-\t" 'mail-complete)
270        (define-key map "\C-c?" 'describe-mode)
271        (define-key map "\C-c\C-f\C-t" 'mail-to)
272        (define-key map "\C-c\C-f\C-b" 'mail-bcc)
273        (define-key map "\C-c\C-f\C-f" 'mail-fcc)
274        (define-key map "\C-c\C-f\C-c" 'mail-cc)
275        (define-key map "\C-c\C-f\C-s" 'mail-subject)
276        (define-key map "\C-c\C-f\C-r" 'mail-reply-to)
277        (define-key map "\C-c\C-f\C-a" 'mail-mail-reply-to)    ; author
278        (define-key map "\C-c\C-f\C-l" 'mail-mail-followup-to) ; list
279        (define-key map "\C-c\C-t" 'mail-text)
280        (define-key map "\C-c\C-y" 'mail-yank-original)
281        (define-key map "\C-c\C-r" 'mail-yank-region)
282        (define-key map [remap split-line] 'mail-split-line)
283        (define-key map "\C-c\C-q" 'mail-fill-yanked-message)
284        (define-key map "\C-c\C-w" 'mail-signature)
285        (define-key map "\C-c\C-v" 'mail-sent-via)
286        (define-key map "\C-c\C-c" 'mail-send-and-exit)
287        (define-key map "\C-c\C-s" 'mail-send)
288        (define-key map "\C-c\C-i" 'mail-attach-file)
289    
290        (define-key map [menu-bar mail]
291          (cons "Mail" (make-sparse-keymap "Mail")))
292    
293        (define-key map [menu-bar mail fill]
294          '("Fill Citation" . mail-fill-yanked-message))
295    
296        (define-key map [menu-bar mail yank]
297          '("Cite Original" . mail-yank-original))
298    
299        (define-key map [menu-bar mail signature]
300          '("Insert Signature" . mail-signature))
301    
302        (define-key map [menu-bar mail mail-sep]
303          '("--"))
304    
305        (define-key map [menu-bar mail cancel]
306          '("Cancel" . mail-dont-send))
307    
308        (define-key map [menu-bar mail send-stay]
309          '("Send, Keep Editing" . mail-send))
310    
311        (define-key map [menu-bar mail send]
312          '("Send Message" . mail-send-and-exit))
313    
314        (define-key map [menu-bar headers]
315          (cons "Headers" (make-sparse-keymap "Move to Header")))
316    
317        (define-key map [menu-bar headers text]
318          '("Text" . mail-text))
319    
320        (define-key map [menu-bar headers expand-aliases]
321          '("Expand Aliases" . expand-mail-aliases))
322    
323        (define-key map [menu-bar headers sent-via]
324          '("Sent Via" . mail-sent-via))
325    
326        (define-key map [menu-bar headers mail-reply-to]
327          '("Mail Reply To" . mail-mail-reply-to))
328    
329        (define-key map [menu-bar headers mail-followup-to]
330          '("Mail Followup To" . mail-mail-followup-to))
331    
332        (define-key map [menu-bar headers reply-to]
333          '("Reply-To" . mail-reply-to))
334    
335        (define-key map [menu-bar headers bcc]
336          '("Bcc" . mail-bcc))
337    
338        (define-key map [menu-bar headers fcc]
339          '("Fcc" . mail-fcc))
340    
341        (define-key map [menu-bar headers cc]
342          '("Cc" . mail-cc))
343    
344        (define-key map [menu-bar headers subject]
345          '("Subject" . mail-subject))
346    
347        (define-key map [menu-bar headers to]
348          '("To" . mail-to))
349    
350        map))
351    
352  (autoload 'build-mail-aliases "mailalias"  (autoload 'build-mail-aliases "mailalias"
353    "Read mail aliases from user's personal aliases file and set `mail-aliases'."    "Read mail aliases from user's personal aliases file and set `mail-aliases'."
# Line 273  removed from alias expansions." Line 362  removed from alias expansions."
362    
363  ;;;###autoload  ;;;###autoload
364  (defcustom mail-signature nil  (defcustom mail-signature nil
365    "*Text inserted at end of mail buffer when a message is initialized.    "Text inserted at end of mail buffer when a message is initialized.
366  If t, it means to insert the contents of the file `mail-signature-file'.  If t, it means to insert the contents of the file `mail-signature-file'.
367  If a string, that string is inserted.  If a string, that string is inserted.
368   (To make a proper signature, the string should begin with \\n\\n-- \\n,   (To make a proper signature, the string should begin with \\n\\n-- \\n,
# Line 289  and should insert whatever you want to i Line 378  and should insert whatever you want to i
378    
379  ;;;###autoload  ;;;###autoload
380  (defcustom mail-signature-file "~/.signature"  (defcustom mail-signature-file "~/.signature"
381    "*File containing the text inserted at end of mail buffer."    "File containing the text inserted at end of mail buffer."
382    :type 'file    :type 'file
383    :group 'sendmail)    :group 'sendmail)
384    
385  ;;;###autoload  ;;;###autoload
386  (defcustom mail-default-directory "~/"  (defcustom mail-default-directory "~/"
387    "*Directory for mail buffers.    "Directory for mail buffers.
388  Value of `default-directory' for mail buffers.  Value of `default-directory' for mail buffers.
389  This directory is used for auto-save files of mail buffers."  This directory is used for auto-save files of mail buffers."
390    :type '(directory :tag "Directory")    :type '(directory :tag "Directory")
# Line 310  This directory is used for auto-save fil Line 399  This directory is used for auto-save fil
399    
400  ;;;###autoload  ;;;###autoload
401  (defcustom mail-default-headers nil  (defcustom mail-default-headers nil
402    "*A string containing header lines, to be inserted in outgoing messages.    "A string containing header lines, to be inserted in outgoing messages.
403  It is inserted before you edit the message,  It is inserted before you edit the message,
404  so you can edit or delete these lines."  so you can edit or delete these lines."
405    :type '(choice (const nil) string)    :type '(choice (const nil) string)
# Line 318  so you can edit or delete these lines." Line 407  so you can edit or delete these lines."
407    
408  ;;;###autoload  ;;;###autoload
409  (defcustom mail-bury-selects-summary t  (defcustom mail-bury-selects-summary t
410    "*If non-nil, try to show RMAIL summary buffer after returning from mail.    "If non-nil, try to show RMAIL summary buffer after returning from mail.
411  The functions \\[mail-send-on-exit] or \\[mail-dont-send] select  The functions \\[mail-send-on-exit] or \\[mail-dont-send] select
412  the RMAIL summary buffer before returning, if it exists and this variable  the RMAIL summary buffer before returning, if it exists and this variable
413  is non-nil."  is non-nil."
# Line 327  is non-nil." Line 416  is non-nil."
416    
417  ;;;###autoload  ;;;###autoload
418  (defcustom mail-send-nonascii 'mime  (defcustom mail-send-nonascii 'mime
419    "*Specify whether to allow sending non-ASCII characters in mail.    "Specify whether to allow sending non-ASCII characters in mail.
420  If t, that means do allow it.  nil means don't allow it.  If t, that means do allow it.  nil means don't allow it.
421  `query' means ask the user each time.  `query' means ask the user each time.
422  `mime' means add an appropriate MIME header if none already present.  `mime' means add an appropriate MIME header if none already present.
# Line 338  for the recipient, who may not know how Line 427  for the recipient, who may not know how
427    :group 'sendmail)    :group 'sendmail)
428    
429  (defcustom mail-use-dsn nil  (defcustom mail-use-dsn nil
430    "*Ask MTA for notification of failed, delayed or successful delivery.    "Ask MTA for notification of failed, delayed or successful delivery.
431  Note that only some MTAs (currently only recent versions of Sendmail)  Note that only some MTAs (currently only recent versions of Sendmail)
432  support Delivery Status Notification."  support Delivery Status Notification."
433    :group 'sendmail    :group 'sendmail
# Line 352  support Delivery Status Notification." Line 441  support Delivery Status Notification."
441  (defvar mail-mailer-swallows-blank-line  (defvar mail-mailer-swallows-blank-line
442    (if (and (string-match "sparc-sun-sunos\\(\\'\\|[^5]\\)" system-configuration)    (if (and (string-match "sparc-sun-sunos\\(\\'\\|[^5]\\)" system-configuration)
443             (file-readable-p "/etc/sendmail.cf")             (file-readable-p "/etc/sendmail.cf")
444             (let ((buffer (get-buffer-create " *temp*")))             (with-temp-buffer
445               (unwind-protect               (insert-file-contents "/etc/sendmail.cf")
446                   (save-excursion               (goto-char (point-min))
447                     (set-buffer buffer)               (let ((case-fold-search nil))
448                     (insert-file-contents "/etc/sendmail.cf")                 (re-search-forward "^OR\\>" nil t))))
                    (goto-char (point-min))  
                    (let ((case-fold-search nil))  
                      (re-search-forward "^OR\\>" nil t)))  
                (kill-buffer buffer))))  
449        ;; According to RFC822, "The field-name must be composed of printable        ;; According to RFC822, "The field-name must be composed of printable
450        ;; ASCII characters (i.e. characters that have decimal values between        ;; ASCII characters (i.e. characters that have decimal values between
451        ;; 33 and 126, except colon)", i.e. any chars except ctl chars,        ;; 33 and 126, except colon)", i.e. any chars except ctl chars,
# Line 632  If within the headers, this makes the ne Line 717  If within the headers, this makes the ne
717              (while (search-forward "," end t)              (while (search-forward "," end t)
718                (or (looking-at "[ \t]")                (or (looking-at "[ \t]")
719                    (insert " "))))                    (insert " "))))
720          (fill-region-as-paragraph beg end)          (fill-region-as-paragraph beg end arg)
721          ;; Mark all lines except the first as continuations.          ;; Mark all lines except the first as continuations.
722          (goto-char beg)          (goto-char beg)
723          (forward-line 1)          (forward-line 1)
# Line 642  If within the headers, this makes the ne Line 727  If within the headers, this makes the ne
727          (move-marker end nil)          (move-marker end nil)
728          t)))          t)))
729    
 ;;; Set up keymap.  
   
 (if mail-mode-map  
     nil  
   (setq mail-mode-map (make-sparse-keymap))  
   (define-key mail-mode-map "\M-\t" 'mail-complete)  
   (define-key mail-mode-map "\C-c?" 'describe-mode)  
   (define-key mail-mode-map "\C-c\C-f\C-t" 'mail-to)  
   (define-key mail-mode-map "\C-c\C-f\C-b" 'mail-bcc)  
   (define-key mail-mode-map "\C-c\C-f\C-f" 'mail-fcc)  
   (define-key mail-mode-map "\C-c\C-f\C-c" 'mail-cc)  
   (define-key mail-mode-map "\C-c\C-f\C-s" 'mail-subject)  
   (define-key mail-mode-map "\C-c\C-f\C-r" 'mail-reply-to)  
   (define-key mail-mode-map "\C-c\C-f\C-a" 'mail-mail-reply-to) ; author  
   (define-key mail-mode-map "\C-c\C-f\C-l" 'mail-mail-followup-to) ; list  
   (define-key mail-mode-map "\C-c\C-t" 'mail-text)  
   (define-key mail-mode-map "\C-c\C-y" 'mail-yank-original)  
   (define-key mail-mode-map "\C-c\C-r" 'mail-yank-region)  
   (define-key mail-mode-map [remap split-line] 'mail-split-line)  
   (define-key mail-mode-map "\C-c\C-q" 'mail-fill-yanked-message)  
   (define-key mail-mode-map "\C-c\C-w" 'mail-signature)  
   (define-key mail-mode-map "\C-c\C-v" 'mail-sent-via)  
   (define-key mail-mode-map "\C-c\C-c" 'mail-send-and-exit)  
   (define-key mail-mode-map "\C-c\C-s" 'mail-send)  
   (define-key mail-mode-map "\C-c\C-i" 'mail-attach-file))  
   
 (define-key mail-mode-map [menu-bar mail]  
   (cons "Mail" (make-sparse-keymap "Mail")))  
   
 (define-key mail-mode-map [menu-bar mail fill]  
   '("Fill Citation" . mail-fill-yanked-message))  
   
 (define-key mail-mode-map [menu-bar mail yank]  
   '("Cite Original" . mail-yank-original))  
   
 (define-key mail-mode-map [menu-bar mail signature]  
   '("Insert Signature" . mail-signature))  
   
 (define-key mail-mode-map [menu-bar mail mail-sep]  
   '("--"))  
   
 (define-key mail-mode-map [menu-bar mail cancel]  
   '("Cancel" . mail-dont-send))  
   
 (define-key mail-mode-map [menu-bar mail send-stay]  
   '("Send, Keep Editing" . mail-send))  
   
 (define-key mail-mode-map [menu-bar mail send]  
   '("Send Message" . mail-send-and-exit))  
   
 (define-key mail-mode-map [menu-bar headers]  
   (cons "Headers" (make-sparse-keymap "Move to Header")))  
   
 (define-key mail-mode-map [menu-bar headers text]  
   '("Text" . mail-text))  
   
 (define-key mail-mode-map [menu-bar headers expand-aliases]  
   '("Expand Aliases" . expand-mail-aliases))  
   
 (define-key mail-mode-map [menu-bar headers sent-via]  
   '("Sent Via" . mail-sent-via))  
   
 (define-key mail-mode-map [menu-bar headers mail-reply-to]  
   '("Mail Reply To" . mail-mail-reply-to))  
   
 (define-key mail-mode-map [menu-bar headers mail-followup-to]  
   '("Mail Followup To" . mail-mail-followup-to))  
   
 (define-key mail-mode-map [menu-bar headers reply-to]  
   '("Reply-To" . mail-reply-to))  
   
 (define-key mail-mode-map [menu-bar headers bcc]  
   '("Bcc" . mail-bcc))  
   
 (define-key mail-mode-map [menu-bar headers fcc]  
   '("Fcc" . mail-fcc))  
   
 (define-key mail-mode-map [menu-bar headers cc]  
   '("Cc" . mail-cc))  
   
 (define-key mail-mode-map [menu-bar headers subject]  
   '("Subject" . mail-subject))  
   
 (define-key mail-mode-map [menu-bar headers to]  
   '("To" . mail-to))  
   
730  ;; User-level commands for sending.  ;; User-level commands for sending.
731    
732  (defun mail-send-and-exit (&optional arg)  (defun mail-send-and-exit (&optional arg)
# Line 759  Prefix arg means don't delete this windo Line 758  Prefix arg means don't delete this windo
758        (let (rmail-flag summary-buffer)        (let (rmail-flag summary-buffer)
759          (and (not arg)          (and (not arg)
760               (not (one-window-p))               (not (one-window-p))
761               (save-excursion               (with-current-buffer
762                 (set-buffer (window-buffer (next-window (selected-window) 'not)))                   (window-buffer (next-window (selected-window) 'not))
763                 (setq rmail-flag (eq major-mode 'rmail-mode))                 (setq rmail-flag (eq major-mode 'rmail-mode))
764                 (setq summary-buffer                 (setq summary-buffer
765                       (and mail-bury-selects-summary                       (and mail-bury-selects-summary
# Line 987  external program defined by `sendmail-pr Line 986  external program defined by `sendmail-pr
986           (and mail-specify-envelope-from           (and mail-specify-envelope-from
987                (or (mail-envelope-from) user-mail-address))))                (or (mail-envelope-from) user-mail-address))))
988      (unwind-protect      (unwind-protect
989          (save-excursion          (with-current-buffer tembuf
           (set-buffer tembuf)  
990            (erase-buffer)            (erase-buffer)
991            (unless multibyte            (unless multibyte
992              (set-buffer-multibyte nil))              (set-buffer-multibyte nil))
# Line 1086  external program defined by `sendmail-pr Line 1084  external program defined by `sendmail-pr
1084                    (setq fcc-was-found t)                    (setq fcc-was-found t)
1085                    (mail-do-fcc delimline)))                    (mail-do-fcc delimline)))
1086              (if mail-interactive              (if mail-interactive
1087                  (save-excursion                  (with-current-buffer errbuf
                   (set-buffer errbuf)  
1088                    (erase-buffer))))                    (erase-buffer))))
1089            (goto-char (point-min))            (goto-char (point-min))
1090            (if (let ((case-fold-search t))            (if (let ((case-fold-search t))
# Line 1133  external program defined by `sendmail-pr Line 1130  external program defined by `sendmail-pr
1130              (or fcc-was-found              (or fcc-was-found
1131                  (error "No recipients")))                  (error "No recipients")))
1132            (if mail-interactive            (if mail-interactive
1133                (save-excursion                (with-current-buffer errbuf
                 (set-buffer errbuf)  
1134                  (goto-char (point-min))                  (goto-char (point-min))
1135                  (while (re-search-forward "\n\n* *" nil t)                  (while (re-search-forward "\n\n* *" nil t)
1136                    (replace-match "; "))                    (replace-match "; "))
# Line 1146  external program defined by `sendmail-pr Line 1142  external program defined by `sendmail-pr
1142            (kill-buffer errbuf)))))            (kill-buffer errbuf)))))
1143    
1144  (defun mail-do-fcc (header-end)  (defun mail-do-fcc (header-end)
1145      (unless (markerp header-end)
1146        (error "Value of `header-end' must be a marker"))
1147    (let (fcc-list    (let (fcc-list
1148          (rmailbuf (current-buffer))          (rmailbuf (current-buffer))
1149          (time (current-time))          (time (current-time))
1150          (tembuf (generate-new-buffer " rmail output"))          (tembuf (generate-new-buffer " rmail output"))
1151          (case-fold-search t))          (case-fold-search t))
     (unless (markerp header-end)  
       (error "Value of `header-end' must be a marker"))  
1152      (save-excursion      (save-excursion
1153        (goto-char (point-min))        (goto-char (point-min))
1154        (while (re-search-forward "^FCC:[ \t]*" header-end t)        (while (re-search-forward "^FCC:[ \t]*" header-end t)
1155          (setq fcc-list (cons (buffer-substring (point)          (push (buffer-substring (point)
1156                                                 (progn                                  (progn
1157                                                   (end-of-line)                                    (end-of-line)
1158                                                   (skip-chars-backward " \t")                                    (skip-chars-backward " \t")
1159                                                   (point)))                                    (point)))
1160                               fcc-list))                fcc-list)
1161          (delete-region (match-beginning 0)          (delete-region (match-beginning 0)
1162                         (progn (forward-line 1) (point))))                         (progn (forward-line 1) (point))))
1163        (set-buffer tembuf)        (set-buffer tembuf)
# Line 1187  external program defined by `sendmail-pr Line 1183  external program defined by `sendmail-pr
1183          (while (search-forward "\nFrom " nil t)          (while (search-forward "\nFrom " nil t)
1184            (forward-char -5)            (forward-char -5)
1185            (insert ?>)))            (insert ?>)))
1186        (while fcc-list        (dolist (fcc fcc-list)
1187          (let* ((buffer (find-buffer-visiting (car fcc-list)))          (let* ((buffer (find-buffer-visiting fcc))
1188                 (curbuf (current-buffer))                 (curbuf (current-buffer))
1189                 dont-write-the-file                 dont-write-the-file
1190                 buffer-matches-file                 buffer-matches-file
# Line 1197  external program defined by `sendmail-pr Line 1193  external program defined by `sendmail-pr
1193                                       (forward-line 2) (point))))                                       (forward-line 2) (point))))
1194            (if buffer            (if buffer
1195                ;; File is present in a buffer => append to that buffer.                ;; File is present in a buffer => append to that buffer.
1196                (save-excursion                (with-current-buffer buffer
                 (set-buffer buffer)  
1197                  (setq buffer-matches-file                  (setq buffer-matches-file
1198                        (and (not (buffer-modified-p))                        (and (not (buffer-modified-p))
1199                             (verify-visited-file-modtime buffer)))                             (verify-visited-file-modtime buffer)))
# Line 1239  external program defined by `sendmail-pr Line 1234  external program defined by `sendmail-pr
1234                          (or buffer-matches-file                          (or buffer-matches-file
1235                              (progn                              (progn
1236                                (if (y-or-n-p (format "Save file %s? "                                (if (y-or-n-p (format "Save file %s? "
1237                                                      (car fcc-list)))                                                      fcc))
1238                                    (save-buffer))                                    (save-buffer))
1239                                (setq dont-write-the-file t))))                                (setq dont-write-the-file t))))
1240                      (if max (narrow-to-region (point-min) max))))))                      (if max (narrow-to-region (point-min) max))))))
1241            ;; Append to the file directly,            ;; Append to the file directly,
1242            ;; unless we've already taken care of it.            ;; unless we've already taken care of it.
1243            (unless dont-write-the-file            (unless dont-write-the-file
1244              (if (and (file-exists-p (car fcc-list))              (if (and (file-exists-p fcc)
1245                       ;; Check that the file isn't empty.  We don't                       ;; Check that the file isn't empty.  We don't
1246                       ;; want to insert a newline at the start of an                       ;; want to insert a newline at the start of an
1247                       ;; empty file.                       ;; empty file.
1248                       (not (zerop (nth 7 (file-attributes (car fcc-list)))))                       (not (zerop (nth 7 (file-attributes fcc))))
1249                       (mail-file-babyl-p (car fcc-list)))                       (mail-file-babyl-p fcc))
1250                  ;; If the file is a Babyl file,                  ;; If the file is a Babyl file,
1251                  ;; convert the message to Babyl format.                  ;; convert the message to Babyl format.
1252                  (let ((coding-system-for-write                  (let ((coding-system-for-write
1253                         (or rmail-file-coding-system                         (or rmail-file-coding-system
1254                             'emacs-mule)))                             'emacs-mule)))
1255                    (save-excursion                    (with-current-buffer (get-buffer-create " mail-temp")
                     (set-buffer (get-buffer-create " mail-temp"))  
1256                      (setq buffer-read-only nil)                      (setq buffer-read-only nil)
1257                      (erase-buffer)                      (erase-buffer)
1258                      (insert "\C-l\n0, unseen,,\n*** EOOH ***\nDate: "                      (insert "\C-l\n0, unseen,,\n*** EOOH ***\nDate: "
1259                              (mail-rfc822-date) "\n")                              (mail-rfc822-date) "\n")
1260                      (insert-buffer-substring curbuf beg2 end)                      (insert-buffer-substring curbuf beg2 end)
1261                      (insert "\n\C-_")                      (insert "\n\C-_")
1262                      (write-region (point-min) (point-max) (car fcc-list) t)                      (write-region (point-min) (point-max) fcc t)
1263                      (erase-buffer)))                      (erase-buffer)))
1264                (write-region                (write-region
1265                 (1+ (point-min)) (point-max) (car fcc-list) t)))                 (1+ (point-min)) (point-max) fcc t)))
1266            (and buffer (not dont-write-the-file)            (and buffer (not dont-write-the-file)
1267                 (with-current-buffer buffer                 (with-current-buffer buffer
1268                   (set-visited-file-modtime))))                   (set-visited-file-modtime))))))
         (setq fcc-list (cdr fcc-list))))  
1269      (kill-buffer tembuf)))      (kill-buffer tembuf)))
1270    
1271  (defun mail-sent-via ()  (defun mail-sent-via ()
# Line 1281  external program defined by `sendmail-pr Line 1274  external program defined by `sendmail-pr
1274    (save-excursion    (save-excursion
1275      ;; put a marker at the end of the header      ;; put a marker at the end of the header
1276      (let ((end (copy-marker (mail-header-end)))      (let ((end (copy-marker (mail-header-end)))
1277            (case-fold-search t)            (case-fold-search t))
           to-line)  
1278        (goto-char (point-min))        (goto-char (point-min))
1279        ;; search for the To: lines and make Sent-via: lines from them        ;; search for the To: lines and make Sent-via: lines from them
1280        ;; search for the next To: line        ;; search for the next To: line
# Line 1625  The seventh argument ACTIONS is a list o Line 1617  The seventh argument ACTIONS is a list o
1617   when the message is sent, we apply FUNCTION to ARGS.   when the message is sent, we apply FUNCTION to ARGS.
1618   This is how Rmail arranges to mark messages `answered'."   This is how Rmail arranges to mark messages `answered'."
1619    (interactive "P")    (interactive "P")
1620  ;;; This is commented out because I found it was confusing in practice.  ;;;  This is commented out because I found it was confusing in practice.
1621  ;;; It is easy enough to rename *mail* by hand with rename-buffer  ;;;  It is easy enough to rename *mail* by hand with rename-buffer
1622  ;;; if you want to have multiple mail buffers.  ;;;  if you want to have multiple mail buffers.
1623  ;;; And then you can control which messages to save. --rms.  ;;;  And then you can control which messages to save. --rms.
1624  ;;;  (let ((index 1)  ;;;  (let ((index 1)
1625  ;;;     buffer)  ;;;     buffer)
1626  ;;;    ;; If requested, look for a mail buffer that is modified and go to it.  ;;;    ;; If requested, look for a mail buffer that is modified and go to it.
# Line 1687  The seventh argument ACTIONS is a list o Line 1679  The seventh argument ACTIONS is a list o
1679    (mail-mode)    (mail-mode)
1680    ;; Disconnect the buffer from its visited file    ;; Disconnect the buffer from its visited file
1681    ;; (in case the user has actually visited a file *mail*).    ;; (in case the user has actually visited a file *mail*).
1682  ;  (set-visited-file-name nil)  ;;;  (set-visited-file-name nil)
1683    (let (initialized)    (let (initialized)
1684      (and (not (and noerase      (and (not (and noerase
1685                     (not (eq noerase 'new))))                     (not (eq noerase 'new))))
# Line 1855  you can move to one of them and type C-c Line 1847  you can move to one of them and type C-c
1847      (pop-to-buffer "*mail*"))      (pop-to-buffer "*mail*"))
1848    (mail noerase to subject in-reply-to cc replybuffer sendactions))    (mail noerase to subject in-reply-to cc replybuffer sendactions))
1849    
1850  ;;; Do not add anything but external entries on this page.  ;; Do not add anything but external entries on this page.
1851    
1852  (provide 'sendmail)  (provide 'sendmail)
1853    
1854  ;;; arch-tag: 48bc1025-d993-4d31-8d81-2a29491f0626  ;; arch-tag: 48bc1025-d993-4d31-8d81-2a29491f0626
1855  ;;; sendmail.el ends here  ;;; sendmail.el ends here

Legend:
Removed from v.1.296  
changed lines
  Added in v.1.297

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26