1 |
@c \input texinfo @c -*-texinfo-*- |
\input texinfo @c -*-texinfo-*- |
2 |
@comment %**start of header |
@comment %**start of header |
3 |
@setfilename ../info/eintr |
@setfilename ../info/eintr |
4 |
|
@c setfilename emacs-lisp-intro.info |
5 |
@c sethtmlfilename emacs-lisp-intro.html |
@c sethtmlfilename emacs-lisp-intro.html |
6 |
@settitle Programming in Emacs Lisp |
@settitle Programming in Emacs Lisp |
7 |
@syncodeindex vr cp |
@syncodeindex vr cp |
22 |
|
|
23 |
@comment %**end of header |
@comment %**end of header |
24 |
|
|
25 |
@set edition-number 2.12 |
@set edition-number 2.14 |
26 |
@set update-date 2003 Nov 19 |
@set update-date 2004 Oct 12 |
27 |
|
|
28 |
@ignore |
@ignore |
29 |
## Summary of shell commands to create various output formats: |
## Summary of shell commands to create various output formats: |
62 |
## View Info output with standalone reader |
## View Info output with standalone reader |
63 |
info emacs-lisp-intro.info |
info emacs-lisp-intro.info |
64 |
|
|
65 |
|
## popd |
66 |
|
|
67 |
@end ignore |
@end ignore |
68 |
|
|
69 |
@c ================ Included Figures ================ |
@c ================ Included Figures ================ |
183 |
Edition @value{edition-number}, @value{update-date} |
Edition @value{edition-number}, @value{update-date} |
184 |
@sp 1 |
@sp 1 |
185 |
Copyright @copyright{} 1990, 1991, 1992, 1993, 1994, 1995, 1997, 2001, |
Copyright @copyright{} 1990, 1991, 1992, 1993, 1994, 1995, 1997, 2001, |
186 |
2002, 2003 Free Software Foundation, Inc. |
2002, 2003, 2004 Free Software Foundation, Inc. |
187 |
@sp 1 |
@sp 1 |
188 |
|
|
189 |
@iftex |
@iftex |
1053 |
@chapter List Processing |
@chapter List Processing |
1054 |
|
|
1055 |
To the untutored eye, Lisp is a strange programming language. In Lisp |
To the untutored eye, Lisp is a strange programming language. In Lisp |
1056 |
code there are parentheses everywhere. Some people even claim that the |
code there are parentheses everywhere. Some people even claim that |
1057 |
name stands for `Lots of Isolated Silly Parentheses'. But the claim is |
the name stands for `Lots of Isolated Silly Parentheses'. But the |
1058 |
unwarranted. Lisp stands for LISt Processing, and the programming |
claim is unwarranted. Lisp stands for LISt Processing, and the |
1059 |
language handles @emph{lists} (and lists of lists) by putting them |
programming language handles @emph{lists} (and lists of lists) by |
1060 |
between parentheses. The parentheses mark the boundaries of the list. |
putting them between parentheses. The parentheses mark the boundaries |
1061 |
Sometimes a list is preceded by a single apostrophe or quotation mark, |
of the list. Sometimes a list is preceded by a single apostrophe or |
1062 |
@samp{'}. Lists are the basis of Lisp. |
quotation mark, @samp{'}@footnote{The single apostrophe or quotation |
1063 |
|
mark is an abbreviation for the function @code{quote}; you need not |
1064 |
|
think about functions now; functions are defined in @ref{Making |
1065 |
|
Errors, , Generate an Error Message}.} Lists are the basis of Lisp. |
1066 |
|
|
1067 |
@menu |
@menu |
1068 |
* Lisp Lists:: What are lists? |
* Lisp Lists:: What are lists? |
2141 |
|
|
2142 |
@need 1250 |
@need 1250 |
2143 |
As usual, the error message tries to be helpful and makes sense after you |
As usual, the error message tries to be helpful and makes sense after you |
2144 |
learn how to read it. |
learn how to read it.@footnote{@code{(quote hello)} is an expansion of |
2145 |
|
the abbreviation @code{'hello}.} |
2146 |
|
|
2147 |
The first part of the error message is straightforward; it says |
The first part of the error message is straightforward; it says |
2148 |
@samp{wrong type argument}. Next comes the mysterious jargon word |
@samp{wrong type argument}. Next comes the mysterious jargon word |
4009 |
false. When this happens, the second argument or then-part of the |
false. When this happens, the second argument or then-part of the |
4010 |
overall @code{if} expression is @emph{not} evaluated, but the third or |
overall @code{if} expression is @emph{not} evaluated, but the third or |
4011 |
else-part @emph{is} evaluated. You might think of this as the cloudy |
else-part @emph{is} evaluated. You might think of this as the cloudy |
4012 |
day alternative for the decision `if it is warm and sunny, then go to |
day alternative for the decision ``if it is warm and sunny, then go to |
4013 |
the beach, else read a book!''. |
the beach, else read a book!''. |
4014 |
|
|
4015 |
The word ``else'' is not written in the Lisp code; the else-part of an |
The word ``else'' is not written in the Lisp code; the else-part of an |
14931 |
((eq t (car (cdr (car current-directory-list)))) |
((eq t (car (cdr (car current-directory-list)))) |
14932 |
;; decide whether to skip or recurse |
;; decide whether to skip or recurse |
14933 |
(if |
(if |
14934 |
(equal (or "." "..") |
(equal "." |
14935 |
(substring (car (car current-directory-list)) -1)) |
(substring (car (car current-directory-list)) -1)) |
14936 |
;; then do nothing if filename is that of |
;; then do nothing since filename is that of |
14937 |
;; current directory or parent |
;; current directory or parent, "." or ".." |
14938 |
() |
() |
14939 |
@end group |
@end group |
14940 |
@group |
@group |
17125 |
@item Ignore case when using `grep'@* |
@item Ignore case when using `grep'@* |
17126 |
@samp{-n}@w{ } Prefix each line of output with line number@* |
@samp{-n}@w{ } Prefix each line of output with line number@* |
17127 |
@samp{-i}@w{ } Ignore case distinctions@* |
@samp{-i}@w{ } Ignore case distinctions@* |
17128 |
@samp{-e}@w{ } Protect patterns beginning with a hyphen character, @samp{-} |
@samp{-e}@w{ } Protect patterns beginning with a hyphen character, @samp{-} |
17129 |
|
|
17130 |
@smallexample |
@smallexample |
17131 |
(setq grep-command "grep -n -i -e ") |
(setq grep-command "grep -n -i -e ") |
17166 |
@end itemize |
@end itemize |
17167 |
|
|
17168 |
@subsubheading Fixing Unpleasant Key Bindings |
@subsubheading Fixing Unpleasant Key Bindings |
17169 |
@cindex Key bindings, fixing |
@cindex Key bindings, fixing |
17170 |
@cindex Bindings, key, fixing unpleasant |
@cindex Bindings, key, fixing unpleasant |
17171 |
|
|
17172 |
Some systems bind keys unpleasantly. Sometimes, for example, the |
Some systems bind keys unpleasantly. Sometimes, for example, the |
18025 |
|
|
18026 |
Sometimes when you you write text, you duplicate words---as with ``you |
Sometimes when you you write text, you duplicate words---as with ``you |
18027 |
you'' near the beginning of this sentence. I find that most |
you'' near the beginning of this sentence. I find that most |
18028 |
frequently, I duplicate ``the'; hence, I call the function for |
frequently, I duplicate ``the''; hence, I call the function for |
18029 |
detecting duplicated words, @code{the-the}. |
detecting duplicated words, @code{the-the}. |
18030 |
|
|
18031 |
@need 1250 |
@need 1250 |
20645 |
@end smallexample |
@end smallexample |
20646 |
@end ifnottex |
@end ifnottex |
20647 |
|
|
20648 |
|
@c qqq |
20649 |
@ignore |
@ignore |
20650 |
Graphing Definitions Re-listed |
Graphing Definitions Re-listed |
20651 |
|
|
21145 |
(print-X-axis numbers-list horizontal-step))) |
(print-X-axis numbers-list horizontal-step))) |
21146 |
@end group |
@end group |
21147 |
@end smallexample |
@end smallexample |
21148 |
|
@c qqq |
21149 |
@end ignore |
@end ignore |
21150 |
|
|
21151 |
@page |
@page |