* Update time stamps of different kind
@ 2009-07-15 14:23 Uwe Siart
2009-07-15 15:46 ` Peter Dyballa
[not found] ` <mailman.2561.1247672821.2239.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 8+ messages in thread
From: Uwe Siart @ 2009-07-15 14:23 UTC (permalink / raw)
To: help-gnu-emacs
Dear all,
I have (add-hook 'before-save-hook 'time-stamp) in my site-start.el in
order to automatically update the time stamp before saving.
Is it also possible to instruct Emacs to update a line like
<meta name="DC.date" content="2009-07-15" />
(Dublin Core meta data in XHTML) in the same way?
--
Uwe
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Update time stamps of different kind
2009-07-15 14:23 Update time stamps of different kind Uwe Siart
@ 2009-07-15 15:46 ` Peter Dyballa
[not found] ` <mailman.2561.1247672821.2239.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 8+ messages in thread
From: Peter Dyballa @ 2009-07-15 15:46 UTC (permalink / raw)
To: Uwe Siart; +Cc: help-gnu-emacs
Am 15.07.2009 um 16:23 schrieb Uwe Siart:
> Is it also possible to instruct Emacs to update a line like
>
> <meta name="DC.date" content="2009-07-15" />
>
> (Dublin Core meta data in XHTML) in the same way?
I presume only the date of the content clause needs updates…
For this a variable exists which you can customise:
time-stamp-format is a variable defined in `time-stamp.el'.
Its value is
"%:y-%02m-%02d %02H:%02M:%02S %u"
This variable is safe as a file local variable if its value
satisfies the predicate `stringp'.
Making it a file local variable you can have as global setting
something else. For you "%:y-%02m-%02d" might be right! The time
stamp needs to be in the first few lines of a file.
--
Mit friedvollen Grüßen
Pete
Atheism is a non prophet organization.
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <mailman.2561.1247672821.2239.help-gnu-emacs@gnu.org>]
* Re: Update time stamps of different kind
[not found] ` <mailman.2561.1247672821.2239.help-gnu-emacs@gnu.org>
@ 2009-07-15 16:35 ` Uwe Siart
2009-07-15 17:21 ` Drew Adams
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Uwe Siart @ 2009-07-15 16:35 UTC (permalink / raw)
To: help-gnu-emacs
Peter Dyballa <Peter_Dyballa@Web.DE> writes:
> Making it a file local variable you can have as global setting
> something else. For you "%:y-%02m-%02d" might be right!
Thank you, Peter. From this I conclude that there's no easy way to get
both, the usual time stamp in its default format "%:y-%02m-%02d
%02H:%02M:%02S %u" plus the meta information updated?
> The time stamp needs to be in the first few lines of a file.
Is it possible to overcome this limitation? I mean to extend the
possible area from the first 8 lines to, say, the first 20 lines?
--
Uwe
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: Update time stamps of different kind
2009-07-15 16:35 ` Uwe Siart
@ 2009-07-15 17:21 ` Drew Adams
2009-07-15 17:28 ` Peter Dyballa
[not found] ` <mailman.2572.1247678929.2239.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 8+ messages in thread
From: Drew Adams @ 2009-07-15 17:21 UTC (permalink / raw)
To: 'Uwe Siart', help-gnu-emacs
> > Making it a file local variable you can have as global setting
> > something else. For you "%:y-%02m-%02d" might be right!
>
> Thank you, Peter. From this I conclude that there's no easy way to get
> both, the usual time stamp in its default format "%:y-%02m-%02d
> %02H:%02M:%02S %u" plus the meta information updated?
>
> > The time stamp needs to be in the first few lines of a file.
>
> Is it possible to overcome this limitation? I mean to extend the
> possible area from the first 8 lines to, say, the first 20 lines?
I don't have time to check exactly what you want to do and how to do it, but you
might want to take a look here:
http://www.emacswiki.org/emacs/AutomaticFileHeaders#header2
http://www.emacswiki.org/emacs/header2.el
That code uses a custom time stamp, with no limit on where you put it.
See also function `format-time-string'. You can use it to get a time stamp of
various forms - quite flexible.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Update time stamps of different kind
2009-07-15 16:35 ` Uwe Siart
2009-07-15 17:21 ` Drew Adams
@ 2009-07-15 17:28 ` Peter Dyballa
[not found] ` <mailman.2572.1247678929.2239.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 8+ messages in thread
From: Peter Dyballa @ 2009-07-15 17:28 UTC (permalink / raw)
To: Uwe Siart; +Cc: help-gnu-emacs
Am 15.07.2009 um 18:35 schrieb Uwe Siart:
> Thank you, Peter. From this I conclude that there's no easy way to get
> both, the usual time stamp in its default format "%:y-%02m-%02d
> %02H:%02M:%02S %u" plus the meta information updated?
It is my default value. I don't know what mean with "meta
information" – is it that you want to see "<some text> <a date>?" IMO
it should be possible to have a format like
"<some funny text> %:y-%02m-%02d <even more funny text!>"
Look up the documentation for details! (C-h v when the text cursor is
in the variable's name)
>
>> The time stamp needs to be in the first few lines of a file.
>
> Is it possible to overcome this limitation? I mean to extend the
> possible area from the first 8 lines to, say, the first 20 lines?
Sorry, I don't know (and I'm in a hurry). Could be time-stamp.el
offers something.
--
Mit friedvollen Grüßen
Pete (:
_ / __ - -
_/ \__/_/ - -
(´`) (´`) - -
`´ `´
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <mailman.2572.1247678929.2239.help-gnu-emacs@gnu.org>]
* Re: Update time stamps of different kind
[not found] ` <mailman.2572.1247678929.2239.help-gnu-emacs@gnu.org>
@ 2009-07-15 17:44 ` Uwe Siart
2009-07-15 23:49 ` Peter Dyballa
[not found] ` <mailman.2596.1247701758.2239.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 8+ messages in thread
From: Uwe Siart @ 2009-07-15 17:44 UTC (permalink / raw)
To: help-gnu-emacs
Peter Dyballa <Peter_Dyballa@Web.DE> writes:
> I don't know what mean with "meta information" – is it that you want
> to see "<some text> <a date>?"
Sorry, this was not in proper context. With "meta information" in mean
the HTML meta tag I mentioned in my OP.
What I would like to reach is the following: In HTML files I have both
the full Emacs time stamp and an HTML meta tag that is read by index
bots. So what I want is that both lines
,----
| <!-- Time-stamp: "2009-07-08 09:19:15 siart" -->
| <meta name="DC.date" content="2009-07-08" />
`----
are updated on save. But as I understand this difficult because
time-stamp-format can of course have just one value at a time.
I will check what I can do with header2.el.
--
Uwe
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Update time stamps of different kind
2009-07-15 17:44 ` Uwe Siart
@ 2009-07-15 23:49 ` Peter Dyballa
[not found] ` <mailman.2596.1247701758.2239.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 8+ messages in thread
From: Peter Dyballa @ 2009-07-15 23:49 UTC (permalink / raw)
To: Uwe Siart; +Cc: help-gnu-emacs
Am 15.07.2009 um 19:44 schrieb Uwe Siart:
> ,----
> | <!-- Time-stamp: "2009-07-08 09:19:15 siart" -->
> | <meta name="DC.date" content="2009-07-08" />
> `----
I found kind of a work-around, which does not work correctly! Maybe
it gives you some hints…
I changed the two-liner to:
<meta name="DC.date" content="2009-07-15" /> <!-- "2009-07-13
00:10:18 dunno" -->
and the file's tail to:
</body>
<!-- Local Variables: -->
<!-- eval: (add-hook 'write-file-hooks 'time-stamp) -->
<!-- eval: (add-hook 'write-file-hooks 'delete-trailing-whitespace) -->
<!-- mode: html-helper -->
<!-- fill-column: 99999 -->
<!-- time-stamp-start: " <meta name=\"DC.date\" content=\"" -->
<!-- time-stamp-format: "%:y-%02m-%02d\" /> <!-- \"%:y-%02m-%02d %
02H:%02M:%02S %u" -->
<!-- End: -->
</html>
If time-stamp is not in global write-file-hooks it's added here
locally. Also the function delete-trailing-whitespace is added (which
is not safe by default, you'll need to declare it as save by typing
``!´´ when you're prompted). The mode line is not that meaningful,
that with fill-column neither, just examples. The local variable time-
stamp-start overrides the default "Timestamp" value. Here part of the
standard header is defined as local substitute. Next comes the real
time-stamp-format. Maybe it's possible to insert a newline there…
A final setting of time-stamp-end is also possible.
The HTML test file with these additions loads OK in GNU Emacs and
displays OK in an HTML browser. When I save the file *Messages* shows:
Saving file ....silly.html...
timestamp delimiter start was not found
and the header now is something like this:
<meta name="DC.date" content="2009-07-16" /> <!-- "2009-07-16
01:38:56 pete" /> <!-- "2009-07-16 01:38:56 pete" /> <!--
"2009-07-13 00:10:18 dunno" -->
So repetition due to some malfunction/error exists! The `` -->´´ in
the footer are not wrong or too much, they're needed. Maybe a block
comment for the local variables section is better.
--
Mit friedvollen Grüßen
Pete
Specifications are for the weak and timid!
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <mailman.2596.1247701758.2239.help-gnu-emacs@gnu.org>]
* Re: Update time stamps of different kind
[not found] ` <mailman.2596.1247701758.2239.help-gnu-emacs@gnu.org>
@ 2009-07-16 5:06 ` Uwe Siart
0 siblings, 0 replies; 8+ messages in thread
From: Uwe Siart @ 2009-07-16 5:06 UTC (permalink / raw)
To: help-gnu-emacs
Peter Dyballa <Peter_Dyballa@Web.DE> writes:
> Am 15.07.2009 um 19:44 schrieb Uwe Siart:
>
>> ,----
>> | <!-- Time-stamp: "2009-07-08 09:19:15 siart" -->
>> | <meta name="DC.date" content="2009-07-08" />
>> `----
>
> I found kind of a work-around, which does not work correctly! Maybe it
> gives you some hints…
>
> [...]
>
> So repetition due to some malfunction/error exists! The `` -->´´ in
> the footer are not wrong or too much, they're needed. Maybe a block
> comment for the local variables section is better.
Many thanks for your efforts. I will take inspirations from your
suggestions which seem to be very close to what I need.
--
Uwe
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-07-16 5:06 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-15 14:23 Update time stamps of different kind Uwe Siart
2009-07-15 15:46 ` Peter Dyballa
[not found] ` <mailman.2561.1247672821.2239.help-gnu-emacs@gnu.org>
2009-07-15 16:35 ` Uwe Siart
2009-07-15 17:21 ` Drew Adams
2009-07-15 17:28 ` Peter Dyballa
[not found] ` <mailman.2572.1247678929.2239.help-gnu-emacs@gnu.org>
2009-07-15 17:44 ` Uwe Siart
2009-07-15 23:49 ` Peter Dyballa
[not found] ` <mailman.2596.1247701758.2239.help-gnu-emacs@gnu.org>
2009-07-16 5:06 ` Uwe Siart
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.