[表紙] [目次] [索引] [検索] [上端 / 下端] [?]

Emacs Lisp プログラミング

検索全文Elisp

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

訳者まえがき  
はじめに  What to look for.
1. リスト処理  What is Lisp?
2. 評価の練習  Running several programs.
3. 関数定義の書き方  How to write function definitions.
4. バッファ関連の関数  Exploring a few buffer-related functions.
5. 多少複雑な関数  A few, even more complex functions.
6. ナロイングとワイドニング  Restricting your and Emacs attention to a region.
7. 基本関数 carcdrcons  Fundamental functions in Lisp.
8. テキストのカットと保存  Removing text and saving it.
9. リストの実装方法  How lists are implemented in the computer.
10. テキストの取り出し方  Pasting stored text.
11. ループと再帰  How to repeat a process.
12. 正規表現の探索  Regular expression searches.
13. 数え上げ:繰り返しと正規表現  A review of repetition and regexps.
14. defun内の単語の数え上げ  Counting words in a defun.
15. グラフの準備  A prototype graph printing function.
16. 個人用ファイル`.emacs'  How to write a `.emacs' file.
17. デバッグ  How to run the Emacs Lisp debuggers.
18. 結 論  Now you have the basics.
A. 関数the-the  An appendix: how to find reduplicated words.
B. キルリングの扱い方  An appendix: how the kill ring works.
C. ラベル付きグラフ  How to create a graph with labelled axes.
索引  
筆者について  

 -- The Detailed Node Listing ---

Preface

On Reading this Text  Read, gain familiarity, pick up habits....
対象とする読者  For whom this is written.
Lispの歴史  
初心者へ一言  You can read this as a novice.
謝 辞  

List Processing

1.1 Lispのリスト  What are lists?
1.2 プログラムの実行  Any list in Lisp is a program ready to run.
1.3 エラーメッセージの生成  Generating an error message.
1.4 シンボル名と関数定義  Names of symbols and function definitions.
1.5 Lispインタープリタ  What the Lisp interpreter does.
1.6 評 価  Running a program.
1.7 変 数  Returning a value from a variable.
1.8 引 数  Passing information to a function.
1.9 変数への値の設定  Setting the value of a variable.
1.10 まとめ  The major points.
1.11 演習問題  

Lisp Lists

1.1.1 Lispのアトム  Elemental entities.
1.1.2 リスト内の空白  Formating lists to be readable.
1.1.3 GNU Emacsのリスト入力補佐機能  How GNU Emacs helps you type lists.

The Lisp Interpreter

1.5.1 バイトコンパイル  Specially processing code for speed.

Evaluation

1.6.1 内側のリストの評価  Lists within lists...

Variables

1.7.1 値のないシンボルに対するエラーメッセージ  The error message for a symbol without a value.

Arguments

1.8.1 引数のデータ型  Types of data passed to a function.
1.8.2 引数としての変数やリストの値  An argument can be the value of a variable or list.
1.8.3 可変個数の引数  Some functions may take a variable number of arguments.
1.8.4 引数に誤った型のオブジェクトを指定  Passing an argument of the wrong type to a function.
1.8.5 関数message  A useful function for sending messages.

Setting the Value of a Variable

1.9.1 setの使い方  Setting values.
1.9.2 setqの使い方  Setting a quoted value.
1.9.3 数え上げ  Using setq to count.

Practicing Evaluation

How to Evaluate  Typing editing commands or C-x C-e causes evaluation.
2.1 バッファ名  Buffers and files are different.
2.2 バッファの取得  Getting a buffer itself, not merely its name.
2.3 バッファの切り替え  How to change to another buffer.
2.4 バッファサイズとポイントの位置  Where point is located and the size of the buffer.
2.5 演習問題  

How To Write Function Definitions

