home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2001 May / SGI Freeware 2001 May - Disc 3.iso / dist / fw_elisp-intro.idb / usr / freeware / info / emacs-lisp-intro.info-1.z / emacs-lisp-intro.info-1
Encoding:
GNU Info File  |  1998-10-28  |  47.7 KB  |  1,126 lines

  1. This is Info file emacs-lisp-intro.info, produced by Makeinfo version
  2. 1.67 from the input file emacs-lisp-intro.texi.
  3.  
  4.    This is an introduction to `Programming in Emacs Lisp', for people
  5. who are not programmers.
  6.  
  7.    Edition 1.05, 21 October 1997
  8.  
  9.    Copyright (C) 1990, '91, '92, '93, '94, '95, '97 Free Software
  10. Foundation, Inc.
  11.  
  12.    Permission is granted to make and distribute verbatim copies of this
  13. manual provided the copyright notice and this permission notice are
  14. preserved on all copies.
  15.  
  16.    Permission is granted to copy and distribute modified versions of
  17. this manual under the conditions for verbatim copying, provided also
  18. that the sections entitled "Copying" and "GNU General Public License"
  19. are included exactly as in the original, and provided that the entire
  20. resulting derived work is distributed under the terms of a permission
  21. notice identical to this one.
  22.  
  23.    Permission is granted to copy and distribute translations of this
  24. manual into another language, under the above conditions for modified
  25. versions, except that this permission notice may be stated in a
  26. translation approved by the Free Software Foundation.
  27.  
  28. 
  29. File: emacs-lisp-intro.info,  Node: Top,  Next: Preface,  Prev: (dir),  Up: (dir)
  30.  
  31.    This master menu first lists each chapter and index; then it lists
  32. every node in every chapter.
  33.  
  34. * Menu:
  35.  
  36. * Preface::                     What to look for.
  37. * List Processing::             What is Lisp?
  38. * Practicing Evaluation::       Running several programs.
  39. * Writing Defuns::              How to write function definitions.
  40. * Buffer Walk Through::         Exploring a few buffer-related functions.
  41. * More Complex::                A few, even more complex functions.
  42. * Narrowing & Widening::        Restricting your and Emacs attention to
  43.                                 a region.
  44. * car cdr & cons::              Fundamental functions in Lisp.
  45. * Cutting & Storing Text::      Removing text and saving it.
  46. * List Implementation::         How lists are implemented in the computer.
  47. * Yanking::                     Pasting stored text.
  48. * Loops & Recursion::           How to repeat a process.
  49. * Regexp Search::               Regular expression searches.
  50. * Counting Words::              A review of repetition and regexps.
  51. * Words in a defun::            Counting words in a `defun'.
  52. * Readying a Graph::            A prototype graph printing function.
  53. * Emacs Initialization::        How to write a `.emacs' file.
  54. * Debugging::                   How to run the Emacs Lisp debuggers.
  55. * Conclusion::                  Now you have the basics.
  56. * the-the::                     An appendix: how to find reduplicated words.
  57. * Kill Ring::                   An appendix: how the kill ring works.
  58. * Full Graph::                  How to create a graph with labelled axes.
  59. * Index::
  60. * About the Author::
  61.  
  62.  -- The Detailed Node Listing --
  63.  
  64. Preface
  65.  
  66. * On Reading this Text::        Read, gain familiarity, pick up habits....
  67. * Who You Are::                 For whom this is written.
  68. * Lisp History::
  69. * Note for Novices::            You can read this as a novice.
  70. * Thank You::
  71.  
  72. List Processing
  73.  
  74. * Lisp Lists::                  What are lists?
  75. * Run a Program::               Any list in Lisp is a program ready to run.
  76. * Making Errors::               Generating an error message.
  77. * Names & Definitions::         Names of symbols and function definitions.
  78. * Lisp Interpreter::            What the Lisp interpreter does.
  79. * Evaluation::                  Running a program.
  80. * Variables::                   Returning a value from a variable.
  81. * Arguments::                   Passing information to a function.
  82. * set & setq::                  Setting the value of a variable.
  83. * Summary::                     The major points.
  84. * Error Message Exercises::
  85.  
  86. Lisp Lists
  87.  
  88. * Lisp Atoms::                  Elemental entities.
  89. * Whitespace in Lists::         Formating lists to be readable.
  90. * Typing Lists::                How GNU Emacs helps you type lists.
  91.  
  92. The Lisp Interpreter
  93.  
  94. * Byte Compiling::              Specially processing code for speed.
  95.  
  96. Evaluation
  97.  
  98. * Evaluating Inner Lists::      Lists within lists...
  99.  
  100. Variables
  101.  
  102. * Void Variable::               The error message for a symbol without a value.
  103.  
  104. Arguments
  105.  
  106. * Data types::                  Types of data passed to a function.
  107. * Args as Variable or List::    An argument can be the value
  108.                                 of a variable or list.
  109. * Variable Number of Arguments::  Some functions may take a
  110.                                 variable number of arguments.
  111. * Wrong Type of Argument::      Passing an argument of the wrong type
  112.                                 to a function.
  113. * message::                     A useful function for sending messages.
  114.  
  115. Setting the Value of a Variable
  116.  
  117. * Using set::                   Setting values.
  118. * Using setq::                  Setting a quoted value.
  119. * Counting::                    Using `setq' to count.
  120.  
  121. Practicing Evaluation
  122.  
  123. * How to Evaluate::             Typing editing commands or `C-x C-e'
  124.                                 causes evaluation.
  125. * Buffer Names::                Buffers and files are different.
  126. * Getting Buffers::             Getting a buffer itself, not merely its name.
  127. * Switching Buffers::           How to change to another buffer.
  128. * Buffer Size & Locations::     Where point is located and the size of
  129.                                 the buffer.
  130. * Evaluation Exercise::
  131.  
  132. How To Write Function Definitions
  133.  
  134. * Primitive Functions::         Some functions are written in C.
  135. * defun::                       The `defun' special form.
  136. * Install::                     Install a Function Definition.
  137. * Interactive::                 Making a function interactive.
  138. * Interactive Options::         Different options for `interactive'.
  139. * Permanent Installation::      Installing code permanently.
  140. * let::                         Creating and initializing local variables.
  141. * if::                          What if?
  142. * else::                        If-then-else expressions.
  143. * Truth & Falsehood::           What Lisp considers false and true.
  144. * save-excursion::              Keeping track of point, mark, and buffer.
  145. * Review::
  146. * defun Exercises::
  147.  
  148. Install a Function Definition
  149.  
  150. * Change a defun::              How to change a function definition.
  151.  
  152. Make a Function Interactive
  153.  
  154. * multiply-by-seven in detail::  The interactive version.
  155.  
  156. `let'
  157.  
  158. * Parts of let Expression::
  159. * Sample let Expression::
  160. * Uninitialized let Variables::
  161.  
  162. The `if' Special Form
  163.  
  164. * type-of-animal in detail::    An example of an `if' expression.
  165.  
  166. `save-excursion'
  167.  
  168. * Template for save-excursion::  One slot to fill in.
  169.  
  170. A Few Buffer-Related Functions
  171.  
  172. * Finding More::                How to find more information.
  173. * simplified-beginning-of-buffer::  Shows `goto-char',
  174.                                 `point-min', and `push-mark'.
  175. * mark-whole-buffer::           Almost the same as `beginning-of-buffer'.
  176. * append-to-buffer::            Uses `save-excursion' and
  177.                                 `insert-buffer-substring'.
  178. * Buffer Related Review::       Review.
  179. * Buffer Exercises::
  180.  
  181. The Definition of `mark-whole-buffer'
  182.  
  183. * Body of mark-whole-buffer::   Only three lines of code.
  184.  
  185. The Definition of `append-to-buffer'
  186.  
  187. * append interactive::          A two part interactive expression.
  188. * append-to-buffer body::       Incorporates a `let' expression.
  189. * append save-excursion::       How the `save-excursion' works.
  190.  
  191. A Few More Complex Functions
  192.  
  193. * copy-to-buffer::              With `set-buffer', `get-buffer-create'.
  194. * insert-buffer::               Read-only, and with `or'.
  195. * beginning-of-buffer::         Shows `goto-char',
  196.                                 `point-min', and `push-mark'.
  197. * Second Buffer Related Review::
  198. * &optional Exercise ::
  199.  
  200. The Definition of `insert-buffer'
  201.  
  202. * insert interactive expression::  A read-only situation.
  203. * insert-buffer body::          The body has an `or' and a ` let'.
  204. * if & or::                     Using an `if' instead of an `or'.
  205. * insert or::                   How the  `or' expression works.
  206. * insert let::                  Two `save-excursion' expressions.
  207.  
  208. The Interactive Expression in `insert-buffer'
  209.  
  210. * read-only buffer::
  211. * b for interactive::
  212.  
  213. Complete Definition of `beginning-of-buffer'
  214.  
  215. * Optional Arguments::
  216. * beginning-of-buffer opt arg::  Example with optional argument.
  217. * beginning-of-buffer complete::
  218.  
  219. `beginning-of-buffer' with an Argument
  220.  
  221. * large-case::                  Division and multiplication in a large buffer.
  222. * small-case::                  Functions embedded in parentheses.
  223.  
  224. Narrowing and Widening
  225.  
  226. * narrowing advantages::        The Advantages of Narrowing
  227. * save-restriction::            The `save-restriction' special form.
  228. * what-line::                   The number of the line that point is on.
  229. * narrow Exercise::
  230.  
  231. `car', `cdr', `cons': Fundamental Functions
  232.  
  233. * Strange Names::               An historical aside: why the strange names?
  234. * car & cdr::                   Functions for extracting part of a list.
  235. * cons::                        Constructing a list.
  236. * nthcdr::                      Calling `cdr' repeatedly.
  237. * setcar::                      Changing the first element of a list.
  238. * setcdr::                      Changing the rest of a list.
  239. * cons Exercise::
  240.  
  241. `cons'
  242.  
  243. * length::                      How to find the length of a list.
  244.  
  245. Cutting and Storing Text
  246.  
  247. * Storing Text::                Text is stored in a list.
  248. * zap-to-char::                 Cutting out text up to a character.
  249. * kill-region::                 Cutting text out of a region.
  250. * delete-region::               A digression into C.
  251. * defvar::                      How to give a variable an initial value.
  252. * copy-region-as-kill::         A definition for copying text.
  253. * cons & search-fwd Review::
  254. * search Exercises::
  255.  
  256. `zap-to-char'
  257.  
  258. * zap-to-char interactive::     A three part interactive expression.
  259. * zap-to-char body::            A short overview.
  260. * search-forward::              How to search for a string.
  261. * progn::                       The `progn' function.
  262. * Summing up zap-to-char::      Using `point' and `search-forward'.
  263. * v-18-zap-to-char::            The version 18 implementation.
  264.  
  265. The Version 18 Implementation
  266.  
  267. * progn body::                  The body of the `progn' expression
  268.  
  269. `copy-region-as-kill'
  270.  
  271. * copy-region-as-kill body::    The body of `copy-region-as-kill'
  272.  
  273. The Body of `copy-region-as-kill'
  274.  
  275. * kill-append function::        The `kill-append' function
  276. * copy-region-as-kill else-part::  The else-part of `copy-region-as-kill'
  277.  
  278. How Lists are Implemented
  279.  
  280. * List Exercise::
  281.  
  282. Yanking Text Back
  283.  
  284. * Kill Ring Overview::          The kill ring is a list.
  285. * kill-ring-yank-pointer::      The `kill-ring-yank-pointer' variable.
  286. * yank nthcdr Exercises::
  287.  
  288. Loops and Recursion
  289.  
  290. * while::                       Causing a stretch of code to repeat.
  291. * Recursion::                   Causing a function to call itself.
  292. * Looping exercise::
  293.  
  294. `while'
  295.  
  296. * Loop Example::                A `while' loop that uses a list.
  297. * print-elements-of-list::      Uses `while', `car', `cdr'.
  298. * Incrementing Loop::           A loop with an incrementing counter.
  299. * Decrementing Loop::           A loop with a decrementing counter.
  300.  
  301. A Loop with an Incrementing Counter
  302.  
  303. * Incrementing Example::        Counting pebbles in a triangle.
  304. * Inc Example parts::           The parts of the function definition.
  305. * Inc Example altogether::      Putting the function definition together.
  306.  
  307. Loop with a Decrementing Counter
  308.  
  309. * Decrementing Example::        More pebbles on the beach.
  310. * Dec Example parts::           The parts of the function definition.
  311. * Dec Example altogether::      Putting the function definition together.
  312.  
  313. Recursion
  314.  
  315. * Recursion with list::         Using a list as the test whether to recurse.
  316. * Recursive triangle function::  Replacing a `while' loop with recursion.
  317. * Recursion with cond::         Recursion example with a different conditional.
  318.  
  319. Recursion in Place of a Counter
  320.  
  321. * Recursive Example arg of 3::
  322.  
  323. Regular Expression Searches
  324.  
  325. * sentence-end::                The regular expression for `sentence-end'.
  326. * re-search-forward::           Very similar to `search-forward'.
  327. * forward-sentence::            A straightforward example of regexp search.
  328. * forward-paragraph::           A somewhat complex example.
  329. * etags::                       How to create your own `TAGS' table.
  330. * Regexp Review::
  331. * re-search Exercises::
  332.  
  333. `forward-sentence'
  334.  
  335. * fwd-sentence while loops::    Two `while' loops.
  336. * fwd-sentence re-search::      A regular expression search.
  337.  
  338. `forward-paragraph': a Goldmine of Functions
  339.  
  340. * fwd-para let::                The `let*' expression.
  341. * fwd-para while::              The forward motion `while' loop.
  342. * fwd-para between paragraphs::  Movement between paragraphs.
  343. * fwd-para within paragraph::   Movement within paragraphs.
  344. * fwd-para no fill prefix::     When there is no fill prefix.
  345. * fwd-para with fill prefix::   When there is a fill prefix.
  346. * fwd-para summary::            Summary of `forward-paragraph' code.
  347.  
  348. Counting: Repetition and Regexps
  349.  
  350. * Why Count Words::             Emacs lacks a word count command.
  351. * count-words-region::          Use a regexp, but find a problem.
  352. * recursive-count-words::       Start with case of no words in region.
  353. * Counting Exercise::
  354.  
  355. The `count-words-region' Function
  356.  
  357. * Whitespace Bug::              The Whitespace Bug in `count-words-region'
  358.  
  359. Counting Words in a `defun'
  360.  
  361. * Divide and Conquer::          Split a daunting project into parts.
  362. * Words and Symbols::           What to count?
  363. * Syntax::                      What constitutes a word or symbol?
  364. * count-words-in-defun::        Very like `count-words'.
  365. * Several defuns::              Counting several defuns in a file.
  366. * Find a File::                 Do you want to look at a file?
  367. * lengths-list-file::           A list of the lengths of many definitions.
  368. * Several files::               Counting in definitions in different files.
  369. * Several files recursively::   Recursively counting in different files.
  370. * Prepare the data::            Prepare the data for display in a graph.
  371.  
  372. Count Words in `defuns' in Different Files
  373.  
  374. * append::                      Attaching one list to another.
  375.  
  376. Prepare the Data for Display in a Graph
  377.  
  378. * Sorting::                     Sorting lists.
  379. * Files List::                  Making a list of files.
  380.  
  381. Readying a Graph
  382.  
  383. * Columns of a graph::          How to print individual columns.
  384. * graph-body-print::            How to print the body of a graph.
  385. * recursive-graph-body-print::
  386. * Printed Axes::
  387. * Line Graph Exercise::
  388.  
  389. Your `.emacs' File
  390.  
  391. * Default Configuration::       Emacs has sensible defaults.
  392. * Site-wide Init::              You can write site-wide init files.
  393. * edit-options::                How to set some variables for a session.
  394. * Beginning a .emacs File::     How to write a `.emacs file'.
  395. * Text and Auto-fill::          Automatically wrap lines.
  396. * Mail Aliases::                Use abbreviations for email addresses.
  397. * Indent Tabs Mode::            Don't use tabs with TeX
  398. * Keybindings::                 Create some personal keybindings.
  399. * Loading Files::               Load (i.e. evaluate) files automatically.
  400. * Autoload::                    Make functions available.
  401. * Simple Extension::            Define a function; bind it to a key.
  402. * Keymaps::                     More about key binding.
  403. * X11 Colors::                  Colors in version 19 in X.
  404. * V19 Miscellaneous::           Automatically resize minibuffer, and more.
  405. * Mode Line::                   How to customize your mode line.
  406.  
  407. Debugging
  408.  
  409. * debug::                       How to use the built-in debugger.
  410. * debug-on-entry::              Start debugging when you call a function.
  411. * debug-on-quit::               Start debugging when you quit with `C-g'.
  412. * edebug::                      How to use Edebug, a source level debugger.
  413. * Debugging Exercises::
  414.  
  415. Handling the Kill Ring
  416.  
  417. * rotate-yank-pointer::         Move a pointer along a list and around.
  418. * yank::                        Paste a copy of a clipped element.
  419. * yank-pop::                    Insert first element pointed to.
  420.  
  421. The `rotate-yank-pointer' Function
  422.  
  423. * rotate-yk-ptr body::          The Body of `rotate-yank-pointer'.
  424.  
  425. The Body of `rotate-yank-pointer'
  426.  
  427. * rotate-yk-ptr else-part::     The else-part of the `if' expression.
  428. * Remainder Function::          The remainder, `%', function.
  429. * rotate-yk-ptr remainder::     Using `%' in `rotate-yank-pointer'.
  430. * kill-rng-yk-ptr last elt::    Pointing to the last element.
  431.  
  432. `yank'
  433.  
  434. * rotate-yk-ptr arg::           Pass the argument to `rotate-yank-pointer'.
  435. * rotate-yk-ptr negative arg::  Pass a negative argument.
  436.  
  437. A Graph with Labelled Axes
  438.  
  439. * Labelled Example::            How a finished graph should look.
  440. * print-graph Varlist::         `let' expression in `print-graph'.
  441. * print-Y-axis::                Print a label for the vertical axis.
  442. * print-X-axis::                Print a horizontal label.
  443. * Print Whole Graph::           The function to print a complete graph.
  444.  
  445. The `print-Y-axis' Function
  446.  
  447. * Compute a Remainder::         How to compute the remainder of a division.
  448. * Y Axis Element::              Construct a line for the Y axis.
  449. * Y-axis-column::               Generate a list of Y axis labels.
  450. * print-Y-axis Final::          Print a vertical axis, final version.
  451.  
  452. The `print-X-axis' Function
  453.  
  454. * X Axis Tic Marks::            Create tic marks for the horizontal axis.
  455.  
  456. Printing the Whole Graph
  457.  
  458. * Test print-graph::            Run a short test.
  459. * Graphing words in defuns::    Executing the final code.
  460. * Final Printed Graph::         The graph itself!
  461.  
  462. Graphing Numbers of Words and Symbols
  463.  
  464. * lambda::                      How to write an anonymous function.
  465. * mapcar::                      Apply a function to elements of a list.
  466. * Another Bug::                 Yet another ... of a most insidious type.
  467.  
  468. 
  469. File: emacs-lisp-intro.info,  Node: Preface,  Next: List Processing,  Prev: Top,  Up: Top
  470.  
  471. Preface
  472. *******
  473.  
  474.    Most of the GNU Emacs text editor is written in the programming
  475. language called Emacs Lisp.  The code written in this programming
  476. language is the software--the sets of instructions--that tell the
  477. computer what to do when you give it commands.  Emacs is designed so
  478. that you can write new code in Emacs Lisp and easily install it as an
  479. extension to the editor.  This is why Emacs is called the "extensible
  480. editor".
  481.  
  482.    (Indeed, since Emacs does so much more than provide editing
  483. capabilities, it should perhaps be called an "extensible computing
  484. environment", but that phrase is quite a mouthful.  Also, everything
  485. you do in Emacs--find the Mayan date and phases of the moon, simplify
  486. polynomials, debug code, manage files, read letters, write books--all
  487. these activities are kinds of editing in the most general sense of the
  488. word.)
  489.  
  490.    Although Emacs Lisp is usually thought of in association with the
  491. text editor, it is a full computer programming language.  You can use
  492. it as you would any other programming language.
  493.  
  494.    Perhaps you want to understand programming; perhaps you want to
  495. extend Emacs; or perhaps you want to become a programmer.  This
  496. introduction to Emacs Lisp is designed to get you started: to guide you
  497. in learning the fundamentals of programming, and more importantly, to
  498. show you how you can teach yourself to go further.
  499.  
  500. * Menu:
  501.  
  502. * On Reading this Text::        Read, gain familiarity, pick up habits....
  503. * Who You Are::                 For whom this is written.
  504. * Lisp History::
  505. * Note for Novices::            You can read this as a novice.
  506. * Thank You::
  507.  
  508. 
  509. File: emacs-lisp-intro.info,  Node: On Reading this Text,  Next: Who You Are,  Prev: Preface,  Up: Preface
  510.  
  511. On Reading this Text
  512. ====================
  513.  
  514.    All through this document, you will see little sample programs you
  515. can run inside of Emacs.  If you read this document in Info inside of
  516. GNU Emacs, you can run the programs as they appear.  (This is easy to
  517. do and is explained when the examples are presented.)  Alternatively,
  518. you can read this introduction as a printed book while sitting beside a
  519. computer running Emacs.  (This is what I like to do; I like printed
  520. books.)  If you don't have a running Emacs beside you, you can still
  521. read this book, but in this case, it is best to treat it as a novel or
  522. as a travel guide to a country not yet visited: interesting, but not
  523. the same as being there.
  524.  
  525.    Much of this introduction is dedicated to walk-throughs or guided
  526. tours of code used in GNU Emacs.  These tours are designed for two
  527. purposes: first, to give you familiarity with real, working code (code
  528. you use every day); and, second, to give you familiarity with the way
  529. Emacs works.  It is interesting to see how an editor is implemented.
  530. Also, I hope that you will pick up the habit of browsing through source
  531. code.  You can learn from it and mine it for ideas.  Having GNU Emacs
  532. is like having a dragon's cave of treasures.
  533.  
  534.    In addition to learning about Emacs as an editor and Emacs Lisp as a
  535. programming language, the examples and guided tours will give you an
  536. opportunity to get acquainted with Emacs as a Lisp programming
  537. environment.  GNU Emacs supports programming and provides tools that
  538. you will want to become comfortable using, such as `M-.' (the key which
  539. invokes the `find-tag' command).  You will also learn about buffers and
  540. other objects that are part of the editing environment.  Learning about
  541. these features of Emacs is like learning new routes around your home
  542. town.
  543.  
  544.    Finally, I hope to convey some of the skills for using Emacs to
  545. learn aspects of programming that you don't know.  You can often use
  546. Emacs to help you understand what puzzles you or to find out how to do
  547. something new.  This self-reliance is not only a pleasure, but an
  548. advantage.
  549.  
  550. 
  551. File: emacs-lisp-intro.info,  Node: Who You Are,  Next: Lisp History,  Prev: On Reading this Text,  Up: Preface
  552.  
  553. For Whom This is Written
  554. ========================
  555.  
  556.    This text is written as an elementary introduction for people who are
  557. not programmers.  If you are a programmer, you may not be satisfied with
  558. this primer.  The reason is that you may have become expert at reading
  559. reference manuals and be put off by the way this text is organized.
  560.  
  561.    An expert programmer who reviewed this text said to me:
  562.  
  563.      I prefer to learn from reference manuals.  I "dive into" each
  564.      paragraph, and "come up for air" between paragraphs.
  565.  
  566.      When I get to the end of a paragraph, I assume that that subject is
  567.      done, finished, that I know everything I need (with the possible
  568.      exception of the case when the next paragraph starts talking about
  569.      it in more detail).  I expect that a well written reference manual
  570.      will not have a lot of redundancy, and that it will have excellent
  571.      pointers to the (one) place where the information I want is.
  572.  
  573.    This introduction is not written for this person!
  574.  
  575.    Firstly, I try to say everything at least three times: first, to
  576. introduce it; second, to show it in context; and third, to show it in a
  577. different context, or to review it.
  578.  
  579.    Secondly, I hardly ever put all the information about a subject in
  580. one place, much less in one paragraph.  To my way of thinking, that
  581. imposes too heavy a burden on the reader.  Instead I try to explain
  582. only what you need to know at the time.  (Sometimes I include a little
  583. extra information so you won't be surprised later when the additional
  584. information is formally introduced.)
  585.  
  586.    When you read this text, you are not expected to learn everything the
  587. first time.  Frequently, you need only make, as it were, a `nodding
  588. acquaintance' with some of the items mentioned.  My hope is that I have
  589. structured the text and given you enough hints that you will be alert to
  590. what is important, and concentrate on it.
  591.  
  592.    You will need to "dive into" some paragraphs; there is no other way
  593. to read them.  But I have tried to keep down the number of such
  594. paragraphs.  This book is intended as an approachable hill, rather than
  595. as a daunting mountain.
  596.  
  597.    This *introduction* to `Programming in Emacs Lisp' has a companion
  598. document, *Note The GNU Emacs Lisp Reference Manual: (elisp)Top.  The
  599. reference manual has more detail than this introduction.  In the
  600. reference manual, all the information about one topic is concentrated
  601. in one place.  You should turn to it if you are like the programmer
  602. quoted above.  And, of course, after you have read this `Introduction',
  603. you will find the `Reference Manual' useful when you are writing your
  604. own programs.
  605.  
  606. 
  607. File: emacs-lisp-intro.info,  Node: Lisp History,  Next: Note for Novices,  Prev: Who You Are,  Up: Preface
  608.  
  609. Lisp History
  610. ============
  611.  
  612.    Lisp was first developed in the late 1950s at the Massachusetts
  613. Institute of Technology for research in artificial intelligence.  The
  614. great power of the Lisp language makes it superior for other purposes as
  615. well, such as writing editor commands.
  616.  
  617.    GNU Emacs Lisp is largely inspired by Maclisp, which was written at
  618. MIT in the 1960's.  It is somewhat inspired by Common Lisp, which
  619. became a standard in the 1980s.  However, Emacs Lisp is much simpler
  620. than Common Lisp.  (The standard Emacs distribution contains an
  621. optional extensions file, `cl.el', that adds many Common Lisp features
  622. to Emacs Lisp.)
  623.  
  624. 
  625. File: emacs-lisp-intro.info,  Node: Note for Novices,  Next: Thank You,  Prev: Lisp History,  Up: Preface
  626.  
  627. A Note for Novices
  628. ==================
  629.  
  630.    If you don't know GNU Emacs, you can still read this document
  631. profitably.  However, I recommend you learn Emacs, if only to learn to
  632. move around your computer screen.  You can teach yourself how to use
  633. Emacs with the on-line tutorial.  To use it, type `C-h t'.  (This means
  634. you press and release the <CTRL> key and the `h' at the same time, and
  635. then press and release `t'.)
  636.  
  637.    Also, I often refer to one of Emacs's standard commands by listing
  638. the keys which you press to invoke the command and then giving the name
  639. of the command in parentheses, like this: `M-C-\' (`indent-region').
  640. What this means is that the `indent-region' command is customarily
  641. invoked by typing `M-C-\'.  (You can, if you wish, change the keys that
  642. are typed to invoke the command; this is called "rebinding".  *Note
  643. Keymaps: Keymaps.)  The abbreviation `M-C-\' means that you type your
  644. <META> key, <CTRL> key and <\> key all at the same time.  Sometimes a
  645. combination like this is called a keychord, since it is similar to the
  646. way you play a chord on a piano.  If your keyboard does not have a
  647. <META> key, the <ESC> key prefix is used in place of it.  In this case,
  648. `M-C-\' means that you press and release your <ESC> key and then type
  649. the <CTRL> key and the <\> key at the same time.
  650.  
  651.    If you are reading this in Info using GNU Emacs, you can read through
  652. this whole document just by pressing the space bar, <SPC>.  (To learn
  653. about Info, type `C-h i' and then select Info.)
  654.  
  655.    A note on terminology:  when I use the word Lisp alone, I am usually
  656. referring to the various dialects of Lisp in general, but when I speak
  657. of Emacs Lisp, I am referring to GNU Emacs Lisp in particular.
  658.  
  659. 
  660. File: emacs-lisp-intro.info,  Node: Thank You,  Prev: Note for Novices,  Up: Preface
  661.  
  662. Thank You
  663. =========
  664.  
  665.    My thanks to all who helped me with this book.  My especial thanks to
  666. Jim Blandy, Noah Friedman, Jim Kingdon, Roland McGrath, Frank Ritter,
  667. Randy Smith, Richard M. Stallman, and Melissa Weisshaus.  My thanks
  668. also go to both Philip Johnson and David Stampe for their patient
  669. encouragement.  My mistakes are my own.
  670.  
  671. 
  672. File: emacs-lisp-intro.info,  Node: List Processing,  Next: Practicing Evaluation,  Prev: Preface,  Up: Top
  673.  
  674. List Processing
  675. ***************
  676.  
  677.    To the untutored eye, Lisp is a strange programming language.  In
  678. Lisp code there are parentheses everywhere.  Some people even claim
  679. that the name stands for `Lots of Isolated Silly Parentheses'.  But the
  680. claim is unwarranted.  Lisp stands for LISt Processing and the
  681. programming language handles *lists* (and lists of lists) by putting
  682. them between parentheses.  The parentheses mark the boundaries of the
  683. list.  Sometimes a list is preceded by a single apostrophe or quotation
  684. mark, `''.  Lists are the basis of Lisp.
  685.  
  686. * Menu:
  687.  
  688. * Lisp Lists::                  What are lists?
  689. * Run a Program::               Any list in Lisp is a program ready to run.
  690. * Making Errors::               Generating an error message.
  691. * Names & Definitions::         Names of symbols and function definitions.
  692. * Lisp Interpreter::            What the Lisp interpreter does.
  693. * Evaluation::                  Running a program.
  694. * Variables::                   Returning a value from a variable.
  695. * Arguments::                   Passing information to a function.
  696. * set & setq::                  Setting the value of a variable.
  697. * Summary::                     The major points.
  698. * Error Message Exercises::
  699.  
  700. 
  701. File: emacs-lisp-intro.info,  Node: Lisp Lists,  Next: Run a Program,  Prev: List Processing,  Up: List Processing
  702.  
  703. Lisp Lists
  704. ==========
  705.  
  706.    In Lisp, a list looks like this: `'(rose violet daisy buttercup)'.
  707. This list is preceded by a single apostrophe.  It could just as well be
  708. written as follows, which looks more like the kind of list you are
  709. likely to be familiar with:
  710.  
  711.      '(rose
  712.        violet
  713.        daisy
  714.        buttercup)
  715.  
  716. The elements of this list are the names of the four different flowers,
  717. separated from each other by whitespace and surrounded by parentheses,
  718. like flowers in a field with a stone wall around them.
  719.  
  720.    Lists can also have numbers in them, as in this list: `(+ 2 2)'.
  721. This list has a plus-sign, `+', followed by two `2's, each separated by
  722. whitespace.
  723.  
  724.    In Lisp, both data and programs are represented the same way; that
  725. is, they are both lists of words, numbers, or other lists, separated by
  726. whitespace and surrounded by parentheses.  (Since a program looks like
  727. data, one program may easily serve as data for another; this is a very
  728. powerful feature of Lisp.)  (Incidentally, these two parenthetical
  729. remarks are *not* Lisp lists, because they contain `;' and `.' as
  730. punctuation marks.)
  731.  
  732.    Here is another list, this time with a list inside of it:
  733.  
  734.      '(this list has (a list inside of it))
  735.  
  736.    The components of this list are the words `this', `list', `has', and
  737. the list `(a list inside of it)'.  The interior list is made up of the
  738. words `a', `list', `inside', `of', `it'.
  739.  
  740. * Menu:
  741.  
  742. * Lisp Atoms::                  Elemental entities.
  743. * Whitespace in Lists::         Formating lists to be readable.
  744. * Typing Lists::                How GNU Emacs helps you type lists.
  745.  
  746. 
  747. File: emacs-lisp-intro.info,  Node: Lisp Atoms,  Next: Whitespace in Lists,  Prev: Lisp Lists,  Up: Lisp Lists
  748.  
  749. Lisp Atoms
  750. ----------
  751.  
  752.    In Lisp, what we have been calling words are called "atoms".  This
  753. term comes from the historical meaning of the word atom, which means
  754. `indivisible'.  As far as Lisp is concerned, the words we have been
  755. using in the lists cannot be divided into any smaller parts and still
  756. mean the same thing as part of a program; likewise with numbers and
  757. single character symbols like `+'.  On the other hand, unlike an atom,
  758. a list can be split into parts.  (*Note `car' `cdr' & `cons'
  759. Fundamental Functions: car cdr & cons.)
  760.  
  761.    In a list, atoms are separated from each other by whitespace.  They
  762. can be right next to a parenthesis.
  763.  
  764.    Technically speaking, a list in Lisp consists of parentheses
  765. surrounding atoms separated by whitespace or surrounding other lists or
  766. surrounding both atoms and other lists.  A list can have just one atom
  767. in it or have nothing in it at all.  A list with nothing in it looks
  768. like this: `()', and is called the "empty list".  Unlike anything else,
  769. an empty list is considered both an atom and a list at the same time.
  770.  
  771.    The printed representation of both atoms and lists are called
  772. "symbolic expressions" or, more concisely, "s-expressions".  The word
  773. "expression" by itself can refer to either the printed representation,
  774. or to the atom or list as it is held internally in the computer.
  775. Often, people use the term "expression" indiscriminately.  (Also, in
  776. many texts, the word "form" is used as a synonym for expression.)
  777.  
  778.    Incidentally, the atoms that make up our universe were named such
  779. when they were thought to be indivisible; but it has been found that
  780. physical atoms are not indivisible.  Parts can split off an atom or it
  781. can fission into two parts of roughly equal size.  Physical atoms were
  782. named prematurely, before their truer nature was found.  In Lisp,
  783. certain kinds of atom, such as an array, can be separated into parts;
  784. but the mechanism for doing this is different from the mechanism for
  785. splitting a list.  As far as list operations are concerned, the atoms
  786. of a list are unsplittable.
  787.  
  788.    As in English, the meanings of the component letters of a Lisp atom
  789. are different from the meaning the letters make as a word.  For
  790. example, the word for the South American sloth, the `ai', is completely
  791. different from the two words, `a', and `i'.
  792.  
  793.    There are many kinds of atom in nature but only a few in Lisp: for
  794. example, "numbers", such as 37, 511, or 1729, and "symbols", such as
  795. `+', `foo', or `forward-line'.  The words we have listed in the
  796. examples above are all symbols.  In everyday Lisp conversation, the
  797. word "atom" is not often used, because programmers usually try to be
  798. more specific about what kind of atom they are dealing with.  Lisp
  799. programming is mostly about symbols (and sometimes numbers) within
  800. lists.  (Incidentally, the preceding three word parenthetical remark is
  801. a proper list in Lisp, since it consists of atoms, which in this case
  802. are symbols, separated by whitespace and enclosed by parentheses,
  803. without any non-Lisp punctuation.)
  804.  
  805.    In addition, text between double quotation marks--even sentences or
  806. paragraphs--is an atom.  Here is an example:
  807.  
  808.      '(this list includes "text between quotation marks.")
  809.  
  810. In Lisp, all of the quoted text including the punctuation mark and the
  811. blank spaces is a single atom.  This kind of atom is called a "string"
  812. (for `string of characters') and is the sort of thing that is used for
  813. messages that a computer can print for a human to read.  Strings are a
  814. different kind of atom than numbers or symbols and are used differently.
  815.  
  816. 
  817. File: emacs-lisp-intro.info,  Node: Whitespace in Lists,  Next: Typing Lists,  Prev: Lisp Atoms,  Up: Lisp Lists
  818.  
  819. Whitespace in Lists
  820. -------------------
  821.  
  822.    The amount of whitespace in a list does not matter.  From the point
  823. of view of the Lisp language,
  824.  
  825.      '(this list
  826.         looks like this)
  827.  
  828. is exactly the same as this:
  829.  
  830.      '(this list looks like this)
  831.  
  832.    Both examples show what to Lisp is the same list, the list made up of
  833. the symbols `this', `list', `looks', `like', and `this' in that order.
  834.  
  835.    Extra whitespace and newlines are designed to make a list more
  836. readable by humans.  When Lisp reads the expression, it gets rid of all
  837. the extra whitespace (but it needs to have at least one space between
  838. atoms in order to tell them apart.)
  839.  
  840.    Odd as it seems, the examples we have seen cover almost all of what
  841. Lisp lists look like!  Every other list in Lisp looks more or less like
  842. one of these examples, except that the list may be longer and more
  843. complex.  In brief, a list is between parentheses, a string is between
  844. quotation marks, a symbol looks like a word, and a number looks like a
  845. number.  (For certain situations, square brackets, dots and a few other
  846. special characters may be used; however, we will go quite far without
  847. them.)
  848.  
  849. 
  850. File: emacs-lisp-intro.info,  Node: Typing Lists,  Prev: Whitespace in Lists,  Up: Lisp Lists
  851.  
  852. GNU Emacs Helps You Type Lists
  853. ------------------------------
  854.  
  855.    If you type a Lisp expression in GNU Emacs using either Lisp
  856. Interaction mode or Emacs Lisp mode, you will have available to you
  857. several commands to format the Lisp expression so it is easy to read.
  858. For example, pressing the <TAB> key automatically indents the line the
  859. cursor is on by the right amount.  A command to properly indent the
  860. code in a region is customarily bound to `M-C-\'.  Indentation is
  861. designed so that you can see which elements of a list belongs to which
  862. list--elements of a sub-list are indented more than the elements of the
  863. enclosing list.
  864.  
  865.    In addition, when you type a closing parenthesis, Emacs momentarily
  866. jumps the cursor back to the matching opening parenthesis, so you can
  867. see which one it is.  This is very useful, since every list you type in
  868. Lisp must have its closing parenthesis match its opening parenthesis.
  869. (*Note Major Modes: (emacs)Major Modes, for more information about
  870. Emacs' modes.)
  871.  
  872. 
  873. File: emacs-lisp-intro.info,  Node: Run a Program,  Next: Making Errors,  Prev: Lisp Lists,  Up: List Processing
  874.  
  875. Run a Program
  876. =============
  877.  
  878.    A list in Lisp--any list--is a program ready to run.  If you run it
  879. (for which the Lisp jargon is "evaluate"), the computer will do one of
  880. three things: do nothing except return to you the list itself; send you
  881. an error message; or, treat the first symbol in the list as a command
  882. to do something.  (Usually, of course, it is the last of these three
  883. things that you really want!)
  884.  
  885.    The single apostrophe, `'', that I put in front of some of the
  886. example lists in preceding sections is called a "quote"; when it
  887. precedes a list, it tells Lisp to do nothing with the list, other than
  888. take it as it is written.  But if there is no quote preceding a list,
  889. the first item of the list is special: it is a command for the computer
  890. to obey.  (In Lisp, these commands are called *functions*.)  The list
  891. `(+ 2 2)' shown above did not have a quote in front of it, so Lisp
  892. understands that the `+' is an instruction to do something with the
  893. rest of the list; in this case, to add the numbers that follow.
  894.  
  895.    If you are reading this inside of GNU Emacs in Info, here is how you
  896. can evaluate such a list:  place your cursor immediately after the right
  897. hand parenthesis of the following list and then type `C-x C-e':
  898.  
  899.      (+ 2 2)
  900.  
  901. You will see the number `4' appear in the echo area.  (In the jargon,
  902. what you have just done is "evaluate the list."  The echo area is the
  903. line at the bottom of the screen that displays or "echoes" text.)  Now
  904. try the same thing with a quoted list:  place the cursor right after
  905. the following list and type `C-x C-e':
  906.  
  907.      '(this is a quoted list)
  908.  
  909. In this case, you will see `(this is a quoted list)' appear in the echo
  910. area.
  911.  
  912.    In both cases, what you are doing is giving a command to the program
  913. inside of GNU Emacs called the "Lisp interpreter"--giving the
  914. interpreter a command to evaluate the expression.  The name of the Lisp
  915. interpreter comes from the word for the task done by a human who comes
  916. up with the meaning of an expression--who "interprets" it.
  917.  
  918.    You can also evaluate an atom that is not part of a list--one that is
  919. not surrounded by parentheses; again, the Lisp interpreter translates
  920. from the humanly readable expression to the language of the computer.
  921. But before discussing this (*note Variables::.), we will discuss what
  922. the Lisp interpreter does when you make an error.
  923.  
  924. 
  925. File: emacs-lisp-intro.info,  Node: Making Errors,  Next: Names & Definitions,  Prev: Run a Program,  Up: List Processing
  926.  
  927. Generate an Error Message
  928. =========================
  929.  
  930.    Partly so you won't worry if you do it accidentally, we will now give
  931. a command to the Lisp interpreter that generates an error message.
  932. This is a harmless activity; and indeed, we will often try to generate
  933. error messages intentionally.  Once you understand the jargon, error
  934. messages can be informative.  Instead of being called "error" messages,
  935. they should be called "help" messages.  They are like signposts to a
  936. traveller in a strange country; decyphering them can be hard, but once
  937. understood, they can point the way.
  938.  
  939.    What we will do is evaluate a list that is not quoted and does not
  940. have a meaningful command as its first element.  Here is a list almost
  941. exactly the same as the one we just used, but without the single-quote
  942. in front of it.  Position the cursor right after it and type `C-x C-e':
  943.  
  944.      (this is an unquoted list)
  945.  
  946. This time, you will see the following appear in the echo area:
  947.  
  948.      Symbol's function definition is void: this
  949.  
  950. (Also, your terminal may beep at you--some do, some don't; and others
  951. blink.  This is just a device to get your attention.)  The message goes
  952. away as soon as you type another key, even just to move the cursor.
  953.  
  954.    Based on what we already know, we can almost read this error message.
  955. We know the meaning of the word `Symbol'.  In this case, it refers to
  956. the first atom of the list, the word `this'.  The word `function' was
  957. mentioned once before.  It is a very important word.  For our purposes,
  958. we can define it by saying that a "function" is a set of instructions
  959. to the computer that tell the computer to do something.  (Technically,
  960. the symbol tells the computer where to find the instructions, but this
  961. is a complication we can ignore for the moment.)
  962.  
  963.    Now we can begin to understand the error message: `Symbol's function
  964. definition is void: this'.  The symbol (that is, the word `this') does
  965. not have a definition of any set of instructions for the computer to
  966. carry out.
  967.  
  968.    The slightly odd wording of the message, `function definition is
  969. void', is designed to cover the way Emacs Lisp is implemented, which is
  970. that when the symbol does not have a function definition attached to it,
  971. the place that should contain the instructions is `void'.
  972.  
  973.    On the other hand, since we were able to add 2 plus 2 successfully,
  974. by evaluating `(+ 2 2)', we can infer that the symbol `+' must have a
  975. set of instructions for the computer to obey and those instructions
  976. must be to add the numbers that follow the `+'.
  977.  
  978. 
  979. File: emacs-lisp-intro.info,  Node: Names & Definitions,  Next: Lisp Interpreter,  Prev: Making Errors,  Up: List Processing
  980.  
  981. Symbol Names and Function Definitions
  982. =====================================
  983.  
  984.    We can articulate another characteristic of Lisp based on what we
  985. have discussed so far--an important characteristic: a symbol, like `+',
  986. is not itself the set of instructions for the computer to carry out.
  987. Instead, the symbol is used, perhaps temporarily, as a way of locating
  988. the definition or set of instructions.  What we see is the name through
  989. which the instructions can be found.  Names of people work the same
  990. way.  I can be referred to as `Bob'; however, I am not the letters `B',
  991. `o', `b' but am the consciousness consistently associated with a
  992. particular life-form.  The name is not me, but it can be used to refer
  993. to me.
  994.  
  995.    In Lisp, one set of instructions can be attached to several names.
  996. For example, the computer instructions for adding numbers can be linked
  997. to the symbol `plus' as well as to the symbol `+' (and are in some
  998. dialects of Lisp).  Among humans, I can be referred to as `Robert' as
  999. well as `Bob' and by other words as well.
  1000.  
  1001.    On the other hand, a symbol can have only one function definition
  1002. attached to it at a time.  Otherwise, the computer would be confused as
  1003. to which definition to use.  If this were the case among people, only
  1004. one person in the world could be named `Bob'.  However, the function
  1005. definition to which the name refers can be changed readily.  (*Note
  1006. Install a Function Definition: Install.)
  1007.  
  1008.    Since Emacs Lisp is large, it is customary to name symbols in a way
  1009. that identifies the part of Emacs to which the function belongs.  Thus,
  1010. all the names for functions that deal with Texinfo start with
  1011. `texinfo-' and those for functions that deal with reading mail start
  1012. with `rmail-'.
  1013.  
  1014. 
  1015. File: emacs-lisp-intro.info,  Node: Lisp Interpreter,  Next: Evaluation,  Prev: Names & Definitions,  Up: List Processing
  1016.  
  1017. The Lisp Interpreter
  1018. ====================
  1019.  
  1020.    Based on what we have seen, we can now start to figure out what the
  1021. Lisp interpreter does when we command it to evaluate a list.  First, it
  1022. looks to see whether there is a quote before the list; if there is, the
  1023. interpreter just gives us the list.  On the other hand, if there is no
  1024. quote, the interpreter looks at the first element in the list and sees
  1025. whether it has a function definition.  If it does, the interpreter
  1026. carries out the instructions in the function definition.  Otherwise,
  1027. the interpreter prints an error message.
  1028.  
  1029.    This is how Lisp works.  Simple.  There are added complications
  1030. which we will get to in a minute, but these are the fundamentals.  Of
  1031. course, to write Lisp programs, you need to know how to write function
  1032. definitions and attach them to names, and how to do this without
  1033. confusing either yourself or the computer.
  1034.  
  1035.    Now, for the first complication.  In addition to lists, the Lisp
  1036. interpreter can evaluate a symbol that is not quoted and does not have
  1037. parentheses around it.  In this case, the Lisp interpreter will attempt
  1038. to determine the symbol's value as a "variable".  This situation is
  1039. described in the section on variables.  (*Note Variables::.)
  1040.  
  1041.    The second complication occurs because some functions are unusual
  1042. and do not work in the usual manner.  Those that don't are called
  1043. "special forms".  They are used for special jobs, like defining a
  1044. function, and there are not many of them.  In the next few chapters,
  1045. you will be introduced to several of the more important special forms.
  1046.  
  1047.    The third and final complication is this: if the function that the
  1048. Lisp interpreter is looking at is not a special form, and if it is part
  1049. of a list, the Lisp interpreter looks to see whether the list has a list
  1050. inside of it.  If there is an inner list, the Lisp interpreter first
  1051. figures out what it should do with the inside list, and then it works on
  1052. the outside list.  If there is yet another list embedded inside the
  1053. inner list, it works on that one first, and so on.  It always works on
  1054. the innermost list first.  The interpreter works on the innermost list
  1055. first in order to find out the result of doing that.  The result may be
  1056. used by the enclosing expression.
  1057.  
  1058.    Otherwise, the interpreter works left to right, from one expression
  1059. to the next.
  1060.  
  1061. * Menu:
  1062.  
  1063. * Byte Compiling::              Specially processing code for speed.
  1064.  
  1065. 
  1066. File: emacs-lisp-intro.info,  Node: Byte Compiling,  Prev: Lisp Interpreter,  Up: Lisp Interpreter
  1067.  
  1068. Byte Compiling
  1069. --------------
  1070.  
  1071.    One other aspect of interpreting: the Lisp interpreter is able to
  1072. interpret two kinds of entity: humanly readable code, on which we will
  1073. focus exclusively, and specially processed code, called "byte compiled"
  1074. code, which is not humanly readable.  Byte compiled code runs faster
  1075. than humanly readable code.
  1076.  
  1077.    You can transform humanly readable code into byte compiled code by
  1078. running one of the compile commands such as `byte-compile-file'.  Byte
  1079. compiled code is usually stored in a file that ends with a `.elc'
  1080. extension rather than a `.el' extension.  You will see both kinds of
  1081. file in the `emacs/lisp' directory; the files to read are those with
  1082. `.el' extensions.
  1083.  
  1084.    As a practical matter, for most things you might do to customize or
  1085. extend Emacs, you do not need to byte compile; and I will not discuss
  1086. the topic here.  *Note Byte Compilation: (elisp)Byte Compilation, for a
  1087. full description of byte compilation.
  1088.  
  1089. 
  1090. File: emacs-lisp-intro.info,  Node: Evaluation,  Next: Variables,  Prev: Lisp Interpreter,  Up: List Processing
  1091.  
  1092. Evaluation
  1093. ==========
  1094.  
  1095.    When the Lisp interpreter works on an expression, the term for the
  1096. activity is called "evaluation".  We say that the interpreter
  1097. `evaluates the expression'.  I've used this term several times before.
  1098. The word comes from its use in everyday language, `to ascertain the
  1099. value or amount of; to appraise', according to `Webster's New
  1100. Collegiate Dictionary'.
  1101.  
  1102.    After evaluating an expression, the Lisp interpreter will most likely
  1103. "return" the value that the computer produces by carrying out the
  1104. instructions it found in the function definition, or perhaps it will
  1105. give up on that function and produce an error message.  (The interpreter
  1106. may also find itself tossed, so to speak, to a different function or it
  1107. may attempt to repeat continually what it is doing for ever and ever in
  1108. what is called an `infinite loop'.  These actions are less common; and
  1109. we can ignore them.)  Most frequently, the interpreter returns a value.
  1110.  
  1111.    At the same time the interpreter returns a value, it may do something
  1112. else as well, such as move a cursor or copy a file; this other kind of
  1113. action is called a "side effect".  Actions that we humans think are
  1114. important, such as printing results, are often "side effects" to the
  1115. Lisp interpreter.  The jargon can sound peculiar, but it turns out that
  1116. it is fairly easy to learn to use side effects.
  1117.  
  1118.    In summary, evaluating a symbolic expression most commonly causes the
  1119. Lisp interpreter to return a value and perhaps carry out a side effect;
  1120. or else produce an error.
  1121.  
  1122. * Menu:
  1123.  
  1124. * Evaluating Inner Lists::      Lists within lists...
  1125.  
  1126.