Programming in Emacs Lisp

Short Contents

Table of Contents

Next: , Previous: (dir), Up: (dir)



An Introduction to Programming in Emacs Lisp

This is an Introduction to Programming in Emacs Lisp, for people who are not programmers.


Edition 2.14, 2004 Oct 12

Copyright © 1990, 1991, 1992, 1993, 1994, 1995, 1997, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.

Published by the:

     GNU Press,                          Website: http://www.gnupress.org
     a division of the                   General: press@gnu.org
     Free Software Foundation, Inc.      Orders:  sales@gnu.org
     59 Temple Place, Suite 330          Tel: +1 (617) 542-5942
     Boston, MA 02111-1307 USA           Fax: +1 (617) 542-2652

ISBN 1-882114-43-4

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; there being no Invariant Section, with the Front-Cover Texts being “A GNU Manual”, and with the Back-Cover Texts as in (a) below. A copy of the license is included in the section entitled “GNU Free Documentation License”.

(a) The FSF's Back-Cover Text is: “You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development.”

This master menu first lists each chapter and index; then it lists every node in every chapter.

--- The Detailed Node Listing ---

Preface

List Processing

Lisp Lists

The Lisp Interpreter

Evaluation

Variables

Arguments

Setting the Value of a Variable

Practicing Evaluation

How To Write Function Definitions

Install a Function Definition

Make a Function Interactive

let

The if Special Form

Truth and Falsehood in Emacs Lisp

save-excursion

A Few Buffer--Related Functions

The Definition of mark-whole-buffer

The Definition of append-to-buffer

A Few More Complex Functions

The Definition of insert-buffer

The Interactive Expression in insert-buffer

Complete Definition of beginning-of-buffer

beginning-of-buffer with an Argument

Narrowing and Widening

car, cdr, cons: Fundamental Functions

cons

Cutting and Storing Text

zap-to-char

kill-region

Initializing a Variable with defvar

copy-region-as-kill

The Body of copy-region-as-kill

How Lists are Implemented

Yanking Text Back

Loops and Recursion

while

A Loop with an Incrementing Counter

Loop with a Decrementing Counter

Save your time: dolist and dotimes

Recursion

Recursion in Place of a Counter

Recursive Patterns

Regular Expression Searches

forward-sentence

forward-paragraph: a Goldmine of Functions

Counting: Repetition and Regexps

The count-words-region Function

Counting Words in a defun

Count Words in defuns in Different Files

Prepare the Data for Display in a Graph

Readying a Graph

Your .emacs File

Debugging

Handling the Kill Ring

The rotate-yank-pointer Function

The Body of rotate-yank-pointer

yank

A Graph with Labelled Axes

The print-Y-axis Function

The print-X-axis Function

Printing the Whole Graph