* regexp to match formatted time string?
@ 2008-02-01 22:29 Drew Adams
2008-02-01 23:42 ` Miles Bader
0 siblings, 1 reply; 3+ messages in thread
From: Drew Adams @ 2008-02-01 22:29 UTC (permalink / raw)
To: Emacs-Devel
Anyone have a function that takes, as its argument, a string that is
acceptable as input to `format-time-string' (i.e. a value like
`display-time-format'), and returns a regexp that will match all such
formatted times, that is, whatever `format-time-string' would return for the
same input, for any time?
IOW, (foo ARG UNIVERSAL) would return a regexp that matches
(format-time-string ARG TIME UNIVERSAL), for all values of TIME.
I searched the source code a bit, but didn't find anything. Seems like this
would be useful. For instance, I would use it in some font-locking code, to
match a time/date field, based on the user's preferred time format.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: regexp to match formatted time string?
2008-02-01 22:29 regexp to match formatted time string? Drew Adams
@ 2008-02-01 23:42 ` Miles Bader
2008-02-02 0:07 ` Drew Adams
0 siblings, 1 reply; 3+ messages in thread
From: Miles Bader @ 2008-02-01 23:42 UTC (permalink / raw)
To: Drew Adams; +Cc: Emacs-Devel
"Drew Adams" <drew.adams@oracle.com> writes:
> Anyone have a function that takes, as its argument, a string that is
> acceptable as input to `format-time-string' (i.e. a value like
> `display-time-format'), and returns a regexp that will match all such
> formatted times, that is, whatever `format-time-string' would return for the
> same input, for any time?
It does sound kind of useful, but wouldn't it be rather hard for some of
the formats format-time-string supports -- e.g., %c, %a, or %b?
Maybe that doesn't matter for the typical uses of such a function...
(formats embedded in a file being font-locked would tend to be more
portable ones, perhaps)
-Miles
--
Carefully crafted initial estimates reward you not only with
reduced computational effort, but also with understanding and
increased self-esteem. -- Numerical methods in C,
Chapter 9. "Root Finding and Nonlinear Sets of Equations"
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: regexp to match formatted time string?
2008-02-01 23:42 ` Miles Bader
@ 2008-02-02 0:07 ` Drew Adams
0 siblings, 0 replies; 3+ messages in thread
From: Drew Adams @ 2008-02-02 0:07 UTC (permalink / raw)
To: 'Miles Bader'; +Cc: 'Emacs-Devel'
> > Anyone have a function that takes, as its argument, a string that is
> > acceptable as input to `format-time-string' (i.e. a value like
> > `display-time-format'), and returns a regexp that will
> > match all such formatted times, that is, whatever
> > `format-time-string' would return for the same input,
> > for any time?
>
> It does sound kind of useful, but wouldn't it be rather hard
> for some of the formats format-time-string supports -- e.g.,
> %c, %a, or %b?
>
> Maybe that doesn't matter for the typical uses of such a function...
> (formats embedded in a file being font-locked would tend to be more
> portable ones, perhaps)
Good point.
I would be interested even if such a function were limited wrt the formats
it supported - some well-defined subset of what `format-time-string'
accepts.
The alternative, as I see it, is code that supports only one or a few
hard-coded time formats.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-02-02 0:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-01 22:29 regexp to match formatted time string? Drew Adams
2008-02-01 23:42 ` Miles Bader
2008-02-02 0:07 ` Drew Adams
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.