\input texinfo @c -*-texinfo-*-
@comment %**start of header
-@setfilename ../../info/eintr
+@setfilename ../../info/eintr.info
@c setfilename emacs-lisp-intro.info
@c sethtmlfilename emacs-lisp-intro.html
@settitle Programming in Emacs Lisp
+@documentencoding UTF-8
@syncodeindex vr cp
@syncodeindex fn cp
@finalout
@c ----------------------------------------------------
-@dircategory GNU Emacs Lisp
+@dircategory Emacs lisp
@direntry
-* Emacs Lisp Intro: (eintr).
- A simple introduction to Emacs Lisp programming.
+* Emacs Lisp Intro: (eintr). A simple introduction to Emacs Lisp programming.
@end direntry
@copying
Distributed with Emacs version @value{EMACSVER}.
@end ifnottex
@sp 1
-Copyright @copyright{} 1990--1995, 1997, 2001--2013 Free Software
+Copyright @copyright{} 1990--1995, 1997, 2001--2014 Free Software
Foundation, Inc.
@sp 1
@sp 1
ISBN 1-882114-43-4
+@quotation
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; there
(a) The FSF's Back-Cover Text is: ``You have the freedom to
copy and modify this GNU manual. Buying copies from the FSF
supports it in developing GNU and promoting software freedom.''
+@end quotation
@end copying
@c half title; two lines here, so do not use `shorttitlepage'
* Default Configuration::
* Site-wide Init:: You can write site-wide init files.
* defcustom:: Emacs will write code for you.
-* Beginning a .emacs File:: How to write a @code{.emacs file}.
+* Beginning init File:: How to write a @file{.emacs} init file.
* Text and Auto-fill:: Automatically wrap lines.
* Mail Aliases:: Use abbreviations for email addresses.
* Indent Tabs Mode:: Don't use tabs with @TeX{}
@flushright
Robert J. Chassell
+@ifnothtml
@email{bob@@gnu.org}
+@end ifnothtml
+@ifhtml
+bob@@gnu.org
+@end ifhtml
@end flushright
@c ================ Beginning of main text ================
end of the comment. To stretch a comment over two or more lines, begin
each line with a semicolon.
-@xref{Beginning a .emacs File, , Beginning a @file{.emacs}
+@xref{Beginning init File, , Beginning a @file{.emacs}
File}, and @ref{Comments, , Comments, elisp, The GNU Emacs Lisp
Reference Manual}, for more about comments.
(/ (+ 10 (* size (prefix-numeric-value arg)))
10)))
(point-min))))
- (if arg (forward-line 1)))
+ (if (and arg (not (consp arg))) (forward-line 1)))
@end group
@end smallexample
invoked with an argument:
@smallexample
-(if arg (forward-line 1)))
+(if (and arg (not (consp arg))) (forward-line 1))
@end smallexample
@noindent
means that the cursor is always located @emph{at least} the requested
tenths of the way through the buffer, which is a nicety that is,
perhaps, not necessary, but which, if it did not occur, would be sure
-to draw complaints.
-
-On the other hand, it also means that if you specify the command with
-a @kbd{C-u}, but without a number, that is to say, if the `raw prefix
-argument' is simply a cons cell, then the command puts you at the
-beginning of the second line @dots{} I don't know whether this is
-intended or whether no one has dealt with the code to avoid this
-happening.
+to draw complaints. (The @code{(not (consp arg))} portion is so that
+if you specify the command with a @kbd{C-u}, but without a number,
+that is to say, if the `raw prefix argument' is simply a cons cell,
+the command does not put you at the beginning of the second line.)
@node Second Buffer Related Review
@section Review
The arguments are @code{beg} and @code{end} and the function is
interactive with @code{"r"}, so the two arguments must refer to the
-beginning and end of the region. If you have been reading though this
+beginning and end of the region. If you have been reading through this
document from the beginning, understanding these parts of a function is
almost becoming routine.
@node Every
@unnumberedsubsubsec Recursive Pattern: @emph{every}
@cindex Every, type of recursive pattern
-@cindex Recursive pattern: every
+@cindex Recursive pattern - every
In the @code{every} recursive pattern, an action is performed on every
element of a list.
@node Accumulate
@unnumberedsubsubsec Recursive Pattern: @emph{accumulate}
@cindex Accumulate, type of recursive pattern
-@cindex Recursive pattern: accumulate
+@cindex Recursive pattern - accumulate
Another recursive pattern is called the @code{accumulate} pattern. In
the @code{accumulate} recursive pattern, an action is performed on
@node Keep
@unnumberedsubsubsec Recursive Pattern: @emph{keep}
@cindex Keep, type of recursive pattern
-@cindex Recursive pattern: keep
+@cindex Recursive pattern - keep
A third recursive pattern is called the @code{keep} pattern.
In the @code{keep} recursive pattern, each element of a list is tested;
@node No deferment solution
@subsection No Deferment Solution
@cindex No deferment solution
-@cindex Defermentless solution
@cindex Solution without deferment
The solution to the problem of deferred operations is to write in a
@end itemize
@node Counting Words
-@chapter Counting: Repetition and Regexps
+@chapter Counting via Repetition and Regexps
@cindex Repetition for word counting
@cindex Regular expressions for word counting
Our next project is to count the number of words in a function
definition. Clearly, this can be done using some variant of
-@code{@value{COUNT-WORDS}}. @xref{Counting Words, , Counting Words:
+@code{@value{COUNT-WORDS}}. @xref{Counting Words, , Counting via
Repetition and Regexps}. If we are just going to count the words in
one definition, it is easy enough to mark the definition with the
@kbd{C-M-h} (@code{mark-defun}) command, and then call
@c !!! 22.1.1 lisp sources location here
@smallexample
(lengths-list-file
- "/usr/local/share/emacs/22.1.1/lisp/emacs-lisp/debug.el")
+ "/usr/local/share/emacs/22.1/lisp/emacs-lisp/debug.el")
@end smallexample
@noindent
-(You may need to change the pathname of the file; the one here is for
-GNU Emacs version 22.1.1. To change the expression, copy it to
+You may need to change the pathname of the file; the one here is for
+GNU Emacs version 22.1. To change the expression, copy it to
the @file{*scratch*} buffer and edit it.
@need 1200
@noindent
-(Also, to see the full length of the list, rather than a truncated
+Also, to see the full length of the list, rather than a truncated
version, you may have to evaluate the following:
+@c We do not want to insert, so do not mention the zero prefix argument.
@smallexample
(custom-set-variables '(eval-expression-print-length nil))
(75 41 80 62 20 45 44 68 45 12 34 235)
@end smallexample
-(The newer version of @file{debug.el} contains more defuns than the
+@noindent
+The newer version of @file{debug.el} contains more defuns than the
earlier one; and my new machine is much faster than the old one.)
Note that the length of the last definition in the file is first in
directory, checking what needs to be done; and we will use a recursive
call to repeat the actions on each sub-directory. The recursive
pattern is `accumulate'
-(@pxref{Accumulate, , Recursive Pattern: @emph{accumulate}}),
+(@pxref{Accumulate}),
using @code{append} as the combiner.
@ignore
* Default Configuration::
* Site-wide Init:: You can write site-wide init files.
* defcustom:: Emacs will write code for you.
-* Beginning a .emacs File:: How to write a @code{.emacs file}.
+* Beginning init File:: How to write a @file{.emacs} init file.
* Text and Auto-fill:: Automatically wrap lines.
* Mail Aliases:: Use abbreviations for email addresses.
* Indent Tabs Mode:: Don't use tabs with @TeX{}
set by @code{defconst}. (You can change it; the value set is a
variable; but please do not.)
-@node Beginning a .emacs File
+@node Beginning init File
@section Beginning a @file{.emacs} File
@cindex @file{.emacs} file, beginning of
first use such a function, while its containing file is evaluated.
Rarely used functions are frequently autoloaded. The
-@file{loaddefs.el} library contains hundreds of autoloaded functions,
-from @code{bookmark-set} to @code{wordstar-mode}. Of course, you may
+@file{loaddefs.el} library contains thousands of autoloaded functions,
+from @code{5x5} to @code{zone}. Of course, you may
come to use a `rare' function frequently. When you do, you should
load that function's file with a @code{load} expression in your
@file{.emacs} file.
@group
;; Set calendar highlighting colors
-(setq calendar-load-hook
+(add-hook 'calendar-load-hook
(lambda ()
(set-face-foreground 'diary-face "skyblue")
(set-face-background 'holiday-face "slate blue")