/[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.256 by rost, Mon May 20 16:05:28 2002 UTC revision 1.256.2.1 by miles, Fri Apr 4 06:20:27 2003 UTC
# Line 1  Line 1 
1  ;;; sendmail.el --- mail sending commands for Emacs.  -*- byte-compile-dynamic: t -*-  ;;; 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, 2002  ;; Copyright (C) 1985, 86, 92, 93, 94, 95, 96, 98, 2000, 2001, 2002, 2003
4  ;;   Free Software Foundation, Inc.  ;;   Free Software Foundation, Inc.
5    
6  ;; Maintainer: FSF  ;; Maintainer: FSF
# Line 82  If this is nil while `mail-specify-envel Line 82  If this is nil while `mail-specify-envel
82  content of `user-mail-address' is used."  content of `user-mail-address' is used."
83    :version "21.1"    :version "21.1"
84    :type '(choice (string :tag "From-name")    :type '(choice (string :tag "From-name")
85                     (const :tag "Use From: header from message" header)
86                   (const :tag "Use `user-mail-address'" nil))                   (const :tag "Use `user-mail-address'" nil))
87    :group 'sendmail)    :group 'sendmail)
88    
# Line 275  and should insert whatever you want to i Line 276  and should insert whatever you want to i
276  Value of `default-directory' for mail buffers.  Value of `default-directory' for mail buffers.
277  This directory is used for auto-save files of mail buffers."  This directory is used for auto-save files of mail buffers."
278    :type '(directory :tag "Directory")    :type '(directory :tag "Directory")
279    :group 'sendmail)    :group 'sendmail
280      :version "21.4")
281    
282  (defvar mail-reply-action nil)  (defvar mail-reply-action nil)
283  (defvar mail-send-actions nil  (defvar mail-send-actions nil
# Line 374  actually occur.") Line 376  actually occur.")
376                 (beginning-of-line) (end-of-line)                 (beginning-of-line) (end-of-line)
377                 (2 font-lock-constant-face nil t)                 (2 font-lock-constant-face nil t)
378                 (4 font-lock-comment-face nil t)))                 (4 font-lock-comment-face nil t)))
379              '("^\\(X-[A-Za-z0-9-]+\\|In-reply-to\\):.*"              '("^\\(X-[A-Za-z0-9-]+\\|In-reply-to\\):.*\\(\n[ \t]+.*\\)*$"
380                . font-lock-string-face))))                . font-lock-string-face))))
381    "Additional expressions to highlight in Mail mode.")    "Additional expressions to highlight in Mail mode.")
382    
# Line 473  actually occur.") Line 475  actually occur.")
475    :type 'hook    :type 'hook
476    :options '(footnote-mode))    :options '(footnote-mode))
477    
478    (defvar mail-mode-abbrev-table text-mode-abbrev-table)
479  ;;;###autoload  ;;;###autoload
480  (define-derived-mode mail-mode text-mode "Mail"  (define-derived-mode mail-mode text-mode "Mail"
481    "Major mode for editing mail to be sent.    "Major mode for editing mail to be sent.
# Line 489  Here are commands that move to a header Line 492  Here are commands that move to a header
492  \\[mail-sent-via]  mail-sent-via (add a Sent-via field for each To or CC).  \\[mail-sent-via]  mail-sent-via (add a Sent-via field for each To or CC).
493  Turning on Mail mode runs the normal hooks `text-mode-hook' and  Turning on Mail mode runs the normal hooks `text-mode-hook' and
494  `mail-mode-hook' (in that order)."  `mail-mode-hook' (in that order)."
   (setq local-abbrev-table text-mode-abbrev-table)  
495    (make-local-variable 'mail-reply-action)    (make-local-variable 'mail-reply-action)
496    (make-local-variable 'mail-send-actions)    (make-local-variable 'mail-send-actions)
497    (setq buffer-offer-save t)    (setq buffer-offer-save t)
# Line 573  If within the headers, this makes the ne Line 575  If within the headers, this makes the ne
575  (defun mail-mode-fill-paragraph (arg)  (defun mail-mode-fill-paragraph (arg)
576    ;; Do something special only if within the headers.    ;; Do something special only if within the headers.
577    (if (< (point) (mail-header-end))    (if (< (point) (mail-header-end))
578        (let (beg end fieldname)        (let (beg end fieldname)
579          (when (prog1 (re-search-backward "^[-a-zA-Z]+:" nil 'yes)          (when (prog1 (re-search-backward "^[-a-zA-Z]+:" nil 'yes)
580                  (setq beg (point)))                  (setq beg (point)))
581          (setq fieldname          (setq fieldname
# Line 620  If within the headers, this makes the ne Line 622  If within the headers, this makes the ne
622    (define-key mail-mode-map "\C-c\C-t" 'mail-text)    (define-key mail-mode-map "\C-c\C-t" 'mail-text)
623    (define-key mail-mode-map "\C-c\C-y" 'mail-yank-original)    (define-key mail-mode-map "\C-c\C-y" 'mail-yank-original)
624    (define-key mail-mode-map "\C-c\C-r" 'mail-yank-region)    (define-key mail-mode-map "\C-c\C-r" 'mail-yank-region)
625      (define-key mail-mode-map [remap split-line] 'mail-split-line)
626    (define-key mail-mode-map "\C-c\C-q" 'mail-fill-yanked-message)    (define-key mail-mode-map "\C-c\C-q" 'mail-fill-yanked-message)
627    (define-key mail-mode-map "\C-c\C-w" 'mail-signature)    (define-key mail-mode-map "\C-c\C-w" 'mail-signature)
628    (define-key mail-mode-map "\C-c\C-v" 'mail-sent-via)    (define-key mail-mode-map "\C-c\C-v" 'mail-sent-via)
# Line 774  the user from the mailer." Line 777  the user from the mailer."
777              (progn              (progn
778                (set-buffer-modified-p nil)                (set-buffer-modified-p nil)
779                (delete-auto-save-file-if-necessary t))))))                (delete-auto-save-file-if-necessary t))))))
780    
781    (defun mail-envelope-from ()
782      "Return the envelope mail address to use when sending mail.
783    This function uses `mail-envelope-from'."
784      (if (eq mail-envelope-from 'header)
785          (nth 1 (mail-extract-address-components
786                  (mail-fetch-field "From")))
787        mail-envelope-from))
788    
789  ;; This does the real work of sending a message via sendmail.  ;; This does the real work of sending a message via sendmail.
790  ;; It is called via the variable send-mail-function.  ;; It is called via the variable send-mail-function.
# Line 806  external program defined by `sendmail-pr Line 817  external program defined by `sendmail-pr
817                      (generate-new-buffer " sendmail errors")                      (generate-new-buffer " sendmail errors")
818                    0))                    0))
819          (tembuf (generate-new-buffer " sendmail temp"))          (tembuf (generate-new-buffer " sendmail temp"))
820            (multibyte enable-multibyte-characters)
821          (case-fold-search nil)          (case-fold-search nil)
822          (coding (and (local-variable-p 'buffer-file-coding-system)          (selected-coding (select-message-coding-system))
                      buffer-file-coding-system))  
         selected-coding  
823  ;;;     resend-to-addresses  ;;;     resend-to-addresses
824          delimline          delimline
825          fcc-was-found          fcc-was-found
# Line 821  external program defined by `sendmail-pr Line 831  external program defined by `sendmail-pr
831          ;; local binding in the mail buffer will take effect.          ;; local binding in the mail buffer will take effect.
832          (envelope-from          (envelope-from
833           (and mail-specify-envelope-from           (and mail-specify-envelope-from
834                (or mail-envelope-from user-mail-address))))                (or (mail-envelope-from) user-mail-address))))
835      (unwind-protect      (unwind-protect
836          (save-excursion          (save-excursion
837            (set-buffer tembuf)            (set-buffer tembuf)
838            (erase-buffer)            (erase-buffer)
839              (unless multibyte
840                (set-buffer-multibyte nil))
841            (insert-buffer-substring mailbuf)            (insert-buffer-substring mailbuf)
           (set-buffer-file-coding-system coding)  
842            (goto-char (point-max))            (goto-char (point-max))
843            ;; require one newline at the end.            ;; require one newline at the end.
844            (or (= (preceding-char) ?\n)            (or (= (preceding-char) ?\n)
# Line 933  external program defined by `sendmail-pr Line 944  external program defined by `sendmail-pr
944                               ;; ... then undo escaping of matching parentheses,                               ;; ... then undo escaping of matching parentheses,
945                               ;; including matching nested parentheses.                               ;; including matching nested parentheses.
946                               (goto-char fullname-start)                               (goto-char fullname-start)
947                               (while (re-search-forward                               (while (re-search-forward
948                                       "\\(\\=\\|[^\\]\\(\\\\\\\\\\)*\\)\\\\(\\(\\([^\\]\\|\\\\\\\\\\)*\\)\\\\)"                                       "\\(\\=\\|[^\\]\\(\\\\\\\\\\)*\\)\\\\(\\(\\([^\\]\\|\\\\\\\\\\)*\\)\\\\)"
949                                       fullname-end 1)                                       fullname-end 1)
950                                 (replace-match "\\1(\\3)" t)                                 (replace-match "\\1(\\3)" t)
# Line 951  external program defined by `sendmail-pr Line 962  external program defined by `sendmail-pr
962                     (not (re-search-forward "^MIME-version:" delimline t))                     (not (re-search-forward "^MIME-version:" delimline t))
963                     (progn (skip-chars-forward "\0-\177")                     (progn (skip-chars-forward "\0-\177")
964                            (/= (point) (point-max)))                            (/= (point) (point-max)))
965                     (setq selected-coding (select-message-coding-system))                     selected-coding
966                     (setq charset                     (setq charset
967                           (coding-system-get selected-coding 'mime-charset))                           (coding-system-get selected-coding 'mime-charset))
968                     (goto-char delimline)                     (goto-char delimline)
# Line 980  external program defined by `sendmail-pr Line 991  external program defined by `sendmail-pr
991  \\|^resent-cc:\\|^resent-bcc:"  \\|^resent-cc:\\|^resent-bcc:"
992                                     delimline t))                                     delimline t))
993                (let* ((default-directory "/")                (let* ((default-directory "/")
994                       (coding-system-for-write                       (coding-system-for-write selected-coding)
995                        (or selected-coding                       (args
                           (select-message-coding-system)))  
                      (args  
996                        (append (list (point-min) (point-max)                        (append (list (point-min) (point-max)
997                                      program                                      program
998                                      nil errbuf nil "-oi")                                      nil errbuf nil "-oi")
# Line 1221  external program defined by `sendmail-pr Line 1230  external program defined by `sendmail-pr
1230        (mail-position-on-field "to"))        (mail-position-on-field "to"))
1231    (insert "\nFCC: " folder))    (insert "\nFCC: " folder))
1232    
1233  (defun mail-reply-to ()        (defun mail-reply-to ()
1234    "Move point to end of Reply-To-field.  Create a Reply-To field if none."    "Move point to end of Reply-To-field.  Create a Reply-To field if none."
1235    (interactive)    (interactive)
1236    (expand-abbrev)    (expand-abbrev)
# Line 1251  external program defined by `sendmail-pr Line 1260  external program defined by `sendmail-pr
1260    (goto-char (mail-text-start)))    (goto-char (mail-text-start)))
1261    
1262  (defun mail-signature (&optional atpoint)  (defun mail-signature (&optional atpoint)
1263    "Sign letter with contents of the file `mail-signature-file'.    "Sign letter with signature based on `mail-signature-file'.
1264  Prefix arg means put contents at point."  Prefix arg means put contents at point."
1265    (interactive "P")    (interactive "P")
1266    (save-excursion    (save-excursion
# Line 1261  Prefix arg means put contents at point." Line 1270  Prefix arg means put contents at point."
1270      (end-of-line)      (end-of-line)
1271      (or atpoint      (or atpoint
1272          (delete-region (point) (point-max)))          (delete-region (point) (point-max)))
1273      (insert "\n\n-- \n")      (if (stringp mail-signature)
1274      (insert-file-contents (expand-file-name mail-signature-file))))          (insert mail-signature)
1275          (insert "\n\n-- \n")
1276          (insert-file-contents (expand-file-name mail-signature-file)))))
1277    
1278  (defun mail-fill-yanked-message (&optional justifyp)  (defun mail-fill-yanked-message (&optional justifyp)
1279    "Fill the paragraphs of a message yanked into this one.    "Fill the paragraphs of a message yanked into this one.
# Line 1408  and don't delete any header fields." Line 1419  and don't delete any header fields."
1419                 (if mail-yank-hooks                 (if mail-yank-hooks
1420                     (run-hooks 'mail-yank-hooks)                     (run-hooks 'mail-yank-hooks)
1421                   (mail-indent-citation))))))))                   (mail-indent-citation))))))))
1422    
1423    (defun mail-split-line ()
1424      "Split current line, moving portion beyond point vertically down.
1425    If the current line has `mail-yank-prefix', insert it on the new line."
1426      (interactive "*")
1427      (split-line mail-yank-prefix))
1428    
1429    
1430  (defun mail-attach-file (&optional file)  (defun mail-attach-file (&optional file)
1431    "Insert a file at the end of the buffer, with separator lines around it."    "Insert a file at the end of the buffer, with separator lines around it."

Legend:
Removed from v.1.256  
changed lines
  Added in v.1.256.2.1

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