Harley Hahn
Harley Hahn
Santa Barbara, California, USA
Any source code or other supplementary materials referenced by the author in this text are available to readers at www.apress.com/9781484217023 . For detailed information about how to locate your book’s source code, go to www.apress.com/source-code/ . Readers can also access source code at SpringerLink in the Supplementary Material section for each chapter.
ISBN 978-1-4842-1702-3
e-ISBN 978-1-4842-1703-0
DOI 10.1007/978-1-4842-1703-0
Library of Congress Control Number: 2016938804
© Harley Hahn 2016
Harley Hahn’s Emacs Field Guide
The name “Harley Hahn” the Harley Hahn stylized signature, and the Harley Hahn Unisphere logo are registered trademarks of Harley Hahn.
Managing Director: Welmoed Spahr
Lead Editor: Jeffrey Pepper
Technical Reviewer: Dmitry Shkatov
Copyeditor: Lydia Hearn
Editorial Board: Steve Anglin, Pramila Balan, Louise Corrigan, Jonathan Gennick, Robert Hutchinson, Celestin Suresh John, Michelle Lowman, James Markham, Susan McDermott, Matthew Moodie, Jeffrey Pepper, Douglas Pundick, Ben Renow-Clarke, Gwenan Spearing
Coordinating Editor: Mark Powers
Compositor: SPi Global
Indexer: SPi Global
Artist: SPi Global
For information on translations, please e-mail [email protected] , or visit www.apress.com .
Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at www.apress.com/bulk-sales .
Material from this book was published with McGraw-Hill in a chapter on Emacs. This book extends that content into a complete book. We have an email from the McGraw-Hill permissions department saying that the rights were reverted long ago and that will be attached to the contract.This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein.
Printed on acid-free paper
To Maria, for love and support.
And to Sadie (my dog) and Max (Maria’s dog), for being such good company.
You are floating down a narrow, winding river. Much of the time you move slowly, drifting with the current. You have been drifting a long time. Although the current is steady, the water is warm and comfortable, and you don’t even notice it anymore. It just is. Warm, comfortable, predictable.
You are floating peacefully. Still, every now and then, you find yourself wondering: Is something missing? Am I bored? Is that all there is?
One day, you notice that the river is about to bifurcate into two different streams, and you need to make a choice. Which way do you want to go? You look carefully, squinting your eyes against the bright sun, trying to notice the details you are used to taking for granted.
Straight ahead, the water is calm. Do nothing, and you will keep drifting, safely and predictably. And why not? After all, your journey is far from over, and everything seems to be working out just fine. Part of you wants nothing more than to lay back and relax.
To the left, however, the water looks unusual. The current is faster and, in the distance, you see some rapids, although nothing you can’t handle. A memory comes back: Years ago, you used to love the rapids, bouncing up and down for a short time, then resting to catch your breath. You were living in the moment, over and over and over, just being. How long has it been since you had that feeling of really being alive? You can’t remember.
You close your eyes and imagine the map of the river, the map you thought you had memorized. However, you can’t recall a place where one river turns into two. You open your eyes, feeling puzzled, and you see that, soon, you must make a decision.
Here is a promise. If you decide to turn and travel down the unknown branch of the river away from the current, you will find me there, waiting for you, and we will explore together. In fact, I have a map that we will share. There is a lot ahead of us, and I can tell you now that what is just around the bend will take effort. However, I can also tell you it will change your life.
What to do? Should you push against the current and explore the unknown, unexpected branch of the river? Or should you keep drifting in a slow, safe, predictable direction? Even doing nothing is a decision.
My advice? Go to Chapter 1 of this book and read the first three sections.
Then make your choice.
Writing a book requires me to spend many, many hours at home for months at a time, researching, composing and rewriting, alone at my desk, with only my dog Sadie to keep me company. (Sadie is a three-year-old border collie, who doesn’t understand why we don’t spend every day running around outside.) Publishing a book, however, is a team effort, so if you have a moment, I’d like to introduce you to my team.
Let’s start with Lydia Hearn. Lydia and I have worked on books together for a long time, and I have found her to be a truly remarkable person. She is a tenured professor at De Anza College in Cupertino, California, where she teaches English. For this book, Lydia was my copy editor, which means that it was her job to find and correct any writing mistakes I might have made. This is harder than you might imagine, because writers think so fast that their fingers can’t keep up with their thoughts, which means it is easy to make mistakes, many of which are subtle and hard to find. That is why I need Lydia, a tireless perfectionist (actually, a tired perfectionist) with boundless enthusiasm and enormous skill. Moreover, Lydia is the only person in the world that I will, voluntarily, let make changes to what I write.
Next comes Jeff Pepper, the lead editor for this book. Jeff and I started publishing books together a long, long time ago, and it is through his efforts that I have been able to create many of my most successful, high-quality books. Whenever I start a new project with Jeff, I know that he will be there with lots of advice, experience, and a good-natured approach that comes from dealing with authors and publishing people all day long, for many years. In addition, for this particular book, Jeff put in many hours—often late at night and under pressure — processing the files I would send him to ensure that everything was done just right.
The other editor on our team is Mark Powers, who served as managing editor for this book. This means that Mark handled a lot of details, including a schedule that seemed to have a life of its own. Mark has a background, not only in book publishing, but in writing graphic novels and comic books, which makes him uniquely qualified to work with the more esoteric parts of this book.
Then there is Dmitry Shkatov, a very special person whose job it was to help me look for technical mistakes. Dmitry teaches computer science at the University of the Witwatersrand in Johannesburg, South Africa. In fact, if it weren’t for Dmitry, this book would never have been written. Here is how it happened.
On July 20, 2015, Dmitry wrote me the following letter:
Dear Harley,
I was wondering whether it would be possible to somehow get access to the chapter on Emacs from the 2nd edition of your “Student Guide to Unix”, which was sadly left out of the 3rd edition.
It’s the best introduction to Emacs I have ever seen (and that’s how I came to love Emacs), and now that I’m teaching computer science to South African undergraduates, I’d like to be able to share it with my students.
Your assistance would be highly appreciated not only by me, but I am sure, by my students as well.
Not long afterwards, Jeff Pepper contacted me about writing a new book. I showed him Dmitry’s letter, and we agreed that it would be a good idea for me to write a book focusing only on Emacs. We asked Dmitry if he would be the technical editor for the book, and he said yes. This was a stroke of luck for me, because you would have to search long and hard to find someone as smart as Dmitry, who has as much experience with Emacs. Dmitry not only read everything I wrote, making important suggestions, he also took the time to discuss all manner of Emacs-related ideas, which helped me enormously.
Speaking of help, I thank Ron Lockwood-Childs and Stephanie Lockwood-Childs, highly accomplished engineers and programmers, who helped me with advice on how to set up a Linux system to run on a virtual machine, specifically for testing Emacs. In addition, I thank Jebi Koilpillai, for helping me understand and test the technical issues involved in installing Emacs under Mac OS X.
As a writer, I always hope for production people who share my desire to create the best possible book. As such, I wish to thank several hard-working, skillful employees of SPi Global, an international business service provider. These three people are Mercy Thomas (account manager), Dulcy Nirmala Chellappa (project manager), Parameswari Balasubramaniyan (page layout artist), and Samuel Devanand (production editor). Without the time-consuming, detailed work of people like Mercy, Dulcy, Parameswari, and Samuel, it would not be possible to produce high-quality books like this one. I am lucky to have had their help.
For the final acknowledgments, I call upon the wisdom of the ancient Roman poet Juvenal who once observed, if you are going to spend hours a day for months at a time writing an Emacs book, you had better make sure that you get a lot of high-quality exercise, or you are going to have a lot of trouble. (Actually, the way he put it was Mens sana in corpore sano , which means “A healthy mind in a healthy body”.)
With this in mind, I thank Sandrine Rocher-Krul, my cardioboxing teacher, for helping me to stay fit, alert, and healthy. I have taken a lot of classes in my life — as a child, as an undergraduate, in grad school, and in medical school — and without a doubt, Sandrine is the best teacher I have ever had. She has a rare confluence of motivation, skill, and creativity, which she demonstrates daily. For the same reason, I am grateful to the other students with whom I have been taking cardioboxing for so long. In particular, I thank Miguel Trujillo and Abe Solis for their continued encouragement and their help.
Harley Hahn is a writer, philosopher, humorist, abstract artist, musician and computer expert. Hahn has written 33 books, including three university-level Unix/Linux textbooks. In all, Hahn’s books have sold more than 2 million copies, including Harley Hahn’s Internet Yellow Pages , the first Internet book in history to sell more than 1 million copies.
Hahn is the best-selling Internet author of all time, and has had three of his books nominated for a Pulitzer Prize. His work—including a complete set of his books—is archived by the Special Collections Department of the library at the University of California at Santa Barbara.
In addition to books, Hahn has written numerous articles, essays, and stories on a wide variety of topics, including romance, philosophy, money and economics, culture, medicine, and biology. Much of his writing is available on his Web site www.harley.com .
Hahn has a degree in Mathematics and Computer Science from the University of Waterloo (Canada), and a graduate degree in Computer Science from the University of California at San Diego. He has also studied medicine at the University of Toronto Medical School, and has been the recipient of a number of honors and awards, including a prestigious National Research Council (Canada) post-graduate scholarship, and the 1974 George Forsythe Award from the ACM (Association of Computer Machinery).
Of all his endeavors, Hahn most enjoys writing books, because “I get to sleep in, and I like telling people what to do.”
Web Site for This Book
For online support for Harley Hahn’s Emacs Field Guide , please visit:
http://www.harley.com/emacs
At this Web site, you will find a variety of useful information. You can also send a message to Harley Hahn.
Dmitry Shkatov has an MA in Philosophy from Moscow State University, Russia, and a PhD in Computer Science from the University of Nottingham, England. Shkatov lives in South Africa, where he is a Senior Lecturer in Computer Science at the University of the Witwatersrand, Johannesburg.
18.189.22.136