\input texinfo   @c -*-texinfo-*-

@comment $Id: elib.texinfo,v 0.23 1993/01/24 21:13:22 ceder Exp $
@comment Documentation for the GNU Emacs lisp library, Elib
@comment Copyright (C) 1991, 1992 Free Software Foundation

@comment This file is part of the GNU Emacs lisp library, Elib.

@comment GNU Elib is free software; you can redistribute it and/or modify
@comment it under the terms of the GNU General Public License as published by
@comment the Free Software Foundation; either version 1, or (at your option)
@comment any later version.

@comment GNU Elib is distributed in the hope that it will be useful,
@comment but WITHOUT ANY WARRANTY; without even the implied warranty of
@comment MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@comment GNU General Public License for more details.

@comment You should have received a copy of the GNU General Public License
@comment along with GNU Emacs; see the file COPYING.  If not, write to
@comment the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

@setfilename elib.info
@settitle Elib - The Emacs Lisp Library
@setchapternewpage odd
     
@ifinfo
Copyright @copyright{} 1991, 1992 Free Software Foundation
@end ifinfo
     
@comment The titlepage section does not appear in the Info file.
@titlepage
@sp 4
@comment The title is printed in a large font.
@center @titlefont{User's Guide}
@sp
@center @titlefont{to}
@sp
@center @titlefont{Elib - The Emacs Lisp Library}
@sp 2
@center version 0.06
@c --version--
@sp 3
@center Inge Wallin
@sp 3
@center last updated 24 Jan 1993
@c --date--

@comment  The following two commands start the copyright page
@comment  for the printed manual.  This will not appear in the Info file.
@page
@vskip 0pt plus 1filll
Copyright @copyright{} 1991, 1992 Free Software Foundation

Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.

Permission is granted to copy and distribute modified versions of this
manual under the conditions that the section entitled ``GNU ELIB GENERAL
PUBLIC LICENSE'' is included exactly as in the original, and provided
that the entire resulting derived work is distributed under the terms of
a permission notice identical to this one.

Permission is granted to copy and distribute translations of this manual
into another language under the above conditions for modified versions,
except that the section entitled ``GNU ELIB GENERAL PUBLIC LICENSE'' may
be included in a translation approved by the author instead of in the
original English.
@end titlepage

@comment ================================================================
@comment                   The real text starts here
@comment ================================================================

@ifinfo
@node    Top, License information, (dir), (dir)
@comment node-name, next,          previous, up
@cindex Introduction


This info manual describes Elib, the GNU emacs lisp library version 0.06.
@c --version--
The functions and data types in Elib are supposed to be a common
base for all kinds of other elisp packages and are not programs, modes
or packages of their own.

@end ifinfo
@menu
* License information::         Information about terms for copying Elib.
* Installation::                How to install Elib on your system.
* What is Elib?::               What is Elib?
* Container data types::        Data types which can contain other data.
* Cookie package::              The Cookie package.
* String functions::            A number of string functions.
* Read functions::              Read data from the minibuffer.

* Future enhancements::         Future enhancements of Elib.
* Reporting bugs::              Where do you report a bug you have found?

* Node index::                  Index over important all the nodes 
                                  in this manual.
@end menu

@node   License information, Installation, Top, Top
@comment  node-name,    next,   previous,       up
@unnumbered GNU ELIB GENERAL PUBLIC LICENSE
@cindex Licensing

  The license agreements of most software companies keep you at the
mercy of those companies.  By contrast, our general public license is
intended to give everyone the right to share GNU Elib.  To make sure
that you get the rights we want you to have, we need to make
restrictions that forbid anyone to deny you these rights or to ask you
to surrender the rights.  Hence this license agreement.

  Specifically, we want to make sure that you have the right to give
away copies of GNU Elib, that you receive source code or else can get it
if you want it, that you can change GNU Elib or use pieces of it in new
free programs, and that you know you can do these things.

  To make sure that everyone has such rights, we have to forbid you to
deprive anyone else of these rights.  For example, if you distribute
copies of GNU Elib, you must give the recipients all the rights that you
have.  You must make sure that they, too, receive or can get the source
code.  And you must tell them their rights.

  Also, for our own protection, we must make certain that everyone finds
out that there is no warranty for GNU Elib.  If GNU Elib is modified by
someone else and passed on, we want its recipients to know that what
they have is not what we distributed, so that any problems introduced by
others will not reflect on our reputation.

  Therefore we make the following terms which say what you must do to be
allowed to distribute or change GNU Elib.

@unnumberedsec COPYING POLICIES

@enumerate
@item
You may copy and distribute verbatim copies of GNU Elib source code as
you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy a valid copyright notice ``Copyright
@copyright{} 1992 Free Software Foundation (or with whatever year is
appropriate); keep intact the notices on all files that refer to this
License Agreement and to the absence of any warranty; and give any other
recipients of the GNU Elib program a copy of this License Agreement
along with the program.  You may charge a distribution fee for the
physical act of transferring a copy.

@item
You may modify your copy or copies of GNU Elib or any portion of it,
and copy and distribute such modifications under the terms of
Paragraph 1 above, provided that you also do the following:

@itemize @bullet
@item
cause the modified files to carry prominent notices stating
that you changed the files and the date of any change; and

@item
cause the whole of any work that you distribute or publish, that
in whole or in part contains or is a derivative of GNU Elib or any
part thereof, to be licensed at no charge to all third parties on
terms identical to those contained in this License Agreement
(except that you may choose to grant more extensive warranty
protection to some or all third parties, at your option).

@item
You may charge a distribution fee for the physical act of
transferring a copy, and you may at your option offer warranty
protection in exchange for a fee.
@end itemize

Mere aggregation of another unrelated program with this program (or its
derivative) on a volume of a storage or distribution medium does not bring
the other program under the scope of these terms.

@item
You may copy and distribute GNU Elib (or any portion of it in
under Paragraph 2) in object code or executable form under the terms
of Paragraphs 1 and 2 above provided that you also do one of the
following:

@itemize @bullet
@item
accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of
Paragraphs 1 and 2 above; or,

@item
accompany it with a written offer, valid for at least three
years, to give any third party free (except for a nominal
shipping charge) a complete machine-readable copy of the
corresponding source code, to be distributed under the terms of
Paragraphs 1 and 2 above; or,

@item
accompany it with the information you received as to where the
corresponding source code may be obtained.  (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form alone.)
@end itemize

For an executable file, complete source code means all the source code
for all modules it contains; but, as a special exception, it need not
include source code for modules which are standard libraries that
accompany the operating system on which the executable file runs.

@item
You may not copy, sublicense, distribute or transfer GNU Elib except as
expressly provided under this License Agreement.  Any attempt
otherwise to copy, sublicense, distribute or transfer GNU Elib is void
and your rights to use the program under this License agreement shall
be automatically terminated.  However, parties who have received
computer software programs from you with this License Agreement will
not have their licenses terminated so long as such parties remain in
full compliance.

@item
If you wish to incorporate parts of GNU Elib into other free programs
whose distribution conditions are different, write to the Free Software
Foundation at 675 Mass Ave, Cambridge, MA 02139.  We have not yet worked
out a simple rule that can be stated here, but we will often permit this.
We will be guided by the two goals of preserving the free status of all
derivatives of our free software and of promoting the sharing and reuse of
software.
@end enumerate

Your comments and suggestions about our licensing policies and our
software are welcome!  Please contact the Free Software Foundation, Inc.,
675 Mass Ave, Cambridge, MA 02139, or call (617) 876-3296.

@unnumberedsec NO WARRANTY

  BECAUSE GNU ELIB IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY NO
WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.  EXCEPT WHEN
OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC, INGE WALLIN
AND/OR OTHER PARTIES PROVIDE GNU ELIB "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF GNU ELIB
IS WITH YOU.  SHOULD GNU ELIB PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL INGE WALLIN,
THE FREE SOFTWARE FOUNDATION, INC., AND/OR ANY OTHER PARTY WHO
MAY MODIFY AND REDISTRIBUTE GNU ELIB AS PERMITTED ABOVE, BE LIABLE TO
YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR OTHER
SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A
FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) GNU ELIB,
EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR
ANY CLAIM BY ANY OTHER PARTY.


