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

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

Re: onSave comment file


From: Tim X
Subject: Re: onSave comment file
Date: 26 Jul 2003 18:48:11 +1000
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

>>>>> "Patrick" == Patrick  <ptully@avatartechnology.com> writes:

 Patrick> Hi, I know this must be possible, because emacs is the best
 Patrick> editor ever (and probly already exists, but I just haven't
 Patrick> found how to do it).  I was wondering how I could do the
 Patrick> following:

 Patrick> When i save a file (C-x C-s), I would like emacs to insert a
 Patrick> comment which contains the author name and timestamp into
 Patrick> the first 2 or 3 lines of the edited file, but would like
 Patrick> this to be done automaticly, instead of running a separate
 Patrick> command.  Ideally it would also overwrite the first couple
 Patrick> lines (not append).  Does anyone know how to do this or
 Patrick> point to some How-to?  Thanks,

 Patrick> -Patrick-

time-stamp.el will do the time stamp bit for you. If its functionality
is not quite enough (e.g. need to add author name etc), write a
function which does what you want and then you just need to find a
hook to attach it to which runs when the file is saved. Have a look at
time-stamp.el and see what hook it uses and attach your function to
that hook.

Alternatively, use one of the template modes which sets up an initial
template that includes the necessary text for time-stamp mode and
which adds the author when the file is created. Each time you save the
file, the timestamp will be updated.

Finally, consider using RCS/CVS - it supports tags which are
automatically updated when you check in a file and which can give you
a better history of change details etc.

Tim
Tim
-- 
Tim Cross
The e-mail address on this message is FALSE (obviously!). My real e-mail is
to a company in Australia called rapttech and my login is tcross - if you 
really need to send mail, you should be able to work it out!


reply via email to

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