An Aside about Primitive Functions  Some functions are written in C.
3.1 スペシャルフォームdefun  The defun special form.
3.2 関数定義のインストール  Install a Function Definition.
3.3 関数を対話的にする  Making a function interactive.
3.4 interactiveの他のオプション  Different options for interactive.
3.5 コードの恒久的インストール  Installing code permanently.
3.6 let  Creating and initializing local variables.
3.7 スペシャルフォームif  What if?
3.8 If--then--else式  If--then--else expressions.
3.9 Lispの真偽値  What Lisp considers false and true.
3.10 save-excursion  Keeping track of point, mark, and buffer.
3.11 復 習  
3.12 演習問題  

Install a Function Definition

3.2.1 関数定義の変更  How to change a function definition.

Make a Function Interactive

3.3.1 対話的multiply-by-seven  The interactive version.

let

3.6.1 let式の構造  
3.6.2 let式の例  
3.6.3 let式の非初期化変数  

The if Special Form

3.7.1 関数type-of-animalの詳細  An example of an if expression.

save-excursion

3.10.1 save-excursion式の雛型  One slot to fill in.

A Few Buffer--Related Functions

4.1 詳しい情報を得る  How to find more information.
4.2 beginning-of-bufferの簡略した定義  Shows goto-char,
                                point-min, and push-mark.
4.3 mark-whole-bufferの定義  Almost the same as beginning-of-buffer.
4.4 append-to-bufferの定義  Uses save-excursion and
                                insert-buffer-substring.
4.5 復 習  Review.
4.6 演習問題  

The Definition of mark-whole-buffer

4.3.1 mark-whole-bufferの本体  Only three lines of code.

The Definition of append-to-buffer

4.4.1 append-to-bufferinteractive  A two part interactive expression.
4.4.2 append-to-bufferの本体  Incorporates a let expression.
4.4.3 append-to-buffersave-excursion  How the save-excursion works.

A Few More Complex Functions

5.1 copy-to-bufferの定義  With set-buffer, get-buffer-create.
5.2 insert-bufferの定義  Read-only, and with or.
5.3 beginning-of-bufferの完全な定義  Shows goto-char,
                                point-min, and push-mark.
5.4 復 習  
5.5 &optional引数の演習問題  

The Definition of insert-buffer

5.2.1 insert-bufferinteractive  A read-only situation.
5.2.2 関数insert-bufferの本体  The body has an or and a let.
5.2.3 orのかわりにifを使ったinsert-buffer  Using an if instead of an or.
5.2.4 orの本体  How the or expression works.
5.2.5 insert-bufferlet  Two save-excursion expressions.

The Interactive Expression in insert-buffer

