1 ;;; setaddr.el --- determine whether sendmail is configured on this machine
3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
27 ;; If neither sendmail nor Emacs knows what host address to use
28 ;; for this machine, ask for it, and save it in site-start.el
29 ;; so we won't have to ask again.
31 ;; This uses a heuristic about the output from sendmail
32 ;; which may or may not really work. We will have to find
38 (let (sendmail-configured)
39 (with-temp-buffer " mail-host-address"
40 (call-process sendmail-program nil t nil
"-bv" "root")
41 (goto-char (point-min))
42 (setq sendmail-configured
(looking-at "root@")))
43 (or sendmail-configured
45 (setq mail-host-address
46 (read-string "Specify your host's fully qualified domain name: ")))
47 ;; Create an init file, and if we just read mail-host-address,
48 ;; make the init file set it.
51 (set-buffer (find-file-noselect "site-start.el"))
52 (setq buffer
(current-buffer))
53 ;; Get rid of the line that ran this file.
54 (if (search-forward "(load \"setaddr\")\n")
57 (delete-region (point)
61 (goto-char (point-max))
62 (insert "\n(setq mail-host-address "
63 (prin1-to-string mail-host-address
)
69 (kill-buffer buffer
))))))
71 ;;; setaddr.el ends here