[darcs-users] Re: Darcs and a single developer working on multiple workstations

Steven E. Harris seh at panix.com
Tue Mar 29 22:12:45 UTC 2005

David Roundy <droundy at abridgegame.org> writes:

> The trouble is that I don't know any decent way to look for
> /usr/sbin/sendmail (or /usr/lib/sendmail, or whatever it's called)
> at runtime in a safe and effective manner.  So the path to sendmail
> is fixed at configure time.

I'm not sure whether this would qualify as "safe," but perhaps there
could be a repository preference called something like "MTA" that
either specified "MAPI" or "sendmail" with an accompanying path.

,----[ _darcs/prefs/mta ]

,----[ _darcs/prefs/mta ]
| sendmail /usr/bin/exim

By analogy, XEmacs has a variable called sendmail-program, initialized
thusly, which I keep set to "exim".

,----[ sendmail-program initialization ]
| (cond
|  ((file-exists-p "/usr/lib/sendmail") "/usr/lib/sendmail")
|  ((file-exists-p "/usr/sbin/sendmail") "/usr/sbin/sendmail")
|  ((file-exists-p "/usr/ucblib/sendmail") "/usr/ucblib/sendmail")
|  (t "fakemail"))

Within the "message" library, the variable message-send-mail-function
is initialized like so:

,----[ message.el ]
| (defcustom message-send-mail-function
|   (let ((program (if (boundp 'sendmail-program)
| 		     ;; see paths.el
| 		     sendmail-program)))
|     (cond
|      ((and program
| 	   (string-match "/" program) ;; Skip path
| 	   (file-executable-p program))
|       'message-send-mail-with-sendmail)
|      ((and program
| 	   (executable-find program))
|       'message-send-mail-with-sendmail)
|      (t
|       'smtpmail-send-it)))
|   "Function to call to send the current buffer as mail.
| The headers should be delimited by a line whose contents match the
| variable `mail-header-separator'.
| Valid values include `message-send-mail-with-sendmail' (the default),
| `message-send-mail-with-mh', `message-send-mail-with-qmail',
| `message-smtpmail-send-it', `smtpmail-send-it' and `feedmail-send-it'.
| See also `send-mail-function'."
| ; ...
| )

When sendmail-program is set and the specified executable is found,
the function message-send-mail-with-sendmail is used as the transport.
Note that the fallback here, smptmail-send-it, is a simple ELisp SMTP
client, like others proposed including in darcs.

Since exim can impersonate sendmail, all I need to do is tell XEmacs
what I call "sendmail" on my system and it figures the rest
out. Obviously other transports are expected and configurable.

Could something like this work for darcs?

Steven E. Harris

More information about the darcs-users mailing list