unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Levin Du" <zslevin@gmail.com>
To: emacs-devel@gnu.org
Subject: Fwd: parse-time-string error with non ASCII timestamp
Date: Tue, 17 Apr 2007 18:10:03 +0800	[thread overview]
Message-ID: <9649271a0704170310s5c92163bv15f8d6e8eaef37db@mail.gmail.com> (raw)
In-Reply-To: <1175499420.269736.200740@b75g2000hsg.googlegroups.com>


[-- Attachment #1.1: Type: text/plain, Size: 3240 bytes --]

Hi list,

   I'was dicovering this when inserting timestamp in org-mode.

   My timestamp includes Chinese number, when the following executes:

    (parse-time-string "<2007-04-02 一>")  ; the 12nd char is the
Chinese number.

An error will occur:

Debugger entered--Lisp error: (args-out-of-range [nil nil nil nil nil
nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
nil nil nil nil 1 nil -1 nil nil 48 48 48 48 48 48 48 48 48 48 100 nil
nil nil nil nil nil 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65
65 65 65 65 65 65 65 65 65 nil nil nil nil nil nil 97 97 97 97 97 97
97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 nil nil
nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
nil nil nil nil nil nil nil nil nil nil nil nil] 19968)
  aref([nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
nil nil nil nil nil nil nil nil nil nil nil 1 nil -1 nil nil 48
48 ...] 19968)
  parse-time-string-chars(19968)
  (setq c (parse-time-string-chars (aref string index)))
  (not (setq c (parse-time-string-chars ...)))
  (and (< index end) (not (setq c ...)))
  (while (and (< index end) (not ...)) (incf index))
  (while (< index end) (while (and ... ...) (incf index)) (setq start
index all-digits (eq c 48)) (while (and ... ...) (setq all-
digits ...)) (if (<= index end) (push ... list)))
  (let ((start nil) (end ...) (all-digits nil) (list nil) (index 0) (c
nil)) (while (< index end) (while ... ...) (setq start index all-
digits ...) (while ... ...) (if ... ...)) (nreverse list))
  parse-time-tokenize("<2007-04-02 \x4e00>")
  (let ((time ...) (temp ...)) (while temp (let ... ...)) time)
  parse-time-string("<2007-04-02 \x4e00>")
  eval((parse-time-string "<2007-04-02 \x4e00>"))
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp)


This is a patch I wrote to solve this problem:
*** /home/zslevin/Cook/emacs/lisp/calendar/parse-time.el.orig
2007-04-02 10:01:27.000000000 +0800
--- /home/zslevin/Cook/emacs/lisp/calendar/parse-time.el        2007-04-02
15:35:07.000000000 +0800
***************
*** 66,72 ****
    (aref parse-time-digits char))

  (defsubst parse-time-string-chars (char)
!   (aref parse-time-syntax char))

  (put 'parse-error 'error-conditions '(parse-error error))
  (put 'parse-error 'error-message "Parsing error")
--- 66,73 ----
    (aref parse-time-digits char))

  (defsubst parse-time-string-chars (char)
!   (and (< char (length parse-time-syntax))
!        (aref parse-time-syntax char)))

  (put 'parse-error 'error-conditions '(parse-error error))
  (put 'parse-error 'error-message "Parsing error")


Hope this is useful and can be merged into emacs.

Thanks!

Levin

[-- Attachment #1.2: Type: text/html, Size: 4078 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

       reply	other threads:[~2007-04-17 10:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1175499420.269736.200740@b75g2000hsg.googlegroups.com>
2007-04-17 10:10 ` Levin Du [this message]
2007-04-17 11:20   ` Fwd: parse-time-string error with non ASCII timestamp Kenichi Handa
2007-04-17 11:33     ` Andreas Schwab
2007-04-17 11:50       ` Kenichi Handa
2007-04-17 14:32         ` Andreas Schwab
2007-04-17 23:07           ` Kenichi Handa
2007-04-18  2:02     ` Richard Stallman
2007-04-18  2:46       ` Kenichi Handa

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=9649271a0704170310s5c92163bv15f8d6e8eaef37db@mail.gmail.com \
    --to=zslevin@gmail.com \
    --cc=emacs-devel@gnu.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.
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).