From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Harry Putnam Newsgroups: gmane.emacs.help Subject: Re: Inserting a timestamp in a file Date: Sat, 31 Jan 2009 10:30:47 -0600 Organization: Still searching... Message-ID: <87hc3fjv48.fsf@newsguy.com> References: <40785.25014.qm@web59703.mail.ac4.yahoo.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1233419497 14008 80.91.229.12 (31 Jan 2009 16:31:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 31 Jan 2009 16:31:37 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jan 31 17:32:51 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LTIm0-0008Pk-JR for geh-help-gnu-emacs@m.gmane.org; Sat, 31 Jan 2009 17:32:48 +0100 Original-Received: from localhost ([127.0.0.1]:42641 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LTIki-00088k-7v for geh-help-gnu-emacs@m.gmane.org; Sat, 31 Jan 2009 11:31:28 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LTIkK-00087O-VR for help-gnu-emacs@gnu.org; Sat, 31 Jan 2009 11:31:05 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LTIkK-00086Z-Bl for help-gnu-emacs@gnu.org; Sat, 31 Jan 2009 11:31:04 -0500 Original-Received: from [199.232.76.173] (port=43382 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LTIkK-00086Q-4X for help-gnu-emacs@gnu.org; Sat, 31 Jan 2009 11:31:04 -0500 Original-Received: from main.gmane.org ([80.91.229.2]:36383 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LTIkJ-0004rq-Nc for help-gnu-emacs@gnu.org; Sat, 31 Jan 2009 11:31:03 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1LTIkG-0006Bh-1f for help-gnu-emacs@gnu.org; Sat, 31 Jan 2009 16:31:00 +0000 Original-Received: from c-98-215-178-6.hsd1.in.comcast.net ([98.215.178.6]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 31 Jan 2009 16:31:00 +0000 Original-Received: from reader by c-98-215-178-6.hsd1.in.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 31 Jan 2009 16:31:00 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 34 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: c-98-215-178-6.hsd1.in.comcast.net User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:NPogeLSreznh6qSKg0R+PWt+Z8I= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:61800 Archived-At: Fred Picher 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 ] 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 ' to insert the skeleton