読み出し専用バッファ  
interactive式の`b'  

Complete Definition of beginning-of-buffer

5.3.1 オプションの引数  
5.3.2 引数を指定したbeginning-of-buffer  Example with optional argument.
5.3.3 beginning-of-bufferの完全なコード  

beginning-of-buffer with an Argument

大きなバッファでの動作  Division and multiplication in a large buffer.
小さなバッファでの動作  Functions embedded in parentheses.

Narrowing and Widening

The Advantages of Narrowing  
6.1 スペシャルフォームsave-restriction  The save-restriction special form.
6.2 what-line  The number of the line that point is on.
6.3 ナロイングの演習問題  

carcdrcons: Fundamental Functions

Strange Names  An historical aside: why the strange names?
7.1 carcdr  Functions for extracting part of a list.
7.2 cons  Constructing a list.
7.3 nthcdr  Calling cdr repeatedly.
7.4 setcar  Changing the first element of a list.
7.5 setcdr  Changing the rest of a list.
7.6 演習問題  

cons

7.2.1 リストの長さ:length  How to find the length of a list.

Cutting and Storing Text

Storing Text in a List  Text is stored in a list.
8.1 zap-to-char  Cutting out text up to a character.
8.2 kill-region  Cutting text out of a region.
8.3 delete-region:Cへ回り道  A digression into C.
8.4 defvarによる変数の初期化  How to give a variable an initial value.
8.5 copy-region-as-kill  A definition for copying text.
8.6 復 習  
8.7 探索の演習問題  

zap-to-char

8.1.1 interactive  A three part interactive expression.
8.1.2 zap-to-charの本体  A short overview.
8.1.3 関数search-forward  How to search for a string.
8.1.4 関数progn  The progn function.
8.1.5 zap-to-charのまとめ  Using point and search-forward.
8.1.6 第18版の実装  The version 18 implementation.

The Version 18 Implementation

progn式の本体  The body of the progn expression

copy-region-as-kill

8.5.1 copy-region-as-killの本体  The body of copy-region-as-kill

The Body of copy-region-as-kill

関数kill-append  The kill-append function
copy-region-as-killの偽の場合の動作  The else-part of copy-region-as-kill

How Lists are Implemented

9.1 演習問題  

Yanking Text Back

10.1 キルリングの概要  The kill ring is a list.
10.2 変数kill-ring-yank-pointer  The kill-ring-yank-pointer variable.
10.3 yanknthcdrの演習問題  

Loops and Recursion

11.1 while  Causing a stretch of code to repeat.
11.2 再 帰  Causing a function to call itself.
11.3 ループの演習問題  

while

11.1.1 whileループとリスト  A while loop that uses a list.
11.1.2 例:print-elements-of-list  Uses while, car, cdr.
11.1.3 増加カウンタによるループ  A loop with an incrementing counter.
11.1.4 減少カウンタによるループ  A loop with a decrementing counter.

A Loop with an Incrementing Counter

増加カウンタの例  Counting pebbles in a triangle.
関数定義の各部分  The parts of the function definition.
関数定義をまとめる  Putting the function definition together.

Loop with a Decrementing Counter

減少カウンタの例  More pebbles on the beach.
関数の各部分  The parts of the function definition.
関数定義をまとめる   Putting the function definition together.

Recursion

11.2.1 リストについての再帰  Using a list as the test whether to recurse.
11.2.2 カウンタの代用としての再帰  Replacing a while loop with recursion.
11.2.3 condを用いた再帰の例  Recursion example with a different conditional.

Recursion in Place of a Counter

引数が3の場合  

Regular Expression Searches

12.1 sentence-endのための正規表現  The regular expression for sentence-end.
12.2 関数re-search-forward  Very similar to search-forward.
12.3 forward-sentence  A straightforward example of regexp search.
12.4 forward-paragraph:関数の宝庫  A somewhat complex example.
12.5 専用タグファイルの作成方法  How to create your own `TAGS' table.
12.6 復 習  
12.7 re-search-forwardの演習問題  

forward-sentence

whileループ  Two while loops.
正規表現の探索  A regular expression search.

forward-paragraph: a Goldmine of Functions

let*  The let* expression.
先へ進めるwhileループ  The forward motion while loop.
段落のあいだ  Movement between paragraphs.
段落の中  Movement within paragraphs.
詰め込み接頭辞なし  When there is no fill prefix.
詰め込み接頭辞あり  When there is a fill prefix.
まとめ  Summary of forward-paragraph code.

Counting: Repetition and Regexps

Counting words  Emacs lacks a word count command.
13.1 関数count-words-region  Use a regexp, but find a problem.
13.2 再帰による単語の数え上げ  Start with case of no words in region.
13.3 演習問題:句読点の数え上げ  

The count-words-region Function

13.1.1 count-words-regionの空白に関するバグ  The Whitespace Bug in count-words-region

Counting Words in a defun

Divide and Conquer  Split a daunting project into parts.
14.1 何を数えるか?  What to count?
14.2 単語やシンボルを構成するものは何か?  What constitutes a word or symbol?
14.3 関数count-words-in-defun  Very like count-words.
14.5 ファイルを探す  Do you want to look at a file?
14.6 lengths-list-fileの詳細  A list of the lengths of many definitions.
14.7 別のファイルのdefuns内の単語の数え上げ  Counting in definitions in different files.
14.8 別のファイルの再帰による単語の数え上げ  Recursively counting in different files.
14.9 グラフ表示用データの準備  Prepare the data for display in a graph.

