unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* File header/title box ??
@ 2007-08-14 17:21 William Case
  0 siblings, 0 replies; 3+ messages in thread
From: William Case @ 2007-08-14 17:21 UTC (permalink / raw)
  To: EMACS List

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.

Any suggestions, references or copies welcomed.

-- 
Regards Bill

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

* Re: File header/title box ??
       [not found] <mailman.4774.1187112070.32220.help-gnu-emacs@gnu.org>
@ 2007-08-14 18:00 ` Pascal Bourguignon
  2007-08-18  6:03 ` Tim Cross
  1 sibling, 0 replies; 3+ messages in thread
From: Pascal Bourguignon @ 2007-08-14 18:00 UTC (permalink / raw)
  To: help-gnu-emacs

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.
>
> Any suggestions, references or copies welcomed.

I guess most people use skeleton to do that.  I use my own command,
M-x pjb-add-header RET (along with M-x pjb-add-change-log-entry and
M-x pjb-change-license) which inserts this kind of header (comment
style depending on major mode):

/* -*- mode:c;coding:utf-8 -*- */
/*****************************************************************************
FILE:               a.c
LANGUAGE:           c
SYSTEM:             POSIX
USER-INTERFACE:     NONE
DESCRIPTION
    
    XXX
    
AUTHORS
    <PJB> Pascal Bourguignon <pjb@informatimago.com>
MODIFICATIONS
    2007-08-14 <PJB> Created.
BUGS
LEGAL
    GPL
    
    Copyright Pascal Bourguignon 2007 - 2007
    
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version
    2 of the License, or (at your option) any later version.
    
    This program is distributed in the hope that it will be
    useful, but WITHOUT ANY WARRANTY; without even the implied
    warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    PURPOSE.  See the GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public
    License along with this program; if not, write to the Free
    Software Foundation, Inc., 59 Temple Place, Suite 330,
    Boston, MA 02111-1307 USA
*****************************************************************************/


Have a look at http://darcs.informatimago.com/public/emacs/pjb-sources.el
http://www.informatimago.com/develop/emacs/index.html 
CVS instructions not valid anymore, use: 
darcs get http://darcs.informatimago.com/public/emacs


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.

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

* Re: File header/title box ??
       [not found] <mailman.4774.1187112070.32220.help-gnu-emacs@gnu.org>
  2007-08-14 18:00 ` Pascal Bourguignon
@ 2007-08-18  6:03 ` Tim Cross
  1 sibling, 0 replies; 3+ messages in thread
From: Tim Cross @ 2007-08-18  6:03 UTC (permalink / raw)
  To: help-gnu-emacs

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.

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

end of thread, other threads:[~2007-08-18  6:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-14 17:21 File header/title box ?? William Case
     [not found] <mailman.4774.1187112070.32220.help-gnu-emacs@gnu.org>
2007-08-14 18:00 ` Pascal Bourguignon
2007-08-18  6:03 ` Tim Cross

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).