Mercurial > emacs
comparison lispref/intro.texi @ 21682:90da2489c498
*** empty log message ***
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 20 Apr 1998 17:43:57 +0000 |
parents | 66d807bdc5b4 |
children | d4ac295a98b3 |
comparison
equal
deleted
inserted
replaced
21681:11eafe90b842 | 21682:90da2489c498 |
---|---|
502 @cindex Common Lisp | 502 @cindex Common Lisp |
503 Dozens of Lisp implementations have been built over the years, each | 503 Dozens of Lisp implementations have been built over the years, each |
504 with its own idiosyncrasies. Many of them were inspired by Maclisp, | 504 with its own idiosyncrasies. Many of them were inspired by Maclisp, |
505 which was written in the 1960's at MIT's Project MAC. Eventually the | 505 which was written in the 1960's at MIT's Project MAC. Eventually the |
506 implementors of the descendants of Maclisp came together and developed a | 506 implementors of the descendants of Maclisp came together and developed a |
507 standard for Lisp systems, called Common Lisp. | 507 standard for Lisp systems, called Common Lisp. In the mean time, Gerry |
508 Sussman and Guy Steele at MIT developed a simplified but very powerful | |
509 dialect of Lisp, called Scheme. | |
508 | 510 |
509 GNU Emacs Lisp is largely inspired by Maclisp, and a little by Common | 511 GNU Emacs Lisp is largely inspired by Maclisp, and a little by Common |
510 Lisp. If you know Common Lisp, you will notice many similarities. | 512 Lisp. If you know Common Lisp, you will notice many similarities. |
511 However, many of the features of Common Lisp have been omitted or | 513 However, many of the features of Common Lisp have been omitted or |
512 simplified in order to reduce the memory requirements of GNU Emacs. | 514 simplified in order to reduce the memory requirements of GNU Emacs. |
513 Sometimes the simplifications are so drastic that a Common Lisp user | 515 Sometimes the simplifications are so drastic that a Common Lisp user |
514 might be very confused. We will occasionally point out how GNU Emacs | 516 might be very confused. We will occasionally point out how GNU Emacs |
515 Lisp differs from Common Lisp. If you don't know Common Lisp, don't | 517 Lisp differs from Common Lisp. If you don't know Common Lisp, don't |
516 worry about it; this manual is self-contained. | 518 worry about it; this manual is self-contained. |
517 | 519 |
520 Emacs Lisp is not at all influenced by Scheme; but the GNU project has | |
521 an implementation of Scheme, called Guile. We use Guile for | |
522 extensibility in all new GNU software that calls for extensibility. | |
523 | |
518 @node Conventions | 524 @node Conventions |
519 @section Conventions | 525 @section Conventions |
520 | 526 |
521 This section explains the notational conventions that are used in this | 527 This section explains the notational conventions that are used in this |
522 manual. You may want to skip this section and refer back to it later. | 528 manual. You may want to skip this section and refer back to it later. |
527 * Evaluation Notation:: The format we use for examples of evaluation. | 533 * Evaluation Notation:: The format we use for examples of evaluation. |
528 * Printing Notation:: The format we use for examples that print output. | 534 * Printing Notation:: The format we use for examples that print output. |
529 * Error Messages:: The format we use for examples of errors. | 535 * Error Messages:: The format we use for examples of errors. |
530 * Buffer Text Notation:: The format we use for buffer contents in examples. | 536 * Buffer Text Notation:: The format we use for buffer contents in examples. |
531 * Format of Descriptions:: Notation for describing functions, variables, etc. | 537 * Format of Descriptions:: Notation for describing functions, variables, etc. |
538 * Version Info:: Which Emacs version is running? | |
532 @end menu | 539 @end menu |
533 | 540 |
534 @node Some Terms | 541 @node Some Terms |
535 @subsection Some Terms | 542 @subsection Some Terms |
536 | 543 |
542 addressed as ``you''. ``The user'' is the person who uses Lisp programs, | 549 addressed as ``you''. ``The user'' is the person who uses Lisp programs, |
543 including those you write. | 550 including those you write. |
544 | 551 |
545 @cindex fonts | 552 @cindex fonts |
546 Examples of Lisp code appear in this font or form: @code{(list 1 2 | 553 Examples of Lisp code appear in this font or form: @code{(list 1 2 |
547 3)}. Names that represent arguments or metasyntactic variables appear | 554 3)}. Names that represent metasyntactic variables, or arguments to a |
548 in this font or form: @var{first-number}. | 555 function being described, appear in this font or form: |
556 @var{first-number}. | |
549 | 557 |
550 @node nil and t | 558 @node nil and t |
551 @subsection @code{nil} and @code{t} | 559 @subsection @code{nil} and @code{t} |
552 @cindex @code{nil}, uses of | 560 @cindex @code{nil}, uses of |
553 @cindex truth value | 561 @cindex truth value |
585 choosing, use @code{t}. The symbol @code{t} always has value @code{t}. | 593 choosing, use @code{t}. The symbol @code{t} always has value @code{t}. |
586 | 594 |
587 In Emacs Lisp, @code{nil} and @code{t} are special symbols that always | 595 In Emacs Lisp, @code{nil} and @code{t} are special symbols that always |
588 evaluate to themselves. This is so that you do not need to quote them | 596 evaluate to themselves. This is so that you do not need to quote them |
589 to use them as constants in a program. An attempt to change their | 597 to use them as constants in a program. An attempt to change their |
590 values results in a @code{setting-constant} error. @xref{Accessing | 598 values results in a @code{setting-constant} error. The same is true of |
599 any symbol whose name starts with a colon (@samp{:}). @xref{Constant | |
591 Variables}. | 600 Variables}. |
592 | 601 |
593 @node Evaluation Notation | 602 @node Evaluation Notation |
594 @subsection Evaluation Notation | 603 @subsection Evaluation Notation |
595 @cindex evaluation notation | 604 @cindex evaluation notation |
673 and ``after'' versions of the text. These examples show the contents of | 682 and ``after'' versions of the text. These examples show the contents of |
674 the buffer in question between two lines of dashes containing the buffer | 683 the buffer in question between two lines of dashes containing the buffer |
675 name. In addition, @samp{@point{}} indicates the location of point. | 684 name. In addition, @samp{@point{}} indicates the location of point. |
676 (The symbol for point, of course, is not part of the text in the buffer; | 685 (The symbol for point, of course, is not part of the text in the buffer; |
677 it indicates the place @emph{between} two characters where point is | 686 it indicates the place @emph{between} two characters where point is |
678 located.) | 687 currently located.) |
679 | 688 |
680 @example | 689 @example |
681 ---------- Buffer: foo ---------- | 690 ---------- Buffer: foo ---------- |
682 This is the @point{}contents of foo. | 691 This is the @point{}contents of foo. |
683 ---------- Buffer: foo ---------- | 692 ---------- Buffer: foo ---------- |
721 @cindex command descriptions | 730 @cindex command descriptions |
722 @cindex macro descriptions | 731 @cindex macro descriptions |
723 @cindex special form descriptions | 732 @cindex special form descriptions |
724 | 733 |
725 In a function description, the name of the function being described | 734 In a function description, the name of the function being described |
726 appears first. It is followed on the same line by a list of parameters. | 735 appears first. It is followed on the same line by a list of argument |
727 The names used for the parameters are also used in the body of the | 736 names. These names are also used in the body of the description, to |
728 description. | 737 stand for the values of the arguments. |
729 | 738 |
730 The appearance of the keyword @code{&optional} in the parameter list | 739 The appearance of the keyword @code{&optional} in the argument list |
731 indicates that the arguments for subsequent parameters may be omitted | 740 indicates that the subsequent arguments may be omitted (omitted |
732 (omitted parameters default to @code{nil}). Do not write | 741 arguments default to @code{nil}). Do not write @code{&optional} when |
733 @code{&optional} when you call the function. | 742 you call the function. |
734 | 743 |
735 The keyword @code{&rest} (which will always be followed by a single | 744 The keyword @code{&rest} (which will always be followed by a single |
736 parameter) indicates that any number of arguments can follow. The value | 745 argument name) indicates that any number of arguments can follow. The value |
737 of the single following parameter will be a list of all these arguments. | 746 of the single following arguments name will be a list of all these arguments. |
738 Do not write @code{&rest} when you call the function. | 747 Do not write @code{&rest} when you call the function. |
739 | 748 |
740 Here is a description of an imaginary function @code{foo}: | 749 Here is a description of an imaginary function @code{foo}: |
741 | 750 |
742 @defun foo integer1 &optional integer2 &rest integers | 751 @defun foo integer1 &optional integer2 &rest integers |
758 @equiv{} | 767 @equiv{} |
759 (+ (- @var{x} @var{w}) @var{y}@dots{}) | 768 (+ (- @var{x} @var{w}) @var{y}@dots{}) |
760 @end example | 769 @end example |
761 @end defun | 770 @end defun |
762 | 771 |
763 Any parameter whose name contains the name of a type (e.g., | 772 Any argument whose name contains the name of a type (e.g., |
764 @var{integer}, @var{integer1} or @var{buffer}) is expected to be of that | 773 @var{integer}, @var{integer1} or @var{buffer}) is expected to be of that |
765 type. A plural of a type (such as @var{buffers}) often means a list of | 774 type. A plural of a type (such as @var{buffers}) often means a list of |
766 objects of that type. Parameters named @var{object} may be of any type. | 775 objects of that type. Arguments named @var{object} may be of any type. |
767 (@xref{Lisp Data Types}, for a list of Emacs object types.) | 776 (@xref{Lisp Data Types}, for a list of Emacs object types.) Arguments |
768 Parameters with other sorts of names (e.g., @var{new-file}) are | 777 with other sorts of names (e.g., @var{new-file}) are discussed |
769 discussed specifically in the description of the function. In some | 778 specifically in the description of the function. In some sections, |
770 sections, features common to parameters of several functions are | 779 features common to the arguments of several functions are described at |
771 described at the beginning. | 780 the beginning. |
772 | 781 |
773 @xref{Lambda Expressions}, for a more complete description of optional | 782 @xref{Lambda Expressions}, for a more complete description of optional |
774 and rest arguments. | 783 and rest arguments. |
775 | 784 |
776 Command, macro, and special form descriptions have the same format, | 785 Command, macro, and special form descriptions have the same format, |
778 Form', respectively. Commands are simply functions that may be called | 787 Form', respectively. Commands are simply functions that may be called |
779 interactively; macros process their arguments differently from functions | 788 interactively; macros process their arguments differently from functions |
780 (the arguments are not evaluated), but are presented the same way. | 789 (the arguments are not evaluated), but are presented the same way. |
781 | 790 |
782 Special form descriptions use a more complex notation to specify | 791 Special form descriptions use a more complex notation to specify |
783 optional and repeated parameters because they can break the argument | 792 optional and repeated arguments because they can break the argument |
784 list down into separate arguments in more complicated ways. | 793 list down into separate arguments in more complicated ways. |
785 @samp{@code{@r{[}@var{optional-arg}@r{]}}} means that @var{optional-arg} is | 794 @samp{@code{@r{[}@var{optional-arg}@r{]}}} means that @var{optional-arg} is |
786 optional and @samp{@var{repeated-args}@dots{}} stands for zero or more | 795 optional and @samp{@var{repeated-args}@dots{}} stands for zero or more |
787 arguments. Parentheses are used when several arguments are grouped into | 796 arguments. Parentheses are used when several arguments are grouped into |
788 additional levels of list structure. Here is an example: | 797 additional levels of list structure. Here is an example: |
796 if @var{var} equals @var{to}. Here is an example: | 805 if @var{var} equals @var{to}. Here is an example: |
797 | 806 |
798 @example | 807 @example |
799 (count-loop (i 0 10) | 808 (count-loop (i 0 10) |
800 (prin1 i) (princ " ") | 809 (prin1 i) (princ " ") |
801 (prin1 (aref vector i)) (terpri)) | 810 (prin1 (aref vector i)) |
811 (terpri)) | |
802 @end example | 812 @end example |
803 | 813 |
804 If @var{from} and @var{to} are omitted, then @var{var} is bound to | 814 If @var{from} and @var{to} are omitted, then @var{var} is bound to |
805 @code{nil} before the loop begins, and the loop exits if @var{var} is | 815 @code{nil} before the loop begins, and the loop exits if @var{var} is |
806 non-@code{nil} at the beginning of an iteration. Here is an example: | 816 non-@code{nil} at the beginning of an iteration. Here is an example: |
839 have not yet thought about executing. | 849 have not yet thought about executing. |
840 @end defvar | 850 @end defvar |
841 | 851 |
842 User option descriptions have the same format, but `Variable' is | 852 User option descriptions have the same format, but `Variable' is |
843 replaced by `User Option'. | 853 replaced by `User Option'. |
854 | |
855 @node Version Info | |
856 @section Version Information | |
857 | |
858 These functions and variables provide information about which | |
859 version of Emacs is in use. | |
860 | |
861 @deffn Command emacs-version | |
862 This function returns a string describing the version of Emacs that is | |
863 running. It is useful to include this string in bug reports. | |
864 | |
865 @example | |
866 @group | |
867 (emacs-version) | |
868 @result{} "GNU Emacs 20.3.5 (i486-pc-linux-gnulibc1, X toolkit) | |
869 of Sat Feb 14 1998 on psilocin.gnu.org" | |
870 @end group | |
871 @end example | |
872 | |
873 Called interactively, the function prints the same information in the | |
874 echo area. | |
875 @end deffn | |
876 | |
877 @defvar emacs-build-time | |
878 The value of this variable is the time at which Emacs was built at the | |
879 local site. | |
880 | |
881 @example | |
882 @group | |
883 emacs-build-time | |
884 @result{} "Tue Jun 6 14:55:57 1995" | |
885 @end group | |
886 @end example | |
887 @end defvar | |
888 | |
889 @defvar emacs-version | |
890 The value of this variable is the version of Emacs being run. It is a | |
891 string such as @code{"20.3.1"}. The last number in this string is not | |
892 really part of the Emacs release version number; it is incremented each | |
893 time you build Emacs in any given directory. | |
894 @end defvar | |
895 | |
896 The following two variables have existed since Emacs version 19.23, | |
897 | |
898 @defvar emacs-major-version | |
899 The major version number of Emacs, as an integer. For Emacs version | |
900 20.3, the value is 20. | |
901 @end defvar | |
902 | |
903 @defvar emacs-minor-version | |
904 The minor version number of Emacs, as an integer. For Emacs version | |
905 20.3, the value is 3. | |
906 @end defvar | |
844 | 907 |
845 @node Acknowledgements | 908 @node Acknowledgements |
846 @section Acknowledgements | 909 @section Acknowledgements |
847 | 910 |
848 This manual was written by Robert Krawitz, Bil Lewis, Dan LaLiberte, | 911 This manual was written by Robert Krawitz, Bil Lewis, Dan LaLiberte, |