Emacs is the program editor that we use, it is simple, different than
Software, but efficient!
How to use
At the top of the window you have the menu, at the bottom you
the command line.
Learn to use emacs, learn the shortcuts and have programming fun!!
Files that you open in emacs are stored in buffers, you can
more files, to switch to another file than the currently displayed, use
+ left mouse click to get a list of the files or use menu item Buffers.
File manipulation: under menu item Files
open file: Open File and type in the path of the file at the
tip: if your directory or filename is incomplete, press TAB to
the name. If there are multiple possibilities and you press TAB
again, you get a list of all possibilities.
use the shortcut: Control-x-f (keep the Control key down and
x first and then f)
new file: the same as Open File, type the name of the new file
emacs creates it for you.
save file: Save Buffer or Control-x-s
close file: Kill Current Buffer
use Split Window to visualise multiple files (very handy!)
when your file has changed outside emacs: choose Revert Buffer
upload the changements (this menu item is only activated when the file
has changed outside of emacs)
Menu item Tools: use Print -> Print Buffer to print your
the default printer
Cut: select a text and press Control-w
Copy: just select the text, you don't have to press
always remembers the last selected text
Paste: Control-y or use the middle mouse
Search or Control-S: type the word you are looking
the command line
press Control-S again to find the next
use Query Replace of the Search menu item to replace a
you'll have to press y or n each time to say if you
the word being replaced or not
Esc: to escape from a command in the command line (press 3
Control-e to go the end of the line
Press Escape to exit commands (lot's of times it is necessary
do it multiple times to get back in normal mode)
C++ in emacs
The power of emacs is that it has special features for c or c++ files.
When you open a .c, .h or .cc file, emacs recognises it as a c or c++
you get a coloured file and a c or c++ menu item:
Documentation: Help => Manuals => Browse Manuals with Info
use Comment Out Region to put the selected text in comments
use the Tab key to indent your program automatically!!
press the F3, you get "make -k" in the command line, complete
with the rule of your makefile (the makefile of the directory of the
selected file is used!!) and press ENTER
- if F3 doesn't work, start it via menu Tools -> Compile
- you can type any linux command here
use the Up & Down arrows to reuse old commands (the history)
Control-c-c on an compilation error to go automatically to
the line of the error in the code!