emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: send-mail-function initialized in ldefs-boot (using window-system)


From: David Reitter
Subject: Re: send-mail-function initialized in ldefs-boot (using window-system)
Date: Sun, 27 Nov 2005 21:07:57 +0000

On 24 Nov 2005, at 17:50, Luc Teirlinck wrote:

David Reitter wrote:

The default value for send-mail-function is supposed to be different
   depending on the system. This doesn't work, at least not on Darwin,
   where it is supposed
   Currently, we have (lisp/mail/sendmail.el):

   ;;;###autoload
   (defcustom send-mail-function
      (if (and window-system (memq system-type '(darwin windows-nt)))
          'mailclient-send-it
        'sendmail-send-it)

This is included in ldefs-boot.el / loaddefs.el and is loaded before
   dumping.
At that time, window-system is nil, of course, and the default is set
   prematurely.

   I'm not sure what the right solution for this is.

One thing you could try is to add:

(custom-reevaluate-setting 'send-mail-function)

Sorry, I responded too quickly.  I forgot to notice that you were
talking about ldefs-boot.


OK, what about the following?
Add the initialization code to before-init-hook. This should be persistent, i.e. saved while dumping, so it will be eval'ed at runtime.



;;;###autoload
(defcustom send-mail-function
  (progn ;; init value will be included in autoloads
    (defun send-mail-function-default ()
      "Initial value for `send-mail-function'"
      (if (and window-system
               (memq system-type '(darwin windows-nt)))
          'mailclient-send-it
        'sendmail-send-it))
    (add-hook 'before-init-hook 
              ;; evaluate at runtime when window-system is known
              (lambda ()
                "Initialize `send-mail-function'"
                (set-default 'send-mail-function
                             (send-mail-function-default))))
    (send-mail-function-default))
  "Function to call to send the current buffer as mail.
The headers should be delimited by a line which is
not a valid RFC822 header or continuation line,
that matches the variable `mail-header-separator'.
This is used by the default mail-sending commands.  See also
`message-send-mail-function' for use with the Message package."
:type '(radio (function-item sendmail-send-it :tag "Use Sendmail package")
                (function-item smtpmail-send-it :tag "Use SMTPmail package")
                (function-item feedmail-send-it :tag "Use Feedmail package")
                (function-item mailclient-send-it :tag "Use Mailclient package")
                function)
  :group 'sendmail)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]