unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#3190: Fix for parse-time.el
@ 2009-05-02 14:24 Jan Seeger
  2009-05-02 14:26 ` bug#3190: Forward: " Jan Seeger
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Seeger @ 2009-05-02 14:24 UTC (permalink / raw)
  To: 3190

Greetings!

I have written a quick fix for parse-time.el that uses
POSIX character classes instead of a vector. I'm a novice elisp
hacker, so if there's anything wrong with this patch, tell me.

It is not thoroughly tested, but works for gnus and twittering-mode.el
using german day and month names as configured in the aforementioned
mail.

Regards,
Jan Seeger






^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#3190: Forward: Fix for parse-time.el
  2009-05-02 14:24 bug#3190: Fix for parse-time.el Jan Seeger
@ 2009-05-02 14:26 ` Jan Seeger
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Seeger @ 2009-05-02 14:26 UTC (permalink / raw)
  To: 3190

[-- Attachment #1: Type: text/plain, Size: 399 bytes --]

Sorry, forgot to attach the patch.

Greetings!

I have written a quick fix for parse-time.el that uses
POSIX character classes instead of a vector. I'm a novice elisp
hacker, so if there's anything wrong with this patch, tell me.

It is not thoroughly tested, but works for gnus and twittering-mode.el
using german day and month names as configured in the aforementioned
mail.

Regards,
Jan Seeger


[-- Attachment #2: parse-time.patch --]
[-- Type: application/octet-stream, Size: 1177 bytes --]

--- /usr/share/emacs/22.3/lisp/calendar/parse-time.el	2008-01-07 02:03:33.000000000 +0100
+++ /home/jeeger/.emacs.d/elisp/parse-time.el	2009-05-02 16:20:19.000000000 +0200
@@ -50,24 +50,22 @@
   (loop for i from ?0 to ?9
     do (aset parse-time-digits i (- i ?0))))
 
-(unless (aref parse-time-syntax ?0)
-  (loop for i from ?0 to ?9
-    do (aset parse-time-syntax i ?0))
-  (loop for i from ?A to ?Z
-    do (aset parse-time-syntax i ?A))
-  (loop for i from ?a to ?z
-    do (aset parse-time-syntax i ?a))
-  (aset parse-time-syntax ?+ 1)
-  (aset parse-time-syntax ?- -1)
-  (aset parse-time-syntax ?: ?d)
-  )
-
 (defsubst digit-char-p (char)
   (aref parse-time-digits char))
 
 (defsubst parse-time-string-chars (char)
-  (and (< char (length parse-time-syntax))
-       (aref parse-time-syntax char)))
+  (cond ((string-match "[[:upper:]]" (char-to-string char))
+	 ?A)
+	((string-match "[[:lower:]]" (char-to-string char))
+	 ?a)
+	((string-match "[0-9]" (char-to-string char))
+	 ?0)
+	((eq char ?+)
+	 1)
+	((eq char ?-)
+	 -1)
+	((eq char ?:)
+	 ?d)))
 
 (put 'parse-error 'error-conditions '(parse-error error))
 (put 'parse-error 'error-message "Parsing error")

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-05-02 14:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-02 14:24 bug#3190: Fix for parse-time.el Jan Seeger
2009-05-02 14:26 ` bug#3190: Forward: " Jan Seeger

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).