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).
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems
Join editor Bill Childers and Bit9's Paul Riegle on April 27 at 12pm Central to learn how to keep your Linux systems secure.
Free to Linux Journal readers.Register Now!
|diff -u: What's New in Kernel Development||Aug 20, 2014|
|Security Hardening with Ansible||Aug 18, 2014|
|Monitoring Android Traffic with Wireshark||Aug 14, 2014|
|IndieBox: for Gamers Who Miss Boxes!||Aug 13, 2014|
|Non-Linux FOSS: a Virtualized Cisco Infrastructure?||Aug 11, 2014|
|Linux Security Threats on the Rise||Aug 08, 2014|
- diff -u: What's New in Kernel Development
- Security Hardening with Ansible
- Tech Tip: Really Simple HTTP Server with Python
- NSA: Linux Journal is an "extremist forum" and its readers get flagged for extra surveillance
- Monitoring Android Traffic with Wireshark
- [<Megashare>] Watch Mrs Brown's Boys Movie Online Full Movie HD 2014
- RSS Feeds
- Linux Security Threats on the Rise
- Linux Systems Administrator
- Senior Perl Developer