Gnus development mailing list
 help / color / mirror / Atom feed
* [patch] message.el - more safe message-send-mail-function
@ 2004-09-02 21:08 Jari Aalto
  0 siblings, 0 replies; only message in thread
From: Jari Aalto @ 2004-09-02 21:08 UTC (permalink / raw)



The patch is against CVS. Win32 Emacs does not come woth program
"fakemail" which is set in path.el as default value for
`sendmail-program'. The following will use more sensible
default.

2004-09-02  Jari Aalto  <jari aalto A T poboxes com>

        * message.el (message-send-mail-function): Check existence of
        sendmail-program first before using
        default value `message-send-mail-with-sendmail'. Oterwise
        use more generic `smtpmail-send-it'.

Index: message.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/message.el,v
retrieving revision 7.41
diff -u -IId: -b -w -u -r7.41 message.el
--- message.el	22 Aug 2004 22:06:18 -0000	7.41
+++ message.el	2 Sep 2004 20:32:01 -0000
@@ -560,7 +560,20 @@
 
 ;; Useful to set in site-init.el
 ;;;###autoload
-(defcustom message-send-mail-function 'message-send-mail-with-sendmail
+(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'.
@@ -1557,9 +1570,6 @@
   (autoload 'rmail-msg-restore-non-pruned-header "rmail")
   (autoload 'rmail-output "rmailout"))
 
-(eval-when-compile
-  (autoload 'sha1 "sha1-el"))
-
 \f
 
 ;;;
@@ -3860,7 +3870,7 @@
 	    (save-excursion
 	      (set-buffer errbuf)
 	      (goto-char (point-min))
-	      (while (re-search-forward "\n\n* *" nil t)
+	      (while (re-search-forward "\n+ *" nil t)
 		(replace-match "; "))
 	      (if (not (zerop (buffer-size)))
 		  (error "Sending...failed to %s"
@@ -3942,7 +3952,7 @@
 (defun message-canlock-generate ()
   "Return a string that is non-trivial to guess.
 Do not use this for anything important, it is cryptographically weak."
-  (require 'sha1-el)
+  (require 'sha1)
   (let (sha1-maximum-internal-length)
     (sha1 (concat (message-unique-id)
 		  (format "%x%x%x" (random) (random t) (random))
@@ -5194,7 +5204,7 @@
     (when (looking-at "[ \t]*$")
       (message-delete-line))
     (goto-char begin)
-    (re-search-forward ":" nil t)
+    (search-forward ":" nil t)
     (when (looking-at "\n[ \t]+")
       (replace-match " " t t))
     (goto-char (point-max))))
@@ -6493,7 +6503,7 @@
     (let ((end1 (make-marker)))
       (move-marker end1 (max start end))
       (goto-char (min start end))
-      (while (re-search-forward "\b" end1 t)
+      (while (search-forward "\b" end1 t)
 	(if (eq (char-after) (char-after (- (point) 2)))
 	    (delete-char -2))))))
 




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-09-02 21:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-02 21:08 [patch] message.el - more safe message-send-mail-function Jari Aalto

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 NNTP newsgroup(s).