GNU Emacs Lisp Reference Manual Volume 2 for Emacs Version 24.1 Revision 3.1, May 2012
Total Page:16
File Type:pdf, Size:1020Kb
GNU Emacs Lisp Reference Manual Volume 2 For Emacs Version 24.1 Revision 3.1, May 2012 by Bil Lewis, Dan LaLiberte, Richard Stallman, the GNU Manual Group, et al. This is edition 3.1 of the GNU Emacs Lisp Reference Manual, corresponding to Emacs version 24.1. Copyright c 1990-1996, 1998-2012 Free Software Foundation, Inc. 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; with the Invariant Sections being \GNU General Public License," 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." Published by the Free Software Foundation 51 Franklin St, Fifth Floor Boston, MA 02110-1301 USA ISBN 1-882114-74-4 Cover art by Etienne Suvasa. i Short Contents Volume 1 1 Introduction :::::::::::::::::::::::::::::::::::::::: I:1 2 Lisp Data Types ::::::::::::::::::::::::::::::::::::: I:8 3 Numbers :::::::::::::::::::::::::::::::::::::::::: I:33 4 Strings and Characters::::::::::::::::::::::::::::::: I:48 5 Lists ::::::::::::::::::::::::::::::::::::::::::::: I:64 6 Sequences, Arrays, and Vectors :::::::::::::::::::::::: I:86 7 Hash Tables ::::::::::::::::::::::::::::::::::::::: I:97 8 Symbols:::::::::::::::::::::::::::::::::::::::::: I:102 9 Evaluation :::::::::::::::::::::::::::::::::::::::: I:110 10 Control Structures ::::::::::::::::::::::::::::::::: I:120 11 Variables ::::::::::::::::::::::::::::::::::::::::: I:137 12 Functions :::::::::::::::::::::::::::::::::::::::: I:163 13 Macros::::::::::::::::::::::::::::::::::::::::::: I:181 14 Customization Settings ::::::::::::::::::::::::::::: I:190 15 Loading :::::::::::::::::::::::::::::::::::::::::: I:209 16 Byte Compilation :::::::::::::::::::::::::::::::::: I:223 17 Advising Emacs Lisp Functions ::::::::::::::::::::::: I:233 18 Debugging Lisp Programs ::::::::::::::::::::::::::: I:243 19 Reading and Printing Lisp Objects :::::::::::::::::::: I:274 20 Minibuffers ::::::::::::::::::::::::::::::::::::::: I:284 21 Command Loop ::::::::::::::::::::::::::::::::::: I:315 22 Keymaps ::::::::::::::::::::::::::::::::::::::::: I:360 23 Major and Minor Modes :::::::::::::::::::::::::::: I:396 24 Documentation :::::::::::::::::::::::::::::::::::: I:451 25 Files::::::::::::::::::::::::::::::::::::::::::::: I:461 26 Backups and Auto-Saving ::::::::::::::::::::::::::: I:502 Index:::::::::::::::::::::::::::::::::::::::::::::::: I:512 ii Volume 2 27 Buffers :::::::::::::::::::::::::::::::::::::::::::::: 1 28 Windows ::::::::::::::::::::::::::::::::::::::::::: 18 29 Frames ::::::::::::::::::::::::::::::::::::::::::::: 66 30 Positions ::::::::::::::::::::::::::::::::::::::::::: 99 31 Markers ::::::::::::::::::::::::::::::::::::::::::: 112 32 Text :::::::::::::::::::::::::::::::::::::::::::::: 122 33 Non-ASCII Characters ::::::::::::::::::::::::::::::: 182 34 Searching and Matching :::::::::::::::::::::::::::::: 209 35 Syntax Tables :::::::::::::::::::::::::::::::::::::: 234 36 Abbrevs and Abbrev Expansion:::::::::::::::::::::::: 250 37 Processes :::::::::::::::::::::::::::::::::::::::::: 257 38 Emacs Display:::::::::::::::::::::::::::::::::::::: 299 39 Operating System Interface ::::::::::::::::::::::::::: 386 40 Preparing Lisp code for distribution :::::::::::::::::::: 418 A Emacs 23 Antinews :::::::::::::::::::::::::::::::::: 423 B GNU Free Documentation License :::::::::::::::::::::: 425 C GNU General Public License :::::::::::::::::::::::::: 433 D Tips and Conventions :::::::::::::::::::::::::::::::: 444 E GNU Emacs Internals :::::::::::::::::::::::::::::::: 457 F Standard Errors :::::::::::::::::::::::::::::::::::: 477 G Standard Keymaps :::::::::::::::::::::::::::::::::: 481 H Standard Hooks :::::::::::::::::::::::::::::::::::: 484 Index ::::::::::::::::::::::::::::::::::::::::::::::::: 488 iii Table of Contents Volume 1 1 Introduction ::::::::::::::::::::::::::::::::::: I:1 1.1 Caveats::::::::::::::::::::::::::::::::::::::::::::::::::::::: I:1 1.2 Lisp History :::::::::::::::::::::::::::::::::::::::::::::::::: I:1 1.3 Conventions :::::::::::::::::::::::::::::::::::::::::::::::::: I:2 1.3.1 Some Terms ::::::::::::::::::::::::::::::::::::::::::::: I:2 1.3.2 nil and t:::::::::::::::::::::::::::::::::::::::::::::::: I:2 1.3.3 Evaluation Notation ::::::::::::::::::::::::::::::::::::: I:3 1.3.4 Printing Notation :::::::::::::::::::::::::::::::::::::::: I:3 1.3.5 Error Messages :::::::::::::::::::::::::::::::::::::::::: I:3 1.3.6 Buffer Text Notation::::::::::::::::::::::::::::::::::::: I:4 1.3.7 Format of Descriptions ::::::::::::::::::::::::::::::::::: I:4 1.3.7.1 A Sample Function Description:::::::::::::::::::::: I:4 1.3.7.2 A Sample Variable Description :::::::::::::::::::::: I:6 1.4 Version Information::::::::::::::::::::::::::::::::::::::::::: I:6 1.5 Acknowledgements:::::::::::::::::::::::::::::::::::::::::::: I:7 2 Lisp Data Types :::::::::::::::::::::::::::::: I:8 2.1 Printed Representation and Read Syntax:::::::::::::::::::::: I:8 2.2 Comments :::::::::::::::::::::::::::::::::::::::::::::::::::: I:9 2.3 Programming Types :::::::::::::::::::::::::::::::::::::::::: I:9 2.3.1 Integer Type::::::::::::::::::::::::::::::::::::::::::::: I:9 2.3.2 Floating Point Type :::::::::::::::::::::::::::::::::::: I:10 2.3.3 Character Type::::::::::::::::::::::::::::::::::::::::: I:10 2.3.3.1 Basic Char Syntax ::::::::::::::::::::::::::::::::: I:10 2.3.3.2 General Escape Syntax::::::::::::::::::::::::::::: I:11 2.3.3.3 Control-Character Syntax :::::::::::::::::::::::::: I:12 2.3.3.4 Meta-Character Syntax :::::::::::::::::::::::::::: I:12 2.3.3.5 Other Character Modifier Bits ::::::::::::::::::::: I:13 2.3.4 Symbol Type ::::::::::::::::::::::::::::::::::::::::::: I:13 2.3.5 Sequence Types::::::::::::::::::::::::::::::::::::::::: I:14 2.3.6 Cons Cell and List Types ::::::::::::::::::::::::::::::: I:14 2.3.6.1 Drawing Lists as Box Diagrams :::::::::::::::::::: I:15 2.3.6.2 Dotted Pair Notation :::::::::::::::::::::::::::::: I:17 2.3.6.3 Association List Type :::::::::::::::::::::::::::::: I:17 2.3.7 Array Type ::::::::::::::::::::::::::::::::::::::::::::: I:18 2.3.8 String Type :::::::::::::::::::::::::::::::::::::::::::: I:18 2.3.8.1 Syntax for Strings:::::::::::::::::::::::::::::::::: I:18 2.3.8.2 Non-ASCII Characters in Strings ::::::::::::::::::: I:19 2.3.8.3 Nonprinting Characters in Strings :::::::::::::::::: I:19 2.3.8.4 Text Properties in Strings :::::::::::::::::::::::::: I:20 iv 2.3.9 Vector Type :::::::::::::::::::::::::::::::::::::::::::: I:20 2.3.10 Char-Table Type :::::::::::::::::::::::::::::::::::::: I:20 2.3.11 Bool-Vector Type:::::::::::::::::::::::::::::::::::::: I:21 2.3.12 Hash Table Type :::::::::::::::::::::::::::::::::::::: I:21 2.3.13 Function Type::::::::::::::::::::::::::::::::::::::::: I:21 2.3.14 Macro Type ::::::::::::::::::::::::::::::::::::::::::: I:22 2.3.15 Primitive Function Type ::::::::::::::::::::::::::::::: I:22 2.3.16 Byte-Code Function Type ::::::::::::::::::::::::::::: I:22 2.3.17 Autoload Type :::::::::::::::::::::::::::::::::::::::: I:23 2.4 Editing Types ::::::::::::::::::::::::::::::::::::::::::::::: I:23 2.4.1 Buffer Type :::::::::::::::::::::::::::::::::::::::::::: I:23 2.4.2 Marker Type ::::::::::::::::::::::::::::::::::::::::::: I:24 2.4.3 Window Type :::::::::::::::::::::::::::::::::::::::::: I:24 2.4.4 Frame Type :::::::::::::::::::::::::::::::::::::::::::: I:25 2.4.5 Terminal Type:::::::::::::::::::::::::::::::::::::::::: I:25 2.4.6 Window Configuration Type :::::::::::::::::::::::::::: I:25 2.4.7 Frame Configuration Type :::::::::::::::::::::::::::::: I:25 2.4.8 Process Type ::::::::::::::::::::::::::::::::::::::::::: I:25 2.4.9 Stream Type ::::::::::::::::::::::::::::::::::::::::::: I:26 2.4.10 Keymap Type ::::::::::::::::::::::::::::::::::::::::: I:26 2.4.11 Overlay Type:::::::::::::::::::::::::::::::::::::::::: I:26 2.4.12 Font Type ::::::::::::::::::::::::::::::::::::::::::::: I:26 2.5 Read Syntax for Circular Objects :::::::::::::::::::::::::::: I:26 2.6 Type Predicates ::::::::::::::::::::::::::::::::::::::::::::: I:27 2.7 Equality Predicates :::::::::::::::::::::::::::::::::::::::::: I:30 3 Numbers:::::::::::::::::::::::::::::::::::::: I:33 3.1 Integer Basics ::::::::::::::::::::::::::::::::::::::::::::::: I:33 3.2 Floating Point Basics :::::::::::::::::::::::::::::::::::::::: I:34 3.3 Type Predicates for Numbers :::::::::::::::::::::::::::::::: I:35 3.4 Comparison of Numbers ::::::::::::::::::::::::::::::::::::: I:36 3.5 Numeric Conversions :::::::::::::::::::::::::::::::::::::::: I:38 3.6 Arithmetic Operations ::::::::::::::::::::::::::::::::::::::: I:39 3.7 Rounding Operations :::::::::::::::::::::::::::::::::::::::: I:42 3.8 Bitwise Operations on Integers ::::::::::::::::::::::::::::::: I:42 3.9 Standard Mathematical Functions ::::::::::::::::::::::::::: I:46 3.10 Random Numbers :::::::::::::::::::::::::::::::::::::::::: I:47 4 Strings and Characters :::::::::::::::::::::: I:48 4.1 String and Character Basics ::::::::::::::::::::::::::::::::: I:48 4.2 The Predicates for Strings ::::::::::::::::::::::::::::::::::: I:49 4.3 Creating Strings ::::::::::::::::::::::::::::::::::::::::::::: I:49 4.4 Modifying Strings ::::::::::::::::::::::::::::::::::::::::::: I:52 4.5 Comparison of Characters and Strings