@node   Installation, What is Elib?, License information, Top
@comment  node-name,    next,   previous,       up
@chapter Installation
@cindex Installation

This section describes the installation of Elib, the GNU emacs lisp
library.  You should install not only the library itself, but also the
on-line documentation so that your users will know how to use it.  You
can create typeset documentation from the file @file{elib.texinfo} as
well as an on-line info file.  The following steps are also described in
the file @file{INSTALL} in the source directory.

@menu
* Library installation::         How to install Elib on your system.
* On-line manual installation::  How to install the on-line manual.
* Typeset manual installation::  How to create typeset documentation 
                                   about Elib.
@end menu

@node     Library installation, On-line manual installation, Installation, Installation
@comment  node-name,  next,  previous,  up
@section Installation of the elisp library
@cindex Library installation

@enumerate
@item
Edit the file @file{Makefile} to reflect the situation at your site. The
only thing you will have to change at this stage is the definition of
@code{LISPDIR}.  In this directory, a subdirectory with the name @file{elib}
will be created.  All elisp files of the library will be copied there
when you do the actual installation (see step 2. below).  We suggest you
use your local elisp directory (usually @file{/usr/local/lib/elisp} or
something similar) for this.

@item
Type `@code{make install}' in the source directory. This will
byte-compile all @code{.el} files of the library and create the
subdirectory @file{elib} in the directory you specified in step 1.
It will also copy both the @code{.el} and the @code{.elc} files of the 
library there.

If you don't want to install the @code{.el} files but only the @code{.elc} 
files (the byte-compiled files), you can type `@code{make install_elc}' instead
of `@code{make install}'.

If you only want to create the compiled elisp files, but don't
want to install them,  you can type `@code{make elcfiles}' instead.
This is what happens if you only type `@code{make}' without parameters.

@item
Edit the file @file{default.el} in your emacs lisp directory (usually
@file{/usr/gnu/emacs/lisp} or something similar) and enter the contents
of the file @file{elib-startup.el} into it.  This file was created from
the file @file{startup_template.el} by the @code{make} in step 2.  It
contains an additional entry in the variable @code{load-path}, which
determines the path where emacs looks for elisp files (ending in
@code{.el} or @code{.elc}).
@end enumerate

@node On-line manual installation, Typeset manual installation, Library installation, Installation
@comment  node-name,  next,  previous,  up
@section Installation of the on-line manual.
@cindex Manual installation (on-line)

@enumerate
@item
Create the info file @file{elib.info} from @file{elib.texinfo}.  If you
have the @code{makeinfo} program, you can do this by running it on
@file{elib.texinfo}.  Otherwise you can do it with emacs by running
these steps:
@enumerate
@item
Read @file{elib.texinfo} into an emacs buffer.
@item
Type `@code{M-X texinfo-format-buffer}'
@item
Save the newly created info file @file{elib}.
@end enumerate

@item
Move the info file @file{elib.info} to your standard info directory.
Usually this is is the directory @file{/usr/gnu/emacs/info} or something
similar. (See step 3 above).

@item
Edit the file @file{dir} in the info directory and enter one line to
contain a pointer to the info file @file{elib}.  The line can, for
instance, look like this:

@example
* Elib: (elib.info).     The Emacs Lisp Library.
@end example

@end enumerate


@node Typeset manual installation,  , On-line manual installation, Installation
@comment  node-name,  next,  previous,  up
@section How to make typeset documentation from elib.texinfo
@cindex Manual installation (typeset)

You can also make a typeset manual from the file
@file{elib.texinfo}.  To to this, you must have the @code{TeX}
text formatting program installed.  Just follow these steps:

@enumerate
@item
If the file @file{texinfo.tex} is not properly installed in the path
given by the environment variable @var{TEXINPUTS}, get it and put it in
the same directory as @file{elib.texinfo} (the source directory of
elib).  This file contains macros used by the @TeX{} text formatting
program to produce typeset output from a texinfo file. You can get this
from, e.g., @code{prep.ai.mit.edu} in the US or from @code{isy.liu.se}
in Europe.

@item
Run @TeX{} by typing `@code{tex elib.texinfo}'.  You might need to do this
twice to get all cross references correct.   If you have the
@code{texindex} program, you can create a sorted index by typing
`@code{texindex elib.??}' between the two @TeX{} passes.  If you don't do
this, you still get a typeset manual, but you will not get the index.

@item
Convert the resulting device independent file @file{elib.dvi} to a form
which your printer can output and print it.  If you have a postscript
printer there is a program, @code{dvi2ps}, which can do this.  There is
also a program which comes together with @TeX{}, @code{dvips}, which you
can use.

@end enumerate

