emacs-devel
[Top][All Lists]
Advanced

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

Re: Shorter and more flexible implementation for parse-time.el


From: Lars Ingebrigtsen
Subject: Re: Shorter and more flexible implementation for parse-time.el
Date: Sat, 24 Jul 2021 14:12:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

"Guu, Jin-Cheng" <jcguu95@gmail.com> writes:

> Currently, the built-in time parsing functions only allow us to parse
> timestrings with respect to some given formats (ISO-8601, RFC-822)
> [1]. I have a parsing function that allows users to parse with
> customized formats which are easy to write. The end result is:
>
> ``` emacs-lisp
> (my/parse-time "20200718-201504"
>                '((:year 4) (:month 2) (:day 2) "-"
>                  (:hour 2) (:minute 2) (:second 2)))
> ;; => ((:second . 4) (:minute . 15) (:hour . 20)
> ;;     (:day . 18) (:month . 7) (:year . 2020))
> ```

It's an interesting approach, but in my experience (having written
parsers for probably more than a hundred different time formats), this
doesn't really get you very far -- the formats often vary in length, use
month names, and so on, so you end up having to write tiny functions for
every format.

So I'm not sure having something like this in Emacs would help that much.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



reply via email to

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