Gnus development mailing list
 help / color / mirror / Atom feed
From: Wolfram Fenske <Wolfram.Fenske@Student.Uni-Magdeburg.DE>
To: ding@gnus.org
Cc: simon@josefsson.org
Subject: Re: The return of starttls doesn't work in smtpmail
Date: Sun, 19 Aug 2007 23:17:35 +0200	[thread overview]
Message-ID: <86hcmvcjgw.fsf@hondo.cadr.de> (raw)
In-Reply-To: <v9ps1mmukp.fsf@marauder.physik.uni-ulm.de>

Reiner Steib <reinersteib+gmane@imap.cc> writes:

> On Fri, Aug 17 2007, Wolfram Fenske wrote:
>
>> According to
>> <http://quimby.gnus.org/cgi-bin/cvsweb.cgi/gnus/contrib/smtpmail.el>,
>> smptmail.el still isn't fixed.  
>
> ,----[ contrib/README ]
> | sendmail.el
> | smtpmail.el
> | 
> | 	Copies of the corresponding files from the Emacs lisp/mail/
> | 	directory, to provide features (occasionally) needed by Gnus which
> | 	may not be provided by the versions of these files in older Emacs
> | 	distributions.  XEmacs users should NOT use this, since it doesn't
> | 	work.  See the XEmacs mail-lib module instead.
> `----
>
> In contrib/smtpmail.el we even have:
>
> ;; This version of `smtpmail.el' should only be used with Emacs 21.
> (if (featurep 'xemacs)
>     (error "Please use `smtpmail.el' from the mail-lib package.")
>   (when (>= emacs-major-version 22)
>     (error "Please use `smtpmail.el' bundled with Emacs.")))
>
> So it should be fixed in XEmacs or the smtpmail.el file in XEmacs
> mail-lib package.

Thanks for the pointer.  However, it's not fixed in the XEmacs
mail-lib module, either (see
<http://cvs.xemacs.org/viewcvs.cgi/XEmacs/packages/xemacs-packages/mail-lib/smtpmail.el>).
In fact, I *am* using the version from the XEmacs sumo-mule package
collection, version 2007-04-27.  I didn't realize there were two "sort
of current" versions of smptmail.el.  So I guess I should contact the
package maintainer, which would be Simon Joseffson.

>> ;;; XEmacs and older Emacs might not have `with-no-warnings'
>> (unless (fboundp 'with-no-warnings)
>>   ;; Taken from Emacs' byte-run.el
>>   (defun with-no-warnings (&rest body)
>>     "Like `progn', but prevents compiler warnings in the body."
>>     ;; The implementation for the interpreter is basically trivial.
>>     (car (last body))))
>
> This is a bad idea.
>
> ,----[ (info "(elisp)Coding Conventions") ]
> |    * If a package needs to define an alias or a new function for
> |      compatibility with some other version of Emacs, name it with the
> |      package prefix, not with the raw name with which it occurs in the
> |      other version.  Here is an example from Gnus, which provides many
> |      examples of such compatibility issues.
> | 
> |           (defalias 'gnus-point-at-bol
> |             (if (fboundp 'point-at-bol)
> |                 'point-at-bol
> |               'line-beginning-position))
> `----

Would this be better?

--8<---------------cut here---------------start------------->8---
;;; XEmacs and older Emacs might not have `with-no-warnings'
(if (fboundp 'with-no-warnings)
    (defalias 'gnus-with-no-warnings 'with-no-warnings)
  ;; Taken from Emacs' byte-run.el
  (defun gnus-with-no-warnings (&rest body)
    "Like `progn', but prevents compiler warnings in the body."
    ;; The implementation for the interpreter is basically trivial.
    (car (last body))))
--8<---------------cut here---------------end--------------->8---

In any case, I think the specific piece code that caused my headaches
is problematic because the "condtition-case" form simply swallows all
errors (from "smtpmail-open-stream"):

--8<---------------cut here---------------start------------->8---
    ...
    (if (null (and cred (condition-case ()
			    (with-no-warnings
			      (require 'starttls)
			      (call-process (if starttls-use-gnutls
						starttls-gnutls-program
					      starttls-program)))
			  (error nil))))
	;; The normal case.
	(open-network-stream "SMTP" process-buffer host port)
    ...
--8<---------------cut here---------------end--------------->8---

If there really isn't a more specific kind of error it could catch,
then the "condition-case" should at least contain as few forms as
possible.  Otherwise real bugs like unbound functions (say,
"with-no-warnings") might go unnoticed.

-- 
Wolfram Fenske

A: Yes.
>Q: Are you sure?
>>A: Because it reverses the logical flow of conversation.
>>>Q: Why is top posting frowned upon?



      reply	other threads:[~2007-08-19 21:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-17  2:21 Wolfram Fenske
2007-08-17  8:30 ` Reiner Steib
2007-08-19 21:17   ` Wolfram Fenske [this message]

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=86hcmvcjgw.fsf@hondo.cadr.de \
    --to=wolfram.fenske@student.uni-magdeburg.de \
    --cc=ding@gnus.org \
    --cc=simon@josefsson.org \
    /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).