unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tim Cross <tcross@rapttech.com.au>
To: help-gnu-emacs@gnu.org
Subject: Re: File header/title box ??
Date: Sat, 18 Aug 2007 16:03:57 +1000	[thread overview]
Message-ID: <87lkc9xtte.fsf@lion.rapttech.com.au> (raw)
In-Reply-To: mailman.4774.1187112070.32220.help-gnu-emacs@gnu.org

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.

  parent reply	other threads:[~2007-08-18  6:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.4774.1187112070.32220.help-gnu-emacs@gnu.org>
2007-08-14 18:00 ` File header/title box ?? Pascal Bourguignon
2007-08-18  6:03 ` Tim Cross [this message]
2007-08-14 17:21 William Case

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lkc9xtte.fsf@lion.rapttech.com.au \
    --to=tcross@rapttech.com.au \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).