Emacs: the Free Software IDE
Diffing is comparing two files, say two versions of a source file. Most programmers are familiar with diff and patch. Emacs provides a powerful front end for diff and patch. For one thing, Emacs' ediff mode shows the two (or three) files in the editor one above the other. The differences are highlighted on any display capable of color (Figure 10). The entire line is indicated, and the exact differences are indicated in different colors.
Not only that, but you can use single-character commands to move differences from one file to the other; a or b moves the line from the A or B buffer, respectively, to the other. This allows you to walk through two files, compare them and accept or reject each difference.
To step through the two files one difference at a time, put the ediff control panel in focus. Use the spacebar to advance and the P key to go back (Figure 11). Ediff mode can keep up with changes you make on the fly. Try adding a line to goodbye.c right after the printf line, a call to flush();.
Emacs has a huge library of built-in help. The gateway to Emacs' help is Ctrl-H. If you aren't familiar with Emacs at all, get started with the tutorial, Ctrl-H T. If you are already familiar with Emacs, you should walk through the tutorial; there's always something to learn about Emacs.
If you are familiar with the GNU program Info, you already know how to use Emacs' help system. Ctrl-H I gets you to the top menu of the Info system. From there, Memacs gets you to the Emacs documentation. And, of course, the documentation for Info is available from the top-level Info menu.
If you want documentation for other programs or for Linux function calls, you can use Emacs as an Info reader. Or, you can read the man pages from within Emacs. You can use Emacs as a front end for Man with the command M-X manual-entry. Or you can have Emacs interpret the man page and display it for you with the woman (WithOut MAN) package. Since the Cygwin tools for Windows (www.cygwin.com) include man pages but not a program to read them, woman is just the ticket.
For example, to see the man page for printf, put the cursor over the word printf in your source code. Enter M-X woman and press Return. Emacs will propose printf as the default manual entry. There are two printf man pages, one in man 3 and one in man 1. Tell Emacs you want man 3 by pressing 3 Tab. Emacs will complete the filename, then press Return. Emacs will show you the man page for printf.
Emacs is a fully integrated development environment. While a front end for external programs, Emacs uses free software for the back end. In that sense, it is better integrated into Linux than some proprietary IDEs. There is very little missing from Emacs, but if something is missing, Emacs is open-source and free software. You can write it.
Charles Curley (w3.trib.com/~ccurley) lives in Wyoming. He has 23 years' experience with computers, much of that as a software developer. He has worked for Hughes Aircraft, Hewlett-Packard, Microsoft and the Jet Propulsion Lab. He contributed to Sams' Teach Yourself Emacs in 24 Hours (ISBN: 0-672-31594-7).
- Readers' Choice Awards 2013
- Mars Needs Women
- Linux Kernel News - November 2013
- Sublime Text: One Editor to Rule Them All?
- RSS Feeds
- Raspberry Pi: the Perfect Home Server
- December 2013 Issue of Linux Journal: Readers' Choice
- Tech Tip: Really Simple HTTP Server with Python
- IBM Will Minimize Impact of Future Disasters
- Linux Systems Administrator
- The kernel doesn't really
35 min 58 sec ago
1 hour 6 min ago
1 hour 7 min ago
3 hours 11 min ago
- This should be very helpful
4 hours 25 min ago
- As much as I share your point
6 hours 45 min ago
- So girls had it better ?
10 hours 17 min ago
- Reply to comment | Linux Journal
10 hours 37 min ago
- why is GNOME 3 in the fifth position at 14.1 %?
16 hours 9 min ago
- Sublime Is Brilliant!
21 hours 12 min ago