diff options
| author | Robert J. Chassell | 2006-11-09 17:05:07 +0000 |
|---|---|---|
| committer | Robert J. Chassell | 2006-11-09 17:05:07 +0000 |
| commit | 303b49618e536c0bffa45a7382555f4e96372a00 (patch) | |
| tree | 8344e0185dc19222532c8f59b6ebe82e7e14ebd2 | |
| parent | ce3ba12c88ef9c0179afee9c1844c25e47088222 (diff) | |
| download | emacs-303b49618e536c0bffa45a7382555f4e96372a00.tar.gz emacs-303b49618e536c0bffa45a7382555f4e96372a00.zip | |
(beginning of emacs-lisp-intro.texi): Add `other shell commands' to
produce additional output formats; total is now ten.
(A Loop with an Incrementing Counter, and others): Ensure Info menus
will appear in short windows.
(Disentangle beginning-of-buffer): Replace `version 21' with `more
recent versions'.
(Simple Extension): Show how to handle multiple versions by adding
an alternative with a test of `>= 21'
| -rw-r--r-- | lispintro/ChangeLog | 11 | ||||
| -rw-r--r-- | lispintro/emacs-lisp-intro.texi | 304 |
2 files changed, 202 insertions, 113 deletions
diff --git a/lispintro/ChangeLog b/lispintro/ChangeLog index 62501c7d635..e11d6a4cd92 100644 --- a/lispintro/ChangeLog +++ b/lispintro/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2006-11-09 Robert J. Chassell <bob@rattlesnake.com> | ||
| 2 | |||
| 3 | * emacs-lisp-intro.texi (at the beginning): Add `other shell | ||
| 4 | commands' to produce additional output formats; total is now ten. | ||
| 5 | (A Loop with an Incrementing Counter, and others): Ensure Info | ||
| 6 | menus will appear in short windows. | ||
| 7 | (Disentangle beginning-of-buffer): Replace `version 21' with `more | ||
| 8 | recent versions'. | ||
| 9 | (Simple Extension): Show how to handle multiple versions by adding | ||
| 10 | an alternative with a test of `>= 21' | ||
| 11 | |||
| 1 | 2006-11-06 Robert J. Chassell <bob@rattlesnake.com> | 12 | 2006-11-06 Robert J. Chassell <bob@rattlesnake.com> |
| 2 | 13 | ||
| 3 | * emacs-lisp-intro.texi: Finish minor changes seen from DVI output. | 14 | * emacs-lisp-intro.texi: Finish minor changes seen from DVI output. |
diff --git a/lispintro/emacs-lisp-intro.texi b/lispintro/emacs-lisp-intro.texi index 13590c7288c..00d3a38145d 100644 --- a/lispintro/emacs-lisp-intro.texi +++ b/lispintro/emacs-lisp-intro.texi | |||
| @@ -24,8 +24,8 @@ | |||
| 24 | 24 | ||
| 25 | @comment %**end of header | 25 | @comment %**end of header |
| 26 | 26 | ||
| 27 | @set edition-number 3.06 | 27 | @set edition-number 3.07 |
| 28 | @set update-date 6 November 2006 | 28 | @set update-date 9 November 2006 |
| 29 | 29 | ||
| 30 | @ignore | 30 | @ignore |
| 31 | ## Summary of shell commands to create various output formats: | 31 | ## Summary of shell commands to create various output formats: |
| @@ -34,54 +34,66 @@ | |||
| 34 | ## pushd /u/intro/ | 34 | ## pushd /u/intro/ |
| 35 | 35 | ||
| 36 | ## Info output | 36 | ## Info output |
| 37 | # makeinfo --no-split --paragraph-indent=0 --verbose emacs-lisp-intro.texi | ||
| 38 | makeinfo --paragraph-indent=0 --verbose emacs-lisp-intro.texi | 37 | makeinfo --paragraph-indent=0 --verbose emacs-lisp-intro.texi |
| 39 | 38 | ||
| 40 | ## ;; (progn (when (bufferp (get-buffer "*info*")) (kill-buffer "*info*")) (info "../info/eintr")) | 39 | ## ;; (progn (when (bufferp (get-buffer "*info*")) (kill-buffer "*info*")) (info "/usr/local/src/emacs/info/eintr")) |
| 41 | 40 | ||
| 42 | ## DVI output | 41 | ## DVI output |
| 43 | texi2dvi emacs-lisp-intro.texi | 42 | texi2dvi emacs-lisp-intro.texi |
| 44 | 43 | ||
| 45 | ## View DVI output; see below also | 44 | ## xdvi -margins 24pt -topmargin 4pt -offsets 24pt -geometry 760x1140 -s 5 -useTeXpages -mousemode 1 emacs-lisp-intro.dvi & |
| 46 | # xdvi -margins 24pt -topmargin 4pt -offsets 24pt -geometry 760x1140 -s 5 -useTeXpages -mousemode 1 emacs-lisp-intro.dvi & | ||
| 47 | 45 | ||
| 48 | ## HTML output | 46 | ## HTML output |
| 49 | makeinfo --html --no-split --verbose emacs-lisp-intro.texi | 47 | makeinfo --html --no-split --verbose emacs-lisp-intro.texi |
| 50 | 48 | ||
| 49 | ## galeon emacs-lisp-intro.html | ||
| 50 | |||
| 51 | ## Plain text output | 51 | ## Plain text output |
| 52 | makeinfo --fill-column=70 --no-split --paragraph-indent=0 \ | 52 | makeinfo --fill-column=70 --no-split --paragraph-indent=0 \ |
| 53 | --verbose --no-headers --output=emacs-lisp-intro.txt emacs-lisp-intro.texi | 53 | --verbose --no-headers --output=emacs-lisp-intro.txt emacs-lisp-intro.texi |
| 54 | 54 | ||
| 55 | ## DocBook output | 55 | popd |
| 56 | makeinfo --docbook --no-split --paragraph-indent=0 \ | ||
| 57 | --verbose emacs-lisp-intro.texi | ||
| 58 | 56 | ||
| 59 | ## XML output | 57 | # as user `root' |
| 60 | makeinfo --xml --no-split --paragraph-indent=0 \ | 58 | # insert thumbdrive |
| 61 | --verbose emacs-lisp-intro.texi | 59 | mtusb # mount -v -t ext3 /dev/sda /mnt |
| 60 | cp -v /u/intro/emacs-lisp-intro.texi /mnt/backup/intro/emacs-lisp-intro.texi | ||
| 61 | umtusb # umount -v /mnt | ||
| 62 | # remove thumbdrive | ||
| 62 | 63 | ||
| 63 | popd | 64 | ## Other shell commands |
| 64 | 65 | ||
| 65 | #### (You must be in the same directory as the viewed file.) | 66 | pushd /usr/local/src/emacs/lispintro/ |
| 67 | ## pushd /u/intro/ | ||
| 66 | 68 | ||
| 67 | ## View DVI output | 69 | |
| 68 | xdvi emacs-lisp-intro.dvi & | 70 | texi2dvi --pdf emacs-lisp-intro.texi |
| 71 | # xpdf emacs-lisp-intro.pdf & | ||
| 69 | 72 | ||
| 70 | ## View HTML output | 73 | ## DocBook -- note file extension |
| 71 | galeon emacs-lisp-intro.html | 74 | makeinfo --docbook --no-split --paragraph-indent=0 \ |
| 75 | --verbose --output=emacs-lisp-intro.docbook emacs-lisp-intro.texi | ||
| 72 | 76 | ||
| 73 | ## View Info output with standalone reader | 77 | ## XML with a Texinfo DTD -- note file extension |
| 74 | info emacs-lisp-intro.info | 78 | makeinfo --xml --no-split --paragraph-indent=0 \ |
| 79 | --verbose --output=emacs-lisp-intro.texinfoxml emacs-lisp-intro.texi | ||
| 75 | 80 | ||
| 76 | ## popd | 81 | ## PostScript (needs DVI) |
| 82 | # gv emacs-lisp-intro.ps & | ||
| 83 | # Create DVI if we lack it | ||
| 84 | # texi2dvi emacs-lisp-intro.texi | ||
| 85 | dvips emacs-lisp-intro.dvi -o emacs-lisp-intro.ps | ||
| 77 | 86 | ||
| 87 | ## RTF (needs HTML) | ||
| 88 | # Use OpenOffice to view RTF | ||
| 89 | # Create HTML if we lack it | ||
| 90 | # makeinfo --no-split --html emacs-lisp-intro.texi | ||
| 91 | /usr/local/src/html2rtf.pl emacs-lisp-intro.html | ||
| 78 | 92 | ||
| 79 | # as user `root' | 93 | ## LaTeX (needs RTF) |
| 80 | # insert thumbdrive | 94 | /usr/bin/rtf2latex emacs-lisp-intro.rtf |
| 81 | mtusb # mount -v -t ext3 /dev/sda /mnt | 95 | |
| 82 | cp -v /u/intro/emacs-lisp-intro.texi /mnt/backup/intro/emacs-lisp-intro.texi | 96 | popd |
| 83 | umtusb # umount -v /mnt | ||
| 84 | # remove thumbdrive | ||
| 85 | 97 | ||
| 86 | @end ignore | 98 | @end ignore |
| 87 | 99 | ||
| @@ -381,6 +393,7 @@ The Lisp Interpreter | |||
| 381 | 393 | ||
| 382 | Evaluation | 394 | Evaluation |
| 383 | 395 | ||
| 396 | * How the Interpreter Acts:: Returns and Side Effects... | ||
| 384 | * Evaluating Inner Lists:: Lists within lists... | 397 | * Evaluating Inner Lists:: Lists within lists... |
| 385 | 398 | ||
| 386 | Variables | 399 | Variables |
| @@ -614,9 +627,10 @@ Loops and Recursion | |||
| 614 | * Loop Example:: A @code{while} loop that uses a list. | 627 | * Loop Example:: A @code{while} loop that uses a list. |
| 615 | * print-elements-of-list:: Uses @code{while}, @code{car}, @code{cdr}. | 628 | * print-elements-of-list:: Uses @code{while}, @code{car}, @code{cdr}. |
| 616 | * Incrementing Loop:: A loop with an incrementing counter. | 629 | * Incrementing Loop:: A loop with an incrementing counter. |
| 630 | * Incrementing Loop Details:: | ||
| 617 | * Decrementing Loop:: A loop with a decrementing counter. | 631 | * Decrementing Loop:: A loop with a decrementing counter. |
| 618 | 632 | ||
| 619 | A Loop with an Incrementing Counter | 633 | Details of an Incrementing Loop |
| 620 | 634 | ||
| 621 | * Incrementing Example:: Counting pebbles in a triangle. | 635 | * Incrementing Example:: Counting pebbles in a triangle. |
| 622 | * Inc Example parts:: The parts of the function definition. | 636 | * Inc Example parts:: The parts of the function definition. |
| @@ -709,6 +723,7 @@ Count Words in @code{defuns} in Different Files | |||
| 709 | 723 | ||
| 710 | Prepare the Data for Display in a Graph | 724 | Prepare the Data for Display in a Graph |
| 711 | 725 | ||
| 726 | * Data for Display in Detail:: | ||
| 712 | * Sorting:: Sorting lists. | 727 | * Sorting:: Sorting lists. |
| 713 | * Files List:: Making a list of files. | 728 | * Files List:: Making a list of files. |
| 714 | * Counting function definitions:: | 729 | * Counting function definitions:: |
| @@ -749,6 +764,7 @@ Debugging | |||
| 749 | 764 | ||
| 750 | Handling the Kill Ring | 765 | Handling the Kill Ring |
| 751 | 766 | ||
| 767 | * What the Kill Ring Does:: | ||
| 752 | * current-kill:: | 768 | * current-kill:: |
| 753 | * yank:: Paste a copy of a clipped element. | 769 | * yank:: Paste a copy of a clipped element. |
| 754 | * yank-pop:: Insert element pointed to. | 770 | * yank-pop:: Insert element pointed to. |
| @@ -760,6 +776,7 @@ The @code{current-kill} Function | |||
| 760 | 776 | ||
| 761 | @code{current-kill} in Outline | 777 | @code{current-kill} in Outline |
| 762 | 778 | ||
| 779 | * Body of current-kill:: | ||
| 763 | * Digression concerning error:: How to mislead humans, but not computers. | 780 | * Digression concerning error:: How to mislead humans, but not computers. |
| 764 | * Determining the Element:: | 781 | * Determining the Element:: |
| 765 | 782 | ||
| @@ -773,6 +790,7 @@ A Graph with Labelled Axes | |||
| 773 | 790 | ||
| 774 | The @code{print-Y-axis} Function | 791 | The @code{print-Y-axis} Function |
| 775 | 792 | ||
| 793 | * print-Y-axis in Detail:: | ||
| 776 | * Height of label:: What height for the Y axis? | 794 | * Height of label:: What height for the Y axis? |
| 777 | * Compute a Remainder:: How to compute the remainder of a division. | 795 | * Compute a Remainder:: How to compute the remainder of a division. |
| 778 | * Y Axis Element:: Construct a line for the Y axis. | 796 | * Y Axis Element:: Construct a line for the Y axis. |
| @@ -1626,6 +1644,17 @@ The word comes from its use in everyday language, `to ascertain the | |||
| 1626 | 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 |
| 1627 | Collegiate Dictionary}. | 1645 | Collegiate Dictionary}. |
| 1628 | 1646 | ||
| 1647 | @menu | ||
| 1648 | * How the Interpreter Acts:: | ||
| 1649 | * Evaluating Inner Lists:: | ||
| 1650 | @end menu | ||
| 1651 | |||
| 1652 | @node How the Interpreter Acts, Evaluating Inner Lists, Evaluation, Evaluation | ||
| 1653 | @ifnottex | ||
| 1654 | @unnumberedsubsec How the Lisp Interpreter Acts | ||
| 1655 | @end ifnottex | ||
| 1656 | |||
| 1657 | @cindex @samp{returned value} explained | ||
| 1629 | After evaluating an expression, the Lisp interpreter will most likely | 1658 | After evaluating an expression, the Lisp interpreter will most likely |
| 1630 | @dfn{return} the value that the computer produces by carrying out the | 1659 | @dfn{return} the value that the computer produces by carrying out the |
| 1631 | instructions it found in the function definition, or perhaps it will | 1660 | instructions it found in the function definition, or perhaps it will |
| @@ -1647,11 +1676,7 @@ In summary, evaluating a symbolic expression most commonly causes the | |||
| 1647 | Lisp interpreter to return a value and perhaps carry out a side effect; | 1676 | Lisp interpreter to return a value and perhaps carry out a side effect; |
| 1648 | or else produce an error. | 1677 | or else produce an error. |
| 1649 | 1678 | ||
| 1650 | @menu | 1679 | @node Evaluating Inner Lists, , How the Interpreter Acts, Evaluation |
| 1651 | * Evaluating Inner Lists:: | ||
| 1652 | @end menu | ||
| 1653 | |||
| 1654 | @node Evaluating Inner Lists, , Evaluation, Evaluation | ||
| 1655 | @comment node-name, next, previous, up | 1680 | @comment node-name, next, previous, up |
| 1656 | @subsection Evaluating Inner Lists | 1681 | @subsection Evaluating Inner Lists |
| 1657 | @cindex Inner list evaluation | 1682 | @cindex Inner list evaluation |
| @@ -4501,24 +4526,12 @@ For example, | |||
| 4501 | 4526 | ||
| 4502 | @smallexample | 4527 | @smallexample |
| 4503 | @group | 4528 | @group |
| 4504 | (if (string-equal | 4529 | (if (= 22 emacs-major-version) |
| 4505 | (number-to-string 22) | ||
| 4506 | (substring (emacs-version) 10 12)) | ||
| 4507 | (message "This is version 22 Emacs") | 4530 | (message "This is version 22 Emacs") |
| 4508 | (message "This is not version 22 Emacs")) | 4531 | (message "This is not version 22 Emacs")) |
| 4509 | @end group | 4532 | @end group |
| 4510 | @end smallexample | 4533 | @end smallexample |
| 4511 | 4534 | ||
| 4512 | @item equal | ||
| 4513 | @itemx eq | ||
| 4514 | Test whether two objects are the same. @code{equal} uses one meaning | ||
| 4515 | of the word `same' and @code{eq} uses another: @code{equal} returns | ||
| 4516 | true if the two objects have a similar structure and contents, such as | ||
| 4517 | two copies of the same book. On the other hand, @code{eq}, returns | ||
| 4518 | true if both arguments are actually the same object. | ||
| 4519 | @findex equal | ||
| 4520 | @findex eq | ||
| 4521 | |||
| 4522 | @need 1250 | 4535 | @need 1250 |
| 4523 | @item < | 4536 | @item < |
| 4524 | @itemx > | 4537 | @itemx > |
| @@ -4537,6 +4550,18 @@ the second. In all cases, both arguments must be numbers or markers | |||
| 4537 | The @code{=} function tests whether two arguments, both numbers or | 4550 | The @code{=} function tests whether two arguments, both numbers or |
| 4538 | markers, are equal. | 4551 | markers, are equal. |
| 4539 | 4552 | ||
| 4553 | @need 1250 | ||
| 4554 | @item equal | ||
| 4555 | @itemx eq | ||
| 4556 | Test whether two objects are the same. @code{equal} uses one meaning | ||
| 4557 | of the word `same' and @code{eq} uses another: @code{equal} returns | ||
| 4558 | true if the two objects have a similar structure and contents, such as | ||
| 4559 | two copies of the same book. On the other hand, @code{eq}, returns | ||
| 4560 | true if both arguments are actually the same object. | ||
| 4561 | @findex equal | ||
| 4562 | @findex eq | ||
| 4563 | |||
| 4564 | @need 1250 | ||
| 4540 | @item string< | 4565 | @item string< |
| 4541 | @itemx string-lessp | 4566 | @itemx string-lessp |
| 4542 | @itemx string= | 4567 | @itemx string= |
| @@ -5660,7 +5685,7 @@ between the name of an object and the object actually referred to. | |||
| 5660 | * if & or:: | 5685 | * if & or:: |
| 5661 | * Insert or:: | 5686 | * Insert or:: |
| 5662 | * Insert let:: | 5687 | * Insert let:: |
| 5663 | * New insert-buffer :: | 5688 | * New insert-buffer:: |
| 5664 | @end menu | 5689 | @end menu |
| 5665 | 5690 | ||
| 5666 | @node insert-buffer code, insert-buffer interactive, insert-buffer, insert-buffer | 5691 | @node insert-buffer code, insert-buffer interactive, insert-buffer, insert-buffer |
| @@ -5934,7 +5959,7 @@ written like this: | |||
| 5934 | (or (holding-on-to-guest) (find-and-take-arm-of-guest)) | 5959 | (or (holding-on-to-guest) (find-and-take-arm-of-guest)) |
| 5935 | @end smallexample | 5960 | @end smallexample |
| 5936 | 5961 | ||
| 5937 | @node Insert let, New insert-buffer , Insert or, insert-buffer | 5962 | @node Insert let, New insert-buffer, Insert or, insert-buffer |
| 5938 | @comment node-name, next, previous, up | 5963 | @comment node-name, next, previous, up |
| 5939 | @subsection The @code{let} Expression in @code{insert-buffer} | 5964 | @subsection The @code{let} Expression in @code{insert-buffer} |
| 5940 | 5965 | ||
| @@ -6033,7 +6058,7 @@ function uses @code{let}, @code{save-excursion}, and | |||
| 6033 | use @code{or}. All these functions are building blocks that we will | 6058 | use @code{or}. All these functions are building blocks that we will |
| 6034 | find and use again and again. | 6059 | find and use again and again. |
| 6035 | 6060 | ||
| 6036 | @node New insert-buffer , , Insert let, insert-buffer | 6061 | @node New insert-buffer, , Insert let, insert-buffer |
| 6037 | @comment node-name, next, previous, up | 6062 | @comment node-name, next, previous, up |
| 6038 | @subsection New Body for @code{insert-buffer} | 6063 | @subsection New Body for @code{insert-buffer} |
| 6039 | @findex insert-buffer, new version body | 6064 | @findex insert-buffer, new version body |
| @@ -6235,14 +6260,14 @@ expression. In skeletal form, the expression looks like this: | |||
| 6235 | @end smallexample | 6260 | @end smallexample |
| 6236 | 6261 | ||
| 6237 | The true-or-false-test of this inner @code{if} expression checks the | 6262 | The true-or-false-test of this inner @code{if} expression checks the |
| 6238 | size of the buffer. The reason for this is that the old Version 18 | 6263 | size of the buffer. The reason for this is that the old version 18 |
| 6239 | Emacs used numbers that are no bigger than eight million or so | 6264 | Emacs used numbers that are no bigger than eight million or so and in |
| 6240 | and in the computation that followed, the programmer feared that Emacs | 6265 | the computation that followed, the programmer feared that Emacs might |
| 6241 | might try to use over-large numbers if the buffer were large. The | 6266 | try to use over-large numbers if the buffer were large. The term |
| 6242 | term `overflow', mentioned in the comment, means numbers that are over | 6267 | `overflow', mentioned in the comment, means numbers that are over |
| 6243 | large. Version 21 Emacs uses larger numbers, but this code has not | 6268 | large. More recent versions of Emacs use larger numbers, but this |
| 6244 | been touched, if only because people now look at buffers that are far, | 6269 | code has not been touched, if only because people now look at buffers |
| 6245 | far larger than ever before. | 6270 | that are far, far larger than ever before. |
| 6246 | 6271 | ||
| 6247 | There are two cases: if the buffer is large and if it is not. | 6272 | There are two cases: if the buffer is large and if it is not. |
| 6248 | 6273 | ||
| @@ -10396,6 +10421,7 @@ The template for a @code{while} expression looks like this: | |||
| 10396 | * Loop Example:: | 10421 | * Loop Example:: |
| 10397 | * print-elements-of-list:: | 10422 | * print-elements-of-list:: |
| 10398 | * Incrementing Loop:: | 10423 | * Incrementing Loop:: |
| 10424 | * Incrementing Loop Details:: | ||
| 10399 | * Decrementing Loop:: | 10425 | * Decrementing Loop:: |
| 10400 | @end menu | 10426 | @end menu |
| 10401 | 10427 | ||
| @@ -10617,7 +10643,7 @@ function is printed. Since the last expression in the function is the | |||
| 10617 | @code{while} loop, and since @code{while} loops always return | 10643 | @code{while} loop, and since @code{while} loops always return |
| 10618 | @code{nil}, a @code{nil} is printed after the last element of the list. | 10644 | @code{nil}, a @code{nil} is printed after the last element of the list. |
| 10619 | 10645 | ||
| 10620 | @node Incrementing Loop, Decrementing Loop, print-elements-of-list, while | 10646 | @node Incrementing Loop, Incrementing Loop Details, print-elements-of-list, while |
| 10621 | @comment node-name, next, previous, up | 10647 | @comment node-name, next, previous, up |
| 10622 | @subsection A Loop with an Incrementing Counter | 10648 | @subsection A Loop with an Incrementing Counter |
| 10623 | 10649 | ||
| @@ -10628,15 +10654,21 @@ number of repetitions are complete. This means that the loop must | |||
| 10628 | have a counter---an expression that counts how many times the loop | 10654 | have a counter---an expression that counts how many times the loop |
| 10629 | repeats itself. | 10655 | repeats itself. |
| 10630 | 10656 | ||
| 10631 | The test can be an expression such as @code{(< count desired-number)} | 10657 | @node Incrementing Loop Details, Decrementing Loop, Incrementing Loop, while |
| 10632 | which returns @code{t} for true if the value of @code{count} is less | 10658 | @ifnottex |
| 10633 | than the @code{desired-number} of repetitions and @code{nil} for false if | 10659 | @unnumberedsubsec Details of an Incrementing Loop |
| 10634 | the value of @code{count} is equal to or is greater than the | 10660 | @end ifnottex |
| 10635 | @code{desired-number}. The expression that increments the count can be | 10661 | |
| 10636 | a simple @code{setq} such as @code{(setq count (1+ count))}, where | 10662 | The test for a loop with an incrementing counter can be an expression |
| 10663 | such as @code{(< count desired-number)} which returns @code{t} for | ||
| 10664 | true if the value of @code{count} is less than the | ||
| 10665 | @code{desired-number} of repetitions and @code{nil} for false if the | ||
| 10666 | value of @code{count} is equal to or is greater than the | ||
| 10667 | @code{desired-number}. The expression that increments the count can | ||
| 10668 | be a simple @code{setq} such as @code{(setq count (1+ count))}, where | ||
| 10637 | @code{1+} is a built-in function in Emacs Lisp that adds 1 to its | 10669 | @code{1+} is a built-in function in Emacs Lisp that adds 1 to its |
| 10638 | argument. (The expression @w{@code{(1+ count)}} has the same result as | 10670 | argument. (The expression @w{@code{(1+ count)}} has the same result |
| 10639 | @w{@code{(+ count 1)}}, but is easier for a human to read.) | 10671 | as @w{@code{(+ count 1)}}, but is easier for a human to read.) |
| 10640 | 10672 | ||
| 10641 | @need 1250 | 10673 | @need 1250 |
| 10642 | The template for a @code{while} loop controlled by an incrementing | 10674 | The template for a @code{while} loop controlled by an incrementing |
| @@ -10661,7 +10693,7 @@ is set to 1. | |||
| 10661 | * Inc Example altogether:: | 10693 | * Inc Example altogether:: |
| 10662 | @end menu | 10694 | @end menu |
| 10663 | 10695 | ||
| 10664 | @node Incrementing Example, Inc Example parts, Incrementing Loop, Incrementing Loop | 10696 | @node Incrementing Example, Inc Example parts, Incrementing Loop Details, Incrementing Loop Details |
| 10665 | @unnumberedsubsubsec Example with incrementing counter | 10697 | @unnumberedsubsubsec Example with incrementing counter |
| 10666 | 10698 | ||
| 10667 | Suppose you are playing on the beach and decide to make a triangle of | 10699 | Suppose you are playing on the beach and decide to make a triangle of |
| @@ -10728,7 +10760,7 @@ row has been added to the total of all the preceding rows. In a more | |||
| 10728 | complex loop the repetitive action might not be so simple, but it will | 10760 | complex loop the repetitive action might not be so simple, but it will |
| 10729 | be simpler than doing everything all at once. | 10761 | be simpler than doing everything all at once. |
| 10730 | 10762 | ||
| 10731 | @node Inc Example parts, Inc Example altogether, Incrementing Example, Incrementing Loop | 10763 | @node Inc Example parts, Inc Example altogether, Incrementing Example, Incrementing Loop Details |
| 10732 | @unnumberedsubsubsec The parts of the function definition | 10764 | @unnumberedsubsubsec The parts of the function definition |
| 10733 | 10765 | ||
| 10734 | The preceding analysis gives us the bones of our function definition: | 10766 | The preceding analysis gives us the bones of our function definition: |
| @@ -10822,7 +10854,7 @@ The built-in Emacs Lisp function @code{1+} adds 1 to a number, so the | |||
| 10822 | (setq row-number (1+ row-number)) | 10854 | (setq row-number (1+ row-number)) |
| 10823 | @end smallexample | 10855 | @end smallexample |
| 10824 | 10856 | ||
| 10825 | @node Inc Example altogether, , Inc Example parts, Incrementing Loop | 10857 | @node Inc Example altogether, , Inc Example parts, Incrementing Loop Details |
| 10826 | @unnumberedsubsubsec Putting the function definition together | 10858 | @unnumberedsubsubsec Putting the function definition together |
| 10827 | 10859 | ||
| 10828 | We have created the parts for the function definition; now we need to | 10860 | We have created the parts for the function definition; now we need to |
| @@ -10932,7 +10964,7 @@ can try it out. Here are two examples: | |||
| 10932 | The sum of the first four numbers is 10 and the sum of the first seven | 10964 | The sum of the first four numbers is 10 and the sum of the first seven |
| 10933 | numbers is 28. | 10965 | numbers is 28. |
| 10934 | 10966 | ||
| 10935 | @node Decrementing Loop, , Incrementing Loop, while | 10967 | @node Decrementing Loop, , Incrementing Loop Details, while |
| 10936 | @comment node-name, next, previous, up | 10968 | @comment node-name, next, previous, up |
| 10937 | @subsection Loop with a Decrementing Counter | 10969 | @subsection Loop with a Decrementing Counter |
| 10938 | 10970 | ||
| @@ -15517,7 +15549,7 @@ in their customary places. To change the expressions, copy them to | |||
| 15517 | the @file{*scratch*} buffer, edit them, and then evaluate them. | 15549 | the @file{*scratch*} buffer, edit them, and then evaluate them. |
| 15518 | 15550 | ||
| 15519 | The results are shown after the @samp{@result{}}. (These results are | 15551 | The results are shown after the @samp{@result{}}. (These results are |
| 15520 | for files from Emacs Version 22.1.1; files from other versions of | 15552 | for files from Emacs version 22.1.1; files from other versions of |
| 15521 | Emacs may produce different results.) | 15553 | Emacs may produce different results.) |
| 15522 | 15554 | ||
| 15523 | @c !!! 22.1.1 lisp sources location here | 15555 | @c !!! 22.1.1 lisp sources location here |
| @@ -15569,6 +15601,18 @@ In brief, we need to go through the lengths' list produced by the | |||
| 15569 | of defuns within each range of lengths, and produce a list of those | 15601 | of defuns within each range of lengths, and produce a list of those |
| 15570 | numbers. | 15602 | numbers. |
| 15571 | 15603 | ||
| 15604 | @menu | ||
| 15605 | * Data for Display in Detail:: | ||
| 15606 | * Sorting:: | ||
| 15607 | * Files List:: | ||
| 15608 | * Counting function definitions:: | ||
| 15609 | @end menu | ||
| 15610 | |||
| 15611 | @node Data for Display in Detail, Sorting, Prepare the data, Prepare the data | ||
| 15612 | @ifnottex | ||
| 15613 | @unnumberedsubsec The Data for Display in Detail | ||
| 15614 | @end ifnottex | ||
| 15615 | |||
| 15572 | Based on what we have done before, we can readily foresee that it | 15616 | Based on what we have done before, we can readily foresee that it |
| 15573 | should not be too hard to write a function that `@sc{cdr}s' down the | 15617 | should not be too hard to write a function that `@sc{cdr}s' down the |
| 15574 | lengths' list, looks at each element, determines which length range it | 15618 | lengths' list, looks at each element, determines which length range it |
| @@ -15583,13 +15627,7 @@ inspecting a sorted list, we can discover the highest and lowest | |||
| 15583 | number, and thereby determine the largest and smallest length range | 15627 | number, and thereby determine the largest and smallest length range |
| 15584 | that we will need. | 15628 | that we will need. |
| 15585 | 15629 | ||
| 15586 | @menu | 15630 | @node Sorting, Files List, Data for Display in Detail, Prepare the data |
| 15587 | * Sorting:: | ||
| 15588 | * Files List:: | ||
| 15589 | * Counting function definitions:: | ||
| 15590 | @end menu | ||
| 15591 | |||
| 15592 | @node Sorting, Files List, Prepare the data, Prepare the data | ||
| 15593 | @subsection Sorting Lists | 15631 | @subsection Sorting Lists |
| 15594 | @findex sort | 15632 | @findex sort |
| 15595 | 15633 | ||
| @@ -17764,12 +17802,12 @@ come to use a `rare' function frequently. When you do, you should | |||
| 17764 | load that function's file with a @code{load} expression in your | 17802 | load that function's file with a @code{load} expression in your |
| 17765 | @file{.emacs} file. | 17803 | @file{.emacs} file. |
| 17766 | 17804 | ||
| 17767 | In my @file{.emacs} file for Emacs version 22, I load 14 libraries | 17805 | In my @file{.emacs} file, I load 14 libraries that contain functions |
| 17768 | that contain functions that would otherwise be autoloaded. (Actually, | 17806 | that would otherwise be autoloaded. (Actually, it would have been |
| 17769 | it would have been better to include these files in my `dumped' Emacs, | 17807 | better to include these files in my `dumped' Emacs, but I forgot. |
| 17770 | but I forgot. @xref{Building Emacs, , Building Emacs, elisp, The GNU | 17808 | @xref{Building Emacs, , Building Emacs, elisp, The GNU Emacs Lisp |
| 17771 | Emacs Lisp Reference Manual}, and the @file{INSTALL} file for more | 17809 | Reference Manual}, and the @file{INSTALL} file for more about |
| 17772 | about dumping.) | 17810 | dumping.) |
| 17773 | 17811 | ||
| 17774 | You may also want to include autoloaded expressions in your @file{.emacs} | 17812 | You may also want to include autoloaded expressions in your @file{.emacs} |
| 17775 | file. @code{autoload} is a built-in function that takes up to five | 17813 | file. @code{autoload} is a built-in function that takes up to five |
| @@ -17923,6 +17961,21 @@ emacs -Q - D | |||
| 17923 | @end group | 17961 | @end group |
| 17924 | @end smallexample | 17962 | @end smallexample |
| 17925 | 17963 | ||
| 17964 | @need 1250 | ||
| 17965 | Alternatively, since @code{blink-cursor-mode} has existed since Emacs | ||
| 17966 | version 21 and is likely to continue, you could write | ||
| 17967 | |||
| 17968 | @smallexample | ||
| 17969 | @group | ||
| 17970 | (when (>= emacs-major-version 21) | ||
| 17971 | (blink-cursor-mode 0) | ||
| 17972 | @end group | ||
| 17973 | @end smallexample | ||
| 17974 | |||
| 17975 | @noindent | ||
| 17976 | and add other expressions, too. | ||
| 17977 | |||
| 17978 | |||
| 17926 | @node X11 Colors, Miscellaneous, Simple Extension, Emacs Initialization | 17979 | @node X11 Colors, Miscellaneous, Simple Extension, Emacs Initialization |
| 17927 | @section X11 Colors | 17980 | @section X11 Colors |
| 17928 | 17981 | ||
| @@ -19093,6 +19146,19 @@ This appendix describes the @code{current-kill} function as well as | |||
| 19093 | both the @code{yank} and the @code{yank-pop} commands, but first, | 19146 | both the @code{yank} and the @code{yank-pop} commands, but first, |
| 19094 | consider the workings of the kill ring. | 19147 | consider the workings of the kill ring. |
| 19095 | 19148 | ||
| 19149 | @menu | ||
| 19150 | * What the Kill Ring Does:: | ||
| 19151 | * current-kill:: | ||
| 19152 | * yank:: | ||
| 19153 | * yank-pop:: | ||
| 19154 | * ring file:: | ||
| 19155 | @end menu | ||
| 19156 | |||
| 19157 | @node What the Kill Ring Does, current-kill, Kill Ring, Kill Ring | ||
| 19158 | @ifnottex | ||
| 19159 | @unnumberedsec What the Kill Ring Does | ||
| 19160 | @end ifnottex | ||
| 19161 | |||
| 19096 | @need 1250 | 19162 | @need 1250 |
| 19097 | The kill ring has a default maximum length of sixty items; this number | 19163 | The kill ring has a default maximum length of sixty items; this number |
| 19098 | is too large for an explanation. Instead, set it to four. Please | 19164 | is too large for an explanation. Instead, set it to four. Please |
| @@ -19163,14 +19229,7 @@ To return to the old value for the length of the kill ring, evaluate: | |||
| 19163 | (setq kill-ring-max old-kill-ring-max) | 19229 | (setq kill-ring-max old-kill-ring-max) |
| 19164 | @end smallexample | 19230 | @end smallexample |
| 19165 | 19231 | ||
| 19166 | @menu | 19232 | @node current-kill, yank, What the Kill Ring Does, Kill Ring |
| 19167 | * current-kill:: | ||
| 19168 | * yank:: | ||
| 19169 | * yank-pop:: | ||
| 19170 | * ring file:: | ||
| 19171 | @end menu | ||
| 19172 | |||
| 19173 | @node current-kill, yank, Kill Ring, Kill Ring | ||
| 19174 | @comment node-name, next, previous, up | 19233 | @comment node-name, next, previous, up |
| 19175 | @appendixsec The @code{current-kill} Function | 19234 | @appendixsec The @code{current-kill} Function |
| 19176 | @findex current-kill | 19235 | @findex current-kill |
| @@ -19183,6 +19242,17 @@ function is used directly or indirectly by @code{kill-append}, | |||
| 19183 | @code{copy-region-as-kill}, @code{kill-ring-save}, @code{kill-line}, | 19242 | @code{copy-region-as-kill}, @code{kill-ring-save}, @code{kill-line}, |
| 19184 | and @code{kill-region}.) | 19243 | and @code{kill-region}.) |
| 19185 | 19244 | ||
| 19245 | @menu | ||
| 19246 | * Code for current-kill:: | ||
| 19247 | * Understanding current-kill:: | ||
| 19248 | @end menu | ||
| 19249 | |||
| 19250 | @node Code for current-kill, Understanding current-kill, current-kill, current-kill | ||
| 19251 | @ifnottex | ||
| 19252 | @unnumberedsubsec The code for @code{current-kill} | ||
| 19253 | @end ifnottex | ||
| 19254 | |||
| 19255 | |||
| 19186 | @need 1500 | 19256 | @need 1500 |
| 19187 | The @code{current-kill} function is used by @code{yank} and by | 19257 | The @code{current-kill} function is used by @code{yank} and by |
| 19188 | @code{yank-pop}. Here is the code for @code{current-kill}: | 19258 | @code{yank-pop}. Here is the code for @code{current-kill}: |
| @@ -19238,11 +19308,7 @@ Here is the line in @code{kill-new}, which is explained in | |||
| 19238 | (setq kill-ring-yank-pointer kill-ring) | 19308 | (setq kill-ring-yank-pointer kill-ring) |
| 19239 | @end smallexample | 19309 | @end smallexample |
| 19240 | 19310 | ||
| 19241 | @menu | 19311 | @node Understanding current-kill, , Code for current-kill, current-kill |
| 19242 | * Understanding current-kill:: | ||
| 19243 | @end menu | ||
| 19244 | |||
| 19245 | @node Understanding current-kill, , current-kill, current-kill | ||
| 19246 | @ifnottex | 19312 | @ifnottex |
| 19247 | @unnumberedsubsec @code{current-kill} in Outline | 19313 | @unnumberedsubsec @code{current-kill} in Outline |
| 19248 | @end ifnottex | 19314 | @end ifnottex |
| @@ -19263,6 +19329,17 @@ skeletal form: | |||
| 19263 | This function takes two arguments, one of which is optional. It has a | 19329 | This function takes two arguments, one of which is optional. It has a |
| 19264 | documentation string. It is @emph{not} interactive. | 19330 | documentation string. It is @emph{not} interactive. |
| 19265 | 19331 | ||
| 19332 | @menu | ||
| 19333 | * Body of current-kill:: | ||
| 19334 | * Digression concerning error:: | ||
| 19335 | * Determining the Element:: | ||
| 19336 | @end menu | ||
| 19337 | |||
| 19338 | @node Body of current-kill, Digression concerning error, Understanding current-kill, Understanding current-kill | ||
| 19339 | @ifnottex | ||
| 19340 | @unnumberedsubsubsec The Body of @code{current-kill} | ||
| 19341 | @end ifnottex | ||
| 19342 | |||
| 19266 | The body of the function definition is a @code{let} expression, which | 19343 | The body of the function definition is a @code{let} expression, which |
| 19267 | itself has a body as well as a @var{varlist}. | 19344 | itself has a body as well as a @var{varlist}. |
| 19268 | 19345 | ||
| @@ -19341,12 +19418,7 @@ current value of @code{kill-ring-yank-pointer} is set to point to the | |||
| 19341 | list. Finally, another expression returns the first element of the | 19418 | list. Finally, another expression returns the first element of the |
| 19342 | list even if the @code{do-not-move} argument is true. | 19419 | list even if the @code{do-not-move} argument is true. |
| 19343 | 19420 | ||
| 19344 | @menu | 19421 | @node Digression concerning error, Determining the Element, Body of current-kill, Understanding current-kill |
| 19345 | * Digression concerning error:: | ||
| 19346 | * Determining the Element :: | ||
| 19347 | @end menu | ||
| 19348 | |||
| 19349 | @node Digression concerning error, Determining the Element , Understanding current-kill, Understanding current-kill | ||
| 19350 | @ifnottex | 19422 | @ifnottex |
| 19351 | @unnumberedsubsubsec Digression about the word `error' | 19423 | @unnumberedsubsubsec Digression about the word `error' |
| 19352 | @end ifnottex | 19424 | @end ifnottex |
| @@ -19368,7 +19440,7 @@ environment, is making an error. This is bad. Even though the computer | |||
| 19368 | takes the same steps as it does when there is an `error', a term such as | 19440 | takes the same steps as it does when there is an `error', a term such as |
| 19369 | `cancel' would have a clearer connotation. | 19441 | `cancel' would have a clearer connotation. |
| 19370 | 19442 | ||
| 19371 | @node Determining the Element , , Digression concerning error, Understanding current-kill | 19443 | @node Determining the Element, , Digression concerning error, Understanding current-kill |
| 19372 | @ifnottex | 19444 | @ifnottex |
| 19373 | @unnumberedsubsubsec Determining the Element | 19445 | @unnumberedsubsubsec Determining the Element |
| 19374 | @end ifnottex | 19446 | @end ifnottex |
| @@ -19850,6 +19922,20 @@ the vertical axis that looks like this: | |||
| 19850 | The function should be passed the height of the graph, and then should | 19922 | The function should be passed the height of the graph, and then should |
| 19851 | construct and insert the appropriate numbers and marks. | 19923 | construct and insert the appropriate numbers and marks. |
| 19852 | 19924 | ||
| 19925 | @menu | ||
| 19926 | * print-Y-axis in Detail:: | ||
| 19927 | * Height of label:: | ||
| 19928 | * Compute a Remainder:: | ||
| 19929 | * Y Axis Element:: | ||
| 19930 | * Y-axis-column:: | ||
| 19931 | * print-Y-axis Penultimate:: | ||
| 19932 | @end menu | ||
| 19933 | |||
| 19934 | @node print-Y-axis in Detail, Height of label, print-Y-axis, print-Y-axis | ||
| 19935 | @ifnottex | ||
| 19936 | @unnumberedsubsec The @code{print-Y-axis} Function in Detail | ||
| 19937 | @end ifnottex | ||
| 19938 | |||
| 19853 | It is easy enough to see in the figure what the Y axis label should | 19939 | It is easy enough to see in the figure what the Y axis label should |
| 19854 | look like; but to say in words, and then to write a function | 19940 | look like; but to say in words, and then to write a function |
| 19855 | definition to do the job is another matter. It is not quite true to | 19941 | definition to do the job is another matter. It is not quite true to |
| @@ -19861,15 +19947,7 @@ the base line (number 1) and then that we want a number and a tic on | |||
| 19861 | the fifth line from the bottom and on every line that is a multiple of | 19947 | the fifth line from the bottom and on every line that is a multiple of |
| 19862 | five. | 19948 | five. |
| 19863 | 19949 | ||
| 19864 | @menu | 19950 | @node Height of label, Compute a Remainder, print-Y-axis in Detail, print-Y-axis |
| 19865 | * Height of label:: | ||
| 19866 | * Compute a Remainder:: | ||
| 19867 | * Y Axis Element:: | ||
| 19868 | * Y-axis-column:: | ||
| 19869 | * print-Y-axis Penultimate:: | ||
| 19870 | @end menu | ||
| 19871 | |||
| 19872 | @node Height of label, Compute a Remainder, print-Y-axis, print-Y-axis | ||
| 19873 | @ifnottex | 19951 | @ifnottex |
| 19874 | @unnumberedsubsec What height should the label be? | 19952 | @unnumberedsubsec What height should the label be? |
| 19875 | @end ifnottex | 19953 | @end ifnottex |