all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Inserting a timestamp in a file
@ 2009-01-29 14:25 Fred Picher
  2009-01-29 16:59 ` Drew Adams
  2009-01-31 16:30 ` Harry Putnam
  0 siblings, 2 replies; 6+ messages in thread
From: Fred Picher @ 2009-01-29 14:25 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

  Is there a way to insert a timestamp at a precise place in a file, eg. is there a function that does this ?

Thanks.



      __________________________________________________________________
Connect with friends from any web browser - no download required. Try the new Yahoo! Canada Messenger for the Web BETA at http://ca.messenger.yahoo.com/webmessengerpromo.php





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

* Re: Inserting a timestamp in a file
       [not found] <mailman.6165.1233240186.26697.help-gnu-emacs@gnu.org>
@ 2009-01-29 16:59 ` Maarten Bergvelt
  2009-01-30 11:26 ` Kiwon Um
  2009-01-31  5:15 ` B. T. Raven
  2 siblings, 0 replies; 6+ messages in thread
From: Maarten Bergvelt @ 2009-01-29 16:59 UTC (permalink / raw)
  To: help-gnu-emacs

On 2009-01-29, Fred Picher <frederificc@yahoo.ca> wrote:
>   Is there a way to insert a timestamp at a precise place in a file, eg. is there a function that does this ?

Did you look at the emacs manual?

-- 
Maarten Bergvelt		


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

* RE: Inserting a timestamp in a file
  2009-01-29 14:25 Fred Picher
@ 2009-01-29 16:59 ` Drew Adams
  2009-01-31 16:30 ` Harry Putnam
  1 sibling, 0 replies; 6+ messages in thread
From: Drew Adams @ 2009-01-29 16:59 UTC (permalink / raw)
  To: frederificc, help-gnu-emacs

> Is there a way to insert a timestamp at a precise place in 
> a file, eg. is there a function that does this ?

http://www.emacswiki.org/emacs/TimeStamp

For Emacs 21 and later, that page also points you to the Emacs manual, node Time
Stamps.





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

* Re: Inserting a timestamp in a file
       [not found] <mailman.6165.1233240186.26697.help-gnu-emacs@gnu.org>
  2009-01-29 16:59 ` Inserting a timestamp in a file Maarten Bergvelt
@ 2009-01-30 11:26 ` Kiwon Um
  2009-01-31  5:15 ` B. T. Raven
  2 siblings, 0 replies; 6+ messages in thread
From: Kiwon Um @ 2009-01-30 11:26 UTC (permalink / raw)
  To: help-gnu-emacs

On Jan 29, 11:25 pm, Fred Picher <frederif...@yahoo.ca> wrote:
> Hello,
>
>   Is there a way to insert a timestamp at a precise place in a file, eg. is there a function that does this ?
>
> Thanks.
>
>       __________________________________________________________________
> Connect with friends from any web browser - no download required. Try the new Yahoo! Canada Messenger for the Web BETA athttp://ca.messenger.yahoo.com/webmessengerpromo.php

Check yasnippet, http://code.google.com/p/yasnippet/ :)


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

* Re: Inserting a timestamp in a file
       [not found] <mailman.6165.1233240186.26697.help-gnu-emacs@gnu.org>
  2009-01-29 16:59 ` Inserting a timestamp in a file Maarten Bergvelt
  2009-01-30 11:26 ` Kiwon Um
@ 2009-01-31  5:15 ` B. T. Raven
  2 siblings, 0 replies; 6+ messages in thread
From: B. T. Raven @ 2009-01-31  5:15 UTC (permalink / raw)
  To: help-gnu-emacs

Fred Picher wrote:
> Hello,
> 
>   Is there a way to insert a timestamp at a precise place in a file, eg. is there a function that does this ?
> 
> Thanks.
> 

This has to go in one of the first eight lines of the file

;; Time-stamp: ""

then this (or equivalent code) in your .emacs:

(add-hook 'write-file-hooks 'time-stamp)

I suppose you could copy it programatically anywhere else in the file if 
you needed to, say at a bookmark. That would have to be done again 
everytime you saved. What's the usefulness of putting the time stamp at 
an arbitrary place? A save saves the whole file.

Ed




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

* Re: Inserting a timestamp in a file
  2009-01-29 14:25 Fred Picher
  2009-01-29 16:59 ` Drew Adams
@ 2009-01-31 16:30 ` Harry Putnam
  1 sibling, 0 replies; 6+ messages in thread
From: Harry Putnam @ 2009-01-31 16:30 UTC (permalink / raw)
  To: help-gnu-emacs

Fred Picher <frederificc@yahoo.ca> writes:

> Hello,
>
>   Is there a way to insert a timestamp at a precise place in a file,
>   eg. is there a function that does this ?

Sounds like the kind of thing skeletons are good for.  If you want
something more customized than the existing timestamp functions. (Like
I did) take a look at skeletons here:

     (info "(autotype)Top")

This example may help you get it the way you want:

I wanted something for adding timestamped comments to files in a
certain format... like this:

# [HP 01/31/09_10:24:55 <MY COMMENT GOES HERE> ]

You can get just about any style time format you want by messing with
format-time-string.

This code inserts the above timestamp comment 
(minus the stuff above between `<>')

(define-skeleton hp-comdate
	"Insert #[HP] comment and 
	date string with no newline."
	nil
	"# [HP "
	(format-time-string "%m/%d/%y_%T ") _ " ] ")

So then you can say `M-x hp-comdate <RET>' to insert the skeleton





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

end of thread, other threads:[~2009-01-31 16:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.6165.1233240186.26697.help-gnu-emacs@gnu.org>
2009-01-29 16:59 ` Inserting a timestamp in a file Maarten Bergvelt
2009-01-30 11:26 ` Kiwon Um
2009-01-31  5:15 ` B. T. Raven
2009-01-29 14:25 Fred Picher
2009-01-29 16:59 ` Drew Adams
2009-01-31 16:30 ` Harry Putnam

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.