aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorGlenn Morris2012-05-28 17:53:40 -0700
committerGlenn Morris2012-05-28 17:53:40 -0700
commitd6adf7e76832deca38030d75a1b1bf00484c9a1b (patch)
treef21eb1efd69c923c80ade494ea345008a2b5b124 /doc
parentc1dabff00ce92b13275326acce40821aacd5afd8 (diff)
downloademacs-d6adf7e76832deca38030d75a1b1bf00484c9a1b.tar.gz
emacs-d6adf7e76832deca38030d75a1b1bf00484c9a1b.zip
* doc/lispintro/emacs-lisp-intro.texi: Nuke hand-written node pointers.
(dolist, dotimes): Fix sectioning.
Diffstat (limited to 'doc')
-rw-r--r--doc/lispintro/ChangeLog5
-rw-r--r--doc/lispintro/emacs-lisp-intro.texi731
2 files changed, 299 insertions, 437 deletions
diff --git a/doc/lispintro/ChangeLog b/doc/lispintro/ChangeLog
index 126c10c4342..af84726af81 100644
--- a/doc/lispintro/ChangeLog
+++ b/doc/lispintro/ChangeLog
@@ -1,3 +1,8 @@
12012-05-29 Glenn Morris <rgm@gnu.org>
2
3 * emacs-lisp-intro.texi: Nuke hand-written node pointers.
4 (dolist, dotimes): Fix sectioning.
5
12012-05-12 Glenn Morris <rgm@gnu.org> 62012-05-12 Glenn Morris <rgm@gnu.org>
2 7
3 * Makefile.in (MKDIR_P): New, set by configure. 8 * Makefile.in (MKDIR_P): New, set by configure.
diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi
index 9446333db2a..04e3e0c8649 100644
--- a/doc/lispintro/emacs-lisp-intro.texi
+++ b/doc/lispintro/emacs-lisp-intro.texi
@@ -315,7 +315,7 @@ supports it in developing GNU and promoting software freedom.''
315@contents 315@contents
316 316
317@ifnottex 317@ifnottex
318@node Top, Preface, (dir), (dir) 318@node Top
319@top An Introduction to Programming in Emacs Lisp 319@top An Introduction to Programming in Emacs Lisp
320 320
321@insertcopying 321@insertcopying
@@ -829,8 +829,7 @@ Printing the Whole Graph
829@end detailmenu 829@end detailmenu
830@end menu 830@end menu
831 831
832@node Preface, List Processing, Top, Top 832@node Preface
833@comment node-name, next, previous, up
834@unnumbered Preface 833@unnumbered Preface
835 834
836Most of the GNU Emacs integrated environment is written in the programming 835Most of the GNU Emacs integrated environment is written in the programming
@@ -858,8 +857,8 @@ editing in the most general sense of the word.)
858* Thank You:: 857* Thank You::
859@end menu 858@end menu
860 859
861@node Why, On Reading this Text, Preface, Preface
862@ifnottex 860@ifnottex
861@node Why
863@unnumberedsec Why Study Emacs Lisp? 862@unnumberedsec Why Study Emacs Lisp?
864@end ifnottex 863@end ifnottex
865 864
@@ -873,8 +872,7 @@ Emacs Lisp is designed to get you started: to guide you in learning the
873fundamentals of programming, and more importantly, to show you how you 872fundamentals of programming, and more importantly, to show you how you
874can teach yourself to go further. 873can teach yourself to go further.
875 874
876@node On Reading this Text, Who You Are, Why, Preface 875@node On Reading this Text
877@comment node-name, next, previous, up
878@unnumberedsec On Reading this Text 876@unnumberedsec On Reading this Text
879 877
880All through this document, you will see little sample programs you can 878All through this document, you will see little sample programs you can
@@ -924,8 +922,7 @@ Emacs to help you understand what puzzles you or to find out how to do
924something new. This self-reliance is not only a pleasure, but an 922something new. This self-reliance is not only a pleasure, but an
925advantage. 923advantage.
926 924
927@node Who You Are, Lisp History, On Reading this Text, Preface 925@node Who You Are
928@comment node-name, next, previous, up
929@unnumberedsec For Whom This is Written 926@unnumberedsec For Whom This is Written
930 927
931This text is written as an elementary introduction for people who are 928This text is written as an elementary introduction for people who are
@@ -987,7 +984,7 @@ quoted above. And, of course, after you have read this
987@cite{Introduction}, you will find the @cite{Reference Manual} useful 984@cite{Introduction}, you will find the @cite{Reference Manual} useful
988when you are writing your own programs. 985when you are writing your own programs.
989 986
990@node Lisp History, Note for Novices, Who You Are, Preface 987@node Lisp History
991@unnumberedsec Lisp History 988@unnumberedsec Lisp History
992@cindex Lisp history 989@cindex Lisp history
993 990
@@ -1004,8 +1001,7 @@ standard in the 1980s. However, Emacs Lisp is much simpler than Common
1004Lisp. (The standard Emacs distribution contains an optional extensions 1001Lisp. (The standard Emacs distribution contains an optional extensions
1005file, @file{cl.el}, that adds many Common Lisp features to Emacs Lisp.) 1002file, @file{cl.el}, that adds many Common Lisp features to Emacs Lisp.)
1006 1003
1007@node Note for Novices, Thank You, Lisp History, Preface 1004@node Note for Novices
1008@comment node-name, next, previous, up
1009@unnumberedsec A Note for Novices 1005@unnumberedsec A Note for Novices
1010 1006
1011If you don't know GNU Emacs, you can still read this document 1007If you don't know GNU Emacs, you can still read this document
@@ -1052,8 +1048,7 @@ A note on terminology: when I use the word Lisp alone, I often am
1052referring to the various dialects of Lisp in general, but when I speak 1048referring to the various dialects of Lisp in general, but when I speak
1053of Emacs Lisp, I am referring to GNU Emacs Lisp in particular. 1049of Emacs Lisp, I am referring to GNU Emacs Lisp in particular.
1054 1050
1055@node Thank You, , Note for Novices, Preface 1051@node Thank You
1056@comment node-name, next, previous, up
1057@unnumberedsec Thank You 1052@unnumberedsec Thank You
1058 1053
1059My thanks to all who helped me with this book. My especial thanks to 1054My thanks to all who helped me with this book. My especial thanks to
@@ -1099,8 +1094,7 @@ Robert J. Chassell
1099@global@pageno = 1 1094@global@pageno = 1
1100@end iftex 1095@end iftex
1101 1096
1102@node List Processing, Practicing Evaluation, Preface, Top 1097@node List Processing
1103@comment node-name, next, previous, up
1104@chapter List Processing 1098@chapter List Processing
1105 1099
1106To the untutored eye, Lisp is a strange programming language. In Lisp 1100To the untutored eye, Lisp is a strange programming language. In Lisp
@@ -1129,8 +1123,7 @@ Errors, , Generate an Error Message}.} Lists are the basis of Lisp.
1129* Error Message Exercises:: 1123* Error Message Exercises::
1130@end menu 1124@end menu
1131 1125
1132@node Lisp Lists, Run a Program, List Processing, List Processing 1126@node Lisp Lists
1133@comment node-name, next, previous, up
1134@section Lisp Lists 1127@section Lisp Lists
1135@cindex Lisp Lists 1128@cindex Lisp Lists
1136 1129
@@ -1161,8 +1154,8 @@ like flowers in a field with a stone wall around them.
1161* Typing Lists:: How GNU Emacs helps you type lists. 1154* Typing Lists:: How GNU Emacs helps you type lists.
1162@end menu 1155@end menu
1163 1156
1164@node Numbers Lists, Lisp Atoms, Lisp Lists, Lisp Lists
1165@ifnottex 1157@ifnottex
1158@node Numbers Lists
1166@unnumberedsubsec Numbers, Lists inside of Lists 1159@unnumberedsubsec Numbers, Lists inside of Lists
1167@end ifnottex 1160@end ifnottex
1168 1161
@@ -1190,8 +1183,7 @@ The components of this list are the words @samp{this}, @samp{list},
1190list is made up of the words @samp{a}, @samp{list}, @samp{inside}, 1183list is made up of the words @samp{a}, @samp{list}, @samp{inside},
1191@samp{of}, @samp{it}. 1184@samp{of}, @samp{it}.
1192 1185
1193@node Lisp Atoms, Whitespace in Lists, Numbers Lists, Lisp Lists 1186@node Lisp Atoms
1194@comment node-name, next, previous, up
1195@subsection Lisp Atoms 1187@subsection Lisp Atoms
1196@cindex Lisp Atoms 1188@cindex Lisp Atoms
1197 1189
@@ -1271,8 +1263,7 @@ is used for messages that a computer can print for a human to read.
1271Strings are a different kind of atom than numbers or symbols and are 1263Strings are a different kind of atom than numbers or symbols and are
1272used differently. 1264used differently.
1273 1265
1274@node Whitespace in Lists, Typing Lists, Lisp Atoms, Lisp Lists 1266@node Whitespace in Lists
1275@comment node-name, next, previous, up
1276@subsection Whitespace in Lists 1267@subsection Whitespace in Lists
1277@cindex Whitespace in lists 1268@cindex Whitespace in lists
1278 1269
@@ -1312,8 +1303,7 @@ marks, a symbol looks like a word, and a number looks like a number.
1312(For certain situations, square brackets, dots and a few other special 1303(For certain situations, square brackets, dots and a few other special
1313characters may be used; however, we will go quite far without them.) 1304characters may be used; however, we will go quite far without them.)
1314 1305
1315@node Typing Lists, , Whitespace in Lists, Lisp Lists 1306@node Typing Lists
1316@comment node-name, next, previous, up
1317@subsection GNU Emacs Helps You Type Lists 1307@subsection GNU Emacs Helps You Type Lists
1318@cindex Help typing lists 1308@cindex Help typing lists
1319@cindex Formatting help 1309@cindex Formatting help
@@ -1335,8 +1325,7 @@ in Lisp must have its closing parenthesis match its opening
1335parenthesis. (@xref{Major Modes, , Major Modes, emacs, The GNU Emacs 1325parenthesis. (@xref{Major Modes, , Major Modes, emacs, The GNU Emacs
1336Manual}, for more information about Emacs's modes.) 1326Manual}, for more information about Emacs's modes.)
1337 1327
1338@node Run a Program, Making Errors, Lisp Lists, List Processing 1328@node Run a Program
1339@comment node-name, next, previous, up
1340@section Run a Program 1329@section Run a Program
1341@cindex Run a program 1330@cindex Run a program
1342@cindex Program, running one 1331@cindex Program, running one
@@ -1398,8 +1387,7 @@ from the humanly readable expression to the language of the computer.
1398But before discussing this (@pxref{Variables}), we will discuss what the 1387But before discussing this (@pxref{Variables}), we will discuss what the
1399Lisp interpreter does when you make an error. 1388Lisp interpreter does when you make an error.
1400 1389
1401@node Making Errors, Names & Definitions, Run a Program, List Processing 1390@node Making Errors
1402@comment node-name, next, previous, up
1403@section Generate an Error Message 1391@section Generate an Error Message
1404@cindex Generate an error message 1392@cindex Generate an error message
1405@cindex Error message generation 1393@cindex Error message generation
@@ -1549,8 +1537,7 @@ The error message can be understood: @samp{Symbol's function
1549definition is void:@: this}. The symbol (that is, the word 1537definition is void:@: this}. The symbol (that is, the word
1550@samp{this}) lacks instructions for the computer to carry out. 1538@samp{this}) lacks instructions for the computer to carry out.
1551 1539
1552@node Names & Definitions, Lisp Interpreter, Making Errors, List Processing 1540@node Names & Definitions
1553@comment node-name, next, previous, up
1554@section Symbol Names and Function Definitions 1541@section Symbol Names and Function Definitions
1555@cindex Symbol names 1542@cindex Symbol names
1556 1543
@@ -1584,8 +1571,7 @@ Thus, all the names for functions that deal with Texinfo start with
1584@samp{texinfo-} and those for functions that deal with reading mail 1571@samp{texinfo-} and those for functions that deal with reading mail
1585start with @samp{rmail-}. 1572start with @samp{rmail-}.
1586 1573
1587@node Lisp Interpreter, Evaluation, Names & Definitions, List Processing 1574@node Lisp Interpreter
1588@comment node-name, next, previous, up
1589@section The Lisp Interpreter 1575@section The Lisp Interpreter
1590@cindex Lisp interpreter, what it does 1576@cindex Lisp interpreter, what it does
1591@cindex Interpreter, what it does 1577@cindex Interpreter, what it does
@@ -1610,8 +1596,8 @@ yourself or the computer.
1610* Byte Compiling:: Specially processing code for speed. 1596* Byte Compiling:: Specially processing code for speed.
1611@end menu 1597@end menu
1612 1598
1613@node Complications, Byte Compiling, Lisp Interpreter, Lisp Interpreter
1614@ifnottex 1599@ifnottex
1600@node Complications
1615@unnumberedsubsec Complications 1601@unnumberedsubsec Complications
1616@end ifnottex 1602@end ifnottex
1617 1603
@@ -1642,7 +1628,7 @@ used by the enclosing expression.
1642Otherwise, the interpreter works left to right, from one expression to 1628Otherwise, the interpreter works left to right, from one expression to
1643the next. 1629the next.
1644 1630
1645@node Byte Compiling, , Complications, Lisp Interpreter 1631@node Byte Compiling
1646@subsection Byte Compiling 1632@subsection Byte Compiling
1647@cindex Byte compiling 1633@cindex Byte compiling
1648 1634
@@ -1665,8 +1651,7 @@ the topic here. @xref{Byte Compilation, , Byte Compilation, elisp,
1665The GNU Emacs Lisp Reference Manual}, for a full description of byte 1651The GNU Emacs Lisp Reference Manual}, for a full description of byte
1666compilation. 1652compilation.
1667 1653
1668@node Evaluation, Variables, Lisp Interpreter, List Processing 1654@node Evaluation
1669@comment node-name, next, previous, up
1670@section Evaluation 1655@section Evaluation
1671@cindex Evaluation 1656@cindex Evaluation
1672 1657
@@ -1682,8 +1667,8 @@ Collegiate Dictionary}.
1682* Evaluating Inner Lists:: Lists within lists... 1667* Evaluating Inner Lists:: Lists within lists...
1683@end menu 1668@end menu
1684 1669
1685@node How the Interpreter Acts, Evaluating Inner Lists, Evaluation, Evaluation
1686@ifnottex 1670@ifnottex
1671@node How the Interpreter Acts
1687@unnumberedsubsec How the Lisp Interpreter Acts 1672@unnumberedsubsec How the Lisp Interpreter Acts
1688@end ifnottex 1673@end ifnottex
1689 1674
@@ -1709,8 +1694,7 @@ In summary, evaluating a symbolic expression most commonly causes the
1709Lisp interpreter to return a value and perhaps carry out a side effect; 1694Lisp interpreter to return a value and perhaps carry out a side effect;
1710or else produce an error. 1695or else produce an error.
1711 1696
1712@node Evaluating Inner Lists, , How the Interpreter Acts, Evaluation 1697@node Evaluating Inner Lists
1713@comment node-name, next, previous, up
1714@subsection Evaluating Inner Lists 1698@subsection Evaluating Inner Lists
1715@cindex Inner list evaluation 1699@cindex Inner list evaluation
1716@cindex Evaluating inner lists 1700@cindex Evaluating inner lists
@@ -1773,8 +1757,7 @@ instructions in the function definition attached to that name. If a
1773symbol by itself is evaluated, something different happens, as we will 1757symbol by itself is evaluated, something different happens, as we will
1774see in the next section. 1758see in the next section.
1775 1759
1776@node Variables, Arguments, Evaluation, List Processing 1760@node Variables
1777@comment node-name, next, previous, up
1778@section Variables 1761@section Variables
1779@cindex Variables 1762@cindex Variables
1780 1763
@@ -1813,8 +1796,8 @@ function definition, and vice-verse.
1813* Void Variable:: The error message for a symbol without a value. 1796* Void Variable:: The error message for a symbol without a value.
1814@end menu 1797@end menu
1815 1798
1816@node fill-column Example, Void Function, Variables, Variables
1817@ifnottex 1799@ifnottex
1800@node fill-column Example
1818@unnumberedsubsec @code{fill-column}, an Example Variable 1801@unnumberedsubsec @code{fill-column}, an Example Variable
1819@end ifnottex 1802@end ifnottex
1820 1803
@@ -1851,8 +1834,7 @@ A symbol can be bound to a value in several ways. @xref{set & setq, ,
1851Setting the Value of a Variable}, for information about one way to do 1834Setting the Value of a Variable}, for information about one way to do
1852this. 1835this.
1853 1836
1854@node Void Function, Void Variable, fill-column Example, Variables 1837@node Void Function
1855@comment node-name, next, previous, up
1856@subsection Error Message for a Symbol Without a Function 1838@subsection Error Message for a Symbol Without a Function
1857@cindex Symbol without function error 1839@cindex Symbol without function error
1858@cindex Error for symbol without function 1840@cindex Error for symbol without function
@@ -1904,8 +1886,7 @@ Symbol's function definition is void:@: fill-column
1904another key.) 1886another key.)
1905@end ignore 1887@end ignore
1906 1888
1907@node Void Variable, , Void Function, Variables 1889@node Void Variable
1908@comment node-name, next, previous, up
1909@subsection Error Message for a Symbol Without a Value 1890@subsection Error Message for a Symbol Without a Value
1910@cindex Symbol without value error 1891@cindex Symbol without value error
1911@cindex Error for symbol without value 1892@cindex Error for symbol without value
@@ -1971,8 +1952,7 @@ Symbol's value as variable is void:@: +
1971The meaning is the same as in GNU Emacs 22. 1952The meaning is the same as in GNU Emacs 22.
1972@end ignore 1953@end ignore
1973 1954
1974@node Arguments, set & setq, Variables, List Processing 1955@node Arguments
1975@comment node-name, next, previous, up
1976@section Arguments 1956@section Arguments
1977@cindex Arguments 1957@cindex Arguments
1978@cindex Passing information to functions 1958@cindex Passing information to functions
@@ -2025,8 +2005,7 @@ have two different function definitions at the same time.)}
2025* message:: A useful function for sending messages. 2005* message:: A useful function for sending messages.
2026@end menu 2006@end menu
2027 2007
2028@node Data types, Args as Variable or List, Arguments, Arguments 2008@node Data types
2029@comment node-name, next, previous, up
2030@subsection Arguments' Data Types 2009@subsection Arguments' Data Types
2031@cindex Data types 2010@cindex Data types
2032@cindex Types of data 2011@cindex Types of data
@@ -2080,8 +2059,7 @@ and extracts a part. However, @code{substring} is only able to extract
2080a substring from an argument that is a string, not from another type of 2059a substring from an argument that is a string, not from another type of
2081atom such as a number or symbol. 2060atom such as a number or symbol.
2082 2061
2083@node Args as Variable or List, Variable Number of Arguments, Data types, Arguments 2062@node Args as Variable or List
2084@comment node-name, next, previous, up
2085@subsection An Argument as the Value of a Variable or List 2063@subsection An Argument as the Value of a Variable or List
2086 2064
2087An argument can be a symbol that returns a value when it is evaluated. 2065An argument can be a symbol that returns a value when it is evaluated.
@@ -2122,8 +2100,7 @@ the final string. The function @code{number-to-string} converts the
2122integer that the addition function returns to a string. 2100integer that the addition function returns to a string.
2123@code{number-to-string} is also known as @code{int-to-string}.) 2101@code{number-to-string} is also known as @code{int-to-string}.)
2124 2102
2125@node Variable Number of Arguments, Wrong Type of Argument, Args as Variable or List, Arguments 2103@node Variable Number of Arguments
2126@comment node-name, next, previous, up
2127@subsection Variable Number of Arguments 2104@subsection Variable Number of Arguments
2128@cindex Variable number of arguments 2105@cindex Variable number of arguments
2129@cindex Arguments, variable number of 2106@cindex Arguments, variable number of
@@ -2167,8 +2144,7 @@ In this set, the functions have three arguments each:
2167@end group 2144@end group
2168@end smallexample 2145@end smallexample
2169 2146
2170@node Wrong Type of Argument, message, Variable Number of Arguments, Arguments 2147@node Wrong Type of Argument
2171@comment node-name, next, previous, up
2172@subsection Using the Wrong Type Object as an Argument 2148@subsection Using the Wrong Type Object as an Argument
2173@cindex Wrong type of argument 2149@cindex Wrong type of argument
2174@cindex Argument, wrong type of 2150@cindex Argument, wrong type of
@@ -2262,8 +2238,7 @@ This says, in different words, the same as the top line of the
2262@file{*Backtrace*} buffer. 2238@file{*Backtrace*} buffer.
2263@end ignore 2239@end ignore
2264 2240
2265@node message, , Wrong Type of Argument, Arguments 2241@node message
2266@comment node-name, next, previous, up
2267@subsection The @code{message} Function 2242@subsection The @code{message} Function
2268@findex message 2243@findex message
2269 2244
@@ -2375,8 +2350,7 @@ When your fill column is 70 and you evaluate the expression, the
2375message @code{"He saw 38 red foxes leaping."} appears in your echo 2350message @code{"He saw 38 red foxes leaping."} appears in your echo
2376area. 2351area.
2377 2352
2378@node set & setq, Summary, Arguments, List Processing 2353@node set & setq
2379@comment node-name, next, previous, up
2380@section Setting the Value of a Variable 2354@section Setting the Value of a Variable
2381@cindex Variable, setting value 2355@cindex Variable, setting value
2382@cindex Setting value of variable 2356@cindex Setting value of variable
@@ -2396,8 +2370,7 @@ work but also illustrate how arguments are passed.
2396* Counting:: Using @code{setq} to count. 2370* Counting:: Using @code{setq} to count.
2397@end menu 2371@end menu
2398 2372
2399@node Using set, Using setq, set & setq, set & setq 2373@node Using set
2400@comment node-name, next, previous, up
2401@subsection Using @code{set} 2374@subsection Using @code{set}
2402@findex set 2375@findex set
2403 2376
@@ -2453,8 +2426,7 @@ a value after it was evaluated, the @code{set} would attempt to set
2453the value that was returned. There are situations where this is the 2426the value that was returned. There are situations where this is the
2454right thing for the function to do; but such situations are rare.) 2427right thing for the function to do; but such situations are rare.)
2455 2428
2456@node Using setq, Counting, Using set, set & setq 2429@node Using setq
2457@comment node-name, next, previous, up
2458@subsection Using @code{setq} 2430@subsection Using @code{setq}
2459@findex setq 2431@findex setq
2460 2432
@@ -2514,8 +2486,7 @@ part of its name. The name is chosen because the symbol has a value,
2514specifically a list, attached to it; or, expressed another way, 2486specifically a list, attached to it; or, expressed another way,
2515the symbol is set to ``point'' to the list. 2487the symbol is set to ``point'' to the list.
2516 2488
2517@node Counting, , Using setq, set & setq 2489@node Counting
2518@comment node-name, next, previous, up
2519@subsection Counting 2490@subsection Counting
2520@cindex Counting 2491@cindex Counting
2521 2492
@@ -2561,8 +2532,7 @@ is then returned as the value of the inner list and passed to the
2561@code{setq} which sets the variable @code{counter} to this new value. 2532@code{setq} which sets the variable @code{counter} to this new value.
2562Thus, the value of the variable, @code{counter}, is changed. 2533Thus, the value of the variable, @code{counter}, is changed.
2563 2534
2564@node Summary, Error Message Exercises, set & setq, List Processing 2535@node Summary
2565@comment node-name, next, previous, up
2566@section Summary 2536@section Summary
2567 2537
2568Learning Lisp is like climbing a hill in which the first part is the 2538Learning Lisp is like climbing a hill in which the first part is the
@@ -2624,8 +2594,7 @@ an error); in addition, it may also carry out some action called a
2624create a side effect. 2594create a side effect.
2625@end itemize 2595@end itemize
2626 2596
2627@node Error Message Exercises, , Summary, List Processing 2597@node Error Message Exercises
2628@comment node-name, next, previous, up
2629@section Exercises 2598@section Exercises
2630 2599
2631A few simple exercises: 2600A few simple exercises:
@@ -2647,8 +2616,7 @@ Write an expression that prints a message in the echo area when
2647evaluated. 2616evaluated.
2648@end itemize 2617@end itemize
2649 2618
2650@node Practicing Evaluation, Writing Defuns, List Processing, Top 2619@node Practicing Evaluation
2651@comment node-name, next, previous, up
2652@chapter Practicing Evaluation 2620@chapter Practicing Evaluation
2653@cindex Practicing evaluation 2621@cindex Practicing evaluation
2654@cindex Evaluation practice 2622@cindex Evaluation practice
@@ -2673,8 +2641,8 @@ buffer-related functions, to see how they were written.
2673* Evaluation Exercise:: 2641* Evaluation Exercise::
2674@end menu 2642@end menu
2675 2643
2676@node How to Evaluate, Buffer Names, Practicing Evaluation, Practicing Evaluation
2677@ifnottex 2644@ifnottex
2645@node How to Evaluate
2678@unnumberedsec How to Evaluate 2646@unnumberedsec How to Evaluate
2679@end ifnottex 2647@end ifnottex
2680 2648
@@ -2705,8 +2673,7 @@ next few sections are important in their own right. A study of these
2705functions makes clear the distinction between buffers and files, how to 2673functions makes clear the distinction between buffers and files, how to
2706switch to a buffer, and how to determine a location within it. 2674switch to a buffer, and how to determine a location within it.
2707 2675
2708@node Buffer Names, Getting Buffers, How to Evaluate, Practicing Evaluation 2676@node Buffer Names
2709@comment node-name, next, previous, up
2710@section Buffer Names 2677@section Buffer Names
2711@findex buffer-name 2678@findex buffer-name
2712@findex buffer-file-name 2679@findex buffer-file-name
@@ -2831,8 +2798,7 @@ you to change the contents of the buffer. But you can do this in any
2831buffer you can edit; and when you write code or documentation (such as 2798buffer you can edit; and when you write code or documentation (such as
2832this book), this feature is very useful. 2799this book), this feature is very useful.
2833 2800
2834@node Getting Buffers, Switching Buffers, Buffer Names, Practicing Evaluation 2801@node Getting Buffers
2835@comment node-name, next, previous, up
2836@section Getting Buffers 2802@section Getting Buffers
2837@findex current-buffer 2803@findex current-buffer
2838@findex other-buffer 2804@findex other-buffer
@@ -2900,8 +2866,7 @@ just switched is visible to you in another window, @code{other-buffer}
2900will choose the most recent buffer that you cannot see; this is a 2866will choose the most recent buffer that you cannot see; this is a
2901subtlety that I often forget.}. 2867subtlety that I often forget.}.
2902 2868
2903@node Switching Buffers, Buffer Size & Locations, Getting Buffers, Practicing Evaluation 2869@node Switching Buffers
2904@comment node-name, next, previous, up
2905@section Switching Buffers 2870@section Switching Buffers
2906@findex switch-to-buffer 2871@findex switch-to-buffer
2907@findex set-buffer 2872@findex set-buffer
@@ -2990,8 +2955,7 @@ the function as an entity that can do something for you if you `call'
2990it---just as a plumber is an entity who can fix a leak if you call him 2955it---just as a plumber is an entity who can fix a leak if you call him
2991or her. 2956or her.
2992 2957
2993@node Buffer Size & Locations, Evaluation Exercise, Switching Buffers, Practicing Evaluation 2958@node Buffer Size & Locations
2994@comment node-name, next, previous, up
2995@section Buffer Size and the Location of Point 2959@section Buffer Size and the Location of Point
2996@cindex Size of buffer 2960@cindex Size of buffer
2997@cindex Buffer size 2961@cindex Buffer size
@@ -3058,14 +3022,13 @@ or a program, to operations on just a part of a buffer.
3058function @code{point-max} returns the value of the maximum permissible 3022function @code{point-max} returns the value of the maximum permissible
3059value of point in the current buffer. 3023value of point in the current buffer.
3060 3024
3061@node Evaluation Exercise, , Buffer Size & Locations, Practicing Evaluation 3025@node Evaluation Exercise
3062@section Exercise 3026@section Exercise
3063 3027
3064Find a file with which you are working and move towards its middle. 3028Find a file with which you are working and move towards its middle.
3065Find its buffer name, file name, length, and your position in the file. 3029Find its buffer name, file name, length, and your position in the file.
3066 3030
3067@node Writing Defuns, Buffer Walk Through, Practicing Evaluation, Top 3031@node Writing Defuns
3068@comment node-name, next, previous, up
3069@chapter How To Write Function Definitions 3032@chapter How To Write Function Definitions
3070@cindex Definition writing 3033@cindex Definition writing
3071@cindex Function definition writing 3034@cindex Function definition writing
@@ -3095,8 +3058,8 @@ symbol refers to it.)
3095* defun Exercises:: 3058* defun Exercises::
3096@end menu 3059@end menu
3097 3060
3098@node Primitive Functions, defun, Writing Defuns, Writing Defuns
3099@ifnottex 3061@ifnottex
3062@node Primitive Functions
3100@unnumberedsec An Aside about Primitive Functions 3063@unnumberedsec An Aside about Primitive Functions
3101@end ifnottex 3064@end ifnottex
3102@cindex Primitive functions 3065@cindex Primitive functions
@@ -3121,8 +3084,7 @@ mention the distinction only because it is interesting to know. Indeed,
3121unless you investigate, you won't know whether an already-written 3084unless you investigate, you won't know whether an already-written
3122function is written in Emacs Lisp or C. 3085function is written in Emacs Lisp or C.
3123 3086
3124@node defun, Install, Primitive Functions, Writing Defuns 3087@node defun
3125@comment node-name, next, previous, up
3126@section The @code{defun} Special Form 3088@section The @code{defun} Special Form
3127@findex defun 3089@findex defun
3128@cindex Special form of @code{defun} 3090@cindex Special form of @code{defun}
@@ -3294,8 +3256,7 @@ Installing a function is the process that tells the Lisp interpreter the
3294definition of the function. Installation is described in the next 3256definition of the function. Installation is described in the next
3295section. 3257section.
3296 3258
3297@node Install, Interactive, defun, Writing Defuns 3259@node Install
3298@comment node-name, next, previous, up
3299@section Install a Function Definition 3260@section Install a Function Definition
3300@cindex Install a Function Definition 3261@cindex Install a Function Definition
3301@cindex Definition installation 3262@cindex Definition installation
@@ -3332,8 +3293,8 @@ Emacs. To reload code automatically whenever you start Emacs, see
3332* Change a defun:: How to change a function definition. 3293* Change a defun:: How to change a function definition.
3333@end menu 3294@end menu
3334 3295
3335@node Effect of installation, Change a defun, Install, Install
3336@ifnottex 3296@ifnottex
3297@node Effect of installation
3337@unnumberedsubsec The effect of installation 3298@unnumberedsubsec The effect of installation
3338@end ifnottex 3299@end ifnottex
3339 3300
@@ -3363,8 +3324,7 @@ Multiply NUMBER by seven.
3363@noindent 3324@noindent
3364(To return to a single window on your screen, type @kbd{C-x 1}.) 3325(To return to a single window on your screen, type @kbd{C-x 1}.)
3365 3326
3366@node Change a defun, , Effect of installation, Install 3327@node Change a defun
3367@comment node-name, next, previous, up
3368@subsection Change a Function Definition 3328@subsection Change a Function Definition
3369@cindex Changing a function definition 3329@cindex Changing a function definition
3370@cindex Function definition, how to change 3330@cindex Function definition, how to change
@@ -3409,8 +3369,7 @@ In summary, this is how you write code in Emacs Lisp: you write a
3409function; install it; test it; and then make fixes or enhancements and 3369function; install it; test it; and then make fixes or enhancements and
3410install it again. 3370install it again.
3411 3371
3412@node Interactive, Interactive Options, Install, Writing Defuns 3372@node Interactive
3413@comment node-name, next, previous, up
3414@section Make a Function Interactive 3373@section Make a Function Interactive
3415@cindex Interactive functions 3374@cindex Interactive functions
3416@findex interactive 3375@findex interactive
@@ -3434,8 +3393,8 @@ each time you typed a key, it would be very distracting.
3434* multiply-by-seven in detail:: The interactive version. 3393* multiply-by-seven in detail:: The interactive version.
3435@end menu 3394@end menu
3436 3395
3437@node Interactive multiply-by-seven, multiply-by-seven in detail, Interactive, Interactive
3438@ifnottex 3396@ifnottex
3397@node Interactive multiply-by-seven
3439@unnumberedsubsec An Interactive @code{multiply-by-seven}, An Overview 3398@unnumberedsubsec An Interactive @code{multiply-by-seven}, An Overview
3440@end ifnottex 3399@end ifnottex
3441 3400
@@ -3490,8 +3449,7 @@ A prefix argument is passed to an interactive function by typing the
3490typing @kbd{C-u} and then a number, for example, @kbd{C-u 3 M-e} (if you 3449typing @kbd{C-u} and then a number, for example, @kbd{C-u 3 M-e} (if you
3491type @kbd{C-u} without a number, it defaults to 4). 3450type @kbd{C-u} without a number, it defaults to 4).
3492 3451
3493@node multiply-by-seven in detail, , Interactive multiply-by-seven, Interactive 3452@node multiply-by-seven in detail
3494@comment node-name, next, previous, up
3495@subsection An Interactive @code{multiply-by-seven} 3453@subsection An Interactive @code{multiply-by-seven}
3496 3454
3497Let's look at the use of the special form @code{interactive} and then at 3455Let's look at the use of the special form @code{interactive} and then at
@@ -3560,8 +3518,7 @@ expression whose first element is @code{message}; but when embedded in a
3560function, @code{message} prints the text as a side effect without 3518function, @code{message} prints the text as a side effect without
3561quotes.) 3519quotes.)
3562 3520
3563@node Interactive Options, Permanent Installation, Interactive, Writing Defuns 3521@node Interactive Options
3564@comment node-name, next, previous, up
3565@section Different Options for @code{interactive} 3522@section Different Options for @code{interactive}
3566@cindex Options for @code{interactive} 3523@cindex Options for @code{interactive}
3567@cindex Interactive options 3524@cindex Interactive options
@@ -3639,8 +3596,7 @@ for an example. @xref{Using Interactive, , Using @code{Interactive},
3639elisp, The GNU Emacs Lisp Reference Manual}, for a more complete 3596elisp, The GNU Emacs Lisp Reference Manual}, for a more complete
3640explanation about this technique. 3597explanation about this technique.
3641 3598
3642@node Permanent Installation, let, Interactive Options, Writing Defuns 3599@node Permanent Installation
3643@comment node-name, next, previous, up
3644@section Install Code Permanently 3600@section Install Code Permanently
3645@cindex Install code permanently 3601@cindex Install code permanently
3646@cindex Permanent code installation 3602@cindex Permanent code installation
@@ -3688,8 +3644,7 @@ the Free Software Foundation, and properly protect yourself and
3688others, it may be included in the next release of Emacs. In large 3644others, it may be included in the next release of Emacs. In large
3689part, this is how Emacs has grown over the past years, by donations. 3645part, this is how Emacs has grown over the past years, by donations.
3690 3646
3691@node let, if, Permanent Installation, Writing Defuns 3647@node let
3692@comment node-name, next, previous, up
3693@section @code{let} 3648@section @code{let}
3694@findex let 3649@findex let
3695 3650
@@ -3721,8 +3676,8 @@ and the two are not intended to refer to the same value. The
3721* Uninitialized let Variables:: 3676* Uninitialized let Variables::
3722@end menu 3677@end menu
3723 3678
3724@node Prevent confusion, Parts of let Expression, let, let
3725@ifnottex 3679@ifnottex
3680@node Prevent confusion
3726@unnumberedsubsec @code{let} Prevents Confusion 3681@unnumberedsubsec @code{let} Prevents Confusion
3727@end ifnottex 3682@end ifnottex
3728 3683
@@ -3760,8 +3715,7 @@ meaning `to give practical effect to' (@cite{Oxford English
3760Dictionary}). Since you evaluate an expression to perform an action, 3715Dictionary}). Since you evaluate an expression to perform an action,
3761`execute' has evolved as a synonym to `evaluate'.) 3716`execute' has evolved as a synonym to `evaluate'.)
3762 3717
3763@node Parts of let Expression, Sample let Expression, Prevent confusion, let 3718@node Parts of let Expression
3764@comment node-name, next, previous, up
3765@subsection The Parts of a @code{let} Expression 3719@subsection The Parts of a @code{let} Expression
3766@cindex @code{let} expression, parts of 3720@cindex @code{let} expression, parts of
3767@cindex Parts of @code{let} expression 3721@cindex Parts of @code{let} expression
@@ -3809,8 +3763,7 @@ the template for the @code{let} expression looks like this:
3809@end group 3763@end group
3810@end smallexample 3764@end smallexample
3811 3765
3812@node Sample let Expression, Uninitialized let Variables, Parts of let Expression, let 3766@node Sample let Expression
3813@comment node-name, next, previous, up
3814@subsection Sample @code{let} Expression 3767@subsection Sample @code{let} Expression
3815@cindex Sample @code{let} expression 3768@cindex Sample @code{let} expression
3816@cindex @code{let} expression sample 3769@cindex @code{let} expression sample
@@ -3860,8 +3813,7 @@ argument, except for @samp{%s}. In this example, the value of the variable
3860value of the variable @code{tiger} is printed at the location of the 3813value of the variable @code{tiger} is printed at the location of the
3861second @samp{%s}. 3814second @samp{%s}.
3862 3815
3863@node Uninitialized let Variables, , Sample let Expression, let 3816@node Uninitialized let Variables
3864@comment node-name, next, previous, up
3865@subsection Uninitialized Variables in a @code{let} Statement 3817@subsection Uninitialized Variables in a @code{let} Statement
3866@cindex Uninitialized @code{let} variables 3818@cindex Uninitialized @code{let} variables
3867@cindex @code{let} variables uninitialized 3819@cindex @code{let} variables uninitialized
@@ -3909,8 +3861,7 @@ number is printed in the message using a @samp{%d} rather than a
3909@samp{%s}.) The four variables as a group are put into a list to 3861@samp{%s}.) The four variables as a group are put into a list to
3910delimit them from the body of the @code{let}. 3862delimit them from the body of the @code{let}.
3911 3863
3912@node if, else, let, Writing Defuns 3864@node if
3913@comment node-name, next, previous, up
3914@section The @code{if} Special Form 3865@section The @code{if} Special Form
3915@findex if 3866@findex if
3916@cindex Conditional with @code{if} 3867@cindex Conditional with @code{if}
@@ -3932,8 +3883,8 @@ such as, ``if it is warm and sunny, then go to the beach!''
3932* type-of-animal in detail:: An example of an @code{if} expression. 3883* type-of-animal in detail:: An example of an @code{if} expression.
3933@end menu 3884@end menu
3934 3885
3935@node if in more detail, type-of-animal in detail, if, if
3936@ifnottex 3886@ifnottex
3887@node if in more detail
3937@unnumberedsubsec @code{if} in more detail 3888@unnumberedsubsec @code{if} in more detail
3938@end ifnottex 3889@end ifnottex
3939 3890
@@ -4023,8 +3974,7 @@ following message printed in the echo area: @code{"It's a tiger!"}; and
4023when you evaluate @code{(type-of-animal 'zebra)} you will see @code{nil} 3974when you evaluate @code{(type-of-animal 'zebra)} you will see @code{nil}
4024printed in the echo area. 3975printed in the echo area.
4025 3976
4026@node type-of-animal in detail, , if in more detail, if 3977@node type-of-animal in detail
4027@comment node-name, next, previous, up
4028@subsection The @code{type-of-animal} Function in Detail 3978@subsection The @code{type-of-animal} Function in Detail
4029 3979
4030Let's look at the @code{type-of-animal} function in detail. 3980Let's look at the @code{type-of-animal} function in detail.
@@ -4111,8 +4061,7 @@ argument @code{zebra} is passed to @code{type-of-animal}. @code{zebra}
4111is not equal to @code{fierce}, so the then-part is not evaluated and 4061is not equal to @code{fierce}, so the then-part is not evaluated and
4112@code{nil} is returned by the @code{if} expression. 4062@code{nil} is returned by the @code{if} expression.
4113 4063
4114@node else, Truth & Falsehood, if, Writing Defuns 4064@node else
4115@comment node-name, next, previous, up
4116@section If--then--else Expressions 4065@section If--then--else Expressions
4117@cindex Else 4066@cindex Else
4118 4067
@@ -4200,8 +4149,7 @@ misleading! When you write code, you need to take into account the
4200possibility that some such argument will be tested by the @code{if} 4149possibility that some such argument will be tested by the @code{if}
4201and write your program accordingly.) 4150and write your program accordingly.)
4202 4151
4203@node Truth & Falsehood, save-excursion, else, Writing Defuns 4152@node Truth & Falsehood
4204@comment node-name, next, previous, up
4205@section Truth and Falsehood in Emacs Lisp 4153@section Truth and Falsehood in Emacs Lisp
4206@cindex Truth and falsehood in Emacs Lisp 4154@cindex Truth and falsehood in Emacs Lisp
4207@cindex Falsehood and truth in Emacs Lisp 4155@cindex Falsehood and truth in Emacs Lisp
@@ -4224,8 +4172,8 @@ long as it is not empty), or even a buffer!
4224* nil explained:: @code{nil} has two meanings. 4172* nil explained:: @code{nil} has two meanings.
4225@end menu 4173@end menu
4226 4174
4227@node nil explained, , Truth & Falsehood, Truth & Falsehood
4228@ifnottex 4175@ifnottex
4176@node nil explained
4229@unnumberedsubsec An explanation of @code{nil} 4177@unnumberedsubsec An explanation of @code{nil}
4230@end ifnottex 4178@end ifnottex
4231 4179
@@ -4288,8 +4236,7 @@ On the other hand, this function returns @code{nil} if the test is false.
4288(> 4 5) 4236(> 4 5)
4289@end smallexample 4237@end smallexample
4290 4238
4291@node save-excursion, Review, Truth & Falsehood, Writing Defuns 4239@node save-excursion
4292@comment node-name, next, previous, up
4293@section @code{save-excursion} 4240@section @code{save-excursion}
4294@findex save-excursion 4241@findex save-excursion
4295@cindex Region, what it is 4242@cindex Region, what it is
@@ -4313,8 +4260,8 @@ unexpected movement of point or mark.
4313* Template for save-excursion:: 4260* Template for save-excursion::
4314@end menu 4261@end menu
4315 4262
4316@node Point and mark, Template for save-excursion, save-excursion, save-excursion
4317@ifnottex 4263@ifnottex
4264@node Point and mark
4318@unnumberedsubsec Point and Mark 4265@unnumberedsubsec Point and Mark
4319@end ifnottex 4266@end ifnottex
4320 4267
@@ -4371,8 +4318,7 @@ have @code{save-excursion} switch you back to the original buffer.
4371This is how @code{save-excursion} is used in @code{append-to-buffer}. 4318This is how @code{save-excursion} is used in @code{append-to-buffer}.
4372(@xref{append-to-buffer, , The Definition of @code{append-to-buffer}}.) 4319(@xref{append-to-buffer, , The Definition of @code{append-to-buffer}}.)
4373 4320
4374@node Template for save-excursion, , Point and mark, save-excursion 4321@node Template for save-excursion
4375@comment node-name, next, previous, up
4376@subsection Template for a @code{save-excursion} Expression 4322@subsection Template for a @code{save-excursion} Expression
4377 4323
4378@need 800 4324@need 800
@@ -4423,8 +4369,7 @@ within the body of a @code{let} expression. It looks like this:
4423@end group 4369@end group
4424@end smallexample 4370@end smallexample
4425 4371
4426@node Review, defun Exercises, save-excursion, Writing Defuns 4372@node Review
4427@comment node-name, next, previous, up
4428@section Review 4373@section Review
4429 4374
4430In the last few chapters we have introduced a fair number of functions 4375In the last few chapters we have introduced a fair number of functions
@@ -4677,7 +4622,7 @@ effect.
4677@end table 4622@end table
4678 4623
4679@need 1500 4624@need 1500
4680@node defun Exercises, , Review, Writing Defuns 4625@node defun Exercises
4681@section Exercises 4626@section Exercises
4682 4627
4683@itemize @bullet 4628@itemize @bullet
@@ -4691,8 +4636,7 @@ Write a function that tests whether the current value of
4691and if so, prints an appropriate message. 4636and if so, prints an appropriate message.
4692@end itemize 4637@end itemize
4693 4638
4694@node Buffer Walk Through, More Complex, Writing Defuns, Top 4639@node Buffer Walk Through
4695@comment node-name, next, previous, up
4696@chapter A Few Buffer--Related Functions 4640@chapter A Few Buffer--Related Functions
4697 4641
4698In this chapter we study in detail several of the functions used in GNU 4642In this chapter we study in detail several of the functions used in GNU
@@ -4714,7 +4658,7 @@ buffers. Later, we will study other functions.
4714* Buffer Exercises:: 4658* Buffer Exercises::
4715@end menu 4659@end menu
4716 4660
4717@node Finding More, simplified-beginning-of-buffer, Buffer Walk Through, Buffer Walk Through 4661@node Finding More
4718@section Finding More Information 4662@section Finding More Information
4719 4663
4720@findex describe-function, @r{introduced} 4664@findex describe-function, @r{introduced}
@@ -4810,8 +4754,7 @@ In @cite{The GNU Emacs Manual}, you will see sentences such as ``The
4810@kbd{C-h p} command lets you search the standard Emacs Lisp libraries 4754@kbd{C-h p} command lets you search the standard Emacs Lisp libraries
4811by topic keywords.'' 4755by topic keywords.''
4812 4756
4813@node simplified-beginning-of-buffer, mark-whole-buffer, Finding More, Buffer Walk Through 4757@node simplified-beginning-of-buffer
4814@comment node-name, next, previous, up
4815@section A Simplified @code{beginning-of-buffer} Definition 4758@section A Simplified @code{beginning-of-buffer} Definition
4816@findex simplified-beginning-of-buffer 4759@findex simplified-beginning-of-buffer
4817 4760
@@ -4939,8 +4882,7 @@ the @code{beginning-of-buffer} definition except that the body of the
4939function contains the expression @code{(goto-char (point-max))} in place 4882function contains the expression @code{(goto-char (point-max))} in place
4940of @code{(goto-char (point-min))}. 4883of @code{(goto-char (point-min))}.
4941 4884
4942@node mark-whole-buffer, append-to-buffer, simplified-beginning-of-buffer, Buffer Walk Through 4885@node mark-whole-buffer
4943@comment node-name, next, previous, up
4944@section The Definition of @code{mark-whole-buffer} 4886@section The Definition of @code{mark-whole-buffer}
4945@findex mark-whole-buffer 4887@findex mark-whole-buffer
4946 4888
@@ -4959,8 +4901,8 @@ h}.
4959* Body of mark-whole-buffer:: Only three lines of code. 4901* Body of mark-whole-buffer:: Only three lines of code.
4960@end menu 4902@end menu
4961 4903
4962@node mark-whole-buffer overview, Body of mark-whole-buffer, mark-whole-buffer, mark-whole-buffer
4963@ifnottex 4904@ifnottex
4905@node mark-whole-buffer overview
4964@unnumberedsubsec An overview of @code{mark-whole-buffer} 4906@unnumberedsubsec An overview of @code{mark-whole-buffer}
4965@end ifnottex 4907@end ifnottex
4966 4908
@@ -5006,8 +4948,7 @@ to the @code{simplified-beginning-of-buffer} function described in the
5006previous section. 4948previous section.
5007 4949
5008@need 1250 4950@need 1250
5009@node Body of mark-whole-buffer, , mark-whole-buffer overview, mark-whole-buffer 4951@node Body of mark-whole-buffer
5010@comment node-name, next, previous, up
5011@subsection Body of @code{mark-whole-buffer} 4952@subsection Body of @code{mark-whole-buffer}
5012 4953
5013The body of the @code{mark-whole-buffer} function consists of three 4954The body of the @code{mark-whole-buffer} function consists of three
@@ -5080,8 +5021,7 @@ result of this, point is placed at the beginning of the buffer and mark
5080is set at the end of the buffer. The whole buffer is, therefore, the 5021is set at the end of the buffer. The whole buffer is, therefore, the
5081region. 5022region.
5082 5023
5083@node append-to-buffer, Buffer Related Review, mark-whole-buffer, Buffer Walk Through 5024@node append-to-buffer
5084@comment node-name, next, previous, up
5085@section The Definition of @code{append-to-buffer} 5025@section The Definition of @code{append-to-buffer}
5086@findex append-to-buffer 5026@findex append-to-buffer
5087 5027
@@ -5097,8 +5037,8 @@ current buffer to a specified buffer.
5097* append save-excursion:: How the @code{save-excursion} works. 5037* append save-excursion:: How the @code{save-excursion} works.
5098@end menu 5038@end menu
5099 5039
5100@node append-to-buffer overview, append interactive, append-to-buffer, append-to-buffer
5101@ifnottex 5040@ifnottex
5041@node append-to-buffer overview
5102@unnumberedsubsec An Overview of @code{append-to-buffer} 5042@unnumberedsubsec An Overview of @code{append-to-buffer}
5103@end ifnottex 5043@end ifnottex
5104 5044
@@ -5178,8 +5118,7 @@ described in the same order as in the argument list.
5178Note that the documentation distinguishes between a buffer and its 5118Note that the documentation distinguishes between a buffer and its
5179name. (The function can handle either.) 5119name. (The function can handle either.)
5180 5120
5181@node append interactive, append-to-buffer body, append-to-buffer overview, append-to-buffer 5121@node append interactive
5182@comment node-name, next, previous, up
5183@subsection The @code{append-to-buffer} Interactive Expression 5122@subsection The @code{append-to-buffer} Interactive Expression
5184 5123
5185Since the @code{append-to-buffer} function will be used interactively, 5124Since the @code{append-to-buffer} function will be used interactively,
@@ -5247,8 +5186,7 @@ two arguments that follow the symbol @code{buffer} in the function's
5247argument list (that is, @code{start} and @code{end}) to the values of 5186argument list (that is, @code{start} and @code{end}) to the values of
5248point and mark. That argument worked fine.) 5187point and mark. That argument worked fine.)
5249 5188
5250@node append-to-buffer body, append save-excursion, append interactive, append-to-buffer 5189@node append-to-buffer body
5251@comment node-name, next, previous, up
5252@subsection The Body of @code{append-to-buffer} 5190@subsection The Body of @code{append-to-buffer}
5253 5191
5254@ignore 5192@ignore
@@ -5347,8 +5285,7 @@ not realize that the first parenthesis before @code{oldbuf} marks the
5347boundary of the varlist and the second parenthesis marks the beginning 5285boundary of the varlist and the second parenthesis marks the beginning
5348of the two-element list, @code{(oldbuf (current-buffer))}. 5286of the two-element list, @code{(oldbuf (current-buffer))}.
5349 5287
5350@node append save-excursion, , append-to-buffer body, append-to-buffer 5288@node append save-excursion
5351@comment node-name, next, previous, up
5352@subsection @code{save-excursion} in @code{append-to-buffer} 5289@subsection @code{save-excursion} in @code{append-to-buffer}
5353 5290
5354The body of the @code{let} expression in @code{append-to-buffer} 5291The body of the @code{let} expression in @code{append-to-buffer}
@@ -5525,8 +5462,7 @@ complex function. It shows how to use @code{let} and
5525buffer. Many function definitions use @code{let}, 5462buffer. Many function definitions use @code{let},
5526@code{save-excursion}, and @code{set-buffer} this way. 5463@code{save-excursion}, and @code{set-buffer} this way.
5527 5464
5528@node Buffer Related Review, Buffer Exercises, append-to-buffer, Buffer Walk Through 5465@node Buffer Related Review
5529@comment node-name, next, previous, up
5530@section Review 5466@section Review
5531 5467
5532Here is a brief summary of the various functions discussed in this chapter. 5468Here is a brief summary of the various functions discussed in this chapter.
@@ -5578,7 +5514,7 @@ buffer does not exist.
5578@end table 5514@end table
5579 5515
5580@need 1500 5516@need 1500
5581@node Buffer Exercises, , Buffer Related Review, Buffer Walk Through 5517@node Buffer Exercises
5582@section Exercises 5518@section Exercises
5583 5519
5584@itemize @bullet 5520@itemize @bullet
@@ -5595,8 +5531,7 @@ Using @code{find-tag}, find the source for the @code{copy-to-buffer}
5595function. 5531function.
5596@end itemize 5532@end itemize
5597 5533
5598@node More Complex, Narrowing & Widening, Buffer Walk Through, Top 5534@node More Complex
5599@comment node-name, next, previous, up
5600@chapter A Few More Complex Functions 5535@chapter A Few More Complex Functions
5601 5536
5602In this chapter, we build on what we have learned in previous chapters 5537In this chapter, we build on what we have learned in previous chapters
@@ -5616,8 +5551,7 @@ to which the name refers.
5616* optional Exercise:: 5551* optional Exercise::
5617@end menu 5552@end menu
5618 5553
5619@node copy-to-buffer, insert-buffer, More Complex, More Complex 5554@node copy-to-buffer
5620@comment node-name, next, previous, up
5621@section The Definition of @code{copy-to-buffer} 5555@section The Definition of @code{copy-to-buffer}
5622@findex copy-to-buffer 5556@findex copy-to-buffer
5623 5557
@@ -5695,8 +5629,7 @@ In outline, the body of @code{copy-to-buffer} looks like this:
5695@end group 5629@end group
5696@end smallexample 5630@end smallexample
5697 5631
5698@node insert-buffer, beginning-of-buffer, copy-to-buffer, More Complex 5632@node insert-buffer
5699@comment node-name, next, previous, up
5700@section The Definition of @code{insert-buffer} 5633@section The Definition of @code{insert-buffer}
5701@findex insert-buffer 5634@findex insert-buffer
5702 5635
@@ -5725,8 +5658,8 @@ between the name of an object and the object actually referred to.
5725* New insert-buffer:: 5658* New insert-buffer::
5726@end menu 5659@end menu
5727 5660
5728@node insert-buffer code, insert-buffer interactive, insert-buffer, insert-buffer
5729@ifnottex 5661@ifnottex
5662@node insert-buffer code
5730@unnumberedsubsec The Code for @code{insert-buffer} 5663@unnumberedsubsec The Code for @code{insert-buffer}
5731@end ifnottex 5664@end ifnottex
5732 5665
@@ -5770,8 +5703,7 @@ outline of the function:
5770@end group 5703@end group
5771@end smallexample 5704@end smallexample
5772 5705
5773@node insert-buffer interactive, insert-buffer body, insert-buffer code, insert-buffer 5706@node insert-buffer interactive
5774@comment node-name, next, previous, up
5775@subsection The Interactive Expression in @code{insert-buffer} 5707@subsection The Interactive Expression in @code{insert-buffer}
5776@findex interactive, @r{example use of} 5708@findex interactive, @r{example use of}
5777 5709
@@ -5784,8 +5716,7 @@ buffer:@: }.
5784* b for interactive:: An existing buffer or else its name. 5716* b for interactive:: An existing buffer or else its name.
5785@end menu 5717@end menu
5786 5718
5787@node Read-only buffer, b for interactive, insert-buffer interactive, insert-buffer interactive 5719@node Read-only buffer
5788@comment node-name, next, previous, up
5789@unnumberedsubsubsec A Read-only Buffer 5720@unnumberedsubsubsec A Read-only Buffer
5790@cindex Read-only buffer 5721@cindex Read-only buffer
5791@cindex Asterisk for read-only buffer 5722@cindex Asterisk for read-only buffer
@@ -5799,8 +5730,7 @@ may beep or blink at you; you will not be permitted to insert anything
5799into current buffer. The asterisk does not need to be followed by a 5730into current buffer. The asterisk does not need to be followed by a
5800newline to separate it from the next argument. 5731newline to separate it from the next argument.
5801 5732
5802@node b for interactive, , Read-only buffer, insert-buffer interactive 5733@node b for interactive
5803@comment node-name, next, previous, up
5804@unnumberedsubsubsec @samp{b} in an Interactive Expression 5734@unnumberedsubsubsec @samp{b} in an Interactive Expression
5805 5735
5806The next argument in the interactive expression starts with a lower 5736The next argument in the interactive expression starts with a lower
@@ -5820,8 +5750,7 @@ It uses the @code{barf-if-buffer-read-only} and @code{read-buffer}
5820functions with which we are already familiar and the @code{progn} 5750functions with which we are already familiar and the @code{progn}
5821special form with which we are not. (It will be described later.) 5751special form with which we are not. (It will be described later.)
5822 5752
5823@node insert-buffer body, if & or, insert-buffer interactive, insert-buffer 5753@node insert-buffer body
5824@comment node-name, next, previous, up
5825@subsection The Body of the @code{insert-buffer} Function 5754@subsection The Body of the @code{insert-buffer} Function
5826 5755
5827The body of the @code{insert-buffer} function has two major parts: an 5756The body of the @code{insert-buffer} function has two major parts: an
@@ -5856,8 +5785,7 @@ is first necessary to understand the @code{or} function.
5856Before doing this, let me rewrite this part of the function using 5785Before doing this, let me rewrite this part of the function using
5857@code{if} so that you can see what is done in a manner that will be familiar. 5786@code{if} so that you can see what is done in a manner that will be familiar.
5858 5787
5859@node if & or, Insert or, insert-buffer body, insert-buffer 5788@node if & or
5860@comment node-name, next, previous, up
5861@subsection @code{insert-buffer} With an @code{if} Instead of an @code{or} 5789@subsection @code{insert-buffer} With an @code{if} Instead of an @code{or}
5862 5790
5863The job to be done is to make sure the value of @code{buffer} is a 5791The job to be done is to make sure the value of @code{buffer} is a
@@ -5937,8 +5865,7 @@ buffer itself, given its name. The @code{setq} then sets the variable
5937@code{buffer} to the value of the buffer itself, replacing its previous 5865@code{buffer} to the value of the buffer itself, replacing its previous
5938value (which was the name of the buffer). 5866value (which was the name of the buffer).
5939 5867
5940@node Insert or, Insert let, if & or, insert-buffer 5868@node Insert or
5941@comment node-name, next, previous, up
5942@subsection The @code{or} in the Body 5869@subsection The @code{or} in the Body
5943 5870
5944The purpose of the @code{or} expression in the @code{insert-buffer} 5871The purpose of the @code{or} expression in the @code{insert-buffer}
@@ -5996,8 +5923,7 @@ written like this:
5996(or (holding-on-to-guest) (find-and-take-arm-of-guest)) 5923(or (holding-on-to-guest) (find-and-take-arm-of-guest))
5997@end smallexample 5924@end smallexample
5998 5925
5999@node Insert let, New insert-buffer, Insert or, insert-buffer 5926@node Insert let
6000@comment node-name, next, previous, up
6001@subsection The @code{let} Expression in @code{insert-buffer} 5927@subsection The @code{let} Expression in @code{insert-buffer}
6002 5928
6003After ensuring that the variable @code{buffer} refers to a buffer itself 5929After ensuring that the variable @code{buffer} refers to a buffer itself
@@ -6095,8 +6021,7 @@ function uses @code{let}, @code{save-excursion}, and
6095use @code{or}. All these functions are building blocks that we will 6021use @code{or}. All these functions are building blocks that we will
6096find and use again and again. 6022find and use again and again.
6097 6023
6098@node New insert-buffer, , Insert let, insert-buffer 6024@node New insert-buffer
6099@comment node-name, next, previous, up
6100@subsection New Body for @code{insert-buffer} 6025@subsection New Body for @code{insert-buffer}
6101@findex insert-buffer, new version body 6026@findex insert-buffer, new version body
6102@findex new version body for insert-buffer 6027@findex new version body for insert-buffer
@@ -6134,8 +6059,7 @@ its last command. Put another way, the @code{insert-buffer} function
6134exists only to produce a side effect, inserting another buffer, not to 6059exists only to produce a side effect, inserting another buffer, not to
6135return any value. 6060return any value.
6136 6061
6137@node beginning-of-buffer, Second Buffer Related Review, insert-buffer, More Complex 6062@node beginning-of-buffer
6138@comment node-name, next, previous, up
6139@section Complete Definition of @code{beginning-of-buffer} 6063@section Complete Definition of @code{beginning-of-buffer}
6140@findex beginning-of-buffer 6064@findex beginning-of-buffer
6141 6065
@@ -6167,7 +6091,7 @@ argument. The use of the argument is optional.
6167* beginning-of-buffer complete:: 6091* beginning-of-buffer complete::
6168@end menu 6092@end menu
6169 6093
6170@node Optional Arguments, beginning-of-buffer opt arg, beginning-of-buffer, beginning-of-buffer 6094@node Optional Arguments
6171@subsection Optional Arguments 6095@subsection Optional Arguments
6172 6096
6173Unless told otherwise, Lisp expects that a function with an argument in 6097Unless told otherwise, Lisp expects that a function with an argument in
@@ -6250,7 +6174,7 @@ simply @code{point-min}, and when this is the outcome, the whole
6250is how we saw the @code{beginning-of-buffer} function in its 6174is how we saw the @code{beginning-of-buffer} function in its
6251simplified form. 6175simplified form.
6252 6176
6253@node beginning-of-buffer opt arg, beginning-of-buffer complete, Optional Arguments, beginning-of-buffer 6177@node beginning-of-buffer opt arg
6254@subsection @code{beginning-of-buffer} with an Argument 6178@subsection @code{beginning-of-buffer} with an Argument
6255 6179
6256When @code{beginning-of-buffer} is called with an argument, an 6180When @code{beginning-of-buffer} is called with an argument, an
@@ -6278,8 +6202,8 @@ like this:
6278* Small buffer case:: 6202* Small buffer case::
6279@end menu 6203@end menu
6280 6204
6281@node Disentangle beginning-of-buffer, Large buffer case, beginning-of-buffer opt arg, beginning-of-buffer opt arg
6282@ifnottex 6205@ifnottex
6206@node Disentangle beginning-of-buffer
6283@unnumberedsubsubsec Disentangle @code{beginning-of-buffer} 6207@unnumberedsubsubsec Disentangle @code{beginning-of-buffer}
6284@end ifnottex 6208@end ifnottex
6285 6209
@@ -6308,8 +6232,7 @@ that are far, far larger than ever before.
6308 6232
6309There are two cases: if the buffer is large and if it is not. 6233There are two cases: if the buffer is large and if it is not.
6310 6234
6311@node Large buffer case, Small buffer case, Disentangle beginning-of-buffer, beginning-of-buffer opt arg 6235@node Large buffer case
6312@comment node-name, next, previous, up
6313@unnumberedsubsubsec What happens in a large buffer 6236@unnumberedsubsubsec What happens in a large buffer
6314 6237
6315In @code{beginning-of-buffer}, the inner @code{if} expression tests 6238In @code{beginning-of-buffer}, the inner @code{if} expression tests
@@ -6392,8 +6315,7 @@ is large, the @code{goto-char} expression reads like this:
6392 6315
6393This puts the cursor where we want it. 6316This puts the cursor where we want it.
6394 6317
6395@node Small buffer case, , Large buffer case, beginning-of-buffer opt arg 6318@node Small buffer case
6396@comment node-name, next, previous, up
6397@unnumberedsubsubsec What happens in a small buffer 6319@unnumberedsubsubsec What happens in a small buffer
6398 6320
6399If the buffer contains fewer than 10,000 characters, a slightly 6321If the buffer contains fewer than 10,000 characters, a slightly
@@ -6450,8 +6372,7 @@ The number that results from all this is passed to @code{goto-char} and
6450the cursor is moved to that point. 6372the cursor is moved to that point.
6451 6373
6452@need 1500 6374@need 1500
6453@node beginning-of-buffer complete, , beginning-of-buffer opt arg, beginning-of-buffer 6375@node beginning-of-buffer complete
6454@comment node-name, next, previous, up
6455@subsection The Complete @code{beginning-of-buffer} 6376@subsection The Complete @code{beginning-of-buffer}
6456 6377
6457@need 1000 6378@need 1000
@@ -6579,8 +6500,7 @@ beginning of the second line @dots{} I don't know whether this is
6579intended or whether no one has dealt with the code to avoid this 6500intended or whether no one has dealt with the code to avoid this
6580happening. 6501happening.
6581 6502
6582@node Second Buffer Related Review, optional Exercise, beginning-of-buffer, More Complex 6503@node Second Buffer Related Review
6583@comment node-name, next, previous, up
6584@section Review 6504@section Review
6585 6505
6586Here is a brief summary of some of the topics covered in this chapter. 6506Here is a brief summary of some of the topics covered in this chapter.
@@ -6623,7 +6543,7 @@ Delete the entire contents of the current buffer.
6623Return @code{t} if its argument is a buffer; otherwise return @code{nil}. 6543Return @code{t} if its argument is a buffer; otherwise return @code{nil}.
6624@end table 6544@end table
6625 6545
6626@node optional Exercise, , Second Buffer Related Review, More Complex 6546@node optional Exercise
6627@section @code{optional} Argument Exercise 6547@section @code{optional} Argument Exercise
6628 6548
6629Write an interactive function with an optional argument that tests 6549Write an interactive function with an optional argument that tests
@@ -6632,8 +6552,7 @@ less than the value of @code{fill-column}, and tells you which, in a
6632message. However, if you do not pass an argument to the function, use 6552message. However, if you do not pass an argument to the function, use
663356 as a default value. 655356 as a default value.
6634 6554
6635@node Narrowing & Widening, car cdr & cons, More Complex, Top 6555@node Narrowing & Widening
6636@comment node-name, next, previous, up
6637@chapter Narrowing and Widening 6556@chapter Narrowing and Widening
6638@cindex Focusing attention (narrowing) 6557@cindex Focusing attention (narrowing)
6639@cindex Narrowing 6558@cindex Narrowing
@@ -6651,8 +6570,8 @@ novices.
6651* narrow Exercise:: 6570* narrow Exercise::
6652@end menu 6571@end menu
6653 6572
6654@node Narrowing advantages, save-restriction, Narrowing & Widening, Narrowing & Widening
6655@ifnottex 6573@ifnottex
6574@node Narrowing advantages
6656@unnumberedsec The Advantages of Narrowing 6575@unnumberedsec The Advantages of Narrowing
6657@end ifnottex 6576@end ifnottex
6658 6577
@@ -6686,8 +6605,7 @@ On the other hand, the @code{count-lines} function, which is called by
6686of the buffer in which it is interested and then restores the previous 6605of the buffer in which it is interested and then restores the previous
6687situation. 6606situation.
6688 6607
6689@node save-restriction, what-line, Narrowing advantages, Narrowing & Widening 6608@node save-restriction
6690@comment node-name, next, previous, up
6691@section The @code{save-restriction} Special Form 6609@section The @code{save-restriction} Special Form
6692@findex save-restriction 6610@findex save-restriction
6693 6611
@@ -6804,8 +6722,7 @@ and the greater of them is not at the start of a line."
6804 (- (buffer-size) (forward-line (buffer-size))))))) 6722 (- (buffer-size) (forward-line (buffer-size)))))))
6805@end ignore 6723@end ignore
6806 6724
6807@node what-line, narrow Exercise, save-restriction, Narrowing & Widening 6725@node what-line
6808@comment node-name, next, previous, up
6809@section @code{what-line} 6726@section @code{what-line}
6810@findex what-line 6727@findex what-line
6811@cindex Widening, example of 6728@cindex Widening, example of
@@ -6938,7 +6855,7 @@ printed in the echo area, the @code{save-excursion} restores point and
6938mark to their original positions; and @code{save-restriction} restores 6855mark to their original positions; and @code{save-restriction} restores
6939the original narrowing, if any. 6856the original narrowing, if any.
6940 6857
6941@node narrow Exercise, , what-line, Narrowing & Widening 6858@node narrow Exercise
6942@section Exercise with Narrowing 6859@section Exercise with Narrowing
6943 6860
6944Write a function that will display the first 60 characters of the 6861Write a function that will display the first 60 characters of the
@@ -6961,8 +6878,7 @@ Manual}.)
6961Additionally, do you really need @code{goto-char} or @code{point-min}? 6878Additionally, do you really need @code{goto-char} or @code{point-min}?
6962Or can you write the function without them? 6879Or can you write the function without them?
6963 6880
6964@node car cdr & cons, Cutting & Storing Text, Narrowing & Widening, Top 6881@node car cdr & cons
6965@comment node-name, next, previous, up
6966@chapter @code{car}, @code{cdr}, @code{cons}: Fundamental Functions 6882@chapter @code{car}, @code{cdr}, @code{cons}: Fundamental Functions
6967@findex car, @r{introduced} 6883@findex car, @r{introduced}
6968@findex cdr, @r{introduced} 6884@findex cdr, @r{introduced}
@@ -6986,8 +6902,8 @@ namely, @code{setcdr} and @code{nthcdr}. (@xref{copy-region-as-kill}.)
6986* cons Exercise:: 6902* cons Exercise::
6987@end menu 6903@end menu
6988 6904
6989@node Strange Names, car & cdr, car cdr & cons, car cdr & cons
6990@ifnottex 6905@ifnottex
6906@node Strange Names
6991@unnumberedsec Strange Names 6907@unnumberedsec Strange Names
6992@end ifnottex 6908@end ifnottex
6993 6909
@@ -7006,8 +6922,7 @@ functions, the old terms are still in use. In particular, since the
7006terms are used in the Emacs Lisp source code, we will use them in this 6922terms are used in the Emacs Lisp source code, we will use them in this
7007introduction. 6923introduction.
7008 6924
7009@node car & cdr, cons, Strange Names, car cdr & cons 6925@node car & cdr
7010@comment node-name, next, previous, up
7011@section @code{car} and @code{cdr} 6926@section @code{car} and @code{cdr}
7012 6927
7013The @sc{car} of a list is, quite simply, the first item in the list. 6928The @sc{car} of a list is, quite simply, the first item in the list.
@@ -7129,8 +7044,7 @@ together or construct a list, but not an array. (Arrays are handled
7129by array-specific functions. @xref{Arrays, , Arrays, elisp, The GNU 7044by array-specific functions. @xref{Arrays, , Arrays, elisp, The GNU
7130Emacs Lisp Reference Manual}.) 7045Emacs Lisp Reference Manual}.)
7131 7046
7132@node cons, nthcdr, car & cdr, car cdr & cons 7047@node cons
7133@comment node-name, next, previous, up
7134@section @code{cons} 7048@section @code{cons}
7135@findex cons, @r{introduced} 7049@findex cons, @r{introduced}
7136 7050
@@ -7167,8 +7081,8 @@ Like @code{car} and @code{cdr}, @code{cons} is non-destructive.
7167* length:: How to find the length of a list. 7081* length:: How to find the length of a list.
7168@end menu 7082@end menu
7169 7083
7170@node Build a list, length, cons, cons
7171@ifnottex 7084@ifnottex
7085@node Build a list
7172@unnumberedsubsec Build a list 7086@unnumberedsubsec Build a list
7173@end ifnottex 7087@end ifnottex
7174 7088
@@ -7218,8 +7132,7 @@ two element list by putting @code{daisy} in front of @code{buttercup};
7218and the third example constructs a three element list by putting 7132and the third example constructs a three element list by putting
7219@code{violet} in front of @code{daisy} and @code{buttercup}. 7133@code{violet} in front of @code{daisy} and @code{buttercup}.
7220 7134
7221@node length, , Build a list, cons 7135@node length
7222@comment node-name, next, previous, up
7223@subsection Find the Length of a List: @code{length} 7136@subsection Find the Length of a List: @code{length}
7224@findex length 7137@findex length
7225 7138
@@ -7300,8 +7213,7 @@ In an earlier version:
7300 about subroutines. 7213 about subroutines.
7301@end ignore 7214@end ignore
7302 7215
7303@node nthcdr, nth, cons, car cdr & cons 7216@node nthcdr
7304@comment node-name, next, previous, up
7305@section @code{nthcdr} 7217@section @code{nthcdr}
7306@findex nthcdr 7218@findex nthcdr
7307 7219
@@ -7425,8 +7337,7 @@ and 5:
7425@end group 7337@end group
7426@end smallexample 7338@end smallexample
7427 7339
7428@node nth, setcar, nthcdr, car cdr & cons 7340@node nth
7429@comment node-name, next, previous, up
7430@section @code{nth} 7341@section @code{nth}
7431@findex nth 7342@findex nth
7432 7343
@@ -7478,8 +7389,7 @@ It is worth mentioning that @code{nth}, like @code{nthcdr} and
7478non-destructive. This is in sharp contrast to the @code{setcar} and 7389non-destructive. This is in sharp contrast to the @code{setcar} and
7479@code{setcdr} functions. 7390@code{setcdr} functions.
7480 7391
7481@node setcar, setcdr, nth, car cdr & cons 7392@node setcar
7482@comment node-name, next, previous, up
7483@section @code{setcar} 7393@section @code{setcar}
7484@findex setcar 7394@findex setcar
7485 7395
@@ -7554,8 +7464,7 @@ So we can see that @code{setcar} did not add a new element to the list
7554as @code{cons} would have; it replaced @code{antelope} with 7464as @code{cons} would have; it replaced @code{antelope} with
7555@code{hippopotamus}; it @emph{changed} the list. 7465@code{hippopotamus}; it @emph{changed} the list.
7556 7466
7557@node setcdr, cons Exercise, setcar, car cdr & cons 7467@node setcdr
7558@comment node-name, next, previous, up
7559@section @code{setcdr} 7468@section @code{setcdr}
7560@findex setcdr 7469@findex setcdr
7561 7470
@@ -7614,7 +7523,7 @@ Indeed, the list is changed from @code{(horse cow sheep goat)} to
7614@code{(horse cat dog)}. The @sc{cdr} of the list is changed from 7523@code{(horse cat dog)}. The @sc{cdr} of the list is changed from
7615@code{(cow sheep goat)} to @code{(cat dog)}. 7524@code{(cow sheep goat)} to @code{(cat dog)}.
7616 7525
7617@node cons Exercise, , setcdr, car cdr & cons 7526@node cons Exercise
7618@section Exercise 7527@section Exercise
7619 7528
7620Construct a list of four birds by evaluating several expressions with 7529Construct a list of four birds by evaluating several expressions with
@@ -7622,8 +7531,7 @@ Construct a list of four birds by evaluating several expressions with
7622itself. Replace the first element of the list of four birds with a 7531itself. Replace the first element of the list of four birds with a
7623fish. Replace the rest of that list with a list of other fish. 7532fish. Replace the rest of that list with a list of other fish.
7624 7533
7625@node Cutting & Storing Text, List Implementation, car cdr & cons, Top 7534@node Cutting & Storing Text
7626@comment node-name, next, previous, up
7627@chapter Cutting and Storing Text 7535@chapter Cutting and Storing Text
7628@cindex Cutting and storing text 7536@cindex Cutting and storing text
7629@cindex Storing and cutting text 7537@cindex Storing and cutting text
@@ -7655,8 +7563,8 @@ sources with `clip' and all occurrences of `killed' with `clipped'.)
7655* search Exercises:: 7563* search Exercises::
7656@end menu 7564@end menu
7657 7565
7658@node Storing Text, zap-to-char, Cutting & Storing Text, Cutting & Storing Text
7659@ifnottex 7566@ifnottex
7567@node Storing Text
7660@unnumberedsec Storing Text in a List 7568@unnumberedsec Storing Text in a List
7661@end ifnottex 7569@end ifnottex
7662 7570
@@ -7722,8 +7630,7 @@ climb the foothills.
7722A subsequent chapter describes how text that is cut from the buffer is 7630A subsequent chapter describes how text that is cut from the buffer is
7723retrieved. @xref{Yanking, , Yanking Text Back}. 7631retrieved. @xref{Yanking, , Yanking Text Back}.
7724 7632
7725@node zap-to-char, kill-region, Storing Text, Cutting & Storing Text 7633@node zap-to-char
7726@comment node-name, next, previous, up
7727@section @code{zap-to-char} 7634@section @code{zap-to-char}
7728@findex zap-to-char 7635@findex zap-to-char
7729 7636
@@ -7751,8 +7658,8 @@ But first, let us look at the interactive @code{zap-to-char} function.
7751* Summing up zap-to-char:: Using @code{point} and @code{search-forward}. 7658* Summing up zap-to-char:: Using @code{point} and @code{search-forward}.
7752@end menu 7659@end menu
7753 7660
7754@node Complete zap-to-char, zap-to-char interactive, zap-to-char, zap-to-char
7755@ifnottex 7661@ifnottex
7662@node Complete zap-to-char
7756@unnumberedsubsec The Complete @code{zap-to-char} Implementation 7663@unnumberedsubsec The Complete @code{zap-to-char} Implementation
7757@end ifnottex 7664@end ifnottex
7758 7665
@@ -7812,8 +7719,7 @@ Goes backward if ARG is negative; error if CHAR not found."
7812The documentation is thorough. You do need to know the jargon meaning 7719The documentation is thorough. You do need to know the jargon meaning
7813of the word `kill'. 7720of the word `kill'.
7814 7721
7815@node zap-to-char interactive, zap-to-char body, Complete zap-to-char, zap-to-char 7722@node zap-to-char interactive
7816@comment node-name, next, previous, up
7817@subsection The @code{interactive} Expression 7723@subsection The @code{interactive} Expression
7818 7724
7819@need 800 7725@need 800
@@ -7848,8 +7754,7 @@ to the kill ring, but does not remove it. The echo area displays a
7848message saying that the buffer is read-only. Also, the terminal may 7754message saying that the buffer is read-only. Also, the terminal may
7849beep or blink at you. 7755beep or blink at you.
7850 7756
7851@node zap-to-char body, search-forward, zap-to-char interactive, zap-to-char 7757@node zap-to-char body
7852@comment node-name, next, previous, up
7853@subsection The Body of @code{zap-to-char} 7758@subsection The Body of @code{zap-to-char}
7854 7759
7855The body of the @code{zap-to-char} function contains the code that 7760The body of the @code{zap-to-char} function contains the code that
@@ -7887,8 +7792,7 @@ It is easier to understand how @code{progn} works after learning about
7887@code{search-forward}, so we will look at @code{search-forward} and 7792@code{search-forward}, so we will look at @code{search-forward} and
7888then at @code{progn}. 7793then at @code{progn}.
7889 7794
7890@node search-forward, progn, zap-to-char body, zap-to-char 7795@node search-forward
7891@comment node-name, next, previous, up
7892@subsection The @code{search-forward} Function 7796@subsection The @code{search-forward} Function
7893@findex search-forward 7797@findex search-forward
7894 7798
@@ -7963,8 +7867,7 @@ In template form, a @code{search-forward} expression looks like this:
7963 7867
7964We will look at @code{progn} next. 7868We will look at @code{progn} next.
7965 7869
7966@node progn, Summing up zap-to-char, search-forward, zap-to-char 7870@node progn
7967@comment node-name, next, previous, up
7968@subsection The @code{progn} Special Form 7871@subsection The @code{progn} Special Form
7969@findex progn 7872@findex progn
7970 7873
@@ -8004,8 +7907,7 @@ ever a part of the distributed source.) The value of @code{point} is
8004returned by the @code{progn} expression and is passed to 7907returned by the @code{progn} expression and is passed to
8005@code{kill-region} as @code{kill-region}'s second argument. 7908@code{kill-region} as @code{kill-region}'s second argument.
8006 7909
8007@node Summing up zap-to-char, , progn, zap-to-char 7910@node Summing up zap-to-char
8008@comment node-name, next, previous, up
8009@subsection Summing up @code{zap-to-char} 7911@subsection Summing up @code{zap-to-char}
8010 7912
8011Now that we have seen how @code{search-forward} and @code{progn} work, 7913Now that we have seen how @code{search-forward} and @code{progn} work,
@@ -8026,8 +7928,7 @@ sequence as two additional arguments. The @code{progn} expression is
8026a single argument to @code{kill-region} and returns the one value that 7928a single argument to @code{kill-region} and returns the one value that
8027@code{kill-region} needs for its second argument. 7929@code{kill-region} needs for its second argument.
8028 7930
8029@node kill-region, copy-region-as-kill, zap-to-char, Cutting & Storing Text 7931@node kill-region
8030@comment node-name, next, previous, up
8031@section @code{kill-region} 7932@section @code{kill-region}
8032@findex kill-region 7933@findex kill-region
8033 7934
@@ -8111,8 +8012,8 @@ contains the code that is called in the event of an error.
8111* Lisp macro:: 8012* Lisp macro::
8112@end menu 8013@end menu
8113 8014
8114@node Complete kill-region, condition-case, kill-region, kill-region
8115@ifnottex 8015@ifnottex
8016@node Complete kill-region
8116@unnumberedsubsec The Complete @code{kill-region} Definition 8017@unnumberedsubsec The Complete @code{kill-region} Definition
8117@end ifnottex 8018@end ifnottex
8118 8019
@@ -8299,8 +8200,7 @@ The text is deleted but saved in the kill ring."
8299@end smallexample 8200@end smallexample
8300@end ignore 8201@end ignore
8301 8202
8302@node condition-case, Lisp macro, Complete kill-region, kill-region 8203@node condition-case
8303@comment node-name, next, previous, up
8304@subsection @code{condition-case} 8204@subsection @code{condition-case}
8305@findex condition-case 8205@findex condition-case
8306 8206
@@ -8386,8 +8286,7 @@ this is line 8054
8386Initializing a Variable with @code{defvar} includes line 8350 8286Initializing a Variable with @code{defvar} includes line 8350
8387@end ignore 8287@end ignore
8388 8288
8389@node Lisp macro, , condition-case, kill-region 8289@node Lisp macro
8390@comment node-name, next, previous, up
8391@subsection Lisp macro 8290@subsection Lisp macro
8392@cindex Macro, lisp 8291@cindex Macro, lisp
8393@cindex Lisp macro 8292@cindex Lisp macro
@@ -8458,8 +8357,7 @@ whether the previous command was @code{kill-region}. If it was,
8458concatenates a copy of the newly clipped text to the just previously 8357concatenates a copy of the newly clipped text to the just previously
8459clipped text in the kill ring. 8358clipped text in the kill ring.
8460 8359
8461@node copy-region-as-kill, Digression into C, kill-region, Cutting & Storing Text 8360@node copy-region-as-kill
8462@comment node-name, next, previous, up
8463@section @code{copy-region-as-kill} 8361@section @code{copy-region-as-kill}
8464@findex copy-region-as-kill 8362@findex copy-region-as-kill
8465@findex nthcdr 8363@findex nthcdr
@@ -8480,8 +8378,8 @@ the function copies the text into a separate entry in the kill ring.
8480* copy-region-as-kill body:: The body of @code{copy-region-as-kill}. 8378* copy-region-as-kill body:: The body of @code{copy-region-as-kill}.
8481@end menu 8379@end menu
8482 8380
8483@node Complete copy-region-as-kill, copy-region-as-kill body, copy-region-as-kill, copy-region-as-kill
8484@ifnottex 8381@ifnottex
8382@node Complete copy-region-as-kill
8485@unnumberedsubsec The complete @code{copy-region-as-kill} function definition 8383@unnumberedsubsec The complete @code{copy-region-as-kill} function definition
8486@end ifnottex 8384@end ifnottex
8487 8385
@@ -8559,8 +8457,7 @@ if Transient Mark mode is turned on.
8559 8457
8560The body of @code{copy-region-as-kill} merits discussion in detail. 8458The body of @code{copy-region-as-kill} merits discussion in detail.
8561 8459
8562@node copy-region-as-kill body, , Complete copy-region-as-kill, copy-region-as-kill 8460@node copy-region-as-kill body
8563@comment node-name, next, previous, up
8564@subsection The Body of @code{copy-region-as-kill} 8461@subsection The Body of @code{copy-region-as-kill}
8565 8462
8566The @code{copy-region-as-kill} function works in much the same way as 8463The @code{copy-region-as-kill} function works in much the same way as
@@ -8583,8 +8480,8 @@ previous Emacs command.
8583* kill-new function:: 8480* kill-new function::
8584@end menu 8481@end menu
8585 8482
8586@node last-command & this-command, kill-append function, copy-region-as-kill body, copy-region-as-kill body
8587@ifnottex 8483@ifnottex
8484@node last-command & this-command
8588@unnumberedsubsubsec @code{last-command} and @code{this-command} 8485@unnumberedsubsubsec @code{last-command} and @code{this-command}
8589@end ifnottex 8486@end ifnottex
8590 8487
@@ -8639,7 +8536,7 @@ expressions are the same.
8639If the previous command was @code{kill-region}, then the Emacs Lisp 8536If the previous command was @code{kill-region}, then the Emacs Lisp
8640interpreter calls the @code{kill-append} function 8537interpreter calls the @code{kill-append} function
8641 8538
8642@node kill-append function, kill-new function, last-command & this-command, copy-region-as-kill body 8539@node kill-append function
8643@unnumberedsubsubsec The @code{kill-append} function 8540@unnumberedsubsubsec The @code{kill-append} function
8644@findex kill-append 8541@findex kill-append
8645 8542
@@ -8771,7 +8668,7 @@ of the kill ring. The kill ring is a list, each element of which is
8771saved text. The @code{kill-append} function uses the @code{kill-new} 8668saved text. The @code{kill-append} function uses the @code{kill-new}
8772function which in turn uses the @code{setcar} function. 8669function which in turn uses the @code{setcar} function.
8773 8670
8774@node kill-new function, , kill-append function, copy-region-as-kill body 8671@node kill-new function
8775@unnumberedsubsubsec The @code{kill-new} function 8672@unnumberedsubsubsec The @code{kill-new} function
8776@findex kill-new 8673@findex kill-new
8777 8674
@@ -9200,8 +9097,7 @@ delete-and-extract-region is written in C.
9200see Initializing a Variable with @code{defvar} 9097see Initializing a Variable with @code{defvar}
9201@end ignore 9098@end ignore
9202 9099
9203@node Digression into C, defvar, copy-region-as-kill, Cutting & Storing Text 9100@node Digression into C
9204@comment node-name, next, previous, up
9205@section Digression into C 9101@section Digression into C
9206@findex delete-and-extract-region 9102@findex delete-and-extract-region
9207@cindex C, a digression into 9103@cindex C, a digression into
@@ -9366,8 +9262,7 @@ From the point of view of the person writing Lisp, Emacs is all very
9366simple; but hidden underneath is a great deal of complexity to make it 9262simple; but hidden underneath is a great deal of complexity to make it
9367all work. 9263all work.
9368 9264
9369@node defvar, cons & search-fwd Review, Digression into C, Cutting & Storing Text 9265@node defvar
9370@comment node-name, next, previous, up
9371@section Initializing a Variable with @code{defvar} 9266@section Initializing a Variable with @code{defvar}
9372@findex defvar 9267@findex defvar
9373@cindex Initializing a variable 9268@cindex Initializing a variable
@@ -9416,8 +9311,8 @@ that people customize. It has more features than @code{defvar}.
9416* defvar and asterisk:: 9311* defvar and asterisk::
9417@end menu 9312@end menu
9418 9313
9419@node See variable current value, defvar and asterisk, defvar, defvar
9420@ifnottex 9314@ifnottex
9315@node See variable current value
9421@unnumberedsubsec Seeing the Current Value of a Variable 9316@unnumberedsubsec Seeing the Current Value of a Variable
9422@end ifnottex 9317@end ifnottex
9423 9318
@@ -9468,7 +9363,7 @@ like @code{apropos}, print only the first line of documentation.
9468Succeeding lines should not be indented; otherwise they look odd when 9363Succeeding lines should not be indented; otherwise they look odd when
9469you use @kbd{C-h v} (@code{describe-variable}). 9364you use @kbd{C-h v} (@code{describe-variable}).
9470 9365
9471@node defvar and asterisk, , See variable current value, defvar 9366@node defvar and asterisk
9472@subsection @code{defvar} and an asterisk 9367@subsection @code{defvar} and an asterisk
9473@findex defvar @r{for a user customizable variable} 9368@findex defvar @r{for a user customizable variable}
9474@findex defvar @r{with an asterisk} 9369@findex defvar @r{with an asterisk}
@@ -9514,8 +9409,7 @@ readily. Fortunately, you can press @key{TAB} after calling the
9514The GNU Emacs Manual}.) 9409The GNU Emacs Manual}.)
9515 9410
9516@need 1250 9411@need 1250
9517@node cons & search-fwd Review, search Exercises, defvar, Cutting & Storing Text 9412@node cons & search-fwd Review
9518@comment node-name, next, previous, up
9519@section Review 9413@section Review
9520 9414
9521Here is a brief summary of some recently introduced functions. 9415Here is a brief summary of some recently introduced functions.
@@ -9664,7 +9558,7 @@ mark from the buffer and throws it away. You cannot get it back.
9664(This is not an interactive command.) 9558(This is not an interactive command.)
9665 9559
9666@need 1500 9560@need 1500
9667@node search Exercises, , cons & search-fwd Review, Cutting & Storing Text 9561@node search Exercises
9668@section Searching Exercises 9562@section Searching Exercises
9669 9563
9670@itemize @bullet 9564@itemize @bullet
@@ -9682,8 +9576,7 @@ echo area, if any; if the kill ring does not contain a third element,
9682print an appropriate message. 9576print an appropriate message.
9683@end itemize 9577@end itemize
9684 9578
9685@node List Implementation, Yanking, Cutting & Storing Text, Top 9579@node List Implementation
9686@comment node-name, next, previous, up
9687@chapter How Lists are Implemented 9580@chapter How Lists are Implemented
9688@cindex Lists in a computer 9581@cindex Lists in a computer
9689 9582
@@ -9707,8 +9600,8 @@ pointed to. Hence, a list is kept as a series of electronic addresses.
9707* List Exercise:: 9600* List Exercise::
9708@end menu 9601@end menu
9709 9602
9710@node Lists diagrammed, Symbols as Chest, List Implementation, List Implementation
9711@ifnottex 9603@ifnottex
9604@node Lists diagrammed
9712@unnumberedsec Lists diagrammed 9605@unnumberedsec Lists diagrammed
9713@end ifnottex 9606@end ifnottex
9714 9607
@@ -10047,7 +9940,7 @@ is the address of the empty list, of @code{nil}.
10047In summary, when a Lisp variable is set to a value, it is provided with 9940In summary, when a Lisp variable is set to a value, it is provided with
10048the address of the list to which the variable refers. 9941the address of the list to which the variable refers.
10049 9942
10050@node Symbols as Chest, List Exercise, Lists diagrammed, List Implementation 9943@node Symbols as Chest
10051@section Symbols as a Chest of Drawers 9944@section Symbols as a Chest of Drawers
10052@cindex Symbols as a Chest of Drawers 9945@cindex Symbols as a Chest of Drawers
10053@cindex Chest of Drawers, metaphor for a symbol 9946@cindex Chest of Drawers, metaphor for a symbol
@@ -10148,7 +10041,7 @@ Here is a fanciful representation:
10148@end iftex 10041@end iftex
10149@end ifclear 10042@end ifclear
10150 10043
10151@node List Exercise, , Symbols as Chest, List Implementation 10044@node List Exercise
10152@section Exercise 10045@section Exercise
10153 10046
10154Set @code{flowers} to @code{violet} and @code{buttercup}. Cons two 10047Set @code{flowers} to @code{violet} and @code{buttercup}. Cons two
@@ -10156,8 +10049,7 @@ more flowers on to this list and set this new list to
10156@code{more-flowers}. Set the @sc{car} of @code{flowers} to a fish. 10049@code{more-flowers}. Set the @sc{car} of @code{flowers} to a fish.
10157What does the @code{more-flowers} list now contain? 10050What does the @code{more-flowers} list now contain?
10158 10051
10159@node Yanking, Loops & Recursion, List Implementation, Top 10052@node Yanking
10160@comment node-name, next, previous, up
10161@chapter Yanking Text Back 10053@chapter Yanking Text Back
10162@findex yank 10054@findex yank
10163@cindex Text retrieval 10055@cindex Text retrieval
@@ -10188,8 +10080,7 @@ list is handled as a ring.)
10188* yank nthcdr Exercises:: The @code{kill-ring-yank-pointer} variable. 10080* yank nthcdr Exercises:: The @code{kill-ring-yank-pointer} variable.
10189@end menu 10081@end menu
10190 10082
10191@node Kill Ring Overview, kill-ring-yank-pointer, Yanking, Yanking 10083@node Kill Ring Overview
10192@comment node-name, next, previous, up
10193@section Kill Ring Overview 10084@section Kill Ring Overview
10194@cindex Kill ring overview 10085@cindex Kill ring overview
10195 10086
@@ -10232,8 +10123,7 @@ is easier to understand.)
10232To begin to understand how @code{yank} and @code{yank-pop} work, it is 10123To begin to understand how @code{yank} and @code{yank-pop} work, it is
10233first necessary to look at the @code{kill-ring-yank-pointer} variable. 10124first necessary to look at the @code{kill-ring-yank-pointer} variable.
10234 10125
10235@node kill-ring-yank-pointer, yank nthcdr Exercises, Kill Ring Overview, Yanking 10126@node kill-ring-yank-pointer
10236@comment node-name, next, previous, up
10237@section The @code{kill-ring-yank-pointer} Variable 10127@section The @code{kill-ring-yank-pointer} Variable
10238 10128
10239@code{kill-ring-yank-pointer} is a variable, just as @code{kill-ring} is 10129@code{kill-ring-yank-pointer} is a variable, just as @code{kill-ring} is
@@ -10372,7 +10262,7 @@ yanking point; just return the Nth kill forward."
10372@end ignore 10262@end ignore
10373 10263
10374@need 1500 10264@need 1500
10375@node yank nthcdr Exercises, , kill-ring-yank-pointer, Yanking 10265@node yank nthcdr Exercises
10376@section Exercises with @code{yank} and @code{nthcdr} 10266@section Exercises with @code{yank} and @code{nthcdr}
10377 10267
10378@itemize @bullet 10268@itemize @bullet
@@ -10389,8 +10279,7 @@ Using @code{nthcdr} and @code{car}, construct a series of expressions
10389to return the first, second, third, and fourth elements of a list. 10279to return the first, second, third, and fourth elements of a list.
10390@end itemize 10280@end itemize
10391 10281
10392@node Loops & Recursion, Regexp Search, Yanking, Top 10282@node Loops & Recursion
10393@comment node-name, next, previous, up
10394@chapter Loops and Recursion 10283@chapter Loops and Recursion
10395@cindex Loops and recursion 10284@cindex Loops and recursion
10396@cindex Recursion and loops 10285@cindex Recursion and loops
@@ -10426,8 +10315,7 @@ increase the values of @code{max-specpdl-size} and
10426* Looping exercise:: 10315* Looping exercise::
10427@end menu 10316@end menu
10428 10317
10429@node while, dolist dotimes, Loops & Recursion, Loops & Recursion 10318@node while
10430@comment node-name, next, previous, up
10431@section @code{while} 10319@section @code{while}
10432@cindex Loops 10320@cindex Loops
10433@findex while 10321@findex while
@@ -10465,8 +10353,8 @@ The template for a @code{while} expression looks like this:
10465* Decrementing Loop:: A loop with a decrementing counter. 10353* Decrementing Loop:: A loop with a decrementing counter.
10466@end menu 10354@end menu
10467 10355
10468@node Looping with while, Loop Example, while, while
10469@ifnottex 10356@ifnottex
10357@node Looping with while
10470@unnumberedsubsec Looping with @code{while} 10358@unnumberedsubsec Looping with @code{while}
10471@end ifnottex 10359@end ifnottex
10472 10360
@@ -10499,8 +10387,7 @@ This makes sense. It is not the mere act of looping that is desired,
10499but the consequences of what happens when the expressions in the loop 10387but the consequences of what happens when the expressions in the loop
10500are repeatedly evaluated. 10388are repeatedly evaluated.
10501 10389
10502@node Loop Example, print-elements-of-list, Looping with while, while 10390@node Loop Example
10503@comment node-name, next, previous, up
10504@subsection A @code{while} Loop and a List 10391@subsection A @code{while} Loop and a List
10505 10392
10506A common way to control a @code{while} loop is to test whether a list 10393A common way to control a @code{while} loop is to test whether a list
@@ -10604,7 +10491,7 @@ This test and use of @code{cdr} can be put together in a function that
10604goes through a list and prints each element of the list on a line of its 10491goes through a list and prints each element of the list on a line of its
10605own. 10492own.
10606 10493
10607@node print-elements-of-list, Incrementing Loop, Loop Example, while 10494@node print-elements-of-list
10608@subsection An Example: @code{print-elements-of-list} 10495@subsection An Example: @code{print-elements-of-list}
10609@findex print-elements-of-list 10496@findex print-elements-of-list
10610 10497
@@ -10683,8 +10570,7 @@ function is printed. Since the last expression in the function is the
10683@code{while} loop, and since @code{while} loops always return 10570@code{while} loop, and since @code{while} loops always return
10684@code{nil}, a @code{nil} is printed after the last element of the list. 10571@code{nil}, a @code{nil} is printed after the last element of the list.
10685 10572
10686@node Incrementing Loop, Incrementing Loop Details, print-elements-of-list, while 10573@node Incrementing Loop
10687@comment node-name, next, previous, up
10688@subsection A Loop with an Incrementing Counter 10574@subsection A Loop with an Incrementing Counter
10689 10575
10690A loop is not useful unless it stops when it ought. Besides 10576A loop is not useful unless it stops when it ought. Besides
@@ -10694,8 +10580,8 @@ number of repetitions are complete. This means that the loop must
10694have a counter---an expression that counts how many times the loop 10580have a counter---an expression that counts how many times the loop
10695repeats itself. 10581repeats itself.
10696 10582
10697@node Incrementing Loop Details, Decrementing Loop, Incrementing Loop, while
10698@ifnottex 10583@ifnottex
10584@node Incrementing Loop Details
10699@unnumberedsubsec Details of an Incrementing Loop 10585@unnumberedsubsec Details of an Incrementing Loop
10700@end ifnottex 10586@end ifnottex
10701 10587
@@ -10733,7 +10619,7 @@ is set to 1.
10733* Inc Example altogether:: Putting the function definition together. 10619* Inc Example altogether:: Putting the function definition together.
10734@end menu 10620@end menu
10735 10621
10736@node Incrementing Example, Inc Example parts, Incrementing Loop Details, Incrementing Loop Details 10622@node Incrementing Example
10737@unnumberedsubsubsec Example with incrementing counter 10623@unnumberedsubsubsec Example with incrementing counter
10738 10624
10739Suppose you are playing on the beach and decide to make a triangle of 10625Suppose you are playing on the beach and decide to make a triangle of
@@ -10800,7 +10686,7 @@ row has been added to the total of all the preceding rows. In a more
10800complex loop the repetitive action might not be so simple, but it will 10686complex loop the repetitive action might not be so simple, but it will
10801be simpler than doing everything all at once. 10687be simpler than doing everything all at once.
10802 10688
10803@node Inc Example parts, Inc Example altogether, Incrementing Example, Incrementing Loop Details 10689@node Inc Example parts
10804@unnumberedsubsubsec The parts of the function definition 10690@unnumberedsubsubsec The parts of the function definition
10805 10691
10806The preceding analysis gives us the bones of our function definition: 10692The preceding analysis gives us the bones of our function definition:
@@ -10894,7 +10780,7 @@ The built-in Emacs Lisp function @code{1+} adds 1 to a number, so the
10894(setq row-number (1+ row-number)) 10780(setq row-number (1+ row-number))
10895@end smallexample 10781@end smallexample
10896 10782
10897@node Inc Example altogether, , Inc Example parts, Incrementing Loop Details 10783@node Inc Example altogether
10898@unnumberedsubsubsec Putting the function definition together 10784@unnumberedsubsubsec Putting the function definition together
10899 10785
10900We have created the parts for the function definition; now we need to 10786We have created the parts for the function definition; now we need to
@@ -11004,8 +10890,7 @@ can try it out. Here are two examples:
11004The sum of the first four numbers is 10 and the sum of the first seven 10890The sum of the first four numbers is 10 and the sum of the first seven
11005numbers is 28. 10891numbers is 28.
11006 10892
11007@node Decrementing Loop, , Incrementing Loop Details, while 10893@node Decrementing Loop
11008@comment node-name, next, previous, up
11009@subsection Loop with a Decrementing Counter 10894@subsection Loop with a Decrementing Counter
11010 10895
11011Another common way to write a @code{while} loop is to write the test 10896Another common way to write a @code{while} loop is to write the test
@@ -11041,7 +10926,7 @@ The template for a decrementing @code{while} loop looks like this:
11041* Dec Example altogether:: Putting the function definition together. 10926* Dec Example altogether:: Putting the function definition together.
11042@end menu 10927@end menu
11043 10928
11044@node Decrementing Example, Dec Example parts, Decrementing Loop, Decrementing Loop 10929@node Decrementing Example
11045@unnumberedsubsubsec Example with decrementing counter 10930@unnumberedsubsubsec Example with decrementing counter
11046 10931
11047To illustrate a loop with a decrementing counter, we will rewrite the 10932To illustrate a loop with a decrementing counter, we will rewrite the
@@ -11068,7 +10953,7 @@ rows, the number of pebbles in the last row is 7. Likewise, we know how
11068many pebbles are in the preceding row: it is one less than the number in 10953many pebbles are in the preceding row: it is one less than the number in
11069the row. 10954the row.
11070 10955
11071@node Dec Example parts, Dec Example altogether, Decrementing Example, Decrementing Loop 10956@node Dec Example parts
11072@unnumberedsubsubsec The parts of the function definition 10957@unnumberedsubsubsec The parts of the function definition
11073 10958
11074We start with three variables: the total number of rows in the 10959We start with three variables: the total number of rows in the
@@ -11130,7 +11015,7 @@ the @code{while} loop is simply:
11130(while (> number-of-pebbles-in-row 0) 11015(while (> number-of-pebbles-in-row 0)
11131@end smallexample 11016@end smallexample
11132 11017
11133@node Dec Example altogether, , Dec Example parts, Decrementing Loop 11018@node Dec Example altogether
11134@unnumberedsubsubsec Putting the function definition together 11019@unnumberedsubsubsec Putting the function definition together
11135 11020
11136We can put these expressions together to create a function definition 11021We can put these expressions together to create a function definition
@@ -11201,8 +11086,7 @@ that the test returns false after the loop has repeated itself the right
11201number of times. 11086number of times.
11202@end enumerate 11087@end enumerate
11203 11088
11204@node dolist dotimes, Recursion, while, Loops & Recursion 11089@node dolist dotimes
11205@comment node-name, next, previous, up
11206@section Save your time: @code{dolist} and @code{dotimes} 11090@section Save your time: @code{dolist} and @code{dotimes}
11207 11091
11208In addition to @code{while}, both @code{dolist} and @code{dotimes} 11092In addition to @code{while}, both @code{dolist} and @code{dotimes}
@@ -11222,8 +11106,8 @@ each shorter version of the list to the first of its arguments.
11222* dotimes:: 11106* dotimes::
11223@end menu 11107@end menu
11224 11108
11225@node dolist, dotimes, dolist dotimes, dolist dotimes 11109@node dolist
11226@unnumberedsubsubsec The @code{dolist} Macro 11110@unnumberedsubsec The @code{dolist} Macro
11227@findex dolist 11111@findex dolist
11228 11112
11229Suppose, for example, you want to reverse a list, so that 11113Suppose, for example, you want to reverse a list, so that
@@ -11326,8 +11210,8 @@ version of the list to @code{element} and then evaluates the body of
11326the expression; and repeats the loop. The result is returned in 11210the expression; and repeats the loop. The result is returned in
11327@code{value}. 11211@code{value}.
11328 11212
11329@node dotimes, , dolist, dolist dotimes 11213@node dotimes
11330@unnumberedsubsubsec The @code{dotimes} Macro 11214@unnumberedsubsec The @code{dotimes} Macro
11331@findex dotimes 11215@findex dotimes
11332 11216
11333The @code{dotimes} macro is similar to @code{dolist}, except that it 11217The @code{dotimes} macro is similar to @code{dolist}, except that it
@@ -11376,8 +11260,7 @@ up the number of pebbles in a triangle.
11376@end group 11260@end group
11377@end smallexample 11261@end smallexample
11378 11262
11379@node Recursion, Looping exercise, dolist dotimes, Loops & Recursion 11263@node Recursion
11380@comment node-name, next, previous, up
11381@section Recursion 11264@section Recursion
11382@cindex Recursion 11265@cindex Recursion
11383 11266
@@ -11403,8 +11286,7 @@ arguments that the final instance will stop.
11403* No deferment solution:: 11286* No deferment solution::
11404@end menu 11287@end menu
11405 11288
11406@node Building Robots, Recursive Definition Parts, Recursion, Recursion 11289@node Building Robots
11407@comment node-name, next, previous, up
11408@subsection Building Robots: Extending the Metaphor 11290@subsection Building Robots: Extending the Metaphor
11409@cindex Building robots 11291@cindex Building robots
11410@cindex Robots, building 11292@cindex Robots, building
@@ -11441,8 +11323,7 @@ does the same job as the first, but with different arguments.
11441It is important that the arguments differ from one instance to the 11323It is important that the arguments differ from one instance to the
11442next; otherwise, the process will never stop. 11324next; otherwise, the process will never stop.
11443 11325
11444@node Recursive Definition Parts, Recursion with list, Building Robots, Recursion 11326@node Recursive Definition Parts
11445@comment node-name, next, previous, up
11446@subsection The Parts of a Recursive Definition 11327@subsection The Parts of a Recursive Definition
11447@cindex Parts of a Recursive Definition 11328@cindex Parts of a Recursive Definition
11448@cindex Recursive Definition Parts 11329@cindex Recursive Definition Parts
@@ -11506,8 +11387,7 @@ false when the function should no longer be repeated.
11506The do-again-test is sometimes called the @dfn{stop condition}, 11387The do-again-test is sometimes called the @dfn{stop condition},
11507since it stops the repetitions when it tests false. 11388since it stops the repetitions when it tests false.
11508 11389
11509@node Recursion with list, Recursive triangle function, Recursive Definition Parts, Recursion 11390@node Recursion with list
11510@comment node-name, next, previous, up
11511@subsection Recursion with a List 11391@subsection Recursion with a List
11512 11392
11513The example of a @code{while} loop that printed the elements of a list 11393The example of a @code{while} loop that printed the elements of a list
@@ -11599,8 +11479,7 @@ nil
11599@end smallexample 11479@end smallexample
11600 11480
11601@need 2000 11481@need 2000
11602@node Recursive triangle function, Recursion with cond, Recursion with list, Recursion 11482@node Recursive triangle function
11603@comment node-name, next, previous, up
11604@subsection Recursion in Place of a Counter 11483@subsection Recursion in Place of a Counter
11605@findex triangle-recursively 11484@findex triangle-recursively
11606 11485
@@ -11638,8 +11517,8 @@ its argument.
11638* Recursive Example arg of 3 or 4:: 11517* Recursive Example arg of 3 or 4::
11639@end menu 11518@end menu
11640 11519
11641@node Recursive Example arg of 1 or 2, Recursive Example arg of 3 or 4, Recursive triangle function, Recursive triangle function
11642@ifnottex 11520@ifnottex
11521@node Recursive Example arg of 1 or 2
11643@unnumberedsubsubsec An argument of 1 or 2 11522@unnumberedsubsubsec An argument of 1 or 2
11644@end ifnottex 11523@end ifnottex
11645 11524
@@ -11701,7 +11580,7 @@ returned, which is correct. A triangle with two rows has three
11701pebbles in it. 11580pebbles in it.
11702@end table 11581@end table
11703 11582
11704@node Recursive Example arg of 3 or 4, , Recursive Example arg of 1 or 2, Recursive triangle function 11583@node Recursive Example arg of 3 or 4
11705@unnumberedsubsubsec An argument of 3 or 4 11584@unnumberedsubsubsec An argument of 3 or 4
11706 11585
11707Suppose that @code{triangle-recursively} is called with an argument of 11586Suppose that @code{triangle-recursively} is called with an argument of
@@ -11791,8 +11670,7 @@ on.
11791There is a way around this kind of waiting, which we will discuss in 11670There is a way around this kind of waiting, which we will discuss in
11792@ref{No Deferment, , Recursion without Deferments}. 11671@ref{No Deferment, , Recursion without Deferments}.
11793 11672
11794@node Recursion with cond, Recursive Patterns, Recursive triangle function, Recursion 11673@node Recursion with cond
11795@comment node-name, next, previous, up
11796@subsection Recursion Example Using @code{cond} 11674@subsection Recursion Example Using @code{cond}
11797@findex cond 11675@findex cond
11798 11676
@@ -11868,8 +11746,7 @@ equal to 0, it returns 1 if the number is 1 and it evaluates @code{(+
11868number (triangle-using-cond (1- number)))} if the number is greater than 11746number (triangle-using-cond (1- number)))} if the number is greater than
118691. 117471.
11870 11748
11871@node Recursive Patterns, No Deferment, Recursion with cond, Recursion 11749@node Recursive Patterns
11872@comment node-name, next, previous, up
11873@subsection Recursive Patterns 11750@subsection Recursive Patterns
11874@cindex Recursive Patterns 11751@cindex Recursive Patterns
11875 11752
@@ -11883,8 +11760,7 @@ and this provides a sense of its primal capabilities.
11883* Keep:: 11760* Keep::
11884@end menu 11761@end menu
11885 11762
11886@node Every, Accumulate, Recursive Patterns, Recursive Patterns 11763@node Every
11887@comment node-name, next, previous, up
11888@unnumberedsubsubsec Recursive Pattern: @emph{every} 11764@unnumberedsubsubsec Recursive Pattern: @emph{every}
11889@cindex Every, type of recursive pattern 11765@cindex Every, type of recursive pattern
11890@cindex Recursive pattern: every 11766@cindex Recursive pattern: every
@@ -11983,8 +11859,7 @@ But when the list has at least one element,
11983 @end itemize 11859 @end itemize
11984@end itemize 11860@end itemize
11985 11861
11986@node Accumulate, Keep, Every, Recursive Patterns 11862@node Accumulate
11987@comment node-name, next, previous, up
11988@unnumberedsubsubsec Recursive Pattern: @emph{accumulate} 11863@unnumberedsubsubsec Recursive Pattern: @emph{accumulate}
11989@cindex Accumulate, type of recursive pattern 11864@cindex Accumulate, type of recursive pattern
11990@cindex Recursive pattern: accumulate 11865@cindex Recursive pattern: accumulate
@@ -12035,8 +11910,7 @@ Here is an example:
12035@xref{Files List, , Making a List of Files}, for an example of the 11910@xref{Files List, , Making a List of Files}, for an example of the
12036accumulate pattern. 11911accumulate pattern.
12037 11912
12038@node Keep, , Accumulate, Recursive Patterns 11913@node Keep
12039@comment node-name, next, previous, up
12040@unnumberedsubsubsec Recursive Pattern: @emph{keep} 11914@unnumberedsubsubsec Recursive Pattern: @emph{keep}
12041@cindex Keep, type of recursive pattern 11915@cindex Keep, type of recursive pattern
12042@cindex Recursive pattern: keep 11916@cindex Recursive pattern: keep
@@ -12105,7 +11979,7 @@ Here is an example that uses @code{cond}:
12105It goes without saying that you need not use @code{nil} as the test for 11979It goes without saying that you need not use @code{nil} as the test for
12106when to stop; and you can, of course, combine these patterns. 11980when to stop; and you can, of course, combine these patterns.
12107 11981
12108@node No Deferment, No deferment solution, Recursive Patterns, Recursion 11982@node No Deferment
12109@subsection Recursion without Deferments 11983@subsection Recursion without Deferments
12110@cindex Deferment in recursion 11984@cindex Deferment in recursion
12111@cindex Recursion without Deferments 11985@cindex Recursion without Deferments
@@ -12188,7 +12062,7 @@ is being waited on. This is not a problem when there are only a few
12188steps, as in this example. But it can be a problem when there are 12062steps, as in this example. But it can be a problem when there are
12189more steps. 12063more steps.
12190 12064
12191@node No deferment solution, , No Deferment, Recursion 12065@node No deferment solution
12192@subsection No Deferment Solution 12066@subsection No Deferment Solution
12193@cindex No deferment solution 12067@cindex No deferment solution
12194@cindex Defermentless solution 12068@cindex Defermentless solution
@@ -12352,7 +12226,7 @@ This kind of pattern helps when you are writing functions that can use
12352many resources in a computer. 12226many resources in a computer.
12353 12227
12354@need 1500 12228@need 1500
12355@node Looping exercise, , Recursion, Loops & Recursion 12229@node Looping exercise
12356@section Looping Exercise 12230@section Looping Exercise
12357 12231
12358@itemize @bullet 12232@itemize @bullet
@@ -12399,8 +12273,7 @@ Documentation Format}.
12399@end iftex 12273@end iftex
12400@end itemize 12274@end itemize
12401 12275
12402@node Regexp Search, Counting Words, Loops & Recursion, Top 12276@node Regexp Search
12403@comment node-name, next, previous, up
12404@chapter Regular Expression Searches 12277@chapter Regular Expression Searches
12405@cindex Searches, illustrating 12278@cindex Searches, illustrating
12406@cindex Regular expression searches 12279@cindex Regular expression searches
@@ -12446,8 +12319,7 @@ introduces several new features.
12446* re-search Exercises:: 12319* re-search Exercises::
12447@end menu 12320@end menu
12448 12321
12449@node sentence-end, re-search-forward, Regexp Search, Regexp Search 12322@node sentence-end
12450@comment node-name, next, previous, up
12451@section The Regular Expression for @code{sentence-end} 12323@section The Regular Expression for @code{sentence-end}
12452@findex sentence-end 12324@findex sentence-end
12453 12325
@@ -12598,8 +12470,7 @@ return between square brackets but here it is shown as @key{RET}.
12598@end table 12470@end table
12599@end ignore 12471@end ignore
12600 12472
12601@node re-search-forward, forward-sentence, sentence-end, Regexp Search 12473@node re-search-forward
12602@comment node-name, next, previous, up
12603@section The @code{re-search-forward} Function 12474@section The @code{re-search-forward} Function
12604@findex re-search-forward 12475@findex re-search-forward
12605 12476
@@ -12673,8 +12544,7 @@ sentence cannot go beyond a paragraph). If the search fails, the
12673function will return @code{nil}; and the repeat count will be provided 12544function will return @code{nil}; and the repeat count will be provided
12674by the argument to the @code{forward-sentence} function. 12545by the argument to the @code{forward-sentence} function.
12675 12546
12676@node forward-sentence, forward-paragraph, re-search-forward, Regexp Search 12547@node forward-sentence
12677@comment node-name, next, previous, up
12678@section @code{forward-sentence} 12548@section @code{forward-sentence}
12679@findex forward-sentence 12549@findex forward-sentence
12680 12550
@@ -12691,8 +12561,8 @@ bound to the key command @kbd{M-e}.
12691* fwd-sentence re-search:: A regular expression search. 12561* fwd-sentence re-search:: A regular expression search.
12692@end menu 12562@end menu
12693 12563
12694@node Complete forward-sentence, fwd-sentence while loops, forward-sentence, forward-sentence
12695@ifnottex 12564@ifnottex
12565@node Complete forward-sentence
12696@unnumberedsubsec Complete @code{forward-sentence} function definition 12566@unnumberedsubsec Complete @code{forward-sentence} function definition
12697@end ifnottex 12567@end ifnottex
12698 12568
@@ -12818,7 +12688,7 @@ point, from before the search, is used in the
12818equivalents. The @code{sentence-end} variable is set by the 12688equivalents. The @code{sentence-end} variable is set by the
12819@code{sentence-end} function. 12689@code{sentence-end} function.
12820 12690
12821@node fwd-sentence while loops, fwd-sentence re-search, Complete forward-sentence, forward-sentence 12691@node fwd-sentence while loops
12822@unnumberedsubsec The @code{while} loops 12692@unnumberedsubsec The @code{while} loops
12823 12693
12824Two @code{while} loops follow. The first @code{while} has a 12694Two @code{while} loops follow. The first @code{while} has a
@@ -12919,7 +12789,7 @@ It may seem odd to have what looks like the `real work' of
12919the @code{forward-sentence} function buried here, but this is a common 12789the @code{forward-sentence} function buried here, but this is a common
12920way this kind of operation is carried out in Lisp. 12790way this kind of operation is carried out in Lisp.
12921 12791
12922@node fwd-sentence re-search, , fwd-sentence while loops, forward-sentence 12792@node fwd-sentence re-search
12923@unnumberedsubsec The regular expression search 12793@unnumberedsubsec The regular expression search
12924 12794
12925The @code{re-search-forward} function searches for the end of the 12795The @code{re-search-forward} function searches for the end of the
@@ -12967,8 +12837,7 @@ illustrated by @code{re-search-forward}, in which the search is the
12967test of an @code{if} expression, is handy. You will see or write code 12837test of an @code{if} expression, is handy. You will see or write code
12968incorporating this pattern often. 12838incorporating this pattern often.
12969 12839
12970@node forward-paragraph, etags, forward-sentence, Regexp Search 12840@node forward-paragraph
12971@comment node-name, next, previous, up
12972@section @code{forward-paragraph}: a Goldmine of Functions 12841@section @code{forward-paragraph}: a Goldmine of Functions
12973@findex forward-paragraph 12842@findex forward-paragraph
12974 12843
@@ -13151,8 +13020,8 @@ This is an added complication.
13151* fwd-para while:: The forward motion @code{while} loop. 13020* fwd-para while:: The forward motion @code{while} loop.
13152@end menu 13021@end menu
13153 13022
13154@node forward-paragraph in brief, fwd-para let, forward-paragraph, forward-paragraph
13155@ifnottex 13023@ifnottex
13024@node forward-paragraph in brief
13156@unnumberedsubsec Shortened @code{forward-paragraph} function definition 13025@unnumberedsubsec Shortened @code{forward-paragraph} function definition
13157@end ifnottex 13026@end ifnottex
13158 13027
@@ -13191,7 +13060,7 @@ This case was described earlier. (@xref{forward-sentence, The
13191@code{forward-sentence} function}.) Now we reach the end of the 13060@code{forward-sentence} function}.) Now we reach the end of the
13192familiar part of this function. 13061familiar part of this function.
13193 13062
13194@node fwd-para let, fwd-para while, forward-paragraph in brief, forward-paragraph 13063@node fwd-para let
13195@unnumberedsubsec The @code{let*} expression 13064@unnumberedsubsec The @code{let*} expression
13196 13065
13197The next line of the @code{forward-paragraph} function begins a 13066The next line of the @code{forward-paragraph} function begins a
@@ -13323,7 +13192,7 @@ of the @code{let*} deals with the case when the function is given a
13323negative argument and is therefore moving backwards. We will skip this 13192negative argument and is therefore moving backwards. We will skip this
13324section. 13193section.
13325 13194
13326@node fwd-para while, , fwd-para let, forward-paragraph 13195@node fwd-para while
13327@unnumberedsubsec The forward motion @code{while} loop 13196@unnumberedsubsec The forward motion @code{while} loop
13328 13197
13329The second part of the body of the @code{let*} deals with forward 13198The second part of the body of the @code{let*} deals with forward
@@ -13596,7 +13465,7 @@ key; you will be taken directly to the source. (Be sure to install
13596your sources! Without them, you are like a person who tries to drive 13465your sources! Without them, you are like a person who tries to drive
13597a car with his eyes shut!) 13466a car with his eyes shut!)
13598 13467
13599@node etags, Regexp Review, forward-paragraph, Regexp Search 13468@node etags
13600@section Create Your Own @file{TAGS} File 13469@section Create Your Own @file{TAGS} File
13601@findex etags 13470@findex etags
13602@cindex @file{TAGS} file, create own 13471@cindex @file{TAGS} file, create own
@@ -13720,8 +13589,7 @@ as well as with some other source packages.)
13720For more information, see @ref{Tags, , Tag Tables, emacs, The GNU Emacs 13589For more information, see @ref{Tags, , Tag Tables, emacs, The GNU Emacs
13721Manual}. 13590Manual}.
13722 13591
13723@node Regexp Review, re-search Exercises, etags, Regexp Search 13592@node Regexp Review
13724@comment node-name, next, previous, up
13725@section Review 13593@section Review
13726 13594
13727Here is a brief summary of some recently introduced functions. 13595Here is a brief summary of some recently introduced functions.
@@ -13812,7 +13680,7 @@ the buffer is narrowed.
13812@end table 13680@end table
13813 13681
13814@need 1500 13682@need 1500
13815@node re-search Exercises, , Regexp Review, Regexp Search 13683@node re-search Exercises
13816@section Exercises with @code{re-search-forward} 13684@section Exercises with @code{re-search-forward}
13817 13685
13818@itemize @bullet 13686@itemize @bullet
@@ -13830,7 +13698,7 @@ The function I use is described in an appendix, along with several
13830regexps. @xref{the-the, , @code{the-the} Duplicated Words Function}. 13698regexps. @xref{the-the, , @code{the-the} Duplicated Words Function}.
13831@end itemize 13699@end itemize
13832 13700
13833@node Counting Words, Words in a defun, Regexp Search, Top 13701@node Counting Words
13834@chapter Counting: Repetition and Regexps 13702@chapter Counting: Repetition and Regexps
13835@cindex Repetition for word counting 13703@cindex Repetition for word counting
13836@cindex Regular expressions for word counting 13704@cindex Regular expressions for word counting
@@ -13847,8 +13715,8 @@ word count commands using @code{while} loops and recursion.
13847* Counting Exercise:: 13715* Counting Exercise::
13848@end menu 13716@end menu
13849 13717
13850@node Why Count Words, @value{COUNT-WORDS}, Counting Words, Counting Words
13851@ifnottex 13718@ifnottex
13719@node Why Count Words
13852@unnumberedsec Counting words 13720@unnumberedsec Counting words
13853@end ifnottex 13721@end ifnottex
13854 13722
@@ -13869,8 +13737,7 @@ There are many ways to implement a command to count words. Here are
13869some examples, which you may wish to compare with the standard Emacs 13737some examples, which you may wish to compare with the standard Emacs
13870command, @code{count-words-region}. 13738command, @code{count-words-region}.
13871 13739
13872@node @value{COUNT-WORDS}, recursive-count-words, Why Count Words, Counting Words 13740@node @value{COUNT-WORDS}
13873@comment node-name, next, previous, up
13874@section The @code{@value{COUNT-WORDS}} Function 13741@section The @code{@value{COUNT-WORDS}} Function
13875@findex @value{COUNT-WORDS} 13742@findex @value{COUNT-WORDS}
13876 13743
@@ -13895,8 +13762,8 @@ or to a @code{while} loop.
13895* Whitespace Bug:: The Whitespace Bug in @code{@value{COUNT-WORDS}}. 13762* Whitespace Bug:: The Whitespace Bug in @code{@value{COUNT-WORDS}}.
13896@end menu 13763@end menu
13897 13764
13898@node Design @value{COUNT-WORDS}, Whitespace Bug, @value{COUNT-WORDS}, @value{COUNT-WORDS}
13899@ifnottex 13765@ifnottex
13766@node Design @value{COUNT-WORDS}
13900@unnumberedsubsec Designing @code{@value{COUNT-WORDS}} 13767@unnumberedsubsec Designing @code{@value{COUNT-WORDS}}
13901@end ifnottex 13768@end ifnottex
13902 13769
@@ -14072,8 +13939,7 @@ table determines which characters these are."
14072@noindent 13939@noindent
14073As written, the function works, but not in all circumstances. 13940As written, the function works, but not in all circumstances.
14074 13941
14075@node Whitespace Bug, , Design @value{COUNT-WORDS}, @value{COUNT-WORDS} 13942@node Whitespace Bug
14076@comment node-name, next, previous, up
14077@subsection The Whitespace Bug in @code{@value{COUNT-WORDS}} 13943@subsection The Whitespace Bug in @code{@value{COUNT-WORDS}}
14078 13944
14079The @code{@value{COUNT-WORDS}} command described in the preceding 13945The @code{@value{COUNT-WORDS}} command described in the preceding
@@ -14325,8 +14191,7 @@ Here is what it looks like:
14325@end group 14191@end group
14326@end smallexample 14192@end smallexample
14327 14193
14328@node recursive-count-words, Counting Exercise, @value{COUNT-WORDS}, Counting Words 14194@node recursive-count-words
14329@comment node-name, next, previous, up
14330@section Count Words Recursively 14195@section Count Words Recursively
14331@cindex Count words recursively 14196@cindex Count words recursively
14332@cindex Recursively counting words 14197@cindex Recursively counting words
@@ -14704,14 +14569,14 @@ determines which characters these are."
14704@end group 14569@end group
14705@end smallexample 14570@end smallexample
14706 14571
14707@node Counting Exercise, , recursive-count-words, Counting Words 14572@node Counting Exercise
14708@section Exercise: Counting Punctuation 14573@section Exercise: Counting Punctuation
14709 14574
14710Using a @code{while} loop, write a function to count the number of 14575Using a @code{while} loop, write a function to count the number of
14711punctuation marks in a region---period, comma, semicolon, colon, 14576punctuation marks in a region---period, comma, semicolon, colon,
14712exclamation mark, and question mark. Do the same using recursion. 14577exclamation mark, and question mark. Do the same using recursion.
14713 14578
14714@node Words in a defun, Readying a Graph, Counting Words, Top 14579@node Words in a defun
14715@chapter Counting Words in a @code{defun} 14580@chapter Counting Words in a @code{defun}
14716@cindex Counting words in a @code{defun} 14581@cindex Counting words in a @code{defun}
14717@cindex Word counting in a @code{defun} 14582@cindex Word counting in a @code{defun}
@@ -14744,8 +14609,8 @@ and this will tell.
14744* Prepare the data:: Prepare the data for display in a graph. 14609* Prepare the data:: Prepare the data for display in a graph.
14745@end menu 14610@end menu
14746 14611
14747@node Divide and Conquer, Words and Symbols, Words in a defun, Words in a defun
14748@ifnottex 14612@ifnottex
14613@node Divide and Conquer
14749@unnumberedsec Divide and Conquer 14614@unnumberedsec Divide and Conquer
14750@end ifnottex 14615@end ifnottex
14751 14616
@@ -14782,7 +14647,7 @@ Fifth, write a function to print the results as a graph.
14782This is quite a project! But if we take each step slowly, it will not 14647This is quite a project! But if we take each step slowly, it will not
14783be difficult. 14648be difficult.
14784 14649
14785@node Words and Symbols, Syntax, Divide and Conquer, Words in a defun 14650@node Words and Symbols
14786@section What to Count? 14651@section What to Count?
14787@cindex Words and symbols in defun 14652@cindex Words and symbols in defun
14788 14653
@@ -14836,7 +14701,7 @@ that are not word constituents. What is meant by `word constituent
14836characters' brings us to the issue of syntax, which is worth a section 14701characters' brings us to the issue of syntax, which is worth a section
14837of its own. 14702of its own.
14838 14703
14839@node Syntax, count-words-in-defun, Words and Symbols, Words in a defun 14704@node Syntax
14840@section What Constitutes a Word or Symbol? 14705@section What Constitutes a Word or Symbol?
14841@cindex Syntax categories and tables 14706@cindex Syntax categories and tables
14842 14707
@@ -14920,7 +14785,7 @@ Here is the full regular expression:
14920"\\(\\w\\|\\s_\\)+[^ \t\n]*[ \t\n]*" 14785"\\(\\w\\|\\s_\\)+[^ \t\n]*[ \t\n]*"
14921@end smallexample 14786@end smallexample
14922 14787
14923@node count-words-in-defun, Several defuns, Syntax, Words in a defun 14788@node count-words-in-defun
14924@section The @code{count-words-in-defun} Function 14789@section The @code{count-words-in-defun} Function
14925@cindex Counting words in a @code{defun} 14790@cindex Counting words in a @code{defun}
14926 14791
@@ -15114,7 +14979,7 @@ Success! The definition has 10 words and symbols.
15114The next problem is to count the numbers of words and symbols in 14979The next problem is to count the numbers of words and symbols in
15115several definitions within a single file. 14980several definitions within a single file.
15116 14981
15117@node Several defuns, Find a File, count-words-in-defun, Words in a defun 14982@node Several defuns
15118@section Count Several @code{defuns} Within a File 14983@section Count Several @code{defuns} Within a File
15119 14984
15120A file such as @file{simple.el} may have a hundred or more function 14985A file such as @file{simple.el} may have a hundred or more function
@@ -15169,8 +15034,7 @@ switched back and forth to some other buffer, such as the
15169 15034
15170Finding a file is a new process that we have not yet discussed. 15035Finding a file is a new process that we have not yet discussed.
15171 15036
15172@node Find a File, lengths-list-file, Several defuns, Words in a defun 15037@node Find a File
15173@comment node-name, next, previous, up
15174@section Find a File 15038@section Find a File
15175@cindex Find a File 15039@cindex Find a File
15176 15040
@@ -15253,7 +15117,7 @@ our own expression.
15253 15117
15254The task is easy: use @code{find-file-noselect} and @code{set-buffer}. 15118The task is easy: use @code{find-file-noselect} and @code{set-buffer}.
15255 15119
15256@node lengths-list-file, Several files, Find a File, Words in a defun 15120@node lengths-list-file
15257@section @code{lengths-list-file} in Detail 15121@section @code{lengths-list-file} in Detail
15258 15122
15259The core of the @code{lengths-list-file} function is a @code{while} 15123The core of the @code{lengths-list-file} function is a @code{while}
@@ -15394,7 +15258,7 @@ earlier one; and my new machine is much faster than the old one.)
15394Note that the length of the last definition in the file is first in 15258Note that the length of the last definition in the file is first in
15395the list. 15259the list.
15396 15260
15397@node Several files, Several files recursively, lengths-list-file, Words in a defun 15261@node Several files
15398@section Count Words in @code{defuns} in Different Files 15262@section Count Words in @code{defuns} in Different Files
15399 15263
15400In the previous section, we created a function that returns a list of 15264In the previous section, we created a function that returns a list of
@@ -15410,8 +15274,8 @@ either a @code{while} loop or recursion.
15410* append:: Attach one list to another. 15274* append:: Attach one list to another.
15411@end menu 15275@end menu
15412 15276
15413@node lengths-list-many-files, append, Several files, Several files
15414@ifnottex 15277@ifnottex
15278@node lengths-list-many-files
15415@unnumberedsubsec Determine the lengths of @code{defuns} 15279@unnumberedsubsec Determine the lengths of @code{defuns}
15416@end ifnottex 15280@end ifnottex
15417 15281
@@ -15507,7 +15371,7 @@ The only other new element of this function definition is the as yet
15507unstudied function @code{append}, which merits a short section for 15371unstudied function @code{append}, which merits a short section for
15508itself. 15372itself.
15509 15373
15510@node append, , lengths-list-many-files, Several files 15374@node append
15511@subsection The @code{append} Function 15375@subsection The @code{append} Function
15512 15376
15513@need 800 15377@need 800
@@ -15542,7 +15406,7 @@ becomes the first element of the new list:
15542((1 2 3 4) 5 6 7 8) 15406((1 2 3 4) 5 6 7 8)
15543@end smallexample 15407@end smallexample
15544 15408
15545@node Several files recursively, Prepare the data, Several files, Words in a defun 15409@node Several files recursively
15546@section Recursively Count Words in Different Files 15410@section Recursively Count Words in Different Files
15547 15411
15548Besides a @code{while} loop, you can work on each of a list of files 15412Besides a @code{while} loop, you can work on each of a list of files
@@ -15625,7 +15489,7 @@ output we want.
15625 15489
15626The next step is to prepare the data in the list for display in a graph. 15490The next step is to prepare the data in the list for display in a graph.
15627 15491
15628@node Prepare the data, , Several files recursively, Words in a defun 15492@node Prepare the data
15629@section Prepare the Data for Display in a Graph 15493@section Prepare the Data for Display in a Graph
15630 15494
15631The @code{recursive-lengths-list-many-files} function returns a list 15495The @code{recursive-lengths-list-many-files} function returns a list
@@ -15648,8 +15512,8 @@ numbers.
15648* Counting function definitions:: 15512* Counting function definitions::
15649@end menu 15513@end menu
15650 15514
15651@node Data for Display in Detail, Sorting, Prepare the data, Prepare the data
15652@ifnottex 15515@ifnottex
15516@node Data for Display in Detail
15653@unnumberedsubsec The Data for Display in Detail 15517@unnumberedsubsec The Data for Display in Detail
15654@end ifnottex 15518@end ifnottex
15655 15519
@@ -15667,7 +15531,7 @@ inspecting a sorted list, we can discover the highest and lowest
15667number, and thereby determine the largest and smallest length range 15531number, and thereby determine the largest and smallest length range
15668that we will need. 15532that we will need.
15669 15533
15670@node Sorting, Files List, Data for Display in Detail, Prepare the data 15534@node Sorting
15671@subsection Sorting Lists 15535@subsection Sorting Lists
15672@findex sort 15536@findex sort
15673 15537
@@ -15746,7 +15610,7 @@ which produces:
15746quoted, since the expression must be evaluated so as to produce the 15610quoted, since the expression must be evaluated so as to produce the
15747list that is passed to @code{sort}.) 15611list that is passed to @code{sort}.)
15748 15612
15749@node Files List, Counting function definitions, Sorting, Prepare the data 15613@node Files List
15750@subsection Making a List of Files 15614@subsection Making a List of Files
15751 15615
15752The @code{recursive-lengths-list-many-files} function requires a list 15616The @code{recursive-lengths-list-many-files} function requires a list
@@ -16007,7 +15871,7 @@ like this:
16007 (insert (format "%s" (current-time-string)))) 15871 (insert (format "%s" (current-time-string))))
16008@end ignore 15872@end ignore
16009 15873
16010@node Counting function definitions, , Files List, Prepare the data 15874@node Counting function definitions
16011@subsection Counting function definitions 15875@subsection Counting function definitions
16012 15876
16013Our immediate goal is to generate a list that tells us how many 15877Our immediate goal is to generate a list that tells us how many
@@ -16311,7 +16175,7 @@ between 120 and 129, and so on. There are four elements with a value
16311of 200 or larger. 16175of 200 or larger.
16312 16176
16313@c The next step is to turn this numbers' list into a graph. 16177@c The next step is to turn this numbers' list into a graph.
16314@node Readying a Graph, Emacs Initialization, Words in a defun, Top 16178@node Readying a Graph
16315@chapter Readying a Graph 16179@chapter Readying a Graph
16316@cindex Readying a graph 16180@cindex Readying a graph
16317@cindex Graph prototype 16181@cindex Graph prototype
@@ -16343,8 +16207,8 @@ the function to label the axes automatically.
16343* Line Graph Exercise:: 16207* Line Graph Exercise::
16344@end menu 16208@end menu
16345 16209
16346@node Columns of a graph, graph-body-print, Readying a Graph, Readying a Graph
16347@ifnottex 16210@ifnottex
16211@node Columns of a graph
16348@unnumberedsec Printing the Columns of a Graph 16212@unnumberedsec Printing the Columns of a Graph
16349@end ifnottex 16213@end ifnottex
16350 16214
@@ -16716,7 +16580,7 @@ Now, finally, we come to our first actual graph printing function.
16716This prints the body of a graph, not the labels for the vertical and 16580This prints the body of a graph, not the labels for the vertical and
16717horizontal axes, so we can call this @code{graph-body-print}. 16581horizontal axes, so we can call this @code{graph-body-print}.
16718 16582
16719@node graph-body-print, recursive-graph-body-print, Columns of a graph, Readying a Graph 16583@node graph-body-print
16720@section The @code{graph-body-print} Function 16584@section The @code{graph-body-print} Function
16721@findex graph-body-print 16585@findex graph-body-print
16722 16586
@@ -16875,7 +16739,7 @@ Emacs will print a graph like this:
16875@end group 16739@end group
16876@end smallexample 16740@end smallexample
16877 16741
16878@node recursive-graph-body-print, Printed Axes, graph-body-print, Readying a Graph 16742@node recursive-graph-body-print
16879@section The @code{recursive-graph-body-print} Function 16743@section The @code{recursive-graph-body-print} Function
16880@findex recursive-graph-body-print 16744@findex recursive-graph-body-print
16881 16745
@@ -16962,7 +16826,7 @@ Here is what @code{recursive-graph-body-print} produces:
16962Either of these two functions, @code{graph-body-print} or 16826Either of these two functions, @code{graph-body-print} or
16963@code{recursive-graph-body-print}, create the body of a graph. 16827@code{recursive-graph-body-print}, create the body of a graph.
16964 16828
16965@node Printed Axes, Line Graph Exercise, recursive-graph-body-print, Readying a Graph 16829@node Printed Axes
16966@section Need for Printed Axes 16830@section Need for Printed Axes
16967 16831
16968A graph needs printed axes, so you can orient yourself. For a do-once 16832A graph needs printed axes, so you can orient yourself. For a do-once
@@ -16975,12 +16839,12 @@ the horizontal and vertical axes. Since the label printing functions
16975do not contain much new material, I have placed their description in 16839do not contain much new material, I have placed their description in
16976an appendix. @xref{Full Graph, , A Graph with Labeled Axes}. 16840an appendix. @xref{Full Graph, , A Graph with Labeled Axes}.
16977 16841
16978@node Line Graph Exercise, , Printed Axes, Readying a Graph 16842@node Line Graph Exercise
16979@section Exercise 16843@section Exercise
16980 16844
16981Write a line graph version of the graph printing functions. 16845Write a line graph version of the graph printing functions.
16982 16846
16983@node Emacs Initialization, Debugging, Readying a Graph, Top 16847@node Emacs Initialization
16984@chapter Your @file{.emacs} File 16848@chapter Your @file{.emacs} File
16985@cindex @file{.emacs} file 16849@cindex @file{.emacs} file
16986@cindex Customizing your @file{.emacs} file 16850@cindex Customizing your @file{.emacs} file
@@ -17012,8 +16876,8 @@ expressions in Emacs Lisp you can change or extend Emacs.
17012* Mode Line:: How to customize your mode line. 16876* Mode Line:: How to customize your mode line.
17013@end menu 16877@end menu
17014 16878
17015@node Default Configuration, Site-wide Init, Emacs Initialization, Emacs Initialization
17016@ifnottex 16879@ifnottex
16880@node Default Configuration
17017@unnumberedsec Emacs's Default Configuration 16881@unnumberedsec Emacs's Default Configuration
17018@end ifnottex 16882@end ifnottex
17019 16883
@@ -17059,7 +16923,7 @@ describes a simple @file{.emacs} file; for more information, see
17059@ref{Init File, , The Init File, elisp, The GNU Emacs Lisp Reference 16923@ref{Init File, , The Init File, elisp, The GNU Emacs Lisp Reference
17060Manual}. 16924Manual}.
17061 16925
17062@node Site-wide Init, defcustom, Default Configuration, Emacs Initialization 16926@node Site-wide Init
17063@section Site-wide Initialization Files 16927@section Site-wide Initialization Files
17064 16928
17065@cindex @file{default.el} init file 16929@cindex @file{default.el} init file
@@ -17105,7 +16969,7 @@ The @file{loaddefs.el} file contains a good many suggestions as to
17105what to put into your own @file{.emacs} file, or into a site-wide 16969what to put into your own @file{.emacs} file, or into a site-wide
17106initialization file. 16970initialization file.
17107 16971
17108@node defcustom, Beginning a .emacs File, Site-wide Init, Emacs Initialization 16972@node defcustom
17109@section Specifying Variables using @code{defcustom} 16973@section Specifying Variables using @code{defcustom}
17110@findex defcustom 16974@findex defcustom
17111 16975
@@ -17270,7 +17134,7 @@ intent is that neither programs nor users should ever change a value
17270set by @code{defconst}. (You can change it; the value set is a 17134set by @code{defconst}. (You can change it; the value set is a
17271variable; but please do not.) 17135variable; but please do not.)
17272 17136
17273@node Beginning a .emacs File, Text and Auto-fill, defcustom, Emacs Initialization 17137@node Beginning a .emacs File
17274@section Beginning a @file{.emacs} File 17138@section Beginning a @file{.emacs} File
17275@cindex @file{.emacs} file, beginning of 17139@cindex @file{.emacs} file, beginning of
17276 17140
@@ -17353,7 +17217,7 @@ Of course, you don't need to include comments like these in your
17353about Mode help or the conventions for comments---but I was able to 17217about Mode help or the conventions for comments---but I was able to
17354remember to look here to remind myself. 17218remember to look here to remind myself.
17355 17219
17356@node Text and Auto-fill, Mail Aliases, Beginning a .emacs File, Emacs Initialization 17220@node Text and Auto-fill
17357@section Text and Auto Fill Mode 17221@section Text and Auto Fill Mode
17358 17222
17359Now we come to the part that `turns on' Text mode and 17223Now we come to the part that `turns on' Text mode and
@@ -17475,7 +17339,7 @@ fill commands to insert two spaces after a colon:
17475(setq colon-double-space t) 17339(setq colon-double-space t)
17476@end smallexample 17340@end smallexample
17477 17341
17478@node Mail Aliases, Indent Tabs Mode, Text and Auto-fill, Emacs Initialization 17342@node Mail Aliases
17479@section Mail Aliases 17343@section Mail Aliases
17480 17344
17481Here is a @code{setq} that `turns on' mail aliases, along with more 17345Here is a @code{setq} that `turns on' mail aliases, along with more
@@ -17509,7 +17373,7 @@ alias geo george@@foobar.wiz.edu
17509When you write a message to George, address it to @samp{geo}; the 17373When you write a message to George, address it to @samp{geo}; the
17510mailer will automatically expand @samp{geo} to the full address. 17374mailer will automatically expand @samp{geo} to the full address.
17511 17375
17512@node Indent Tabs Mode, Keybindings, Mail Aliases, Emacs Initialization 17376@node Indent Tabs Mode
17513@section Indent Tabs Mode 17377@section Indent Tabs Mode
17514@cindex Tabs, preventing 17378@cindex Tabs, preventing
17515@findex indent-tabs-mode 17379@findex indent-tabs-mode
@@ -17547,7 +17411,7 @@ Files'' in @cite{The GNU Emacs Manual}.
17547@end iftex 17411@end iftex
17548 17412
17549@need 1700 17413@need 1700
17550@node Keybindings, Keymaps, Indent Tabs Mode, Emacs Initialization 17414@node Keybindings
17551@section Some Keybindings 17415@section Some Keybindings
17552 17416
17553Now for some personal keybindings: 17417Now for some personal keybindings:
@@ -17660,7 +17524,7 @@ window, I prefer the @code{buffer-menu}
17660command, which not only lists the buffers, 17524command, which not only lists the buffers,
17661but moves point into that window. 17525but moves point into that window.
17662 17526
17663@node Keymaps, Loading Files, Keybindings, Emacs Initialization 17527@node Keymaps
17664@section Keymaps 17528@section Keymaps
17665@cindex Keymaps 17529@cindex Keymaps
17666@cindex Rebinding keys 17530@cindex Rebinding keys
@@ -17728,7 +17592,7 @@ You will see numerous @code{define-key} expressions in
17728Manual}, and @ref{Keymaps, , Keymaps, elisp, The GNU Emacs Lisp 17592Manual}, and @ref{Keymaps, , Keymaps, elisp, The GNU Emacs Lisp
17729Reference Manual}, for more information about keymaps. 17593Reference Manual}, for more information about keymaps.
17730 17594
17731@node Loading Files, Autoload, Keymaps, Emacs Initialization 17595@node Loading Files
17732@section Loading Files 17596@section Loading Files
17733@cindex Loading files 17597@cindex Loading files
17734@c findex load 17598@c findex load
@@ -17820,7 +17684,7 @@ Another interactive command that does a slightly different job is
17820Emacs, emacs, The GNU Emacs Manual}, for information on the 17684Emacs, emacs, The GNU Emacs Manual}, for information on the
17821distinction between @code{load-library} and this command. 17685distinction between @code{load-library} and this command.
17822 17686
17823@node Autoload, Simple Extension, Loading Files, Emacs Initialization 17687@node Autoload
17824@section Autoloading 17688@section Autoloading
17825@findex autoload 17689@findex autoload
17826 17690
@@ -17889,7 +17753,7 @@ documentation is not available.)
17889@xref{Autoload, , Autoload, elisp, The GNU Emacs Lisp Reference 17753@xref{Autoload, , Autoload, elisp, The GNU Emacs Lisp Reference
17890Manual}, for more information. 17754Manual}, for more information.
17891 17755
17892@node Simple Extension, X11 Colors, Autoload, Emacs Initialization 17756@node Simple Extension
17893@section A Simple Extension: @code{line-to-top-of-window} 17757@section A Simple Extension: @code{line-to-top-of-window}
17894@findex line-to-top-of-window 17758@findex line-to-top-of-window
17895@cindex Simple extension in @file{.emacs} file 17759@cindex Simple extension in @file{.emacs} file
@@ -18001,7 +17865,7 @@ emacs -Q - D
18001@end group 17865@end group
18002@end smallexample 17866@end smallexample
18003 17867
18004@node X11 Colors, Miscellaneous, Simple Extension, Emacs Initialization 17868@node X11 Colors
18005@section X11 Colors 17869@section X11 Colors
18006 17870
18007You can specify colors when you use Emacs with the MIT X Windowing 17871You can specify colors when you use Emacs with the MIT X Windowing
@@ -18079,7 +17943,7 @@ xsetroot -solid Navy -fg white &
18079@end smallexample 17943@end smallexample
18080 17944
18081@need 1700 17945@need 1700
18082@node Miscellaneous, Mode Line, X11 Colors, Emacs Initialization 17946@node Miscellaneous
18083@section Miscellaneous Settings for a @file{.emacs} File 17947@section Miscellaneous Settings for a @file{.emacs} File
18084 17948
18085@need 1250 17949@need 1250
@@ -18271,7 +18135,7 @@ xmodmap -e "keysym Alt_L = Meta_L Alt_L"
18271@end smallexample 18135@end smallexample
18272 18136
18273@need 1700 18137@need 1700
18274@node Mode Line, , Miscellaneous, Emacs Initialization 18138@node Mode Line
18275@section A Modified Mode Line 18139@section A Modified Mode Line
18276@vindex mode-line-format 18140@vindex mode-line-format
18277@cindex Mode line format 18141@cindex Mode line format
@@ -18434,7 +18298,7 @@ This will start an Emacs that does @emph{not} load your
18434@file{~/.emacs} initialization file. A plain, default Emacs. Nothing 18298@file{~/.emacs} initialization file. A plain, default Emacs. Nothing
18435more. 18299more.
18436 18300
18437@node Debugging, Conclusion, Emacs Initialization, Top 18301@node Debugging
18438@chapter Debugging 18302@chapter Debugging
18439@cindex debugging 18303@cindex debugging
18440 18304
@@ -18454,7 +18318,7 @@ In this chapter, I will walk through a short example of each.
18454* Debugging Exercises:: 18318* Debugging Exercises::
18455@end menu 18319@end menu
18456 18320
18457@node debug, debug-on-entry, Debugging, Debugging 18321@node debug
18458@section @code{debug} 18322@section @code{debug}
18459@findex debug 18323@findex debug
18460 18324
@@ -18581,7 +18445,7 @@ Debugger entered--Lisp error: (void-function 1=)
18581You can correct the mistake, re-evaluate the function definition, and 18445You can correct the mistake, re-evaluate the function definition, and
18582then run your test again. 18446then run your test again.
18583 18447
18584@node debug-on-entry, debug-on-quit, debug, Debugging 18448@node debug-on-entry
18585@section @code{debug-on-entry} 18449@section @code{debug-on-entry}
18586@findex debug-on-entry 18450@findex debug-on-entry
18587 18451
@@ -18720,7 +18584,7 @@ M-x cancel-debug-on-entry RET triangle-bugged RET
18720@noindent 18584@noindent
18721(If you are reading this in Info, cancel @code{debug-on-entry} now.) 18585(If you are reading this in Info, cancel @code{debug-on-entry} now.)
18722 18586
18723@node debug-on-quit, edebug, debug-on-entry, Debugging 18587@node debug-on-quit
18724@section @code{debug-on-quit} and @code{(debug)} 18588@section @code{debug-on-quit} and @code{(debug)}
18725 18589
18726In addition to setting @code{debug-on-error} or calling @code{debug-on-entry}, 18590In addition to setting @code{debug-on-error} or calling @code{debug-on-entry},
@@ -18752,7 +18616,7 @@ where you want the debugger to start, like this:
18752The @code{debug} function is described in detail in @ref{Debugger, , 18616The @code{debug} function is described in detail in @ref{Debugger, ,
18753The Lisp Debugger, elisp, The GNU Emacs Lisp Reference Manual}. 18617The Lisp Debugger, elisp, The GNU Emacs Lisp Reference Manual}.
18754 18618
18755@node edebug, Debugging Exercises, debug-on-quit, Debugging 18619@node edebug
18756@section The @code{edebug} Source Level Debugger 18620@section The @code{edebug} Source Level Debugger
18757@cindex Source level debugger 18621@cindex Source level debugger
18758@findex edebug 18622@findex edebug
@@ -18895,7 +18759,7 @@ Edebug is described in @ref{edebug, , Edebug, elisp, The GNU Emacs
18895Lisp Reference Manual}. 18759Lisp Reference Manual}.
18896 18760
18897@need 1500 18761@need 1500
18898@node Debugging Exercises, , edebug, Debugging 18762@node Debugging Exercises
18899@section Debugging Exercises 18763@section Debugging Exercises
18900 18764
18901@itemize @bullet 18765@itemize @bullet
@@ -18940,7 +18804,7 @@ Set a breakpoint, then run Edebug in Trace mode until it reaches the
18940stopping point. 18804stopping point.
18941@end itemize 18805@end itemize
18942 18806
18943@node Conclusion, the-the, Debugging, Top 18807@node Conclusion
18944@chapter Conclusion 18808@chapter Conclusion
18945 18809
18946We have now reached the end of this Introduction. You have now 18810We have now reached the end of this Introduction. You have now
@@ -19060,7 +18924,7 @@ beginning.
19060 18924
19061@c ================ Appendix ================ 18925@c ================ Appendix ================
19062 18926
19063@node the-the, Kill Ring, Conclusion, Top 18927@node the-the
19064@appendix The @code{the-the} Function 18928@appendix The @code{the-the} Function
19065@findex the-the 18929@findex the-the
19066@cindex Duplicated words function 18930@cindex Duplicated words function
@@ -19157,7 +19021,7 @@ five six seven
19157You can substitute the other regular expressions shown above in the 19021You can substitute the other regular expressions shown above in the
19158function definition and try each of them on this list. 19022function definition and try each of them on this list.
19159 19023
19160@node Kill Ring, Full Graph, the-the, Top 19024@node Kill Ring
19161@appendix Handling the Kill Ring 19025@appendix Handling the Kill Ring
19162@cindex Kill ring handling 19026@cindex Kill ring handling
19163@cindex Handling the kill ring 19027@cindex Handling the kill ring
@@ -19179,8 +19043,8 @@ consider the workings of the kill ring.
19179* ring file:: 19043* ring file::
19180@end menu 19044@end menu
19181 19045
19182@node What the Kill Ring Does, current-kill, Kill Ring, Kill Ring
19183@ifnottex 19046@ifnottex
19047@node What the Kill Ring Does
19184@unnumberedsec What the Kill Ring Does 19048@unnumberedsec What the Kill Ring Does
19185@end ifnottex 19049@end ifnottex
19186 19050
@@ -19254,8 +19118,7 @@ To return to the old value for the length of the kill ring, evaluate:
19254(setq kill-ring-max old-kill-ring-max) 19118(setq kill-ring-max old-kill-ring-max)
19255@end smallexample 19119@end smallexample
19256 19120
19257@node current-kill, yank, What the Kill Ring Does, Kill Ring 19121@node current-kill
19258@comment node-name, next, previous, up
19259@appendixsec The @code{current-kill} Function 19122@appendixsec The @code{current-kill} Function
19260@findex current-kill 19123@findex current-kill
19261 19124
@@ -19272,8 +19135,8 @@ and @code{kill-region}.)
19272* Understanding current-kill:: 19135* Understanding current-kill::
19273@end menu 19136@end menu
19274 19137
19275@node Code for current-kill, Understanding current-kill, current-kill, current-kill
19276@ifnottex 19138@ifnottex
19139@node Code for current-kill
19277@unnumberedsubsec The code for @code{current-kill} 19140@unnumberedsubsec The code for @code{current-kill}
19278@end ifnottex 19141@end ifnottex
19279 19142
@@ -19333,8 +19196,8 @@ Here is the line in @code{kill-new}, which is explained in
19333(setq kill-ring-yank-pointer kill-ring) 19196(setq kill-ring-yank-pointer kill-ring)
19334@end smallexample 19197@end smallexample
19335 19198
19336@node Understanding current-kill, , Code for current-kill, current-kill
19337@ifnottex 19199@ifnottex
19200@node Understanding current-kill
19338@unnumberedsubsec @code{current-kill} in Outline 19201@unnumberedsubsec @code{current-kill} in Outline
19339@end ifnottex 19202@end ifnottex
19340 19203
@@ -19360,8 +19223,8 @@ documentation string. It is @emph{not} interactive.
19360* Determining the Element:: 19223* Determining the Element::
19361@end menu 19224@end menu
19362 19225
19363@node Body of current-kill, Digression concerning error, Understanding current-kill, Understanding current-kill
19364@ifnottex 19226@ifnottex
19227@node Body of current-kill
19365@unnumberedsubsubsec The Body of @code{current-kill} 19228@unnumberedsubsubsec The Body of @code{current-kill}
19366@end ifnottex 19229@end ifnottex
19367 19230
@@ -19443,8 +19306,8 @@ current value of @code{kill-ring-yank-pointer} is set to point to the
19443list. Finally, another expression returns the first element of the 19306list. Finally, another expression returns the first element of the
19444list even if the @code{do-not-move} argument is true. 19307list even if the @code{do-not-move} argument is true.
19445 19308
19446@node Digression concerning error, Determining the Element, Body of current-kill, Understanding current-kill
19447@ifnottex 19309@ifnottex
19310@node Digression concerning error
19448@unnumberedsubsubsec Digression about the word `error' 19311@unnumberedsubsubsec Digression about the word `error'
19449@end ifnottex 19312@end ifnottex
19450 19313
@@ -19465,8 +19328,8 @@ environment, is making an error. This is bad. Even though the computer
19465takes the same steps as it does when there is an `error', a term such as 19328takes the same steps as it does when there is an `error', a term such as
19466`cancel' would have a clearer connotation. 19329`cancel' would have a clearer connotation.
19467 19330
19468@node Determining the Element, , Digression concerning error, Understanding current-kill
19469@ifnottex 19331@ifnottex
19332@node Determining the Element
19470@unnumberedsubsubsec Determining the Element 19333@unnumberedsubsubsec Determining the Element
19471@end ifnottex 19334@end ifnottex
19472 19335
@@ -19603,8 +19466,7 @@ them in an argument list (and within expressions called by them).
19603@ref{defun, , The @code{defun} Special Form}.) 19466@ref{defun, , The @code{defun} Special Form}.)
19604@end ignore 19467@end ignore
19605 19468
19606@node yank, yank-pop, current-kill, Kill Ring 19469@node yank
19607@comment node-name, next, previous, up
19608@appendixsec @code{yank} 19470@appendixsec @code{yank}
19609@findex yank 19471@findex yank
19610 19472
@@ -19689,8 +19551,7 @@ function.)
19689 19551
19690The last part of the function tells what to do when it succeeds. 19552The last part of the function tells what to do when it succeeds.
19691 19553
19692@node yank-pop, ring file, yank, Kill Ring 19554@node yank-pop
19693@comment node-name, next, previous, up
19694@appendixsec @code{yank-pop} 19555@appendixsec @code{yank-pop}
19695@findex yank-pop 19556@findex yank-pop
19696 19557
@@ -19760,8 +19621,7 @@ positions of point and mark set by the preceding @code{yank} command.
19760 19621
19761There is more, but that is the hardest part. 19622There is more, but that is the hardest part.
19762 19623
19763@node ring file, , yank-pop, Kill Ring 19624@node ring file
19764@comment node-name, next, previous, up
19765@appendixsec The @file{ring.el} File 19625@appendixsec The @file{ring.el} File
19766@cindex @file{ring.el} file 19626@cindex @file{ring.el} file
19767 19627
@@ -19770,7 +19630,7 @@ provides many of the features we just discussed. But functions such
19770as @code{kill-ring-yank-pointer} do not use this library, possibly 19630as @code{kill-ring-yank-pointer} do not use this library, possibly
19771because they were written earlier. 19631because they were written earlier.
19772 19632
19773@node Full Graph, Free Software and Free Manuals, Kill Ring, Top 19633@node Full Graph
19774@appendix A Graph with Labeled Axes 19634@appendix A Graph with Labeled Axes
19775 19635
19776Printed axes help you understand a graph. They convey scale. In an 19636Printed axes help you understand a graph. They convey scale. In an
@@ -19787,8 +19647,8 @@ body itself.
19787* Print Whole Graph:: The function to print a complete graph. 19647* Print Whole Graph:: The function to print a complete graph.
19788@end menu 19648@end menu
19789 19649
19790@node Labeled Example, print-graph Varlist, Full Graph, Full Graph
19791@ifnottex 19650@ifnottex
19651@node Labeled Example
19792@unnumberedsec Labeled Example Graph 19652@unnumberedsec Labeled Example Graph
19793@end ifnottex 19653@end ifnottex
19794 19654
@@ -19875,8 +19735,7 @@ These considerations suggest the following outline for the
19875We can work on each part of the @code{print-graph} function definition 19735We can work on each part of the @code{print-graph} function definition
19876in turn. 19736in turn.
19877 19737
19878@node print-graph Varlist, print-Y-axis, Labeled Example, Full Graph 19738@node print-graph Varlist
19879@comment node-name, next, previous, up
19880@appendixsec The @code{print-graph} Varlist 19739@appendixsec The @code{print-graph} Varlist
19881@cindex @code{print-graph} varlist 19740@cindex @code{print-graph} varlist
19882 19741
@@ -19917,8 +19776,7 @@ in the @code{let} for @code{print-graph}:
19917As we shall see, this expression is not quite right. 19776As we shall see, this expression is not quite right.
19918 19777
19919@need 2000 19778@need 2000
19920@node print-Y-axis, print-X-axis, print-graph Varlist, Full Graph 19779@node print-Y-axis
19921@comment node-name, next, previous, up
19922@appendixsec The @code{print-Y-axis} Function 19780@appendixsec The @code{print-Y-axis} Function
19923@cindex Axis, print vertical 19781@cindex Axis, print vertical
19924@cindex Y axis printing 19782@cindex Y axis printing
@@ -19956,8 +19814,8 @@ construct and insert the appropriate numbers and marks.
19956* print-Y-axis Penultimate:: A not quite final version. 19814* print-Y-axis Penultimate:: A not quite final version.
19957@end menu 19815@end menu
19958 19816
19959@node print-Y-axis in Detail, Height of label, print-Y-axis, print-Y-axis
19960@ifnottex 19817@ifnottex
19818@node print-Y-axis in Detail
19961@unnumberedsubsec The @code{print-Y-axis} Function in Detail 19819@unnumberedsubsec The @code{print-Y-axis} Function in Detail
19962@end ifnottex 19820@end ifnottex
19963 19821
@@ -19972,8 +19830,8 @@ the base line (number 1) and then that we want a number and a tic on
19972the fifth line from the bottom and on every line that is a multiple of 19830the fifth line from the bottom and on every line that is a multiple of
19973five. 19831five.
19974 19832
19975@node Height of label, Compute a Remainder, print-Y-axis in Detail, print-Y-axis
19976@ifnottex 19833@ifnottex
19834@node Height of label
19977@unnumberedsubsec What height should the label be? 19835@unnumberedsubsec What height should the label be?
19978@end ifnottex 19836@end ifnottex
19979 19837
@@ -20010,7 +19868,7 @@ language, more reminiscent of the classroom, five goes into seven
20010once, with a remainder of two. However, five goes into ten twice, 19868once, with a remainder of two. However, five goes into ten twice,
20011with no remainder: ten is an integral multiple of five. 19869with no remainder: ten is an integral multiple of five.
20012 19870
20013@node Compute a Remainder, Y Axis Element, Height of label, print-Y-axis 19871@node Compute a Remainder
20014@appendixsubsec Side Trip: Compute a Remainder 19872@appendixsubsec Side Trip: Compute a Remainder
20015 19873
20016@findex % @r{(remainder function)} 19874@findex % @r{(remainder function)}
@@ -20144,7 +20002,7 @@ then the resulting value of @code{height} is used to compute its
20144final value. @xref{fwd-para let, , The @code{let*} expression}, for 20002final value. @xref{fwd-para let, , The @code{let*} expression}, for
20145more about @code{let*}.) 20003more about @code{let*}.)
20146 20004
20147@node Y Axis Element, Y-axis-column, Compute a Remainder, print-Y-axis 20005@node Y Axis Element
20148@appendixsubsec Construct a Y Axis Element 20006@appendixsubsec Construct a Y Axis Element
20149 20007
20150When we print the vertical axis, we want to insert strings such as 20008When we print the vertical axis, we want to insert strings such as
@@ -20250,7 +20108,7 @@ The @code{number-to-string} function is used in the concatenation
20250expression, to convert the number to a string that is concatenated 20108expression, to convert the number to a string that is concatenated
20251with the leading spaces and the tic mark. 20109with the leading spaces and the tic mark.
20252 20110
20253@node Y-axis-column, print-Y-axis Penultimate, Y Axis Element, print-Y-axis 20111@node Y-axis-column
20254@appendixsubsec Create a Y Axis Column 20112@appendixsubsec Create a Y Axis Column
20255 20113
20256The preceding functions provide all the tools needed to construct a 20114The preceding functions provide all the tools needed to construct a
@@ -20297,7 +20155,7 @@ blank label using the @code{make-string} function. The base line
20297consists of the number one followed by a tic mark. 20155consists of the number one followed by a tic mark.
20298 20156
20299@need 2000 20157@need 2000
20300@node print-Y-axis Penultimate, , Y-axis-column, print-Y-axis 20158@node print-Y-axis Penultimate
20301@appendixsubsec The Not Quite Final Version of @code{print-Y-axis} 20159@appendixsubsec The Not Quite Final Version of @code{print-Y-axis}
20302 20160
20303The list constructed by the @code{Y-axis-column} function is passed to 20161The list constructed by the @code{Y-axis-column} function is passed to
@@ -20373,7 +20231,7 @@ Emacs will print labels vertically, the top one being @w{@samp{10 -@w{
20373thereby getting rid of what might appear as a bug.) 20231thereby getting rid of what might appear as a bug.)
20374 20232
20375@need 2000 20233@need 2000
20376@node print-X-axis, Print Whole Graph, print-Y-axis, Full Graph 20234@node print-X-axis
20377@appendixsec The @code{print-X-axis} Function 20235@appendixsec The @code{print-X-axis} Function
20378@cindex Axis, print horizontal 20236@cindex Axis, print horizontal
20379@cindex X axis printing 20237@cindex X axis printing
@@ -20409,8 +20267,8 @@ graph without changing the ways the graph is labeled.
20409* X Axis Tic Marks:: Create tic marks for the horizontal axis. 20267* X Axis Tic Marks:: Create tic marks for the horizontal axis.
20410@end menu 20268@end menu
20411 20269
20412@node Similarities differences, X Axis Tic Marks, print-X-axis, print-X-axis
20413@ifnottex 20270@ifnottex
20271@node Similarities differences
20414@unnumberedsubsec Similarities and differences 20272@unnumberedsubsec Similarities and differences
20415@end ifnottex 20273@end ifnottex
20416 20274
@@ -20435,7 +20293,7 @@ using @code{print-X-axis-tic-line} and
20435@code{print-X-axis-numbered-line}. 20293@code{print-X-axis-numbered-line}.
20436@end enumerate 20294@end enumerate
20437 20295
20438@node X Axis Tic Marks, , Similarities differences, print-X-axis 20296@node X Axis Tic Marks
20439@appendixsubsec X Axis Tic Marks 20297@appendixsubsec X Axis Tic Marks
20440 20298
20441The first function should print the X axis tic marks. We must specify 20299The first function should print the X axis tic marks. We must specify
@@ -20724,7 +20582,7 @@ Emacs will print the horizontal axis like this:
20724@end group 20582@end group
20725@end smallexample 20583@end smallexample
20726 20584
20727@node Print Whole Graph, , print-X-axis, Full Graph 20585@node Print Whole Graph
20728@appendixsec Printing the Whole Graph 20586@appendixsec Printing the Whole Graph
20729@cindex Printing the whole graph 20587@cindex Printing the whole graph
20730@cindex Whole graph printing 20588@cindex Whole graph printing
@@ -20763,8 +20621,8 @@ Here is the outline:
20763* Final printed graph:: The graph itself! 20621* Final printed graph:: The graph itself!
20764@end menu 20622@end menu
20765 20623
20766@node The final version, Test print-graph, Print Whole Graph, Print Whole Graph
20767@ifnottex 20624@ifnottex
20625@node The final version
20768@unnumberedsubsec Changes for the Final Version 20626@unnumberedsubsec Changes for the Final Version
20769@end ifnottex 20627@end ifnottex
20770 20628
@@ -20915,7 +20773,7 @@ each row is five units."
20915@end group 20773@end group
20916@end smallexample 20774@end smallexample
20917 20775
20918@node Test print-graph, Graphing words in defuns, The final version, Print Whole Graph 20776@node Test print-graph
20919@appendixsubsec Testing @code{print-graph} 20777@appendixsubsec Testing @code{print-graph}
20920 20778
20921@need 1250 20779@need 1250
@@ -21005,7 +20863,7 @@ The graph looks like this:
21005feature? If you think it is a bug, and should be a `1' instead, (or 20863feature? If you think it is a bug, and should be a `1' instead, (or
21006even a `0'), you can modify the sources.) 20864even a `0'), you can modify the sources.)
21007 20865
21008@node Graphing words in defuns, lambda, Test print-graph, Print Whole Graph 20866@node Graphing words in defuns
21009@appendixsubsec Graphing Numbers of Words and Symbols 20867@appendixsubsec Graphing Numbers of Words and Symbols
21010 20868
21011Now for the graph for which all this code was written: a graph that 20869Now for the graph for which all this code was written: a graph that
@@ -21093,7 +20951,7 @@ not yet seen, @code{mapcar} and @code{lambda}.
21093@end group 20951@end group
21094@end smallexample 20952@end smallexample
21095 20953
21096@node lambda, mapcar, Graphing words in defuns, Print Whole Graph 20954@node lambda
21097@appendixsubsec A @code{lambda} Expression: Useful Anonymity 20955@appendixsubsec A @code{lambda} Expression: Useful Anonymity
21098@cindex Anonymous function 20956@cindex Anonymous function
21099@findex lambda 20957@findex lambda
@@ -21259,7 +21117,7 @@ divides that number by 50.
21259Lisp Reference Manual}, for more about @code{lambda}. Lisp and lambda 21117Lisp Reference Manual}, for more about @code{lambda}. Lisp and lambda
21260expressions derive from the Lambda Calculus. 21118expressions derive from the Lambda Calculus.
21261 21119
21262@node mapcar, Another Bug, lambda, Print Whole Graph 21120@node mapcar
21263@appendixsubsec The @code{mapcar} Function 21121@appendixsubsec The @code{mapcar} Function
21264@findex mapcar 21122@findex mapcar
21265 21123
@@ -21343,7 +21201,7 @@ information: many of the higher ranges are 0, meaning that fewer than
2134350 defuns had that many words or symbols---but not necessarily meaning 2120150 defuns had that many words or symbols---but not necessarily meaning
21344that none had that many words or symbols.) 21202that none had that many words or symbols.)
21345 21203
21346@node Another Bug, Final printed graph, mapcar, Print Whole Graph 21204@node Another Bug
21347@appendixsubsec Another Bug @dots{} Most Insidious 21205@appendixsubsec Another Bug @dots{} Most Insidious
21348@cindex Bug, most insidious type 21206@cindex Bug, most insidious type
21349@cindex Insidious type of bug 21207@cindex Insidious type of bug
@@ -22040,7 +21898,7 @@ each column."
22040@end ignore 21898@end ignore
22041 21899
22042@page 21900@page
22043@node Final printed graph, , Another Bug, Print Whole Graph 21901@node Final printed graph
22044@appendixsubsec The Printed Graph 21902@appendixsubsec The Printed Graph
22045 21903
22046When made and installed, you can call the @code{print-graph} command 21904When made and installed, you can call the @code{print-graph} command
@@ -22090,7 +21948,7 @@ Here is the graph:
22090@noindent 21948@noindent
22091The largest group of functions contain 10 -- 19 words and symbols each. 21949The largest group of functions contain 10 -- 19 words and symbols each.
22092 21950
22093@node Free Software and Free Manuals, GNU Free Documentation License, Full Graph, Top 21951@node Free Software and Free Manuals
22094@appendix Free Software and Free Manuals 21952@appendix Free Software and Free Manuals
22095 21953
22096@strong{by Richard M. Stallman} 21954@strong{by Richard M. Stallman}
@@ -22210,14 +22068,13 @@ Note: The Free Software Foundation maintains a page on its Web site
22210that lists free books available from other publishers:@* 22068that lists free books available from other publishers:@*
22211@uref{http://www.gnu.org/doc/other-free-books.html} 22069@uref{http://www.gnu.org/doc/other-free-books.html}
22212 22070
22213@node GNU Free Documentation License, Index, Free Software and Free Manuals, Top 22071@node GNU Free Documentation License
22214@appendix GNU Free Documentation License 22072@appendix GNU Free Documentation License
22215 22073
22216@cindex FDL, GNU Free Documentation License 22074@cindex FDL, GNU Free Documentation License
22217@include doclicense.texi 22075@include doclicense.texi
22218 22076
22219@node Index, About the Author, GNU Free Documentation License, Top 22077@node Index
22220@comment node-name, next, previous, up
22221@unnumbered Index 22078@unnumbered Index
22222 22079
22223@ignore 22080@ignore
@@ -22256,7 +22113,7 @@ MENU ENTRY: NODE NAME.
22256@end iftex 22113@end iftex
22257 22114
22258@ifnottex 22115@ifnottex
22259@node About the Author, , Index, Top 22116@node About the Author
22260@unnumbered About the Author 22117@unnumbered About the Author
22261@end ifnottex 22118@end ifnottex
22262 22119