]> code.delx.au - gnu-emacs/blobdiff - lisp/mail/sendmail.el
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-25
[gnu-emacs] / lisp / mail / sendmail.el
index fa6fd8952ffe1ed61722943d4c309566e8b27921..b456f8543b1f29565a9a151d2aa3d4c8c9275478 100644 (file)
@@ -1,6 +1,6 @@
 ;;; sendmail.el --- mail sending commands for Emacs.  -*- byte-compile-dynamic: t -*-
 
-;; Copyright (C) 1985, 86, 92, 93, 94, 95, 96, 98, 2000, 2001, 2002, 2003
+;; Copyright (C) 1985, 86, 92, 93, 94, 95, 96, 98, 2000, 2001, 2002, 03, 2004
 ;;   Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
@@ -68,11 +68,12 @@ controlled by a separate variable, `mail-specify-envelope-from'."
 (defcustom mail-specify-envelope-from nil
   "*If non-nil, specify the envelope-from address when sending mail.
 The value used to specify it is whatever is found in
-`mail-envelope-from', with `user-mail-address' as fallback.
+the variable `mail-envelope-from', with `user-mail-address' as fallback.
 
 On most systems, specifying the envelope-from address is a
-privileged operation.  This variable is only used if
-`send-mail-function' is set to `sendmail-send-it'."
+privileged operation.  This variable affects sendmail and
+smtpmail -- if you use feedmail to send mail, see instead the
+variable `feedmail-deduce-envelope-from'."
   :version "21.1"
   :type 'boolean
   :group 'sendmail)
@@ -184,8 +185,8 @@ The function `mail-setup' runs this hook."
 (defvar mail-aliases t
   "Alist of mail address aliases,
 or t meaning should be initialized from your mail aliases file.
-\(The file's name is normally `~/.mailrc', but your MAILRC environment
-variable can override that name.)
+\(The file's name is normally `~/.mailrc', but `mail-personal-alias-file'
+can specify a different file name.)
 The alias definitions in the file have this form:
     alias ALIAS MEANING")
 
@@ -281,7 +282,7 @@ Value of `default-directory' for mail buffers.
 This directory is used for auto-save files of mail buffers."
   :type '(directory :tag "Directory")
   :group 'sendmail
-  :version "21.4")
+  :version "22.1")
 
 (defvar mail-reply-action nil)
 (defvar mail-send-actions nil
@@ -323,7 +324,7 @@ support Delivery Status Notification."
   :type '(repeat (radio (const :tag "Failure" failure)
                        (const :tag "Delay" delay)
                        (const :tag "Success" success)))
-  :version "21.4")
+  :version "22.1")
 
 ;; Note: could use /usr/ucb/mail instead of sendmail;
 ;; options -t, and -v if not interactive.
