C, C++ - C and C++ programming language templates
hkc.emf - C programming language hook definition
hkcpp.emf - C++ programming language hook definition
c.etf - C programming language template file
h.etf - C programming language header template file
cpp.etf - C++ programming language template file
hpp.etf - C++ programming language header template file
.c, .h, .def - ANSI C
.cpp, .cc, .hpp, .rc .C (UNIX only) - C++ programming language
.l - LEX
.y - YACC
.i - C (or C++) pre-processed file (i.e. output from pre-processor).
.rc - Microsoft Developer resource file.
-*- c -*-
-*- c++ -*-
The C and C++ file type templates offer the most sophisticated editing features within the MicroEmacs '06 environment.
General Editing
Hilighting
Auto Layout
restyle-region(3) and restyle-buffer(3) are available to reformat (re-layout) selected sections of the buffer, or the whole buffer, respectively.
Comments may be formatted using esc o, which reformats the comments according to the current fill paragraph. If a comment commences with /***... then the comment is automatically formatted to a box. If the comment commentces with /** then the comment is assumed to be a Java Doc comment.
Tags
On invoking the tag generator then the user is presented with a dialog box which specifies the generation option of the tags file. The base directory of the tags file search and tagging options may be specified to locate all of the definitions within the code space.
The tags file is extremely useful where the user is dealing with inherited source code spread over multiple directories. Generation of a recursive tag file with all searching options enabled allows labels to be located extremely rapidly (certainly faster than IDE environments).
Folding and Information Hiding
The Tools -> C Tools menu allows #define's to be evaluated within the buffer. Where the state of a #if is established to be false (using the #define information) then the disabled region of code is grayed out indicating which regions of the code are active.
Working Environment
rcs-file(2) is automatically invoked if an RCS file is detected, the normal check-in/out operations may be performed through the editor.
Short Cuts
C-c C-c - Comment out the current line.
C-c C-d - Uncomment the current line.
C-c C-e - Comment to the end of the line with stars (*).
A-C-i - Restyle the current region.
esc q - Format a comment.
esc o - Format a comment.
f2 - (un)fold the current region
f3 - (un)fold all regions
Additional Commands
If the default language is C++, rather than 'C' the order of the file hooks should be over-ridden in the users local setup, using:-
add-file-hook ".c " fhook-c add-file-hook ".cc .cpp .hpp .rc .h .def .l .y .i" fhook-cpp
This defaults all .h and .def files etc. to be C++ rather than C.
The hilighting is typically extended using a file myc.emf (or mycpp.emf) i.e. to include the usual extended types of int32 etc, myc.emf might be defined as:-
hilight .hilight.c 1 "uint8" .scheme.type hilight .hilight.c 1 "int8" .scheme.type hilight .hilight.c 1 "uint16" .scheme.type hilight .hilight.c 1 "int16" .scheme.type hilight .hilight.c 1 "uint32" .scheme.type hilight .hilight.c 1 "int32" .scheme.type hilight .hilight.c 1 "float32" .scheme.type hilight .hilight.c 1 "float64" .scheme.type
The 'C' and 'C++' templates have been throughly used, there are no known issues with the templates.
The .rc hilighting is a little bogus and should not really be mapped onto .cpp. Do not attept to re-style.
c-deslashify(3), c-slashify(3), c-to-cpp-convert(3), collapse-all(3), collapse-current(3), compile(3), ctags(3f), find-tag(2), rcs-file(2), restyle-buffer(3), restyle-region(3), time(2m).
Copyright (c) 1998-2006 JASSPA
Last Modified: 2005/01/16
Generated On: 2006/10/07