Mercurial > emacs
comparison lispintro/emacs-lisp-intro.texi @ 73854:55e5dc416293
Copy descriptions from detailed master menu to menus within body.
author | Robert J. Chassell <bob@rattlesnake.com> |
---|---|
date | Thu, 09 Nov 2006 18:47:52 +0000 |
parents | 1629ec038cb6 |
children | e658f2abf575 dbe3f29e61d6 |
comparison
equal
deleted
inserted
replaced
73853:fb904438445a | 73854:55e5dc416293 |
---|---|
453 * Change a defun:: How to change a function definition. | 453 * Change a defun:: How to change a function definition. |
454 | 454 |
455 Make a Function Interactive | 455 Make a Function Interactive |
456 | 456 |
457 * Interactive multiply-by-seven:: An overview. | 457 * Interactive multiply-by-seven:: An overview. |
458 * multiply-by-seven in detail:: The interactive version. | 458 * multiply-by-seven in detail:: The interactive version. |
459 | 459 |
460 @code{let} | 460 @code{let} |
461 | 461 |
462 * Prevent confusion:: | 462 * Prevent confusion:: |
463 * Parts of let Expression:: | 463 * Parts of let Expression:: |
587 * Lisp macro:: | 587 * Lisp macro:: |
588 | 588 |
589 @code{copy-region-as-kill} | 589 @code{copy-region-as-kill} |
590 | 590 |
591 * Complete copy-region-as-kill:: The complete function definition. | 591 * Complete copy-region-as-kill:: The complete function definition. |
592 * copy-region-as-kill body:: The body of @code{copy-region-as-kill}. | 592 * copy-region-as-kill body:: The body of @code{copy-region-as-kill}. |
593 | 593 |
594 The Body of @code{copy-region-as-kill} | 594 The Body of @code{copy-region-as-kill} |
595 | 595 |
596 * last-command & this-command:: | 596 * last-command & this-command:: |
597 * kill-append function:: | 597 * kill-append function:: |
834 and phases of the moon, simplify polynomials, debug code, manage | 834 and phases of the moon, simplify polynomials, debug code, manage |
835 files, read letters, write books---all these activities are kinds of | 835 files, read letters, write books---all these activities are kinds of |
836 editing in the most general sense of the word.) | 836 editing in the most general sense of the word.) |
837 | 837 |
838 @menu | 838 @menu |
839 * Why:: | 839 * Why:: Why learn Emacs Lisp? |
840 * On Reading this Text:: | 840 * On Reading this Text:: Read, gain familiarity, pick up habits.... |
841 * Who You Are:: | 841 * Who You Are:: For whom this is written. |
842 * Lisp History:: | 842 * Lisp History:: |
843 * Note for Novices:: | 843 * Note for Novices:: You can read this as a novice. |
844 * Thank You:: | 844 * Thank You:: |
845 @end menu | 845 @end menu |
846 | 846 |
847 @node Why, On Reading this Text, Preface, Preface | 847 @node Why, On Reading this Text, Preface, Preface |
848 @ifnottex | 848 @ifnottex |
1091 mark is an abbreviation for the function @code{quote}; you need not | 1091 mark is an abbreviation for the function @code{quote}; you need not |
1092 think about functions now; functions are defined in @ref{Making | 1092 think about functions now; functions are defined in @ref{Making |
1093 Errors, , Generate an Error Message}.} Lists are the basis of Lisp. | 1093 Errors, , Generate an Error Message}.} Lists are the basis of Lisp. |
1094 | 1094 |
1095 @menu | 1095 @menu |
1096 * Lisp Lists:: | 1096 * Lisp Lists:: What are lists? |
1097 * Run a Program:: | 1097 * Run a Program:: Any list in Lisp is a program ready to run. |
1098 * Making Errors:: | 1098 * Making Errors:: Generating an error message. |
1099 * Names & Definitions:: | 1099 * Names & Definitions:: Names of symbols and function definitions. |
1100 * Lisp Interpreter:: | 1100 * Lisp Interpreter:: What the Lisp interpreter does. |
1101 * Evaluation:: | 1101 * Evaluation:: Running a program. |
1102 * Variables:: | 1102 * Variables:: Returning a value from a variable. |
1103 * Arguments:: | 1103 * Arguments:: Passing information to a function. |
1104 * set & setq:: | 1104 * set & setq:: Setting the value of a variable. |
1105 * Summary:: | 1105 * Summary:: The major points. |
1106 * Error Message Exercises:: | 1106 * Error Message Exercises:: |
1107 @end menu | 1107 @end menu |
1108 | 1108 |
1109 @node Lisp Lists, Run a Program, List Processing, List Processing | 1109 @node Lisp Lists, Run a Program, List Processing, List Processing |
1110 @comment node-name, next, previous, up | 1110 @comment node-name, next, previous, up |
1130 separated from each other by whitespace and surrounded by parentheses, | 1130 separated from each other by whitespace and surrounded by parentheses, |
1131 like flowers in a field with a stone wall around them. | 1131 like flowers in a field with a stone wall around them. |
1132 @cindex Flowers in a field | 1132 @cindex Flowers in a field |
1133 | 1133 |
1134 @menu | 1134 @menu |
1135 * Numbers Lists:: | 1135 * Numbers Lists:: List have numbers, other lists, in them. |
1136 * Lisp Atoms:: | 1136 * Lisp Atoms:: Elemental entities. |
1137 * Whitespace in Lists:: | 1137 * Whitespace in Lists:: Formatting lists to be readable. |
1138 * Typing Lists:: | 1138 * Typing Lists:: How GNU Emacs helps you type lists. |
1139 @end menu | 1139 @end menu |
1140 | 1140 |
1141 @node Numbers Lists, Lisp Atoms, Lisp Lists, Lisp Lists | 1141 @node Numbers Lists, Lisp Atoms, Lisp Lists, Lisp Lists |
1142 @ifnottex | 1142 @ifnottex |
1143 @unnumberedsubsec Numbers, Lists inside of Lists | 1143 @unnumberedsubsec Numbers, Lists inside of Lists |
1571 write Lisp programs, you need to know how to write function definitions | 1571 write Lisp programs, you need to know how to write function definitions |
1572 and attach them to names, and how to do this without confusing either | 1572 and attach them to names, and how to do this without confusing either |
1573 yourself or the computer. | 1573 yourself or the computer. |
1574 | 1574 |
1575 @menu | 1575 @menu |
1576 * Complications:: | 1576 * Complications:: Variables, Special forms, Lists within. |
1577 * Byte Compiling:: | 1577 * Byte Compiling:: Specially processing code for speed. |
1578 @end menu | 1578 @end menu |
1579 | 1579 |
1580 @node Complications, Byte Compiling, Lisp Interpreter, Lisp Interpreter | 1580 @node Complications, Byte Compiling, Lisp Interpreter, Lisp Interpreter |
1581 @ifnottex | 1581 @ifnottex |
1582 @unnumberedsubsec Complications | 1582 @unnumberedsubsec Complications |
1643 The word comes from its use in everyday language, `to ascertain the | 1643 The word comes from its use in everyday language, `to ascertain the |
1644 value or amount of; to appraise', according to @cite{Webster's New | 1644 value or amount of; to appraise', according to @cite{Webster's New |
1645 Collegiate Dictionary}. | 1645 Collegiate Dictionary}. |
1646 | 1646 |
1647 @menu | 1647 @menu |
1648 * How the Interpreter Acts:: | 1648 * How the Interpreter Acts:: Returns and Side Effects... |
1649 * Evaluating Inner Lists:: | 1649 * Evaluating Inner Lists:: Lists within lists... |
1650 @end menu | 1650 @end menu |
1651 | 1651 |
1652 @node How the Interpreter Acts, Evaluating Inner Lists, Evaluation, Evaluation | 1652 @node How the Interpreter Acts, Evaluating Inner Lists, Evaluation, Evaluation |
1653 @ifnottex | 1653 @ifnottex |
1654 @unnumberedsubsec How the Lisp Interpreter Acts | 1654 @unnumberedsubsec How the Lisp Interpreter Acts |
1773 changed without affecting the contents of the drawer holding the | 1773 changed without affecting the contents of the drawer holding the |
1774 function definition, and vice-verse. | 1774 function definition, and vice-verse. |
1775 | 1775 |
1776 @menu | 1776 @menu |
1777 * fill-column Example:: | 1777 * fill-column Example:: |
1778 * Void Function:: | 1778 * Void Function:: The error message for a symbol |
1779 * Void Variable:: | 1779 without a function. |
1780 * Void Variable:: The error message for a symbol without a value. | |
1780 @end menu | 1781 @end menu |
1781 | 1782 |
1782 @node fill-column Example, Void Function, Variables, Variables | 1783 @node fill-column Example, Void Function, Variables, Variables |
1783 @ifnottex | 1784 @ifnottex |
1784 @unnumberedsubsec @code{fill-column}, an Example Variable | 1785 @unnumberedsubsec @code{fill-column}, an Example Variable |
1980 (Note here that the English word has two different definitions attached | 1981 (Note here that the English word has two different definitions attached |
1981 to it at the same time. By contrast, in Emacs Lisp, a symbol cannot | 1982 to it at the same time. By contrast, in Emacs Lisp, a symbol cannot |
1982 have two different function definitions at the same time.)} | 1983 have two different function definitions at the same time.)} |
1983 | 1984 |
1984 @menu | 1985 @menu |
1985 * Data types:: | 1986 * Data types:: Types of data passed to a function. |
1986 * Args as Variable or List:: | 1987 * Args as Variable or List:: An argument can be the value |
1987 * Variable Number of Arguments:: | 1988 of a variable or list. |
1988 * Wrong Type of Argument:: | 1989 * Variable Number of Arguments:: Some functions may take a |
1989 * message:: | 1990 variable number of arguments. |
1991 * Wrong Type of Argument:: Passing an argument of the wrong type | |
1992 to a function. | |
1993 * message:: A useful function for sending messages. | |
1990 @end menu | 1994 @end menu |
1991 | 1995 |
1992 @node Data types, Args as Variable or List, Arguments, Arguments | 1996 @node Data types, Args as Variable or List, Arguments, Arguments |
1993 @comment node-name, next, previous, up | 1997 @comment node-name, next, previous, up |
1994 @subsection Arguments' Data Types | 1998 @subsection Arguments' Data Types |
2354 | 2358 |
2355 The following sections not only describe how @code{set} and @code{setq} | 2359 The following sections not only describe how @code{set} and @code{setq} |
2356 work but also illustrate how arguments are passed. | 2360 work but also illustrate how arguments are passed. |
2357 | 2361 |
2358 @menu | 2362 @menu |
2359 * Using set:: | 2363 * Using set:: Setting values. |
2360 * Using setq:: | 2364 * Using setq:: Setting a quoted value. |
2361 * Counting:: | 2365 * Counting:: Using @code{setq} to count. |
2362 @end menu | 2366 @end menu |
2363 | 2367 |
2364 @node Using set, Using setq, set & setq, set & setq | 2368 @node Using set, Using setq, set & setq, set & setq |
2365 @comment node-name, next, previous, up | 2369 @comment node-name, next, previous, up |
2366 @subsection Using @code{set} | 2370 @subsection Using @code{set} |
2626 will start with those. In this section, we will evaluate a few of | 2630 will start with those. In this section, we will evaluate a few of |
2627 these. In another section, we will study the code of several other | 2631 these. In another section, we will study the code of several other |
2628 buffer-related functions, to see how they were written. | 2632 buffer-related functions, to see how they were written. |
2629 | 2633 |
2630 @menu | 2634 @menu |
2631 * How to Evaluate:: | 2635 * How to Evaluate:: Typing editing commands or @kbd{C-x C-e} |
2632 * Buffer Names:: | 2636 causes evaluation. |
2633 * Getting Buffers:: | 2637 * Buffer Names:: Buffers and files are different. |
2634 * Switching Buffers:: | 2638 * Getting Buffers:: Getting a buffer itself, not merely its name. |
2635 * Buffer Size & Locations:: | 2639 * Switching Buffers:: How to change to another buffer. |
2640 * Buffer Size & Locations:: Where point is located and the size of | |
2641 the buffer. | |
2636 * Evaluation Exercise:: | 2642 * Evaluation Exercise:: |
2637 @end menu | 2643 @end menu |
2638 | 2644 |
2639 @node How to Evaluate, Buffer Names, Practicing Evaluation, Practicing Evaluation | 2645 @node How to Evaluate, Buffer Names, Practicing Evaluation, Practicing Evaluation |
2640 @ifnottex | 2646 @ifnottex |
3045 (although, properly speaking, the definition is the function and the | 3051 (although, properly speaking, the definition is the function and the |
3046 symbol refers to it.) | 3052 symbol refers to it.) |
3047 | 3053 |
3048 @menu | 3054 @menu |
3049 * Primitive Functions:: | 3055 * Primitive Functions:: |
3050 * defun:: | 3056 * defun:: The @code{defun} special form. |
3051 * Install:: | 3057 * Install:: Install a function definition. |
3052 * Interactive:: | 3058 * Interactive:: Making a function interactive. |
3053 * Interactive Options:: | 3059 * Interactive Options:: Different options for @code{interactive}. |
3054 * Permanent Installation:: | 3060 * Permanent Installation:: Installing code permanently. |
3055 * let:: | 3061 * let:: Creating and initializing local variables. |
3056 * if:: | 3062 * if:: What if? |
3057 * else:: | 3063 * else:: If--then--else expressions. |
3058 * Truth & Falsehood:: | 3064 * Truth & Falsehood:: What Lisp considers false and true. |
3059 * save-excursion:: | 3065 * save-excursion:: Keeping track of point, mark, and buffer. |
3060 * Review:: | 3066 * Review:: |
3061 * defun Exercises:: | 3067 * defun Exercises:: |
3062 @end menu | 3068 @end menu |
3063 | 3069 |
3064 @node Primitive Functions, defun, Writing Defuns, Writing Defuns | 3070 @node Primitive Functions, defun, Writing Defuns, Writing Defuns |
3293 Emacs. To reload code automatically whenever you start Emacs, see | 3299 Emacs. To reload code automatically whenever you start Emacs, see |
3294 @ref{Permanent Installation, , Installing Code Permanently}.) | 3300 @ref{Permanent Installation, , Installing Code Permanently}.) |
3295 | 3301 |
3296 @menu | 3302 @menu |
3297 * Effect of installation:: | 3303 * Effect of installation:: |
3298 * Change a defun:: | 3304 * Change a defun:: How to change a function definition. |
3299 @end menu | 3305 @end menu |
3300 | 3306 |
3301 @node Effect of installation, Change a defun, Install, Install | 3307 @node Effect of installation, Change a defun, Install, Install |
3302 @ifnottex | 3308 @ifnottex |
3303 @unnumberedsubsec The effect of installation | 3309 @unnumberedsubsec The effect of installation |
3394 effects, such as moving forward by a word or line, and not for the | 3400 effects, such as moving forward by a word or line, and not for the |
3395 value returned. If the returned value were displayed in the echo area | 3401 value returned. If the returned value were displayed in the echo area |
3396 each time you typed a key, it would be very distracting. | 3402 each time you typed a key, it would be very distracting. |
3397 | 3403 |
3398 @menu | 3404 @menu |
3399 * Interactive multiply-by-seven:: | 3405 * Interactive multiply-by-seven:: An overview. |
3400 * multiply-by-seven in detail:: | 3406 * multiply-by-seven in detail:: The interactive version. |
3401 @end menu | 3407 @end menu |
3402 | 3408 |
3403 @node Interactive multiply-by-seven, multiply-by-seven in detail, Interactive, Interactive | 3409 @node Interactive multiply-by-seven, multiply-by-seven in detail, Interactive, Interactive |
3404 @ifnottex | 3410 @ifnottex |
3405 @unnumberedsubsec An Interactive @code{multiply-by-seven}, An Overview | 3411 @unnumberedsubsec An Interactive @code{multiply-by-seven}, An Overview |
3893 expression is not evaluated. For example, you might make a decision | 3899 expression is not evaluated. For example, you might make a decision |
3894 such as, ``if it is warm and sunny, then go to the beach!'' | 3900 such as, ``if it is warm and sunny, then go to the beach!'' |
3895 | 3901 |
3896 @menu | 3902 @menu |
3897 * if in more detail:: | 3903 * if in more detail:: |
3898 * type-of-animal in detail:: | 3904 * type-of-animal in detail:: An example of an @code{if} expression. |
3899 @end menu | 3905 @end menu |
3900 | 3906 |
3901 @node if in more detail, type-of-animal in detail, if, if | 3907 @node if in more detail, type-of-animal in detail, if, if |
3902 @ifnottex | 3908 @ifnottex |
3903 @unnumberedsubsec @code{if} in more detail | 3909 @unnumberedsubsec @code{if} in more detail |
4185 returned is a number such as 47, a string such as @code{"hello"}, or a | 4191 returned is a number such as 47, a string such as @code{"hello"}, or a |
4186 symbol (other than @code{nil}) such as @code{flowers}, or a list (so | 4192 symbol (other than @code{nil}) such as @code{flowers}, or a list (so |
4187 long as it is not empty), or even a buffer! | 4193 long as it is not empty), or even a buffer! |
4188 | 4194 |
4189 @menu | 4195 @menu |
4190 * nil explained:: | 4196 * nil explained:: @code{nil} has two meanings. |
4191 @end menu | 4197 @end menu |
4192 | 4198 |
4193 @node nil explained, , Truth & Falsehood, Truth & Falsehood | 4199 @node nil explained, , Truth & Falsehood, Truth & Falsehood |
4194 @ifnottex | 4200 @ifnottex |
4195 @unnumberedsubsec An explanation of @code{nil} | 4201 @unnumberedsubsec An explanation of @code{nil} |
4273 their previous positions if their locations were changed. Its primary | 4279 their previous positions if their locations were changed. Its primary |
4274 purpose is to keep the user from being surprised and disturbed by | 4280 purpose is to keep the user from being surprised and disturbed by |
4275 unexpected movement of point or mark. | 4281 unexpected movement of point or mark. |
4276 | 4282 |
4277 @menu | 4283 @menu |
4278 * Point and mark:: | 4284 * Point and mark:: A review of various locations. |
4279 * Template for save-excursion:: | 4285 * Template for save-excursion:: |
4280 @end menu | 4286 @end menu |
4281 | 4287 |
4282 @node Point and mark, Template for save-excursion, save-excursion, save-excursion | 4288 @node Point and mark, Template for save-excursion, save-excursion, save-excursion |
4283 @ifnottex | 4289 @ifnottex |
4668 show the actual code used in GNU Emacs. You can learn a great deal from | 4674 show the actual code used in GNU Emacs. You can learn a great deal from |
4669 these definitions. The functions described here are all related to | 4675 these definitions. The functions described here are all related to |
4670 buffers. Later, we will study other functions. | 4676 buffers. Later, we will study other functions. |
4671 | 4677 |
4672 @menu | 4678 @menu |
4673 * Finding More:: | 4679 * Finding More:: How to find more information. |
4674 * simplified-beginning-of-buffer:: | 4680 * simplified-beginning-of-buffer:: Shows @code{goto-char}, |
4675 * mark-whole-buffer:: | 4681 @code{point-min}, and @code{push-mark}. |
4676 * append-to-buffer:: | 4682 * mark-whole-buffer:: Almost the same as @code{beginning-of-buffer}. |
4677 * Buffer Related Review:: | 4683 * append-to-buffer:: Uses @code{save-excursion} and |
4684 @code{insert-buffer-substring}. | |
4685 * Buffer Related Review:: Review. | |
4678 * Buffer Exercises:: | 4686 * Buffer Exercises:: |
4679 @end menu | 4687 @end menu |
4680 | 4688 |
4681 @node Finding More, simplified-beginning-of-buffer, Buffer Walk Through, Buffer Walk Through | 4689 @node Finding More, simplified-beginning-of-buffer, Buffer Walk Through, Buffer Walk Through |
4682 @section Finding More Information | 4690 @section Finding More Information |
4918 a mark at the end of the buffer. It is generally bound to @kbd{C-x | 4926 a mark at the end of the buffer. It is generally bound to @kbd{C-x |
4919 h}. | 4927 h}. |
4920 | 4928 |
4921 @menu | 4929 @menu |
4922 * mark-whole-buffer overview:: | 4930 * mark-whole-buffer overview:: |
4923 * Body of mark-whole-buffer:: | 4931 * Body of mark-whole-buffer:: Only three lines of code. |
4924 @end menu | 4932 @end menu |
4925 | 4933 |
4926 @node mark-whole-buffer overview, Body of mark-whole-buffer, mark-whole-buffer, mark-whole-buffer | 4934 @node mark-whole-buffer overview, Body of mark-whole-buffer, mark-whole-buffer, mark-whole-buffer |
4927 @ifnottex | 4935 @ifnottex |
4928 @unnumberedsubsec An overview of @code{mark-whole-buffer} | 4936 @unnumberedsubsec An overview of @code{mark-whole-buffer} |
5054 (that is, the part of the buffer between point and mark) from the | 5062 (that is, the part of the buffer between point and mark) from the |
5055 current buffer to a specified buffer. | 5063 current buffer to a specified buffer. |
5056 | 5064 |
5057 @menu | 5065 @menu |
5058 * append-to-buffer overview:: | 5066 * append-to-buffer overview:: |
5059 * append interactive:: | 5067 * append interactive:: A two part interactive expression. |
5060 * append-to-buffer body:: | 5068 * append-to-buffer body:: Incorporates a @code{let} expression. |
5061 * append save-excursion:: | 5069 * append save-excursion:: How the @code{save-excursion} works. |
5062 @end menu | 5070 @end menu |
5063 | 5071 |
5064 @node append-to-buffer overview, append interactive, append-to-buffer, append-to-buffer | 5072 @node append-to-buffer overview, append interactive, append-to-buffer, append-to-buffer |
5065 @ifnottex | 5073 @ifnottex |
5066 @unnumberedsubsec An Overview of @code{append-to-buffer} | 5074 @unnumberedsubsec An Overview of @code{append-to-buffer} |
5570 use of an asterisk in an @code{interactive} expression, use of | 5578 use of an asterisk in an @code{interactive} expression, use of |
5571 @code{or}, and the important distinction between a name and the object | 5579 @code{or}, and the important distinction between a name and the object |
5572 to which the name refers. | 5580 to which the name refers. |
5573 | 5581 |
5574 @menu | 5582 @menu |
5575 * copy-to-buffer:: | 5583 * copy-to-buffer:: With @code{set-buffer}, @code{get-buffer-create}. |
5576 * insert-buffer:: | 5584 * insert-buffer:: Read-only, and with @code{or}. |
5577 * beginning-of-buffer:: | 5585 * beginning-of-buffer:: Shows @code{goto-char}, |
5586 @code{point-min}, and @code{push-mark}. | |
5578 * Second Buffer Related Review:: | 5587 * Second Buffer Related Review:: |
5579 * optional Exercise:: | 5588 * optional Exercise:: |
5580 @end menu | 5589 @end menu |
5581 | 5590 |
5582 @node copy-to-buffer, insert-buffer, More Complex, More Complex | 5591 @node copy-to-buffer, insert-buffer, More Complex, More Complex |
5678 buffer that might be @dfn{read-only} and the important distinction | 5687 buffer that might be @dfn{read-only} and the important distinction |
5679 between the name of an object and the object actually referred to. | 5688 between the name of an object and the object actually referred to. |
5680 | 5689 |
5681 @menu | 5690 @menu |
5682 * insert-buffer code:: | 5691 * insert-buffer code:: |
5683 * insert-buffer interactive:: | 5692 * insert-buffer interactive:: When you can read, but not write. |
5684 * insert-buffer body:: | 5693 * insert-buffer body:: The body has an @code{or} and a @code{let}. |
5685 * if & or:: | 5694 * if & or:: Using an @code{if} instead of an @code{or}. |
5686 * Insert or:: | 5695 * Insert or:: How the @code{or} expression works. |
5687 * Insert let:: | 5696 * Insert let:: Two @code{save-excursion} expressions. |
5688 * New insert-buffer:: | 5697 * New insert-buffer:: |
5689 @end menu | 5698 @end menu |
5690 | 5699 |
5691 @node insert-buffer code, insert-buffer interactive, insert-buffer, insert-buffer | 5700 @node insert-buffer code, insert-buffer interactive, insert-buffer, insert-buffer |
5692 @ifnottex | 5701 @ifnottex |
5741 In @code{insert-buffer}, the argument to the @code{interactive} | 5750 In @code{insert-buffer}, the argument to the @code{interactive} |
5742 declaration has two parts, an asterisk, @samp{*}, and @samp{bInsert | 5751 declaration has two parts, an asterisk, @samp{*}, and @samp{bInsert |
5743 buffer:@: }. | 5752 buffer:@: }. |
5744 | 5753 |
5745 @menu | 5754 @menu |
5746 * Read-only buffer:: | 5755 * Read-only buffer:: When a buffer cannot be modified. |
5747 * b for interactive:: | 5756 * b for interactive:: An existing buffer or else its name. |
5748 @end menu | 5757 @end menu |
5749 | 5758 |
5750 @node Read-only buffer, b for interactive, insert-buffer interactive, insert-buffer interactive | 5759 @node Read-only buffer, b for interactive, insert-buffer interactive, insert-buffer interactive |
5751 @comment node-name, next, previous, up | 5760 @comment node-name, next, previous, up |
5752 @unnumberedsubsubsec A Read-only Buffer | 5761 @unnumberedsubsubsec A Read-only Buffer |
6124 The @code{beginning-of-buffer} function can be called with or without an | 6133 The @code{beginning-of-buffer} function can be called with or without an |
6125 argument. The use of the argument is optional. | 6134 argument. The use of the argument is optional. |
6126 | 6135 |
6127 @menu | 6136 @menu |
6128 * Optional Arguments:: | 6137 * Optional Arguments:: |
6129 * beginning-of-buffer opt arg:: | 6138 * beginning-of-buffer opt arg:: Example with optional argument. |
6130 * beginning-of-buffer complete:: | 6139 * beginning-of-buffer complete:: |
6131 @end menu | 6140 @end menu |
6132 | 6141 |
6133 @node Optional Arguments, beginning-of-buffer opt arg, beginning-of-buffer, beginning-of-buffer | 6142 @node Optional Arguments, beginning-of-buffer opt arg, beginning-of-buffer, beginning-of-buffer |
6134 @subsection Optional Arguments | 6143 @subsection Optional Arguments |
6605 on a specific part of a buffer, and work without accidentally changing | 6614 on a specific part of a buffer, and work without accidentally changing |
6606 other parts. Narrowing is normally disabled since it can confuse | 6615 other parts. Narrowing is normally disabled since it can confuse |
6607 novices. | 6616 novices. |
6608 | 6617 |
6609 @menu | 6618 @menu |
6610 * Narrowing advantages:: | 6619 * Narrowing advantages:: The advantages of narrowing |
6611 * save-restriction:: | 6620 * save-restriction:: The @code{save-restriction} special form. |
6612 * what-line:: | 6621 * what-line:: The number of the line that point is on. |
6613 * narrow Exercise:: | 6622 * narrow Exercise:: |
6614 @end menu | 6623 @end menu |
6615 | 6624 |
6616 @node Narrowing advantages, save-restriction, Narrowing & Widening, Narrowing & Widening | 6625 @node Narrowing advantages, save-restriction, Narrowing & Widening, Narrowing & Widening |
6617 @ifnottex | 6626 @ifnottex |
6936 In the walk through of the @code{copy-region-as-kill} function, we | 6945 In the walk through of the @code{copy-region-as-kill} function, we |
6937 will see @code{cons} as well as two variants on @code{cdr}, | 6946 will see @code{cons} as well as two variants on @code{cdr}, |
6938 namely, @code{setcdr} and @code{nthcdr}. (@xref{copy-region-as-kill}.) | 6947 namely, @code{setcdr} and @code{nthcdr}. (@xref{copy-region-as-kill}.) |
6939 | 6948 |
6940 @menu | 6949 @menu |
6941 * Strange Names:: | 6950 * Strange Names:: An historical aside: why the strange names? |
6942 * car & cdr:: | 6951 * car & cdr:: Functions for extracting part of a list. |
6943 * cons:: | 6952 * cons:: Constructing a list. |
6944 * nthcdr:: | 6953 * nthcdr:: Calling @code{cdr} repeatedly. |
6945 * nth:: | 6954 * nth:: |
6946 * setcar:: | 6955 * setcar:: Changing the first element of a list. |
6947 * setcdr:: | 6956 * setcdr:: Changing the rest of a list. |
6948 * cons Exercise:: | 6957 * cons Exercise:: |
6949 @end menu | 6958 @end menu |
6950 | 6959 |
6951 @node Strange Names, car & cdr, car cdr & cons, car cdr & cons | 6960 @node Strange Names, car & cdr, car cdr & cons, car cdr & cons |
6952 @ifnottex | 6961 @ifnottex |
7124 | 7133 |
7125 Like @code{car} and @code{cdr}, @code{cons} is non-destructive. | 7134 Like @code{car} and @code{cdr}, @code{cons} is non-destructive. |
7126 | 7135 |
7127 @menu | 7136 @menu |
7128 * Build a list:: | 7137 * Build a list:: |
7129 * length:: | 7138 * length:: How to find the length of a list. |
7130 @end menu | 7139 @end menu |
7131 | 7140 |
7132 @node Build a list, length, cons, cons | 7141 @node Build a list, length, cons, cons |
7133 @ifnottex | 7142 @ifnottex |
7134 @unnumberedsubsec Build a list | 7143 @unnumberedsubsec Build a list |
7605 put it into storage from which it can be brought back. I have often | 7614 put it into storage from which it can be brought back. I have often |
7606 been tempted to replace globally all occurrences of `kill' in the Emacs | 7615 been tempted to replace globally all occurrences of `kill' in the Emacs |
7607 sources with `clip' and all occurrences of `killed' with `clipped'.) | 7616 sources with `clip' and all occurrences of `killed' with `clipped'.) |
7608 | 7617 |
7609 @menu | 7618 @menu |
7610 * Storing Text:: | 7619 * Storing Text:: Text is stored in a list. |
7611 * zap-to-char:: | 7620 * zap-to-char:: Cutting out text up to a character. |
7612 * kill-region:: | 7621 * kill-region:: Cutting text out of a region. |
7613 * copy-region-as-kill:: | 7622 * copy-region-as-kill:: A definition for copying text. |
7614 * Digression into C:: | 7623 * Digression into C:: Minor note on C programming language macros. |
7615 * defvar:: | 7624 * defvar:: How to give a variable an initial value. |
7616 * cons & search-fwd Review:: | 7625 * cons & search-fwd Review:: |
7617 * search Exercises:: | 7626 * search Exercises:: |
7618 @end menu | 7627 @end menu |
7619 | 7628 |
7620 @node Storing Text, zap-to-char, Cutting & Storing Text, Cutting & Storing Text | 7629 @node Storing Text, zap-to-char, Cutting & Storing Text, Cutting & Storing Text |
7702 that of error handling. We will walk through the function. | 7711 that of error handling. We will walk through the function. |
7703 | 7712 |
7704 But first, let us look at the interactive @code{zap-to-char} function. | 7713 But first, let us look at the interactive @code{zap-to-char} function. |
7705 | 7714 |
7706 @menu | 7715 @menu |
7707 * Complete zap-to-char:: | 7716 * Complete zap-to-char:: The complete implementation. |
7708 * zap-to-char interactive:: | 7717 * zap-to-char interactive:: A three part interactive expression. |
7709 * zap-to-char body:: | 7718 * zap-to-char body:: A short overview. |
7710 * search-forward:: | 7719 * search-forward:: How to search for a string. |
7711 * progn:: | 7720 * progn:: The @code{progn} special form. |
7712 * Summing up zap-to-char:: | 7721 * Summing up zap-to-char:: Using @code{point} and @code{search-forward}. |
7713 @end menu | 7722 @end menu |
7714 | 7723 |
7715 @node Complete zap-to-char, zap-to-char interactive, zap-to-char, zap-to-char | 7724 @node Complete zap-to-char, zap-to-char interactive, zap-to-char, zap-to-char |
7716 @ifnottex | 7725 @ifnottex |
7717 @unnumberedsubsec The Complete @code{zap-to-char} Implementation | 7726 @unnumberedsubsec The Complete @code{zap-to-char} Implementation |
8064 the first argument does nothing. The second argument contains the | 8073 the first argument does nothing. The second argument contains the |
8065 code that does the work when all goes well. The third argument | 8074 code that does the work when all goes well. The third argument |
8066 contains the code that is called in the event of an error. | 8075 contains the code that is called in the event of an error. |
8067 | 8076 |
8068 @menu | 8077 @menu |
8069 * Complete kill-region:: | 8078 * Complete kill-region:: The function definition. |
8070 * condition-case:: | 8079 * condition-case:: Dealing with a problem. |
8071 * Lisp macro:: | 8080 * Lisp macro:: |
8072 @end menu | 8081 @end menu |
8073 | 8082 |
8074 @node Complete kill-region, condition-case, kill-region, kill-region | 8083 @node Complete kill-region, condition-case, kill-region, kill-region |
8075 @ifnottex | 8084 @ifnottex |
8434 get it all, from both this and the previous operation. On the other | 8443 get it all, from both this and the previous operation. On the other |
8435 hand, if some other command precedes the @code{copy-region-as-kill}, | 8444 hand, if some other command precedes the @code{copy-region-as-kill}, |
8436 the function copies the text into a separate entry in the kill ring. | 8445 the function copies the text into a separate entry in the kill ring. |
8437 | 8446 |
8438 @menu | 8447 @menu |
8439 * Complete copy-region-as-kill:: | 8448 * Complete copy-region-as-kill:: The complete function definition. |
8440 * copy-region-as-kill body:: | 8449 * copy-region-as-kill body:: The body of @code{copy-region-as-kill}. |
8441 @end menu | 8450 @end menu |
8442 | 8451 |
8443 @node Complete copy-region-as-kill, copy-region-as-kill body, copy-region-as-kill, copy-region-as-kill | 8452 @node Complete copy-region-as-kill, copy-region-as-kill body, copy-region-as-kill, copy-region-as-kill |
8444 @ifnottex | 8453 @ifnottex |
8445 @unnumberedsubsec The complete @code{copy-region-as-kill} function definition | 8454 @unnumberedsubsec The complete @code{copy-region-as-kill} function definition |
9661 A pointer itself is quite simply the electronic address of what is | 9670 A pointer itself is quite simply the electronic address of what is |
9662 pointed to. Hence, a list is kept as a series of electronic addresses. | 9671 pointed to. Hence, a list is kept as a series of electronic addresses. |
9663 | 9672 |
9664 @menu | 9673 @menu |
9665 * Lists diagrammed:: | 9674 * Lists diagrammed:: |
9666 * Symbols as Chest:: | 9675 * Symbols as Chest:: Exploring a powerful metaphor. |
9667 * List Exercise:: | 9676 * List Exercise:: |
9668 @end menu | 9677 @end menu |
9669 | 9678 |
9670 @node Lists diagrammed, Symbols as Chest, List Implementation, List Implementation | 9679 @node Lists diagrammed, Symbols as Chest, List Implementation, List Implementation |
9671 @ifnottex | 9680 @ifnottex |
10142 @xref{Kill Ring, , Handling the Kill Ring}, for the details of how the | 10151 @xref{Kill Ring, , Handling the Kill Ring}, for the details of how the |
10143 list is handled as a ring.) | 10152 list is handled as a ring.) |
10144 | 10153 |
10145 @menu | 10154 @menu |
10146 * Kill Ring Overview:: | 10155 * Kill Ring Overview:: |
10147 * kill-ring-yank-pointer:: | 10156 * kill-ring-yank-pointer:: The kill ring is a list. |
10148 * yank nthcdr Exercises:: | 10157 * yank nthcdr Exercises:: The @code{kill-ring-yank-pointer} variable. |
10149 @end menu | 10158 @end menu |
10150 | 10159 |
10151 @node Kill Ring Overview, kill-ring-yank-pointer, Yanking, Yanking | 10160 @node Kill Ring Overview, kill-ring-yank-pointer, Yanking, Yanking |
10152 @comment node-name, next, previous, up | 10161 @comment node-name, next, previous, up |
10153 @section Kill Ring Overview | 10162 @section Kill Ring Overview |
10378 increase the values of @code{max-specpdl-size} and | 10387 increase the values of @code{max-specpdl-size} and |
10379 @code{max-lisp-eval-depth}. In my @file{.emacs} file, I set them to | 10388 @code{max-lisp-eval-depth}. In my @file{.emacs} file, I set them to |
10380 15 and 30 times their default value.}. | 10389 15 and 30 times their default value.}. |
10381 | 10390 |
10382 @menu | 10391 @menu |
10383 * while:: | 10392 * while:: Causing a stretch of code to repeat. |
10384 * dolist dotimes:: | 10393 * dolist dotimes:: |
10385 * Recursion:: | 10394 * Recursion:: Causing a function to call itself. |
10386 * Looping exercise:: | 10395 * Looping exercise:: |
10387 @end menu | 10396 @end menu |
10388 | 10397 |
10389 @node while, dolist dotimes, Loops & Recursion, Loops & Recursion | 10398 @node while, dolist dotimes, Loops & Recursion, Loops & Recursion |
10390 @comment node-name, next, previous, up | 10399 @comment node-name, next, previous, up |
10415 @var{body}@dots{}) | 10424 @var{body}@dots{}) |
10416 @end group | 10425 @end group |
10417 @end smallexample | 10426 @end smallexample |
10418 | 10427 |
10419 @menu | 10428 @menu |
10420 * Looping with while:: | 10429 * Looping with while:: Repeat so long as test returns true. |
10421 * Loop Example:: | 10430 * Loop Example:: A @code{while} loop that uses a list. |
10422 * print-elements-of-list:: | 10431 * print-elements-of-list:: Uses @code{while}, @code{car}, @code{cdr}. |
10423 * Incrementing Loop:: | 10432 * Incrementing Loop:: A loop with an incrementing counter. |
10424 * Incrementing Loop Details:: | 10433 * Incrementing Loop Details:: |
10425 * Decrementing Loop:: | 10434 * Decrementing Loop:: A loop with a decrementing counter. |
10426 @end menu | 10435 @end menu |
10427 | 10436 |
10428 @node Looping with while, Loop Example, while, while | 10437 @node Looping with while, Loop Example, while, while |
10429 @ifnottex | 10438 @ifnottex |
10430 @unnumberedsubsec Looping with @code{while} | 10439 @unnumberedsubsec Looping with @code{while} |
10686 @noindent | 10695 @noindent |
10687 Note that you need to set the initial value of @code{count}; usually it | 10696 Note that you need to set the initial value of @code{count}; usually it |
10688 is set to 1. | 10697 is set to 1. |
10689 | 10698 |
10690 @menu | 10699 @menu |
10691 * Incrementing Example:: | 10700 * Incrementing Example:: Counting pebbles in a triangle. |
10692 * Inc Example parts:: | 10701 * Inc Example parts:: The parts of the function definition. |
10693 * Inc Example altogether:: | 10702 * Inc Example altogether:: Putting the function definition together. |
10694 @end menu | 10703 @end menu |
10695 | 10704 |
10696 @node Incrementing Example, Inc Example parts, Incrementing Loop Details, Incrementing Loop Details | 10705 @node Incrementing Example, Inc Example parts, Incrementing Loop Details, Incrementing Loop Details |
10697 @unnumberedsubsubsec Example with incrementing counter | 10706 @unnumberedsubsubsec Example with incrementing counter |
10698 | 10707 |
10994 (setq counter (1- counter))) ; @r{decrementer} | 11003 (setq counter (1- counter))) ; @r{decrementer} |
10995 @end group | 11004 @end group |
10996 @end smallexample | 11005 @end smallexample |
10997 | 11006 |
10998 @menu | 11007 @menu |
10999 * Decrementing Example:: | 11008 * Decrementing Example:: More pebbles on the beach. |
11000 * Dec Example parts:: | 11009 * Dec Example parts:: The parts of the function definition. |
11001 * Dec Example altogether:: | 11010 * Dec Example altogether:: Putting the function definition together. |
11002 @end menu | 11011 @end menu |
11003 | 11012 |
11004 @node Decrementing Example, Dec Example parts, Decrementing Loop, Decrementing Loop | 11013 @node Decrementing Example, Dec Example parts, Decrementing Loop, Decrementing Loop |
11005 @unnumberedsubsubsec Example with decrementing counter | 11014 @unnumberedsubsubsec Example with decrementing counter |
11006 | 11015 |
11351 Eventually, if the program is written correctly, the `slightly | 11360 Eventually, if the program is written correctly, the `slightly |
11352 different arguments' will become sufficiently different from the first | 11361 different arguments' will become sufficiently different from the first |
11353 arguments that the final instance will stop. | 11362 arguments that the final instance will stop. |
11354 | 11363 |
11355 @menu | 11364 @menu |
11356 * Building Robots:: | 11365 * Building Robots:: Same model, different serial number ... |
11357 * Recursive Definition Parts:: | 11366 * Recursive Definition Parts:: Walk until you stop ... |
11358 * Recursion with list:: | 11367 * Recursion with list:: Using a list as the test whether to recurse. |
11359 * Recursive triangle function:: | 11368 * Recursive triangle function:: |
11360 * Recursion with cond:: | 11369 * Recursion with cond:: |
11361 * Recursive Patterns:: | 11370 * Recursive Patterns:: Often used templates. |
11362 * No Deferment:: | 11371 * No Deferment:: Don't store up work ... |
11363 * No deferment solution:: | 11372 * No deferment solution:: |
11364 @end menu | 11373 @end menu |
11365 | 11374 |
11366 @node Building Robots, Recursive Definition Parts, Recursion, Recursion | 11375 @node Building Robots, Recursive Definition Parts, Recursion, Recursion |
11367 @comment node-name, next, previous, up | 11376 @comment node-name, next, previous, up |
12397 @code{forward-paragraph} function is described in the last section of | 12406 @code{forward-paragraph} function is described in the last section of |
12398 this chapter. @code{forward-paragraph} is a complex function that | 12407 this chapter. @code{forward-paragraph} is a complex function that |
12399 introduces several new features. | 12408 introduces several new features. |
12400 | 12409 |
12401 @menu | 12410 @menu |
12402 * sentence-end:: | 12411 * sentence-end:: The regular expression for @code{sentence-end}. |
12403 * re-search-forward:: | 12412 * re-search-forward:: Very similar to @code{search-forward}. |
12404 * forward-sentence:: | 12413 * forward-sentence:: A straightforward example of regexp search. |
12405 * forward-paragraph:: | 12414 * forward-paragraph:: A somewhat complex example. |
12406 * etags:: | 12415 * etags:: How to create your own @file{TAGS} table. |
12407 * Regexp Review:: | 12416 * Regexp Review:: |
12408 * re-search Exercises:: | 12417 * re-search Exercises:: |
12409 @end menu | 12418 @end menu |
12410 | 12419 |
12411 @node sentence-end, re-search-forward, Regexp Search, Regexp Search | 12420 @node sentence-end, re-search-forward, Regexp Search, Regexp Search |
12647 and, optionally, over more than one sentence. The function is usually | 12656 and, optionally, over more than one sentence. The function is usually |
12648 bound to the key command @kbd{M-e}. | 12657 bound to the key command @kbd{M-e}. |
12649 | 12658 |
12650 @menu | 12659 @menu |
12651 * Complete forward-sentence:: | 12660 * Complete forward-sentence:: |
12652 * fwd-sentence while loops:: | 12661 * fwd-sentence while loops:: Two @code{while} loops. |
12653 * fwd-sentence re-search:: | 12662 * fwd-sentence re-search:: A regular expression search. |
12654 @end menu | 12663 @end menu |
12655 | 12664 |
12656 @node Complete forward-sentence, fwd-sentence while loops, forward-sentence, forward-sentence | 12665 @node Complete forward-sentence, fwd-sentence while loops, forward-sentence, forward-sentence |
12657 @ifnottex | 12666 @ifnottex |
12658 @unnumberedsubsec Complete @code{forward-sentence} function definition | 12667 @unnumberedsubsec Complete @code{forward-sentence} function definition |
13106 Moreover, it is sometimes practical to ignore a fill prefix that | 13115 Moreover, it is sometimes practical to ignore a fill prefix that |
13107 exists, especially when blank lines separate paragraphs. | 13116 exists, especially when blank lines separate paragraphs. |
13108 This is an added complication. | 13117 This is an added complication. |
13109 | 13118 |
13110 @menu | 13119 @menu |
13111 * forward-paragraph in brief:: | 13120 * forward-paragraph in brief:: Key parts of the function definition. |
13112 * fwd-para let:: | 13121 * fwd-para let:: The @code{let*} expression. |
13113 * fwd-para while:: | 13122 * fwd-para while:: The forward motion @code{while} loop. |
13114 @end menu | 13123 @end menu |
13115 | 13124 |
13116 @node forward-paragraph in brief, fwd-para let, forward-paragraph, forward-paragraph | 13125 @node forward-paragraph in brief, fwd-para let, forward-paragraph, forward-paragraph |
13117 @ifnottex | 13126 @ifnottex |
13118 @unnumberedsubsec Shortened @code{forward-paragraph} function definition | 13127 @unnumberedsubsec Shortened @code{forward-paragraph} function definition |
13802 the use of regular expression searches through the construction of | 13811 the use of regular expression searches through the construction of |
13803 word count commands using @code{while} loops and recursion. | 13812 word count commands using @code{while} loops and recursion. |
13804 | 13813 |
13805 @menu | 13814 @menu |
13806 * Why Count Words:: | 13815 * Why Count Words:: |
13807 * count-words-region:: | 13816 * count-words-region:: Use a regexp, but find a problem. |
13808 * recursive-count-words:: | 13817 * recursive-count-words:: Start with case of no words in region. |
13809 * Counting Exercise:: | 13818 * Counting Exercise:: |
13810 @end menu | 13819 @end menu |
13811 | 13820 |
13812 @node Why Count Words, count-words-region, Counting Words, Counting Words | 13821 @node Why Count Words, count-words-region, Counting Words, Counting Words |
13813 @ifnottex | 13822 @ifnottex |
13849 word, then the third word, and so on, until you reach the end of the | 13858 word, then the third word, and so on, until you reach the end of the |
13850 region. This means that word counting is ideally suited to recursion | 13859 region. This means that word counting is ideally suited to recursion |
13851 or to a @code{while} loop. | 13860 or to a @code{while} loop. |
13852 | 13861 |
13853 @menu | 13862 @menu |
13854 * Design count-words-region:: | 13863 * Design count-words-region:: The definition using a @code{while} loop. |
13855 * Whitespace Bug:: | 13864 * Whitespace Bug:: The Whitespace Bug in @code{count-words-region}. |
13856 @end menu | 13865 @end menu |
13857 | 13866 |
13858 @node Design count-words-region, Whitespace Bug, count-words-region, count-words-region | 13867 @node Design count-words-region, Whitespace Bug, count-words-region, count-words-region |
13859 @ifnottex | 13868 @ifnottex |
13860 @unnumberedsubsec Designing @code{count-words-region} | 13869 @unnumberedsubsec Designing @code{count-words-region} |
14690 and so on. I have often been curious how long a typical function is, | 14699 and so on. I have often been curious how long a typical function is, |
14691 and this will tell. | 14700 and this will tell. |
14692 | 14701 |
14693 @menu | 14702 @menu |
14694 * Divide and Conquer:: | 14703 * Divide and Conquer:: |
14695 * Words and Symbols:: | 14704 * Words and Symbols:: What to count? |
14696 * Syntax:: | 14705 * Syntax:: What constitutes a word or symbol? |
14697 * count-words-in-defun:: | 14706 * count-words-in-defun:: Very like @code{count-words}. |
14698 * Several defuns:: | 14707 * Several defuns:: Counting several defuns in a file. |
14699 * Find a File:: | 14708 * Find a File:: Do you want to look at a file? |
14700 * lengths-list-file:: | 14709 * lengths-list-file:: A list of the lengths of many definitions. |
14701 * Several files:: | 14710 * Several files:: Counting in definitions in different files. |
14702 * Several files recursively:: | 14711 * Several files recursively:: Recursively counting in different files. |
14703 * Prepare the data:: | 14712 * Prepare the data:: Prepare the data for display in a graph. |
14704 @end menu | 14713 @end menu |
14705 | 14714 |
14706 @node Divide and Conquer, Words and Symbols, Words in a defun, Words in a defun | 14715 @node Divide and Conquer, Words and Symbols, Words in a defun, Words in a defun |
14707 @ifnottex | 14716 @ifnottex |
14708 @unnumberedsec Divide and Conquer | 14717 @unnumberedsec Divide and Conquer |
15364 | 15373 |
15365 Working on each of a list of files is a repetitious act, so we can use | 15374 Working on each of a list of files is a repetitious act, so we can use |
15366 either a @code{while} loop or recursion. | 15375 either a @code{while} loop or recursion. |
15367 | 15376 |
15368 @menu | 15377 @menu |
15369 * lengths-list-many-files:: | 15378 * lengths-list-many-files:: Return a list of the lengths of defuns. |
15370 * append:: | 15379 * append:: Attach one list to another. |
15371 @end menu | 15380 @end menu |
15372 | 15381 |
15373 @node lengths-list-many-files, append, Several files, Several files | 15382 @node lengths-list-many-files, append, Several files, Several files |
15374 @ifnottex | 15383 @ifnottex |
15375 @unnumberedsubsec Determine the lengths of @code{defuns} | 15384 @unnumberedsubsec Determine the lengths of @code{defuns} |
15601 of defuns within each range of lengths, and produce a list of those | 15610 of defuns within each range of lengths, and produce a list of those |
15602 numbers. | 15611 numbers. |
15603 | 15612 |
15604 @menu | 15613 @menu |
15605 * Data for Display in Detail:: | 15614 * Data for Display in Detail:: |
15606 * Sorting:: | 15615 * Sorting:: Sorting lists. |
15607 * Files List:: | 15616 * Files List:: Making a list of files. |
15608 * Counting function definitions:: | 15617 * Counting function definitions:: |
15609 @end menu | 15618 @end menu |
15610 | 15619 |
15611 @node Data for Display in Detail, Sorting, Prepare the data, Prepare the data | 15620 @node Data for Display in Detail, Sorting, Prepare the data, Prepare the data |
15612 @ifnottex | 15621 @ifnottex |
16295 After scouting the terrain, we will feel more confident and enhance | 16304 After scouting the terrain, we will feel more confident and enhance |
16296 the function to label the axes automatically. | 16305 the function to label the axes automatically. |
16297 | 16306 |
16298 @menu | 16307 @menu |
16299 * Columns of a graph:: | 16308 * Columns of a graph:: |
16300 * graph-body-print:: | 16309 * graph-body-print:: How to print the body of a graph. |
16301 * recursive-graph-body-print:: | 16310 * recursive-graph-body-print:: |
16302 * Printed Axes:: | 16311 * Printed Axes:: |
16303 * Line Graph Exercise:: | 16312 * Line Graph Exercise:: |
16304 @end menu | 16313 @end menu |
16305 | 16314 |
16954 GNU Emacs is mostly written in Emacs Lisp; this means that by writing | 16963 GNU Emacs is mostly written in Emacs Lisp; this means that by writing |
16955 expressions in Emacs Lisp you can change or extend Emacs. | 16964 expressions in Emacs Lisp you can change or extend Emacs. |
16956 | 16965 |
16957 @menu | 16966 @menu |
16958 * Default Configuration:: | 16967 * Default Configuration:: |
16959 * Site-wide Init:: | 16968 * Site-wide Init:: You can write site-wide init files. |
16960 * defcustom:: | 16969 * defcustom:: Emacs will write code for you. |
16961 * Beginning a .emacs File:: | 16970 * Beginning a .emacs File:: How to write a @code{.emacs file}. |
16962 * Text and Auto-fill:: | 16971 * Text and Auto-fill:: Automatically wrap lines. |
16963 * Mail Aliases:: | 16972 * Mail Aliases:: Use abbreviations for email addresses. |
16964 * Indent Tabs Mode:: | 16973 * Indent Tabs Mode:: Don't use tabs with @TeX{} |
16965 * Keybindings:: | 16974 * Keybindings:: Create some personal keybindings. |
16966 * Keymaps:: | 16975 * Keymaps:: More about key binding. |
16967 * Loading Files:: | 16976 * Loading Files:: Load (i.e., evaluate) files automatically. |
16968 * Autoload:: | 16977 * Autoload:: Make functions available. |
16969 * Simple Extension:: | 16978 * Simple Extension:: Define a function; bind it to a key. |
16970 * X11 Colors:: | 16979 * X11 Colors:: Colors in X. |
16971 * Miscellaneous:: | 16980 * Miscellaneous:: |
16972 * Mode Line:: | 16981 * Mode Line:: How to customize your mode line. |
16973 @end menu | 16982 @end menu |
16974 | 16983 |
16975 @node Default Configuration, Site-wide Init, Emacs Initialization, Emacs Initialization | 16984 @node Default Configuration, Site-wide Init, Emacs Initialization, Emacs Initialization |
16976 @ifnottex | 16985 @ifnottex |
16977 @unnumberedsec Emacs' Default Configuration | 16986 @unnumberedsec Emacs' Default Configuration |
18420 Both debuggers are described extensively in @ref{Debugging, , | 18429 Both debuggers are described extensively in @ref{Debugging, , |
18421 Debugging Lisp Programs, elisp, The GNU Emacs Lisp Reference Manual}. | 18430 Debugging Lisp Programs, elisp, The GNU Emacs Lisp Reference Manual}. |
18422 In this chapter, I will walk through a short example of each. | 18431 In this chapter, I will walk through a short example of each. |
18423 | 18432 |
18424 @menu | 18433 @menu |
18425 * debug:: | 18434 * debug:: How to use the built-in debugger. |
18426 * debug-on-entry:: | 18435 * debug-on-entry:: Start debugging when you call a function. |
18427 * debug-on-quit:: | 18436 * debug-on-quit:: Start debugging when you quit with @kbd{C-g}. |
18428 * edebug:: | 18437 * edebug:: How to use Edebug, a source level debugger. |
18429 * Debugging Exercises:: | 18438 * Debugging Exercises:: |
18430 @end menu | 18439 @end menu |
18431 | 18440 |
18432 @node debug, debug-on-entry, Debugging, Debugging | 18441 @node debug, debug-on-entry, Debugging, Debugging |
18433 @section @code{debug} | 18442 @section @code{debug} |
19147 consider the workings of the kill ring. | 19156 consider the workings of the kill ring. |
19148 | 19157 |
19149 @menu | 19158 @menu |
19150 * What the Kill Ring Does:: | 19159 * What the Kill Ring Does:: |
19151 * current-kill:: | 19160 * current-kill:: |
19152 * yank:: | 19161 * yank:: Paste a copy of a clipped element. |
19153 * yank-pop:: | 19162 * yank-pop:: Insert element pointed to. |
19154 * ring file:: | 19163 * ring file:: |
19155 @end menu | 19164 @end menu |
19156 | 19165 |
19157 @node What the Kill Ring Does, current-kill, Kill Ring, Kill Ring | 19166 @node What the Kill Ring Does, current-kill, Kill Ring, Kill Ring |
19158 @ifnottex | 19167 @ifnottex |
19329 This function takes two arguments, one of which is optional. It has a | 19338 This function takes two arguments, one of which is optional. It has a |
19330 documentation string. It is @emph{not} interactive. | 19339 documentation string. It is @emph{not} interactive. |
19331 | 19340 |
19332 @menu | 19341 @menu |
19333 * Body of current-kill:: | 19342 * Body of current-kill:: |
19334 * Digression concerning error:: | 19343 * Digression concerning error:: How to mislead humans, but not computers. |
19335 * Determining the Element:: | 19344 * Determining the Element:: |
19336 @end menu | 19345 @end menu |
19337 | 19346 |
19338 @node Body of current-kill, Digression concerning error, Understanding current-kill, Understanding current-kill | 19347 @node Body of current-kill, Digression concerning error, Understanding current-kill, Understanding current-kill |
19339 @ifnottex | 19348 @ifnottex |
19754 for printing and labelling vertical and horizontal axes, along with the | 19763 for printing and labelling vertical and horizontal axes, along with the |
19755 body itself. | 19764 body itself. |
19756 | 19765 |
19757 @menu | 19766 @menu |
19758 * Labelled Example:: | 19767 * Labelled Example:: |
19759 * print-graph Varlist:: | 19768 * print-graph Varlist:: @code{let} expression in @code{print-graph}. |
19760 * print-Y-axis:: | 19769 * print-Y-axis:: Print a label for the vertical axis. |
19761 * print-X-axis:: | 19770 * print-X-axis:: Print a horizontal label. |
19762 * Print Whole Graph:: | 19771 * Print Whole Graph:: The function to print a complete graph. |
19763 @end menu | 19772 @end menu |
19764 | 19773 |
19765 @node Labelled Example, print-graph Varlist, Full Graph, Full Graph | 19774 @node Labelled Example, print-graph Varlist, Full Graph, Full Graph |
19766 @ifnottex | 19775 @ifnottex |
19767 @unnumberedsec Labelled Example Graph | 19776 @unnumberedsec Labelled Example Graph |
19922 The function should be passed the height of the graph, and then should | 19931 The function should be passed the height of the graph, and then should |
19923 construct and insert the appropriate numbers and marks. | 19932 construct and insert the appropriate numbers and marks. |
19924 | 19933 |
19925 @menu | 19934 @menu |
19926 * print-Y-axis in Detail:: | 19935 * print-Y-axis in Detail:: |
19927 * Height of label:: | 19936 * Height of label:: What height for the Y axis? |
19928 * Compute a Remainder:: | 19937 * Compute a Remainder:: How to compute the remainder of a division. |
19929 * Y Axis Element:: | 19938 * Y Axis Element:: Construct a line for the Y axis. |
19930 * Y-axis-column:: | 19939 * Y-axis-column:: Generate a list of Y axis labels. |
19931 * print-Y-axis Penultimate:: | 19940 * print-Y-axis Penultimate:: A not quite final version. |
19932 @end menu | 19941 @end menu |
19933 | 19942 |
19934 @node print-Y-axis in Detail, Height of label, print-Y-axis, print-Y-axis | 19943 @node print-Y-axis in Detail, Height of label, print-Y-axis, print-Y-axis |
19935 @ifnottex | 19944 @ifnottex |
19936 @unnumberedsubsec The @code{print-Y-axis} Function in Detail | 19945 @unnumberedsubsec The @code{print-Y-axis} Function in Detail |
20378 measured in units of @code{symbol-width}, since you may want to change | 20387 measured in units of @code{symbol-width}, since you may want to change |
20379 the width of the symbols that you are using to print the body of the | 20388 the width of the symbols that you are using to print the body of the |
20380 graph without changing the ways the graph is labelled. | 20389 graph without changing the ways the graph is labelled. |
20381 | 20390 |
20382 @menu | 20391 @menu |
20383 * Similarities differences:: | 20392 * Similarities differences:: Much like @code{print-Y-axis}, but not exactly. |
20384 * X Axis Tic Marks:: | 20393 * X Axis Tic Marks:: Create tic marks for the horizontal axis. |
20385 @end menu | 20394 @end menu |
20386 | 20395 |
20387 @node Similarities differences, X Axis Tic Marks, print-X-axis, print-X-axis | 20396 @node Similarities differences, X Axis Tic Marks, print-X-axis, print-X-axis |
20388 @ifnottex | 20397 @ifnottex |
20389 @unnumberedsubsec Similarities and differences | 20398 @unnumberedsubsec Similarities and differences |
20727 (print-X-axis @dots{} ))) | 20736 (print-X-axis @dots{} ))) |
20728 @end group | 20737 @end group |
20729 @end smallexample | 20738 @end smallexample |
20730 | 20739 |
20731 @menu | 20740 @menu |
20732 * The final version:: | 20741 * The final version:: A few changes. |
20733 * Test print-graph:: | 20742 * Test print-graph:: Run a short test. |
20734 * Graphing words in defuns:: | 20743 * Graphing words in defuns:: Executing the final code. |
20735 * lambda:: | 20744 * lambda:: How to write an anonymous function. |
20736 * mapcar:: | 20745 * mapcar:: Apply a function to elements of a list. |
20737 * Another Bug:: | 20746 * Another Bug:: Yet another bug @dots{} most insidious. |
20738 * Final printed graph:: | 20747 * Final printed graph:: The graph itself! |
20739 @end menu | 20748 @end menu |
20740 | 20749 |
20741 @node The final version, Test print-graph, Print Whole Graph, Print Whole Graph | 20750 @node The final version, Test print-graph, Print Whole Graph, Print Whole Graph |
20742 @ifnottex | 20751 @ifnottex |
20743 @unnumberedsubsec Changes for the Final Version | 20752 @unnumberedsubsec Changes for the Final Version |