From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim Cross Newsgroups: gmane.emacs.help Subject: Re: File header/title box ?? Date: Sat, 18 Aug 2007 16:03:57 +1000 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <87lkc9xtte.fsf@lion.rapttech.com.au> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1187429174 12865 80.91.229.12 (18 Aug 2007 09:26:14 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 18 Aug 2007 09:26:14 +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 Aug 18 11:26:11 2007 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 1IMKZM-00010c-MF for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Aug 2007 11:26:08 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IMKZL-0006ba-VD for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Aug 2007 05:26:08 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news1.google.com!news.glorb.com!sn-xt-sjc-04!sn-xt-sjc-01!sn-post-sjc-01!supernews.com!corp.supernews.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) Cancel-Lock: sha1:HNAbBNaNRy0lvGxJlmmZI+p+1os= Original-X-Complaints-To: abuse@supernews.com Original-Lines: 65 Original-Xref: shelby.stanford.edu gnu.emacs.help:151099 X-Mailman-Approved-At: Sat, 18 Aug 2007 05:25:37 -0400 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:46673 Archived-At: William Case writes: > Hi; > > Does anyone know where I can find a File header/title box tool that I > can use for C, Lisp and/or shell scripts written in GNUemacs? I have > visited the wiki and there is one called header2.el which seems far more > complex than I need. > > Ideally, it would be something that just includes some kind of outline > box (dependent on the modes comments style) with space for name of file, > brief description of programs purpose, author, date and time of last > modification. That is all I need. > > I was about to write a macro to do the above, then thought someone has > probably already created something simple I could use. One style would > suffice. I could edit for different modes. > I use a 'tempo' template to do this (see below). I've also customized the timestamp stuff so that now when I save the file in emacs, the last modified timestamp is also updated. (require 'tempo) (tempo-define-template "generic-header" '((format "%s" comment-start) " Filename: " (buffer-file-name) 'n (format "%s" comment-start) " Creation Date: " (format-time-string "%A, %d %B %Y %I:%M %p %Z") 'n (format "%s" comment-start) " Last Modified: " 'n (format "%s" comment-start) " Job: " (p "Job: ") 'n (format "%s" comment-start) " Author: Tim Cross " 'n (format "%s" comment-start) " Description:" 'n (format "%s" comment-start) 'n 'n)) ;;; Lets setup some key bindings. (global-set-key [(f5)] 'tempo-template-generic-header) and I use this to get the timestamp stuff to be updated when I modify the file and save it - (add-hook 'write-file-hooks 'time-stamp) (setq time-stamp-active t) (setq time-stamp-format "%:a, %02d %:b %:y %02I:%02M %#P %Z") (setq time-stamp-start "\\(Time-stamp:[ ]+\\\\?[\"<]+\\|Last Modified:[ ]\\)") (setq time-stamp-end "\\\\?[\">]\\|$") (setq time-stamp-line-limit 10) -- Tim Cross tcross@rapttech.com.au There are two types of people in IT - those who do not manage what they understand and those who do not understand what they manage.