emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: smtpmail.el fixes for windows


From: Simon Josefsson
Subject: Re: smtpmail.el fixes for windows
Date: Thu, 12 Sep 2002 08:04:12 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-debian-linux-gnu)

Richard Stallman <address@hidden> writes:

> It seems ok to me.  However, I think it would be better
> to call format-time-string directly, just once for the date
> and the time.
>
> That way you can avoid the need to load the time-stamp library,
> and make the code a little smaller rather than a little bigger.

Yes, requiring time-stamp for this seems bloated. (The new time-stamp
function seems useful in itself, so I'm installing it as well.)
Revised patch below, which calls `convert-standard-filename', and uses
`expand-file-name' instead of concat (this is preferred, right?).  I
have installed this.

2002-09-12  Simon Josefsson  <address@hidden>

        * mail/smtpmail.el (smtpmail-send-it): Don't use : in filenames
        (for cygwin). Suggested by Andrew Senior <address@hidden>.
        Use expand-file-name.  Also don't require time-stamp.

2002-09-11  Simon Josefsson  <address@hidden>

        * time-stamp.el (time-stamp-hhmmss): New function.

Index: smtpmail.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/mail/smtpmail.el,v
retrieving revision 1.47
diff -u -p -u -r1.47 smtpmail.el
--- smtpmail.el 11 Sep 2002 04:53:15 -0000      1.47
+++ smtpmail.el 12 Sep 2002 06:00:39 -0000
@@ -66,7 +66,6 @@
 ;;; Code:

 (require 'sendmail)
-(require 'time-stamp)
 (autoload 'starttls-open-stream "starttls")
 (autoload 'starttls-negotiate "starttls")
 (autoload 'mail-strip-quoted-names "mail-utils")
@@ -343,14 +342,15 @@ This is relative to `smtpmail-queue-dir'
                            smtpmail-recipient-address-list tembuf))
                      (error "Sending failed; SMTP protocol error"))
                (error "Sending failed; no recipients"))
-           (let* ((file-data (concat
-                              smtpmail-queue-dir
-                              (concat (time-stamp-yyyy-mm-dd)
-                                      "_" (time-stamp-hh:mm:ss)
-                                      "_"
-                                      (setq smtpmail-queue-counter
-                                            (1+ smtpmail-queue-counter)))))
-                     (file-elisp (concat file-data ".el"))
+           (let* ((file-data
+                   (expand-file-name
+                    (format "%s_%i"
+                            (format-time-string "%Y-%m-%d_%H:%M:%S")
+                            (setq smtpmail-queue-counter
+                                  (1+ smtpmail-queue-counter)))
+                    smtpmail-queue-dir))
+                  (file-data (convert-standard-filename file-data))
+                  (file-elisp (concat file-data ".el"))
                   (buffer-data (create-file-buffer file-data))
                   (buffer-elisp (create-file-buffer file-elisp))
                   (buffer-scratch "*queue-mail*"))
Index: time-stamp.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/time-stamp.el,v
retrieving revision 1.51
diff -u -p -u -r1.51 time-stamp.el
--- time-stamp.el       18 May 2002 11:26:16 -0000      1.51
+++ time-stamp.el       12 Sep 2002 06:01:55 -0000
@@ -731,6 +731,10 @@ The first character of DD is space if th
   "Return the current time as a string in \"HH:MM:SS\" form."
   (format-time-string "%T"))

+(defun time-stamp-hhmmss ()
+  "Return the current time as a string in \"HHMMSS\" form."
+  (format-time-string "%H%M%S"))
+
 (defun time-stamp-hhmm ()
   "Return the current time as a string in \"HHMM\" form."
   (format-time-string "%H%M"))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]