@node     What is Elib?, Container data types, Installation, Top
@comment  node-name,     next, previous, up
@chapter What is Elib?
@cindex What is Elib?

Elib, the GNU emacs lisp library, is a collection of elisp
functions which you can use as parts of your own elisp programs.
Each file contains functions which have something in common, e.g.
they handle a certain data type.  

Elib is designed to be both as efficient and as easy to use as
possible.  Each file in Elib uses the elisp function @code{provide}
to tell emacs when it has been loaded.  To use the functions in
the file @code{foo}, you just have to put a line such as:  

@example
(require 'foo)
@end example

into your own elisp file.  This will cause emacs to load the file
@code{foo.elc} and evaluate the functions in it.  This, of course,
requires that your system manager has installed Elib properly on your
system.  @xref{Installation}, for more information.

@menu
* Contributors::                Contributors to GNU Elib.
* Archives::                    Where can I get a copy of Elib?
@end menu

@node     Contributors, Archives, What is Elib?, What is Elib?
@comment  node-name,  next,  previous,  up
@section Contributors to Elib
@cindex Contributors

The following persons have made contributions to GNU Elib.

@itemize @bullet
@item
Inge Wallin wrote most of the otherwise unattributed functions in
Elib as well as all documentation.

@item
Sebastian Kremer contributed the string functions.

@item
Thomas Bellman wrote some of the code for AVL trees.

@item
Per Cederqvist wrote the cookie package and the doubly linked list.  The
first design of @file{cookie.el} was made by Inge Wallin.
@end itemize


@node     Archives,  , Contributors, What is Elib?
@comment  node-name,  next,  previous,  up
@section Where can I get Elib?
@cindex sites
@cindex Archives

There will probably be a number of sites archiving Elib.
Currently the latest release can always be fetched via anonymos
ftp from @code{isy.liu.se}, (IP no. 130.236.1.3) in the directory
@file{pub/gnu/elisp-programs}, or from @code{ftp.lysator.liu.se} 
in @file{pub/emacs}.
@c --site--

@node     Container data types, Cookie package, What is Elib?, Top
@comment  node-name,  next,  previous,  up
@chapter Container Data Types
@cindex Container Data Types

Container data types are data types which are used to hold and organize
other data.  Since lisp is a dynamically typed language, any container
data type can hold any other data type or a mix of other data types.
This is contrary to the case for @code{C} or @code{C++} where all data in
a typical container must be of the same type.

As a convention do all names of the functions handling a certain
container data type begin in @code{<type>-}, i.e. the functions 
implementing the container data type @code{foo} all start with
@code{foo-}. 

@menu
* Stack::                       The Stack data type.
* Queue::                       The Queue data type.
* Doubly Linked List::          The Doubly Linked List Data Type.
* Binary tree::                 An ordinary binary tree.
* AVL tree::                    A balanced binary tree (AVL tree).
@end menu

@node     Stack, Queue, Container data types, Container data types
@comment  node-name,  next,  previous,  up
@section The Stack Data Type
@cindex Stack

The stack data type provides a simple LIFO stack.  There are two
implementations of a stack in Elib, one using macros and one using
functions.  The names of the functions/macros in the two implementations
are the same, but the efficiency of using one or the other vary greatly
under different circumstances.

The implementation using macros should be used when you want to
byte-compile your own elisp program.  This will be most efficient since
byte-compiling an elisp function using macros has the same effect as
using inline code in @code{C}.

To use the stack data type, put the line

@example
(require 'stack-f)
@end example

in your own elisp source file if you want to use the implementation
using functions or

@example
(require 'stack-m)
@end example

if you want to use the implementation using macros.  This is the only
difference between them, so it is easy to switch between them during
debugging.

The following functions are provided by the stack:

@table @code
@item (stack-create)
Create a new empty stack.

@item (stack-p stack)
Return @code{t} if @var{stack} is a stack, otherwise return @code{nil}.

@item (stack-push stack element)
Push @var{element} onto @var{stack}.

@item (stack-pop stack)
Remove the topmost element from @var{stack} and return it. If
@var{stack} is empty, return @code{nil}.

@item (stack-empty stack)
Return @code{t} if @var{stack} is empty, otherwise return @code{nil}.

@item (stack-top stack)
Return the top element of @var{stack}, but don't remove it from the stack.
Return @code{nil} if @var{stack} is empty.

@item (stack-nth stack n)
Return the @var{n}th element of @var{stack} where the top stack element
has number 0.  If @var{stack} is not that long, return @code{nil}.  The
element is not removed from the stack.

@item (stack-all stack)
Return a list of all entries in @var{stack} with the topmost element first.

@item (stack-copy stack)
Return a copy of @var{stack}.  All entries in @var{stack} are also copied.

@item (stack-length stack)
Return the number of elements in @var{stack}.

@item (stack-clear stack)
Remove all elements from @var{stack}.

@end table


@node     Queue, Doubly Linked List, Stack, Container data types
@comment  node-name,  next,  previous,  up
@section The Queue Data Type
@cindex Queue

The queue data type provides a simple FIFO queue.  There are two 
implementations of a queue in Elib, one using macros and one using
functions.  The names of the functions/macros in the two implementations
are the same, but the efficiency of using one or the other vary greatly
under different circumstances.

The implementation using macros should be used when you want to
byte-compile your own elisp program.  This will be most efficient since
byte-compiling an elisp function using macros has the same effect as
using inline code in @code{C}.  

To use the queue data type, put the line

@example
(require 'queue-f)
@end example

in your own elisp source file if you want to use the implementation
using functions or

@example
(require 'queue-m)
@end example

if you want to use the implementation using macros.  This is the only
difference between them, so it is easy to switch between them during
debugging.

Not all functions in @file{queue-m.el} are implemented as macros,
only the short ones.  This does not make it less recommendable to use
the macro version in your compiled code.

The following functions are provided by the queue:

@table @code
@item (queue-create)
Create a new empty queue.

@item (queue-p queue)
Return @code{t} if @var{queue} is a queue, otherwise return @code{nil}.

@item (queue-enqueue queue element)
Enter @var{element} last into @var{queue}.

@item (queue-dequeue queue)
Remove the first element from @var{queue} and return it.

@item (queue-empty queue)
Return @code{t} if @var{queue} is empty, otherwise return @code{nil}.

@item (queue-first queue)
Return the first element of @var{queue} or @code{nil} if it is empty.  The
element is not removed from the queue.

@item (queue-nth queue n)
Return the @var{n}th element of @var{queue}, where the first element of
@var{queue} has number 0.  If the length of @var{queue} is less than
@var{n}, return @code{nil}.  The element is not removed from the queue.

@item (queue-last queue)
Return the last element of @var{queue} or @code{nil} if it is empty.  The
element is not removed from the queue. 

@item (queue-all queue)
Return a list of all elements in @var{queue}.  Return @code{nil} if
@var{queue} is empty.  The oldest element in the queue is the first in
the list.

@item (queue-copy queue)
Return a copy of @var{queue}.  All entries in @var{queue} are also copied.

@item (queue-length queue)
Return the number of elements in @var{queue}.

@item (queue-clear queue)
Remove all elements from @var{queue}.

@end table

@node Doubly Linked List, Binary tree, Queue, Container data types
@comment  node-name,  next,  previous,  up
@section The Doubly Linked List Data Type

The doubly linked list is an efficient data structure if you need to
traverse the elements on the list in two directions, and maybe insert
new elements in the middle of the list.  You can efficiently delete any
element, and insert new elements, anywhere on the list.

A doubly linked list (@dfn{dll} for short) consists of a number of
@dfn{nodes}, each containing exactly one @dfn{element}.  Some of the
functions operate directly on the elements, while some manipulate nodes.
For instance, all of the functions that let you step forward and
backwards in the list handle nodes.  Use the function @dfn{dll-element}
to extract the element of a node.

To use the doubly linked list provided by Elib you must put the line

@example
(require 'dll)
@end example

in your elisp source file.

@menu
* Creating a dll::              Creating a Doubly Linked List
* Entering elements::           Entering elements in a dll
* Accessing elements::          Accessing elements of a dll
* Removing nodes::              Removing nodes from a dll
* Predicates::                  Predicates on a dll
* Maps and Filters::            Maps and Filters on a dll
* Misc dll operations::         Miscellaneous dll operations
* Debugging dll applications::  Debugging dll applications
@end menu

@node Creating a dll, Entering elements, Doubly Linked List, Doubly Linked List
@comment  node-name,  next,  previous,  up
@subsection Creating a Doubly Linked List

@table @code
@item (dll-create)
Create an empty doubly linked list.

@item (dll-create-from-list list)
Given the ordinary lisp list @var{list}, create a doubly linked list
with the same elements.

@item (dll-copy dll &optional element-copy-fnc)
Return a copy of the doubly linked list @var{dll}.  If optional second
argument @var{element-copy-fnc} is non-@code{nil} it should be a
function that takes one argument, an element, and returns a copy of it.
If @var{element-copy-fnc} is not given the elements themselves are not
copied.
@end table

@node Entering elements, Accessing elements, Creating a dll, Doubly Linked List
@comment  node-name,  next,  previous,  up
@subsection Entering elements in a dll

@table @code
@item (dll-enter-first dll element)
Add an element first on a doubly linked list.

@item (dll-enter-last dll element)
Add an element last on a doubly linked list.

@item (dll-enter-after dll node element)
In the doubly linked list @var{dll}, insert a node containing
@var{element} after @var{node}.

@item (dll-enter-before dll node element)
In the doubly linked list @var{dll}, insert a node containing
@var{element} before @var{node}.
@end table

@node Accessing elements, Removing nodes, Entering elements, Doubly Linked List
@comment  node-name,  next,  previous,  up
@subsection Accessing elements of a dll

@table @code
@item (dll-element dll node)
Get the element of a @var{node} in a doubly linked list @var{dll}.

@item (dll-first dll)
Return the first element on the doubly linked list @var{dll}.  Return
@code{nil} if the list is empty. The element is not removed.

@item (dll-nth dll n)
Return the @var{n}th node from the doubly linked list @var{dll}.
@var{n} counts from zero. If @var{dll} is not that long, @code{nil} is
returned.  If @var{n} is negative, return the -(@var{n}+1)th last
element.  Thus, @code{(dll-nth dll 0)} returns the first node, and
@code{(dll-nth dll -1)} returns the last node.

@item (dll-last dll)
Return the last element on the doubly linked list @var{dll}.  Return
@code{nil} if the list is empty. The element is not removed.

@item (dll-next dll node)
Return the last element on the doubly linked list @var{dll}.  Return
@code{nil} if the list is empty. The element is not removed.

@item (dll-previous dll node)
Return the node before @var{node}, or @code{nil} if @var{node} is the
first node.

@item (dll-all dll)
Return all elements on the double linked list @var{dll} as an ordinary list.

@end table

@node Removing nodes, Predicates, Accessing elements, Doubly Linked List
@comment  node-name,  next,  previous,  up
@subsection Removing nodes from a dll

@table @code
@item (dll-delete dll node)
Delete @var{node} from the doubly linked list @var{dll}.  Return the
element of @var{node}.

@item (dll-delete-first dll)
Delete the first @var{node} from the doubly linked list @var{dll}.
Return the element. Returns @code{nil} if @var{dll} was empty.

@item (dll-delete-last dll)
Delete the last @var{node} from the doubly linked list @var{dll}.
Return the element. Returns @code{nil} if @var{dll} was empty.

@item (dll-clear dll)
Clear the doubly linked list @var{dll}, i.e. make it completely empty.
@end table

@node Predicates, Maps and Filters, Removing nodes, Doubly Linked List
@comment  node-name,  next,  previous,  up
@subsection Predicates on a dll

@table @code
@item (dll-p object)
Return @code{t} if @var{object} is a doubly linked list, otherwise return
@code{nil}.

@item (dll-empty dll)
Return @code{t} if the doubly linked list @var{dll} is empty, @code{nil}
otherwise.
@end table

@node Maps and Filters, Misc dll operations, Predicates, Doubly Linked List
@comment  node-name,  next,  previous,  up
@subsection Maps and Filters on a dll

@table @code
@item (dll-map map-function dll)
Apply @var{map-function} to all elements in the doubly linked list @var{dll}.
The function is applied to the first element first.

@item (dll-map-reverse map-function dll)
Apply @var{map-function} to all elements in the doubly linked list
@var{dll}.  The function is applied to the last element first.

@item (dll-filter dll predicate)
Remove all elements in the doubly linked list @var{dll} for which
@var{predicate} returns @code{nil}.
@end table

@node Misc dll operations, Debugging dll applications, Maps and Filters, Doubly Linked List
@comment  node-name,  next,  previous,  up
@subsection Miscellaneous dll operations

@table @code
@item (dll-length dll)
Returns the number of elements in the doubly linked list @var{dll}.

@item (dll-sort dll predicate)
Sort the doubly linked list @var{dll}, stably, comparing elements using
@var{predicate}.  Returns the sorted list. @var{dll} is modified by side
effects.  @var{predicate} is called with two elements of @var{dll}, and
should return @code{t} if the first element is ``less'' than the second.
@end table

@node Debugging dll applications,  , Misc dll operations, Doubly Linked List
@comment  node-name,  next,  previous,  up
@subsection Debugging dll applications

The data structure used by the dll package contains both forward and
backward pointers.  The primitives in Emacs, such as @code{print}, know
nothing about dlls, so when Emacs tries to print out a dll it will think
that it found a circular structure.  Fortunately it detects this 
situation and gives an error message, instead of getting stuck in an
eternal loop.

The error message can be quite annoying when you are developing an
application that uses dlls.  Suppose your code has an error, and you
type @samp{(setq debug-on-error t)} to try to figure out exactly what
the error is.  If any function in the backtrace has a dll as an
argument, Emacs will abort printing the entire backtrace and only
respond with a "Back at top level" message (or something similar,
depending on exactly what you are doing) in the echo area.

There are two solutions to this problem: patch your emacs so that it
detects circular structures (there have been patches for this floating
around the net) or use @file{dll-debug.el}.

The file @file{dll-debug.el} implements all of the functionality that
are present in @file{dll.el}, but it uses a normal, singly linked list
instead.  This makes some operations, like @samp{dll-previous},
dreadfully slow, but it makes it possible to debug dll applications.
@file{dll-debug.el} also has more built-in sanity tests than
@file{dll.el}.

@strong{NOTE:} To use the debug package, you must load the library
@file{dll-debug} before you load any of the libraries (such as cookie)
or your program that use dll.  You must also make sure that you don't
load any byte-compiled version of any file that was compiled with the
normal dll library.  Since it contains some macros very strange results
will occur otherwise...

When the debug package is loaded, you simply run your code normally,
and any bugs should be easier to trace.

@node     Binary tree, AVL tree, Doubly Linked List, Container data types
@comment  node-name,  next,  previous,  up
@section The Binary Tree Data Type
@cindex Binary tree

The binary tree is sometimes an efficient way to store data.  When a
binary tree is created a compare function is given to the create
function (@code{bintree-create}).  This function is used throughout
all data entry and deletions into and out of the tree.

To use the binary tree in Elib you must put the line 

@example
(require 'bintree)
@end example

in your elisp source file.

The following functions are provided by the binary tree in the library:

@table @code
@item (bintree-create compare-function)
Create a new empty binary tree.  The argument @var{compare-function} is a
function which compares two instances of the data type which is to be
entered into the tree.  The call @code{(compare-function data1 data2)}
should return non-@code{nil} if @code{data1} is less than @code{data2},
and @code{nil} otherwise.

@item (bintree-p tree)
Return @code{t} if @var{tree} is an bintree, otherwise return @code{nil}.

@item (bintree-compare-function tree)
Return @code{compare-function} given to @code{bintree-create} when
@var{tree} was created.

@item (bintree-empty tree)
Return @code{t} if @var{tree} is empty, otherwise return @code{nil}.

@item (bintree-enter tree data)
Enter @var{data} into @var{tree}.  If there already is a data element
which is considered equal to @var{data} by @code{compare-function} given
to @code{bintree-create}, the new element will replace the old one in
the tree.

@item (bintree-delete tree data)
Delete the element which is considered equal to @var{data} by
@code{compare-function} given to @code{bintree-create}.  If there
is no matching element within the tree, nothing is done to the tree.

@item (bintree-member tree data)
Return the element in @var{tree} which is considered equal to @var{data} by
@code{compare-function} given to @code{bintree-create}.  If there
is no such element in the tree, return @code{nil}.

@item (bintree-map map-function tree)
Apply @var{map-function} to all elements in @var{tree}.  The function is applied in
the order in which the tree is sorted.

@item (bintree-first tree)
Return the first element of @var{tree}, i.e. the one who is considered first
by @code{compare-function} given to @code{bintree-create}.  If the
tree is empty, return @code{nil}.

@item (bintree-last tree)
Return the last element of @var{tree}, i.e. the one who is considered last
by @code{compare-function} given to @code{bintree-create}.  If the
tree is empty, return @code{nil}.

@item (bintree-copy tree)
Return a copy of @var{tree}.

@item (bintree-flatten tree)
Return a sorted list containing all elements of @var{tree}.

@item (bintree-size tree)
Return the number of elements in @var{tree}.

@item (bintree-clear tree)
Clear @var{tree}, i.e. make it totally empty.

@end table


@node     AVL tree,  , Binary tree, Container data types
@comment  node-name,  next,  previous,  up
@section The AVL Tree Data Type
@cindex AVL tree

The AVL tree data types provides a balanced binary tree.  The tree will
remain balanced throughout its entire life time, regardless of in which
order elements are entered into or deleted from the tree.

Although an AVL tree is not perfectly balanced, it has almost the same
performance as if it was.  The definition of an AVL tree is that the
difference in depth of the two branches of a particular node is at most
1.  This criterium is enough to make the performance of searching in an
AVL tree very close to a perfectly balanced tree, but will simplify the
entering and deleting of data significantly.

All data that is entered into an AVL tree should be of the same type.
If they are not, there are no way to compare two elements and this is
essential for entering and deleting data from the tree.  When a tree is
created, a compare function is given to the create function.  This
function is used throughout the life of the tree in all subsequent
insertions and deletions.

To use the Elib AVL tree, you must put the line

@example
(require 'avltree)
@end example

in your elisp source file.

The following functions are provided by the AVL tree in the library:

@table @code
@item (avltree-create compare-function)
Create a new empty AVL tree.  The argument @var{compare-function} is a
function which compares two instances of the data type which is to be
entered into the tree.  The call @code{(compare-function data1 data2)}
should return non-@code{nil} if @code{data1} is less than @code{data2},
and @code{nil} otherwise.

@item (avltree-p tree)
Return @code{t} if @var{tree} is an avltree, otherwise return @code{nil}.

@item (avltree-compare-function tree)
Return @code{compare-function} given to @code{avltree-create} when
@var{tree} was created.

@item (avltree-empty tree)
Return @code{t} if @var{tree} is empty, otherwise return @code{nil}.

@item (avltree-enter tree data)
Enter @var{data} into @var{tree}.  If there already is a data element
which is considered equal to @var{data} by @code{compare-function} given to
@code{avltree-create}, the new element will replace the old one in the
tree.

@item (avltree-delete tree data)
Delete the element which is considered equal to @var{data} by
@code{compare-function} given to @code{avltree-create}.  If there
is no matching element within the tree, nothing is done to the tree.

@item (avltree-member tree data)
Return the element in @var{tree} which is considered equal to @var{data} by
@code{compare-function} given to @code{avltree-create}.  If there
is no such element in the tree, return @code{nil}.

@item (avltree-map map-function tree)
Apply @var{map-function} to all elements in @var{tree}.  The function is
applied in the order in which the tree is sorted.

@item (avltree-first tree)
Return the first element of @var{tree}, i.e. the one who is considered first
by @code{compare-function} given to @code{avltree-create}.  If the
tree is empty, return @code{nil}.

@item (avltree-last tree)
Return the last element of @var{tree}, i.e. the one who is considered last
by @code{compare-function} given to @code{avltree-create}.  If the
tree is empty, return @code{nil}.

@item (avltree-copy tree)
Return a copy of @var{tree}.

@item (avltree-flatten tree)
Return a sorted list containing all elements of @var{tree}.

@item (avltree-size tree)
Return the number of elements in @var{tree}.

@item (avltree-clear tree)
Clear @var{tree}, i.e. make it totally empty.

@end table

@node Cookie package, String functions, Container data types, Top
@comment  node-name,  next,  previous,  up
@chapter The Cookie package---nodal data in a buffer

If you want to have structured nodal data in a buffer, the cookie
package can be a help to you.

Cookie is a package that implements a connection between a
dll (a doubly linked list) and the contents of a buffer.
Possible uses are @code{dired} (have all files in a list, and show them),
@code{buffer-list}, @code{kom-prioritize} (in the LysKOM elisp client) and
others.  @file{pcl-cvs.el} uses @file{cookie.el}.

@menu
* Cookie terminology::          Introduction to cookies.
* Cookie conventions::          Coding conventions used in the cookie package.
* Collection::                  Manipulating the entire collection.
* Inserting cookies::           Inserting cookies in the collection.
* Tins and cookies::            Tins and cookies.
* Deleting cookies::            Deleting cookies.
* Collection as a DLL::         Treating the collection as a 
                                  doubly linked list.
* Scanning the list::           Scanning the list.
* In the buffer::               Operations that affect the buffer.
* Debugging cookie applications::  Debugging cookie applications
@end menu

@node Cookie terminology, Cookie conventions, Cookie package, Cookie package
@comment  node-name,  next,  previous,  up
@section Introduction to cookie terminology

The cookie package uses its own terminology.  Here are some important
definitions.

@table @dfn
@item cookie
A @dfn{cookie} can be any lisp object.  When you use the cookie
package you specify a pretty-printer, a function that inserts
a printable representation of the cookie in the buffer.

@item collection

A @dfn{collection} consists of a doubly linked list of
cookies, a header, a footer and a pretty-printer.  It is
displayed at a certain point in a certain buffer.  (The
buffer and point are selected when the collection is
created).  The header and the footer are constant strings.
They appear before and after the cookies.  (Currently,
once set, they can not be changed).

@item tin
A @dfn{tin} is an object that contains one cookie.  There
are functions in this package that given a tin extracts
the cookie, or gives the next or previous tin.  (All tins
are linked together in a doubly linked list.  The
previous tin is the one that appears before the other in
the buffer.)  You should not do anything with a tin except
pass it to the functions in this package.

@end table

Cookie does not affect the mode of the buffer in any way.
It merely makes it easy to connect an underlying data
representation to the buffer contents.

A collection is a very dynamic thing.  You can easily add or
delete cookies.  You can sort all cookies in a collection (you
have to supply a function that compares two cookies).  You can
apply a function to all cookies in a collection, et c, et c.

Remember that a cookie can be anything.  Your imagination is the
limit!  It is even possible to have another collection as a
cookie.  In that way some kind of tree hierarchy can be created.

@node Cookie conventions, Collection, Cookie terminology, Cookie package
@comment  node-name,  next,  previous,  up
@section Coding conventions used in the cookie package

All functions that are intended for external use begin
with one of the prefixes @samp{cookie-},
@samp{collection-} or @samp{tin-}.  The prefix
@samp{icookie-} is currently used for internal functions
and macros.  Currently, no global or buffer-local
variables are used.

Many functions operate on tins instead of cookies.  For
most functions, the prefix used should help tell which
kind of object the function uses.

Most doc-strings contains an "Args:" line that lists the
arguments.

@node Collection, Inserting cookies, Cookie conventions, Cookie package
@comment  node-name,  next,  previous,  up
@section Manipulating the entire collection

@table @code
@item (collection-create buffer pretty-printer &optional header footer pos)
Create a collection that is displayed in @var{buffer}.
@var{buffer} may be a buffer or a buffer name. It is created if
it does not exist.

@var{pretty-printer} should be a function that takes one
argument, a cookie, and inserts a string representing it
in the buffer (at point). The string @var{pretty-printer}
inserts may be empty or span several lines. A trailing
newline will always be inserted automatically. The
@var{pretty-printer} should use @code{insert}, and not
@code{insert-before-markers}.

Optional third argument @var{header} is a string that will
always be present at the top of the collection.
@var{header} should end with a newline.  Optionaly fourth
argument @var{footer} is similar, and will always be
inserted at the bottom of the collection.

Optional fifth argument @var{pos} is a buffer position,
specifying where the collection will be inserted.  It
defaults to the begining of the buffer.  @var{pos} will probably default
to the current value of @code{(point)} in future releases of Elib, so
you should not depend on this default in cases where it matters.

@item (collection-empty collection)
Return true if there are no cookies in @var{collection}.

@item (collection-length collection)
Return the number of cookies in @var{collection}.

@item (collection-list-cookies collection)
Return a list of all cookies in @var{collection}.
@end table

@node Inserting cookies, Tins and cookies, Collection, Cookie package
@comment  node-name,  next,  previous,  up
@section Inserting cookies in the collection

These functions can be used to insert one or more cookies
into a collection.  The printed representation will
immediately and automatically be updated by the cookie
package.  (It will call the pretty-printer that was
specified to @code{collection-create}).

@table @code
@item (cookie-enter-first collection cookie)
Enter @var{cookie} first in the cookie collection @var{collection}.

@item (cookie-enter-last collection cookie)
Enter @var{cookie} last in the cookie collection @var{collection}.

@item (cookie-enter-after-tin collection tin cookie)
Enter @var{cookie} into @var{collection}, immediately
after @var{tin}.

@item (cookie-enter-before-tin collection tin cookie)
Enter @var{cookie} into @var{collection}, immediately
before @var{tin}.

@item (collection-append-cookies (collection cookie-list))
Insert all cookies in the list @var{cookie-list} last in
@var{collection}.
@end table

@node Tins and cookies, Deleting cookies, Inserting cookies, Cookie package
@comment  node-name,  next,  previous,  up
@section Tins and cookies

@table @code
@item (tin-cookie collection tin)
This function can be used to extract a cookie from
@var{tin}.  The collection that @var{tin} is present in
must also be specified as @var{collection}.
@end table

@node Deleting cookies, Collection as a DLL, Tins and cookies, Cookie package
@comment  node-name,  next,  previous,  up
@section Deleting cookies

There are a couple of different ways to delete cookies
from the collection.

@table @code
@item (tin-delete collection tin)
Delete @var{tin} from @var{collection}. The cookie that is
stored in @var{tin} is returned.

@item (cookie-delete-first collection)
Delete first cookie in @var{collection} and return it.
Returns @code{nil} if there are no cookies left in
@var{collection}.

@item (cookie-delete-last collection)
Delete last cookie in @var{collection} and return it.
Returns @code{nil} if there are no cookies left in
@var{collection}.
@end table

The following two functions can be used to delete several
cookies that fulfills certain criteria.

@table @code
@item (collection-filter-cookies collection predicate &rest extra-args)
Remove all cookies in @var{collection} for which
@var{predicate} returns nil.  Note that the buffer for
@var{collection} will be current-buffer when
@var{predicate} is called. @var{predicate} must restore
the current buffer before it returns if it changes it.

The @var{predicate} is called with @var{cookie} as its
first argument. If any @var{extra-args} are given to
@code{collection-filter-cookies} they will be passed
unmodified to @var{predicate}.

@item (collection-filter-tins collection predicate &rest extra-args)
This is like @code{collection-filter-cookies}, but
@var{predicate} is called with a tin instead of a cookie.
@end table

And finally, a way to delete all cookies in one swift
function call:

@table @code
@item (collection-clear collection)
Remove all cookies in @var{collection}.
@end table

@node Collection as a DLL, Scanning the list, Deleting cookies, Cookie package
@comment  node-name,  next,  previous,  up
@section Collection as a Doubly linked list

The functions in this section treat the collection as a
doubly linked list.

@table @code
@item (tin-nth collection n)
Return the @var{n}th tin.  @var{n} counts from zero.
@code{nil} is returned if there is less than @var{n}
cookies.  If @var{n} is negative, return the
-(@var{n}+1)th last element.  Thus, @code{(tin-nth dll 0)}
returns the first node, and @code{(tin-nth dll -1)}
returns the last node.

Use @code{tin-cookie} to extract the cookie from the tin (or use
@code{cookie-nth} instead).

@item (cookie-nth collection n)
Like @code{tin-nth}, but the cookie is returned instead of
the tin.

@item (tin-next collection tin)
Get the next tin.  Returns nil if @var{tin} is @code{nil}
or refers to the last cookie in @var{collection}.

@item (tin-previous collection tin)
Get the previous tin.  Returns nil if @var{tin} is
@code{nil} or refers to the first cookie in
@var{collection}.

@item (cookie-sort collection predicate)
Sort the cookies in @var{collection}, stably, comparing
elements using @var{predicate}.  @var{predicate} is called
with two cookies, and should return @samp{t} if the first
cookie is @dfn{less} than the second.

All cookies will be refreshed when the sort is complete.

@item (cookie-first collection)
Return the first cookie in @var{collection}. The cookie is
not removed.

@item (cookie-last collection)
Return the last cookie in @var{collection}. The cookie is
not removed.
@end table

@node Scanning the list, In the buffer, Collection as a DLL, Cookie package
@comment  node-name,  next,  previous,  up
@section Scanning the list

@table @code
@item (cookie-map map-function collection &rest map-args)
Apply @var{map-function} to all cookies in
@var{collection}.  @var{map-function} is applied to the
first element first.  If @var{map-function} returns
non-@code{nil} the cookie will be refreshed (its
pretty-printer will be called once again).

Note that the buffer for @var{collection} will be current
buffer when @var{map-function} is called.
@var{map-function} must restore the current buffer to
@var{buffer} before it returns, if it changes it.

If more than two arguments are given to @code{cookie-map}, remaining
arguments will be passed to @var{map-function}.

@item (cookie-map-reverse map-function collection &rest map-args)
Like @code{cookie-map}, but @var{map-function} will be
applied to the last cookie first.

@item (collection-collect-tin collection predicate &rest predicate-args)
Select cookies from @var{collection} using @var{predicate}.
Return a list of all selected tins.

@var{predicate} is a function that takes a cookie as its
first argument.

The tins on the returned list will appear in the same
order as in the buffer.  You should not rely on in which
order @var{predicate} is called.

Note that the buffer the @var{collection} is displayed in
is current-buffer when @var{predicate} is called.
@var{predicate} must restore current-buffer if it changes
it.

If more than two arguments are given to
@code{collection-collect-tin} the remaining arguments will
be passed to @var{predicate}.

@item (collection-collect-cookie collection predicate &rest predicate-args)
Like @code{collection-collect-tin}, but a list of cookies
is returned.
@end table

@node In the buffer, Debugging cookie applications, Scanning the list, Cookie package
@comment  node-name,  next,  previous,  up
@section Operations that affect the buffer

@table @code
@item (collection-buffer collection)
Return the buffer that @var{collection} is displayed in.

@item (collection-refresh collection)
Refresh all cookies in @var{collection}.

The pretty-printer that was specified when the
@var{collection} was created will be called for all
cookies in @var{collection}.

Note that @code{tin-invalidate} is more efficient if only
a small number of cookies needs to be refreshed.

@item (tin-invalidate collection &rest tins)
Refresh some cookies.  The pretty-printer for
@var{collection} will be called for all @var{tins}.

@item (collection-set-goal-column collection goal)
Set goal-column for @var{collection}.  goal-column is made buffer-local.
This function will be obsoleted in the next release of Elib.  Instead,
there is going to be a function that given a cookie will return a
position where the cursor should be stored.  The details are not yet
decided.

@item (tin-goto-previous collection pos arg)
Move point to the @var{arg}th previous cookie.  Don't move if we are at
the first cookie, or if @var{collection} is empty.  Returns the tin we
move to.

@item (tin-goto-next collection pos arg)
Like @code{tin-goto-previous}, but move towards the end of
the buffer instead.

@item (tin-goto collection tin)
Move point to @var{tin}.

@item (tin-locate collection pos &optional guess)
Return the tin that @var{pos} (a buffer position) is within.

@var{pos} may be a marker or an integer.  @var{guess}
should be a tin that it is likely that @var{pos} is near.

If @var{pos} points before the first cookie, the first
cookie is returned.  If @var{pos} points after the last
cookie, the last cookie is returned.  If @var{collection}
is empty, @code{nil} is returned.
@end table

@node Debugging cookie applications,  , In the buffer, Cookie package
@comment  node-name,  next,  previous,  up
@section Debugging cookie applications

Since the cookie package uses dll, cookie applications can be hard to
debug.  Fortunately, the same technique can be used here---just load
dll-debug prior to loading cookie. @xref{Debugging dll applications}.

@emph{Warning!}  Don't load a byte-compiled @file{cookie.elc} that was
compiled using dll (as opposed to dll-debug) when you have dll-debug in
memory.  Your Emacs will be seriously confused.

@node     String functions, Read functions, Cookie package, Top
@comment  node-name,  next,  previous,  up
@chapter String functions
@cindex String functions

To use the string functions in Elib you have to put the following line
into your elisp source file:  

@example
(require 'string)
@end example

The following string functions are provided with Elib.

@table @code
@item (string-replace-match regexp string newtext &optional literal global)

This function tries to be a string near-equivalent to the elisp function
@code{replace-match}.  It returns a string with the first text matched
by @var{regexp} in @var{string} replaced by @var{newtext}.  If no match
is found, @code{nil} is returned.  If optional argument @var{global} is
non-@code{nil}, all occurances matching @var{regexp} are replaced
instead of only the first one.

If optional argument @var{literal} is non-@code{nil}, then @var{newtext}
is inserted exactly as it is.  If it is @code{nil} (which is the
default), then the character @kbd{\} is treated specially.  If a @kbd{\}
appears in @var{newtext}, it can start any one of the following sequences:

@table @kbd
@item \&
@kbd{\&} stands for the entire text being replaced.

@item \@var{n}
@kbd{\@var{n}} stands for the @var{n}th subexpression in the original regexp.
Subexpressions are those expressions grouped inside of @code{\(...\)}.
@var{n} is a digit.

@item \\
@kbd{\\} stands for a single @kbd{\} in @var{newtext}.
@end table

Any other character after the @key{\} will just be copied into the
string. 

@item (string-split pattern string &optional limit)

Split the string @var{string} on the regexp @var{pattern} and return a
list of the strings between the matches.  If the optional numerical
argument @var{limit} is >= 1, only the first @var{limit} elements of the list are
returned.

For example, the call

@example
(string-split "[ \t]+" "Elisp programming is fun.")
@end example

will return @code{("Elisp" "programming" "is" "fun.")}, but the call

@example
(string-split " " "Elisp programming is fun." 3)
@end example

will return @code{("Elisp" "programming" "is")}.

@end table

@node Read functions, Future enhancements, String functions, Top
@comment  node-name,  next,  previous,  up
@chapter Read functions
@cindex Read functions

Elib provides a number of functions for reading data from the
minibuffer.  To use them in your own elisp programs, put the following
line into you source file:

@example
(require 'read)
@end example

The following functions are provided by @file{read}.

@table @code
@item (read-number &optional prompt default)
Read a number from the minibuffer. If optional argument @var{prompt} is
non-@code{nil}, the user is prompted using @var{prompt}, otherwise the
prompt string @code{Enter a number:} is used.  If optional argument
@var{default} is non-@code{nil}, it is written within parenthesis after
the prompt string.  @var{default} can be either a number or of the type which
@code{(interactive "P")} generates.

@item (read-num-range low high &optional prompt show-range)
Read a number from the minibuffer.  The number returned will be forced
to lie between @var{low} and @var{high}.  If @var{prompt} is
non-@code{nil}, the user is prompted using @var{prompt}, otherwise the
prompt string @code{Enter a number:} is used.  If @var{show-range} is
non-@code{nil}, the prompt will show the range within parenthesis to the
user.

@item (read-silent prompt &optional showchar)
Read a string in the minibuffer without echoing.  The following
characters are special when entering the string:

@table @kbd
@item DEL
Delete the last character in the input buffer.

@item C-u
Clear the input buffer.

@item RET
End the reading of the string.

@item Newline
Same as @kbd{RET}.

@end table

If optional argument @var{showchar} is non-@code{nil}, one of these characters
will be displayed for each character input by the user.

This function is well suited to read a password from the user, but
beware of the function @code{(view-lossage)} which displays the last 100
keystrokes, even hidden ones.

@end table


@node     Future enhancements, Reporting bugs, Read functions, Top
@comment  node-name,  next,  previous,  up
@chapter Future enhancements
@cindex Enhancements

Elib is still under development and needs a number of enhancements to be
called fairly complete.  Here is a list of wishes of functions and data
types which we would like to enter into Elib in future releases:

@itemize @bullet
@item
Numerical data types such as Floating point numbers, Complex
numbers, Arbitrarily long integers, etc.  (Perhaps we can get
these from the freely distributable elisp package @code{calc}.)

@item
Other container data types such as Priority queues, 2-3-trees, Hash
tables, Sets, etc.

@item
Other implementations of old container data types.  For instance, are
vector implementations of stacks and queues faster than the current ones
using cons cells?

@item
Miscellaneous other small functions.
@end itemize


@section Contributions

We are grateful for all donations of code that we can receive.  However,
your code will be still more useful if you also provide documentation
and code to test your new library functions.


@node     Reporting bugs, Node index, Future enhancements, Top
@comment  node-name,  next,  previous,  up
@chapter Reporting bugs
@cindex Reporting bugs

This is an early test release of the GNU emacs lisp library.
Undoubtedly there are numerous bugs remaining, both in the elisp source
code and in the documentation.  If you find a bug in either, please send
a bug report to @code{elib-maintainers@@lysator.liu.se}.  We will try to
be as quick as possible in fixing the bugs and redistributing the fixes.

@ifinfo
@node    Node index,  , Reporting bugs, Top
@comment node-name,    next,  previous,      up
@unnumbered Node index

@printindex cp
@end ifinfo

@contents
@bye
