Gnus development mailing list
 help / color / mirror / Atom feed
From: Jari Aalto <jari.aalto@poboxes.com>
Subject: [patch] message.el - more safe message-send-mail-function
Date: Fri, 3 Sep 2004 00:08:45 +0300	[thread overview]
Message-ID: <20040902210845.QLDS14814.fep19-app.kolumbus.fi@W2KPICASSO> (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))))))
 




                 reply	other threads:[~2004-09-02 21:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040902210845.QLDS14814.fep19-app.kolumbus.fi@W2KPICASSO \
    --to=jari.aalto@poboxes.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).