unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* send-mail-function initialized in ldefs-boot (using window-system)
@ 2005-11-24 15:49 David Reitter
  2005-11-24 17:50 ` Luc Teirlinck
  2005-11-24 17:58 ` Luc Teirlinck
  0 siblings, 2 replies; 4+ messages in thread
From: David Reitter @ 2005-11-24 15:49 UTC (permalink / raw)


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.

I've seen another use of window-system in loaddefs.el - in the  
definition of tex-dvi-view-command. There, the expression is quoted,  
but this value is evaluated before use in that case.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: send-mail-function initialized in ldefs-boot (using window-system)
  2005-11-24 15:49 send-mail-function initialized in ldefs-boot (using window-system) David Reitter
@ 2005-11-24 17:50 ` Luc Teirlinck
  2005-11-27 21:07   ` David Reitter
  2005-11-24 17:58 ` Luc Teirlinck
  1 sibling, 1 reply; 4+ messages in thread
From: Luc Teirlinck @ 2005-11-24 17:50 UTC (permalink / raw)
  Cc: emacs-devel

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)

in startup.el, before the loading of the user's init file.  (For
instance, right after the custom-reevaluate-setting for
file-shadow-mode will do.)  `window-system' should be correctly defined
there.

Sincerely,

Luc.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: send-mail-function initialized in ldefs-boot (using window-system)
  2005-11-24 15:49 send-mail-function initialized in ldefs-boot (using window-system) David Reitter
  2005-11-24 17:50 ` Luc Teirlinck
@ 2005-11-24 17:58 ` Luc Teirlinck
  1 sibling, 0 replies; 4+ messages in thread
From: Luc Teirlinck @ 2005-11-24 17:58 UTC (permalink / raw)
  Cc: emacs-devel

Sorry, I responded too quickly.  I forgot to notice that you were
talking about ldefs-boot.  send-mail-function is defined with a defvar
there, not defcustom, so custom-reevaluate-setting will not work.

Sincerely,

Luc.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: send-mail-function initialized in ldefs-boot (using window-system)
  2005-11-24 17:50 ` Luc Teirlinck
@ 2005-11-27 21:07   ` David Reitter
  0 siblings, 0 replies; 4+ messages in thread
From: David Reitter @ 2005-11-27 21:07 UTC (permalink / raw)
  Cc: emacs-devel

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)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-11-27 21:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-24 15:49 send-mail-function initialized in ldefs-boot (using window-system) David Reitter
2005-11-24 17:50 ` Luc Teirlinck
2005-11-27 21:07   ` David Reitter
2005-11-24 17:58 ` Luc Teirlinck

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).