Programming in Emacs Lisp

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 3.08, 4 October 2008

Copyright © 1990, 1991, 1992, 1993, 1994, 1995, 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 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
     51 Franklin Street, Fifth Floor     Tel: +1 (617) 542-5942
     Boston, MA 02110-1301 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.3 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 the freedom to copy and modify this GNU manual. Buying copies from the FSF supports it in developing GNU and promoting software freedom.”

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

copy-region-as-kill

The Body of copy-region-as-kill

Initializing a Variable with defvar

How Lists are Implemented

Yanking Text Back

Loops and Recursion

while

Details of an Incrementing Loop

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 current-kill Function

current-kill in Outline

A Graph with Labelled Axes

The print-Y-axis Function

The print-X-axis Function

Printing the Whole Graph