An Introduction to Programming in Emacs Lisp
Robert .J Chassell
Computers & Technology
An Introduction to Programming in Emacs Lisp
Free
Description
Contents
Reviews

This tutorial is an elementary introduction to teach non-programmers how to customize their work environment; it can also be used as an introduction to programming basics. It includes numerous exercises and sample programs; the author also walks you through the actual source code of several GNU Emacs commands. A handy reference appendix is included.



Emacs Lisp is a simple, complete, and powerful programming language. It is the building block of GNU Emacs, which is an integrated development environment with special features for scanning and parsing text as well as for handling multiple files, buffers, displays, windows, and sub-processors.



This text will show you:


  • how to set variables and write function definitions

  • How to use "if" and "let"


  • How to write "while" loops and recursive loops


  • How to search for a word or expression


  • How to customize GNU Emacs for yourself, even when it is shared on a network.


  • How to debug programs


and much more.
This revised third edition covers new features included in GNU Emacs version 21, while remaining compatible with earlier versions.



Print copies available for purchase from the Free Software Foundation.
Language
English
ISBN
1-882114-43-4
Preface
On Reading this Text
For Whom This is Written
Lisp History
A Note for Novices
Thank You
List Processing
Lisp Lists
Lisp Atoms
Whitespace in Lists
GNU Emacs Helps You Type Lists
Run a Program
Generate an Error Message
Symbol Names and Function Definitions
The Lisp Interpreter
Byte Compiling
Evaluation
Evaluating Inner Lists
Variables
Error Message for a Symbol Without a Function
Error Message for a Symbol Without a Value
Arguments
Arguments' Data Types
An Argument as the Value of a Variable or List
Variable Number of Arguments
Using the Wrong Type Object as an Argument
The message Function
Setting the Value of a Variable
Using set
Using setq
Counting
Summary
Exercises
Practicing Evaluation
Buffer Names
Getting Buffers
Switching Buffers
Buffer Size and the Location of Point
Exercise
How To Write Function Definitions
The defun Macro
Install a Function Definition
Change a Function Definition
Make a Function Interactive
An Interactive multiply-by-seven
Different Options for interactive
Install Code Permanently
let
The Parts of a let Expression
Sample let Expression
Uninitialized Variables in a let Statement
The if Special Form
The type-of-animal Function in Detail
If--then--else Expressions
Truth and Falsehood in Emacs Lisp
save-excursion
Template for a save-excursion Expression
Review
Exercises
A Few Buffer--Related Functions
Finding More Information
A Simplified beginning-of-buffer Definition
The Definition of mark-whole-buffer
Body of mark-whole-buffer
The Definition of append-to-buffer
The append-to-buffer Interactive Expression
The Body of append-to-buffer
save-excursion in append-to-buffer
Review
Exercises
A Few More Complex Functions
The Definition of copy-to-buffer
The Definition of insert-buffer
The Interactive Expression in insert-buffer
A Read-only Buffer
b in an Interactive Expression
The Body of the insert-buffer Function
insert-buffer With an if Instead of an or
The or in the Body
The let Expression in insert-buffer
New Body for insert-buffer
Complete Definition of beginning-of-buffer
Optional Arguments
beginning-of-buffer with an Argument
What happens in a large buffer
What happens in a small buffer
The Complete beginning-of-buffer
Review
optional Argument Exercise
Narrowing and Widening
The save-restriction Special Form
what-line
Exercise with Narrowing
car, cdr, cons: Fundamental Functions
car and cdr
cons
Find the Length of a List: length
nthcdr
nth
setcar
setcdr
Exercise
Cutting and Storing Text
zap-to-char
The interactive Expression
The Body of zap-to-char
The search-forward Function
The progn Special Form
Summing up zap-to-char
kill-region
condition-case
Lisp macro
copy-region-as-kill
The Body of copy-region-as-kill
The kill-append function
The kill-new function
Digression into C
Initializing a Variable with defvar
defvar and an asterisk
Review
Searching Exercises
How Lists are Implemented
Symbols as a Chest of Drawers
Exercise
Yanking Text Back
Kill Ring Overview
The kill-ring-yank-pointer Variable
Exercises with yank and nthcdr
Loops and Recursion
while
A while Loop and a List
An Example: print-elements-of-list
A Loop with an Incrementing Counter
Example with incrementing counter
The parts of the function definition
Putting the function definition together
Loop with a Decrementing Counter
Example with decrementing counter
The parts of the function definition
Putting the function definition together
Save your time: dolist and dotimes
The dolist Macro
The dotimes Macro
Recursion
Building Robots: Extending the Metaphor
The Parts of a Recursive Definition
Recursion with a List
Recursion in Place of a Counter
An argument of 3 or 4
Recursion Example Using cond
Recursive Patterns
Recursive Pattern: every
Recursive Pattern: accumulate
Recursive Pattern: keep
Recursion without Deferments
No Deferment Solution
Looping Exercise
Regular Expression Searches
The Regular Expression for sentence-end
The re-search-forward Function
forward-sentence
The while loops
The regular expression search
forward-paragraph: a Goldmine of Functions
The let* expression
The forward motion while loop
Create Your Own TAGS File
Review
Exercises with re-search-forward
Counting via Repetition and Regexps
The count-words-example Function
The Whitespace Bug in count-words-example
Count Words Recursively
Exercise: Counting Punctuation
Counting Words in a defun
What to Count?
What Constitutes a Word or Symbol?
The count-words-in-defun Function
Count Several defuns Within a File
Find a File
lengths-list-file in Detail
Count Words in defuns in Different Files
The append Function
Recursively Count Words in Different Files
Prepare the Data for Display in a Graph
Sorting Lists
Making a List of Files
Counting function definitions
Readying a Graph
The graph-body-print Function
The recursive-graph-body-print Function
Need for Printed Axes
Exercise
Your .emacs File
Site-wide Initialization Files
Specifying Variables using defcustom
Beginning a .emacs File
Text and Auto Fill Mode
Mail Aliases
Indent Tabs Mode
Some Keybindings
Keymaps
Loading Files
Autoloading
A Simple Extension: line-to-top-of-window
X11 Colors
Miscellaneous Settings for a .emacs File
A Modified Mode Line
Debugging
debug
debug-on-entry
debug-on-quit and (debug)
The edebug Source Level Debugger
Debugging Exercises
Conclusion
The the-the Function
Handling the Kill Ring
The current-kill Function
yank
yank-pop
The ring.el File
A Graph with Labeled Axes
The print-graph Varlist
The print-Y-axis Function
Side Trip: Compute a Remainder
Construct a Y Axis Element
Create a Y Axis Column
The Not Quite Final Version of print-Y-axis
The print-X-axis Function
X Axis Tic Marks
Printing the Whole Graph
Testing print-graph
Graphing Numbers of Words and Symbols
A lambda Expression: Useful Anonymity
The mapcar Function
Another Bug ...{} Most Insidious
The Printed Graph
Free Software and Free Manuals
GNU Free Documentation License
Index
The book hasn't received reviews yet.