Writing gnu emacs extensions

Solo disponible en BuenasTareas
  • Páginas : 203 (50609 palabras )
  • Descarga(s) : 0
  • Publicado : 24 de abril de 2010
Leer documento completo
Vista previa del texto
Page ii

Writing GNU Emacs Extensions
Bob Glickstein
O'REILLY™ Cambridge • Koln • Paris • Sebastopol • Tokyo

Page iv

Writing GNU Emacs Extensions by Bob Glickstein Copyright © 1997 O'Reilly & Associates, Inc. All rights reserved. Printed in the United States of America. Editor: Andy Oram Production Editors: Kismet McDonough-Chan and Ellie Fountain Maden Printing History: April 1997:First Edition. Nutshell Handbook and the Nutshell Handbook logo are registered trademarks and The Java Series is a trademark of O'Reilly & Associates, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O'Reilly & Associates, Inc. was aware of a trademark claim, the designations havebeen printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher assumes no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.

This book is printed on acid-free paper with 85% recycled content, 15% post-consumer waste. O'Reilly & Associates is committed to using paper withthe highest recycled content available consistent with high quality. ISBN: 1-56592-261-1 [8/97]

Page v

For Mom and Dad, without whom. . . well, I'd just rather not think about it.
Page vii

Table of Contents
Preface 1. Customizing Emacs
Backspace and Delete Lisp Keys and Strings To What Is C-h Bound? To What Should C-h Be Bound? Evaluating Lisp Expressions Apropos

xi 1 1 2 4 7 8 810 13 13 21 23 24 30 33 34 34 35 40

2. Simple New Commands
Traversing Windows Line-at-a-Time Scrolling Other Cursor and Text Motion Commands Clobbering Symbolic Links Advised Buffer Switching Addendum: Raw Prefix Argument

3. Cooperating Commands
The Symptom A Cure Generalizing the Solution

40 4. Searching and Modifying Buffers
Inserting the Current Time

47 47

Page viiiWritestamps Modifystamps

50 65 71 71 72 76 77 78 80 81 81 83 85 87 87 89 93 95 95 96 97 99

5. Lisp Files
Creating a Lisp File Loading the File Compiling the File eval-after-load Local Variables Lists Addendum: Security Consideration

6. Lists
The Simple View of Lists List Details Recursive List Functions Iterative List Functions Other Useful List Functions Destructive List Operations CircularLists?!

7. Minor Mode
Paragraph Filling Modes Defining a Minor Mode Mode Meat

99 8. Evaluation and Error Recovery
limited-save-excursion eval Macro Functions Backquote and Unquote Return Value Failing Gracefully Point Marker

110 110 111 112 113 116 119 120 122 122 123 125 126

9. A Major Mode
My Quips File Major Mode Skeleton Changing the Definition of a Paragraph Quip CommandsPage ix

Keymaps Narrowing Derived Modes

127 130 131 133 133 134 141 148 157 162

10. A Comprehensive Example
New York Times Rules Data Representation User Interface Setting Up the Mode Tracking Unauthorized Changes Parsing the Buffer

Word Finder Last Word

163 181 183 185 185 186 190 193 195 195 195 197 198 200 200 201 201 202 203 203 205 207

Conclusion A. Lisp Quick ReferenceBasics Data Types Control Structure Code Objects

B. Debugging and Profiling
Evaluation The Debugger Edebug The Profiler

C. Sharing Your Code
Preparing Source Files Documentation Copyright Posting

D. Obtaining and Building Emacs
Availability of Packages Unpacking, Building, and Installing Emacs


Page xi

Before you even begin to extend Emacs, it's already thehighest-function text editor there is. Not only can it do everything you'd normally expect (formatting paragraphs, centering lines, searching for patterns, putting a block in upper case), not only does it have advanced features (matching braces in source code, employing color to highlight syntactic elements in your files, giving online help on every keystroke and other commands), but it also...
tracking img