From xemacs-m  Sun Jan 26 12:40:52 1997
Received: from altair.xemacs.org (steve@xemacs.miranova.com [206.190.83.19])
          by xemacs.org (8.8.4/8.8.4) with ESMTP
	  id MAA10305 for <xemacs-beta@xemacs.org>; Sun, 26 Jan 1997 12:40:51 -0600 (CST)
Received: (from steve@localhost)
	by altair.xemacs.org (8.8.5/8.8.5) id KAA02956;
	Sun, 26 Jan 1997 10:51:56 -0800
To: xemacs-beta@xemacs.org
Subject: Re: 19.15b90: timezone-make-date-sortable fails
References: <QQcaem18496.199701261706@crystal.WonderWorks.COM> 	<m2ohecpcml.fsf@altair.xemacs.org> <QQcaeq19392.199701261813@crystal.WonderWorks.COM>
X-Url: http://www.miranova.com/%7Esteve/
Mail-Copies-To: never
X-Face: #!T9!#9s-3o8)*uHlX{Ug[xW7E7Wr!*L46-OxqMu\xz23v|R9q}lH?cRS{rCNe^'[`^sr5"
 f8*@r4ipO6Jl!:Ccq<xoV[Qz2u8<8-+Vwf2gzJ44lf_/y9OaQ`@#Q65{U4/TC)i2`~/M&QI$X>p:9I
 OSS'2{-)-4wBnVeg0S\O4Al@)uC[pD|+
X-Attribution: sb
From: Steven L Baur <steve@miranova.com>
In-Reply-To: Kyle Jones's message of Sun, 26 Jan 1997 13:13:38 -0500 (EST)
Mime-Version: 1.0 (generated by tm-edit 7.100)
Content-Type: text/plain; charset=US-ASCII
Date: 26 Jan 1997 10:51:54 -0800
Message-ID: <m2enf8p8vp.fsf@altair.xemacs.org>
Lines: 68
X-Mailer: Gnus v5.4.1/XEmacs 20.0

Kyle Jones writes:

> Steven L. Baur writes:
>> Kyle Jones writes:
>> 
>> > (timezone-make-date-sortable "Thu, 9 Beb 1995 15:09:45 +0200 (EET)")
>> > signals
>> 
>> > Wrong type argument: numberp, nil
>> 
>> > I don't what "Beb" is supposed to be, but timezone shouldn't
>> > throw an error in response to it.
>> 
>> Why shouldn't it?  Should it return garbage instead?  Emacs 19.34
>> behaves identically.

> I sent them a bug report, too.

> Well, if it must signal an error, have it signal something more
> reasonable that the caller can catch and deal with.  How about

> (signal 'invalid-date (list "Thu, 9 Beb 1995 15:09:45 +0200 (EET)"))

Is this what you want?

Index: timezone.el
===================================================================
RCS file: /usr/local/xemacs/xemacs-20.0/lisp/utils/timezone.el,v
retrieving revision 1.2
diff -u -r1.2 timezone.el
--- timezone.el	1997/01/23 05:29:44	1.2
+++ timezone.el	1997/01/26 18:48:55
@@ -129,6 +129,9 @@
   "Make time string from HOUR, MINUTE, and SECOND."
   (format "%02d:%02d:%02d" hour minute second))
 
+;;;###autoload
+(define-error 'invalid-date "Invalid date string")
+
 (defun timezone-parse-date (date)
   "Parse DATE and return a vector [YEAR MONTH DAY TIME TIMEZONE].
 19 is prepended to year if necessary.  Timezone may be nil if nothing.
@@ -140,6 +143,8 @@
  (5) 22-AUG-1993 10:59:12.82
  (6) Thu, 11 Apr 16:17:12 91 [MET]
  (7) Mon, 6  Jul 16:47:20 T 1992 [MET]"
+  (condition-case nil
+      (progn
   ;; Get rid of any text properties.
   (and (stringp date)
        (or (text-properties-at 0 date)
@@ -219,7 +224,10 @@
     (if year
 	(vector year month day time zone)
       (vector "0" "0" "0" "0" nil))
-    ))
+    )
+  )
+    (t (signal 'invalid-date (list date))))
+)
 
 (defun timezone-parse-time (time)
   "Parse TIME (HH:MM:SS) and return a vector [hour minute second].

-- 
steve@miranova.com baur
Unsolicited commercial e-mail will be billed at $250/message.
Real men aren't afraid to use chains on icy roads.

