LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-26-2004, 06:33 PM   #1
astrowill
Member
 
Registered: Aug 2003
Posts: 32

Rep: Reputation: 15
automatic comments in emacs


When I write Java programs for school, the beginning of each .java file has my name and the date. Eclipse does this automatically, but I'd rather use Emacs. Is there a way to make Emacs automatically write in such text for every new .java file?
 
Old 07-26-2004, 09:56 PM   #2
waynechen
LQ Newbie
 
Registered: Jul 2004
Location: Beijing
Posts: 3

Rep: Reputation: 0
it seems that CVS 's magic string may help you to solve that problem.
$Date$
$Author$

when you checkout or commit your projects, the magic strings will be changed automatically.
 
Old 07-27-2004, 08:09 AM   #3
astrowill
Member
 
Registered: Aug 2003
Posts: 32

Original Poster
Rep: Reputation: 15
Do you mean that I can put
/********
@$Author$
@$Date$
*********/
and it'll fill them in? Where does it get the Name from? Oh, and I was hoping Emacs could enter that whole thing automatically upon creation of a .java file.
 
Old 07-27-2004, 09:40 PM   #4
waynechen
LQ Newbie
 
Registered: Jul 2004
Location: Beijing
Posts: 3

Rep: Reputation: 0
reply

here is the manual:
http://www.gnu.org/software/cvs/manu..._mono/cvs.html

$Author$ will add the login name automatically
$Date$ will record the commit date
$Head$ will record the standard header file info
$Id$ will do as $Header$ without path info
.....................
 
Old 07-27-2004, 11:30 PM   #5
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
you can record macros in emacs.
for all repetitive work !
type
Cntrl-x (
return
emacs is now recording your keystrokes
when you are done
Cntrl-x )
Cntrl-g to cancel
to execute your macro
Cntrl-x e
to see if it'e right
to save your macro
Esc-x name-last-kbd-macro
return
<macroname>
return
or
Alt-x name-last-kbd-macro
(you know how to use the escape key i know !)
return
now open up ~/.emacs
Cntrl-x Cntrl-f ~/.emacs
return
esc->
or Alt->
to go to the end of the file
Esc-x insert-kbd-macro
return
<macroname>
return
Cntrl-x Cntrl-s
to save the file

now to use your new macro
Esc-x <macroname>
return
or of course
Alt-x <macroname>

Last edited by foo_bar_foo; 07-27-2004 at 11:31 PM.
 
Old 07-28-2004, 11:26 AM   #6
astrowill
Member
 
Registered: Aug 2003
Posts: 32

Original Poster
Rep: Reputation: 15
waynechen: I do need to RTFM, so thanks for the link. (edit: it goes to the CVS manual?) foo_bar_foo, a macro might be exactly what I need -- thanks.

Last edited by astrowill; 07-28-2004 at 11:29 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
where is the .emacs file in the emacs source code tarball? aizkorri Programming 2 01-13-2007 02:05 PM
automatic revision data comments cherylchase Linux - Software 0 08-03-2005 12:44 PM
emacs not responding to .emacs file in Mandriva 2005 LE. Please help LaptopLinux Mandriva 1 06-08-2005 08:36 AM
about c comments minil Programming 1 05-02-2005 01:32 AM
edb (emacs database) won't open file - emacs 20 & 21 tip184 Linux - Software 0 04-03-2004 07:31 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration