help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File header/title box ??


From: Tim Cross
Subject: Re: File header/title box ??
Date: Sat, 18 Aug 2007 16:03:57 +1000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux)

William Case <billlinux@rogers.com> 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 <tcross@xxxxx>" '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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]