@@ -386,10 +387,11 @@ actually occur.")
 
 \f
 (defun sendmail-sync-aliases ()
-  (let ((modtime (nth 5 (file-attributes mail-personal-alias-file))))
-    (or (equal mail-alias-modtime modtime)
-       (setq mail-alias-modtime modtime
-             mail-aliases t))))
+  (when mail-personal-alias-file
+    (let ((modtime (nth 5 (file-attributes mail-personal-alias-file))))
+      (or (equal mail-alias-modtime modtime)
+         (setq mail-alias-modtime modtime
+               mail-aliases t)))))
 
 (defun mail-setup (to subject in-reply-to cc replybuffer actions)
   (or mail-default-reply-to
@@ -398,8 +400,9 @@ actually occur.")
   (if (eq mail-aliases t)
       (progn
        (setq mail-aliases nil)
-       (if (file-exists-p mail-personal-alias-file)
-           (build-mail-aliases))))
+       (when mail-personal-alias-file
+         (if (file-exists-p mail-personal-alias-file)
+             (build-mail-aliases)))))
   ;; Don't leave this around from a previous message.
   (kill-local-variable 'buffer-file-coding-system)
   ;; This doesn't work for enable-multibyte-characters.
@@ -509,6 +512,9 @@ Turning on Mail mode runs the normal hooks `text-mode-hook' and
   ;; Allow using comment commands to add/remove quoting (this only does
   ;; anything if mail-yank-prefix is set to a non-nil value).
   (set (make-local-variable 'comment-start) mail-yank-prefix)
+  (if mail-yank-prefix
+      (set (make-local-variable 'comment-start-skip)
+          (concat "^" (regexp-quote mail-yank-prefix) "[ \t]*")))
   (make-local-variable 'adaptive-fill-regexp)
   (setq adaptive-fill-regexp
        (concat "[ \t]*[-[:alnum:]]+>+[ \t]*\\|"
@@ -708,7 +714,12 @@ Prefix arg means don't delete this window."
     (if (and (or (window-dedicated-p (frame-selected-window))
                 (cdr (assq 'mail-dedicated-frame (frame-parameters))))
             (not (null (delq (selected-frame) (visible-frame-list)))))
-       (delete-frame (selected-frame))
+       (progn
+         (if (display-multi-frame-p)
+             (delete-frame (selected-frame))
+           ;; The previous frame is where normally they have the
+           ;; RMAIL buffer displayed.
+           (other-frame -1)))
       (let (rmail-flag summary-buffer)
        (and (not arg)
             (not (one-window-p))
@@ -966,7 +977,7 @@ external program defined by `sendmail-program'."
                          (/= (point) (point-max)))
                   selected-coding
                   (setq charset
-                        (coding-system-get selected-coding 'mime-charset))
+                        (coding-system-get selected-coding :mime-charset))
                   (goto-char delimline)
                   (insert "MIME-version: 1.0\n"
                           "Content-type: text/plain; charset="
@@ -1026,7 +1037,7 @@ external program defined by `sendmail-program'."
                              )
                      )
                     (exit-value (apply 'call-process-region args)))
-               (or (null exit-value) (zerop exit-value)
+               (or (null exit-value) (eq 0 exit-value)
                    (error "Sending...failed with exit value %d" exit-value)))
            (or fcc-was-found
                (error "No recipients")))
@@ -1625,7 +1636,7 @@ The seventh argument ACTIONS is a list of actions to take
       (define-key (current-local-map) "v"
        (lambda ()
          (interactive)
-         (let ((coding-system-for-read 'emacs-mule-unix))
+         (let ((coding-system-for-read 'utf-8-emacs-unix))
            (dired-view-file))))
       (define-key (current-local-map) "\C-c\C-c"
        (lambda ()
@@ -1633,13 +1644,13 @@ The seventh argument ACTIONS is a list of actions to take
          (let ((fname (dired-get-filename))
                ;; Auto-saved files are written in the internal
                ;; representation, so they should be read accordingly.
-               (coding-system-for-read 'emacs-mule-unix))
+               (coding-system-for-read 'utf-8-emacs-unix))
            (switch-to-buffer-other-window "*mail*")
            (let ((buffer-read-only nil))
              (erase-buffer)
              (insert-file-contents fname nil)
              ;; insert-file-contents will set buffer-file-coding-system
-             ;; to emacs-mule, which is probably not what they want to
+             ;; to utf-8-emacs, which is probably not what they want to
              ;; use for sending the message.  But we don't know what
              ;; was its value before the buffer was killed or Emacs
              ;; crashed.  We therefore reset buffer-file-coding-system
@@ -1690,7 +1701,7 @@ you can move to one of them and type C-c C-c to recover that one."
                     (buffer-coding buffer-file-coding-system)
                     ;; Auto-save files are written in internal
                     ;; representation of non-ASCII characters.
-                    (coding-system-for-read 'emacs-mule-unix))
+                    (coding-system-for-read 'utf-8-emacs-unix))
                 (erase-buffer)
                 (insert-file-contents file-name nil)
                 (setq buffer-file-coding-system buffer-coding)))))
@@ -1724,4 +1735,5 @@ you can move to one of them and type C-c C-c to recover that one."
 
 (provide 'sendmail)
 
+;;; arch-tag: 48bc1025-d993-4d31-8d81-2a29491f0626
 ;;; sendmail.el ends here