Count Words in defuns in Different Files

14.7.1 関数append  Attaching one list to another.

Prepare the Data for Display in a Graph

14.9.1 リストのソート(整列)  Sorting lists.
14.9.2 ファイルのリストの作成  Making a list of files.

Readying a Graph

Printing the Columns of a Graph  How to print individual columns.
15.1 関数graph-body-print  How to print the body of a graph.
15.2 関数recursive-graph-body-print  
15.3 軸表示の必要性  
15.4 演習問題  

Your `.emacs' File

Emacs's Default Configuration  Emacs has sensible defaults.
16.1 サイト全体の初期化ファイル  You can write site-wide init files.
16.2 一回だけの作業用の変数の設定  How to set some variables for a session.
16.3 ファイル`.emacs'入門  How to write a .emacs file.
16.4 TextモードとAuto Fillモード  Automatically wrap lines.
16.5 メールの別名  Use abbreviations for email addresses.
16.6 Indent Tabsモード(タブによる字下げ)  Don't use tabs with TeX
16.7 キーバインド例  Create some personal keybindings.
16.8 ファイルのロード  Load (i.e. evaluate) files automatically.
16.9 オートロード  Make functions available.
16.10 簡単な拡張:line-to-top-of-window  Define a function; bind it to a key.
16.11 キーマップ  More about key binding.
16.12 X11の色指定  Colors in version 19 in X.
16.13 第19版のその他  Automatically resize minibuffer, and more.
16.14 モード行の変更  How to customize your mode line.

Debugging

17.1 debug  How to use the built-in debugger.
17.2 debug-on-entry  Start debugging when you call a function.
17.3 debug-on-quit(debug)  Start debugging when you quit with C-g.
17.4 ソースレベルのデバッガedebug  How to use Edebug, a source level debugger.
17.5 デバッグの演習問題  

Handling the Kill Ring

B.1 関数rotate-yank-pointer  Move a pointer along a list and around.
B.2 yank  Paste a copy of a clipped element.
B.3 yank-pop  Insert first element pointed to.

The rotate-yank-pointer Function

B.1.1 rotate-yank-pointerの本体  The Body of rotate-yank-pointer.

The Body of rotate-yank-pointer

if式の偽の場合の動作  The else-part of the if expression.
剰余関数%  The remainder, %, function.
rotate-yank-pointerにおける%の利用  Using % in rotate-yank-pointer.
最後の要素を指す  Pointing to the last element.

yank

引数の渡し方  Pass the argument to rotate-yank-pointer.
負の引数を渡す  Pass a negative argument.

A Graph with Labelled Axes

Labelled Example Graph  How a finished graph should look.
C.1 print-graphの変数リスト  let expression in print-graph.
C.2 関数print-Y-axis  Print a label for the vertical axis.
C.3 関数print-X-axis  Print a horizontal label.
C.4 グラフ全体の表示  The function to print a complete graph.

The print-Y-axis Function

C.2.1 余りの計算  How to compute the remainder of a division.
C.2.2 Y軸の要素の作成  Construct a line for the Y axis.
C.2.3 Y軸のコラムの作成  Generate a list of Y axis labels.
C.2.4 print-Y-axisの最終版  Print a vertical axis, final version.

The print-X-axis Function

C.3.1 X軸の目盛  Create tic marks for the horizontal axis.

Printing the Whole Graph

C.4.1 print-graphのテスト  Run a short test.
C.4.2 単語やシンボルの個数のグラフ  Executing the final code.
C.4.3 グラフ  The graph itself!

Graphing Numbers of Words and Symbols

lambda  How to write an anonymous function.
関数mapcar  Apply a function to elements of a list.
別のバグ ... もっとも潜在的  Yet another ... of a most insidious type.