Appendix B. Emacs Lisp Packages

The tables in this appendix list the most useful Lisp packages that come with Emacs. All Lisp packages are typically located in the directory emacs-source/lisp, where emacs-source is the directory in which you placed the Emacs source distribution. We have omitted all of the packages that provide "basic" Emacs support; likewise, we have omitted many packages whose functionality is obsolete or unspeakably obscure.

While some of these packages are described in some detail in this book, most aren't; you will have to rely on GNU Emacs' help for precise descriptions of what the package does. See Chapter 14 for details about help; the most important help commands you will need for finding out about the functionality of Lisp packages are C-h p (for finder-by-keyword), C-h f (for describe-function), and C-h m (for describe-mode).

C-h p is especially helpful. It lets you navigate through a hierarchy of information about all packages available on your system, from general areas of functionality, like those in the tables in this appendix, to the C-h m information about each individual mode. Unfortunately, the detailed information is sometimes incomplete and also lists many packages that could not possibly be interesting to anyone other than hard-core Emacs customizers.

Wherever it is reasonable, the tables in this appendix give commands that "start" the package. This startup information has the following meanings:

• If the package implements a major mode, the startup command is the function that puts Emacs into this major mode.

• If the package implements a major mode that is automatically loaded when you visit a file with a certain suffix, we list "suffix

suffixname
" in addition to the startup command.

• If the package implements a minor mode, the startup command is the function that puts Emacs into this minor mode.

• If the package implements a set of general-purpose functions, we've tried to pick the most "typical" of these functions. For example, the studly package implements three commands. We arbitrarily picked studlify-region as one way to invoke this package. If there isn't any reasonable choice, we list "many."

Finally, a word on using the packages. Some packages are automatically loaded when Emacs starts; some are loaded when you visit a file with the appropriate suffix (such as many of the modes for programming languages); some are automatically loaded whenever you give the appropriate command (for example, M-x shell Enter loads the package shell.el for shell-mode); and some are never automatically loaded. So how do you know which is which?

You don't really have to concern yourself with this issue. In the tables, the Startup column tells you what command (or commands) put the package to work. Start Emacs, and give this command (M-x

startup-command
Enter). If Emacs complains no match, the package wasn't loaded automatically and you need to load the package "by hand." To do so during an Emacs session, use the command M-x load-library
name
Enter, where the package's "name" is given in the first column of the table. You can also tell Emacs to load packages automatically at startup time by putting lines in your .emacs file that have this form:

(load-library "name")

Finally, if you're interested in looking at the source code of the libraries, which can be a great way to pick up techniques as you develop skills in programming Emacs Lisp, check out the find-library-file function presented in Chapter 11.

Now, without further ado, here are the tables of Lisp packages.

Table B-1. Support for Java, C, and C++ programming

Table B-1. Support for Java, C, and C++ programming

Package Description Startup
cc-mode
Major mode for editing Java, C, C++ and Objective-C source files java-mode, c-mode, c++-mode, objc-mode, suffixes .java, .c, .h, .y, .lex, .cc, .hh, .C, .H, .cpp, .cxx, .hxx, .c++, .h++
cmacexp
Function for using cpp to expand macros in C source code c-macro-expand
hideif
Minor mode for hiding code within C preprocessor commands hide-ifdef-mode
cpp
Major mode for highlighting and hiding code within C preprocessor conditionals; takes advantage of graphical displays cpp-parse-edit

Table B-2. Support for Lisp programming

Table B-2. Support for Lisp programming

Package Description Startup
lisp-mode
Major modes for Lisp, Emacs Lisp and Lisp interaction lisp-mode, emacs-lisp-mode, lisp-interaction-mode, suffixes .l, .lisp, .lsp, .ml, .el, and others[100]
scheme
Major mode for editing Scheme source files scheme-mode, suffixes .scm, .stk, .ss, .sch, .oak
cl
Functions and macros for Emacs Lisp compatibility with Common Lisp many
debug
Major mode for debugging Emacs Lisp programs debug, automatically invoked if an error occurs running code when debug-on-error is not nil
edebug
Emacs Lisp debugging functionality, implemented as a minor mode edebug
disass
Function to disassemble compiled Emacs Lisp code disassemble
elp
Code profiler for Emacs Lisp elp-instrument-package, elp-instrument-function
trace
Produces function call traces for Emacs Lisp trace-function

Table B-3. Support for other programming tasks and languages

Table B-3. Support for other programming tasks and languages

Package Description Startup
gud
Major mode for working with many different debuggers including jdb, gdb, sdb, dbx, xdb, perldb, pdb (Python), and bash jdb, bashdb, gdb, and many others
perl-mode
Major mode for working with Perl source perl-mode, suffixes .pl, .pm, .perl, .al, and capitalized variants
cperl-mode
Major mode for working with Perl source, which many prefer to the older Perl mode cperl-mode, suffixes .pl, .pm, .perl, .al, and capitalized variants
python
Major mode for editing Python source files python-mode, suffix .py
tcl
Major mode for editing TCL source files tcl-mode, suffixes .tcl, .exp, .itcl, .itk
sql
Major mode for editing SQL queries sql-mode, suffix .sql
ada-mode
Major mode for editing Ada source files ada-mode, suffixes .ada, .adb, .ads, .adb.dg, .ads.dg
pascal
Major mode for editing Pascal source files pascal-mode, suffixes .p, .pas
modula2
Major mode for editing Modula-2 source code modula-2-mode
fortran
Major mode for editing Fortran source files fortran-mode, suffixes .f, .F, .for
f90
Major mode for editing source code in the Fortran 90 dialect f90-mode, suffixes .f90, .f95
asm-mode
Major mode for editing assembly language source code asm-mode, suffixes .s, .S, .asm
awk-mode
Major mode for editing awk code awk-mode, suffix .awk
m4-mode
Major mode for editing m4 macro source m4-mode, suffixes .m4, .mc
ps-mode
Major mode for editing PostScript code ps-mode, suffixes .ps, .eps, with any capitalization
compile
Major mode for compiling programs (often through make or ant) and allowing easy access to the source lines on which errors are reported compile

Table B-4. Support for Text Processing

Table B-4. Support for Text Processing

Package Description Startup
text-mode
Major mode for editing unprocessed text files text-mode, suffixes .txt, .text, .article, .letter, and files starting with /tmp/Re, Message and a digit (mail), /tmp/fol (news)
sgml-mode
Major mode for editing structured documents (including HTML and XML)[101] html-mode, xml-mode, sgml-mode, suffixes .htm, .html, .shtml, .xml, .xsl, .dtd, .sgm, .sgml
tex-mode
Major mode for editing TEX and LATEX files tex-mode, latex-mode, suffixes .tex, .ins, .TeX, .ltx, .sty, .cls, .clo, .bbl
bibtex
Major mode for editing bibliography files bibtex-mode, suffix .bib
refbib
Convert bibliography files in refer format to bibtex format r2b-convert-buffer
nroff
Major mode for editing nroff and troff text files nroff-mode, suffixes .mm, .me, .ms, .man, or any digit following a period (manual page source)
scribe
Major mode for editing Scribe text files scribe-mode, suffix .mss

Table B-5. Emulations for other editors

Table B-5. Emulations for other editors

Package Description Startup
vi
Major mode for emulating the vi editor vi-mode
vip
Another major mode for emulating vi vip-mode
edt
Function to set key bindings to emulate the VAX/VMS EDT editor edt-emulation-on

Table B-6. Interfaces to operating system utilities

Table B-6. Interfaces to operating system utilities[102]

Package Description Startup
shell
Major mode for interacting with the command-line shell. shell-mode
find-dired
Run the find command and use dired on the resulting list of files. find-dired
tar-mode
Access files inside a tar archive through a dired-like interface. tar-mode, suffix .tar
arc-mode
Access files in several other archive formats through a dired-like interface. archive-mode, suffixes .arc, .zip, .lzh, .zoo, .ear, .jar, .war, as well as capitalized variants; .sxd, .sxm, .sxi, .sxc, .sxw
lpr
Print the contents of a buffer or region. lpr-buffer, print-buffer, lpr-region, print-region
sort
Sort the contents of a buffer. sort-columns, sort-fields, sort-lines, sort-numeric-fields, sort-paragraphs, sort-regexp-fields
spell
,
ispell
Various tools for checking spelling. See Chapter 3
diff
,
ediff
Tools to help in comparing files. See Chapter 12

Table B-7. Networking support

Table B-7. Networking support

Package Description Startup
ange-ftp
Provides transparent access to remote files via FTP most standard file-handling commands
url
Functions for retrieving the contents of documents through URLs Invoked from Lisp code, not interactively
quickurl
Functions for looking up and adding URLs to documents many commands beginning with quickurl
talk
A multi-user talk package that runs in Emacs talk-connect
eudc
A unified directory client for looking up address information from LDAP, BBDB, CCSO PH/QU and other directory servers eudc-mode
net-utils
Provides access to common network utility programs (ping, traceroute, netstat, etc. ping, traceroute, netstat, etc.

Table B-8. Games and amusements

Table B-8. Games and amusements

Package Description Startup
animate
Draws animated text. animate-birthday-present
blackbox
Major mode to play the Blackbox game. blackbox-mode
decipher
Major mode to cryptanalyze monoalphabetic substitution ciphers (break simple codes). decipher
dissociate
Randomly scramble text. dissociated-press
doctor
Major mode for playing the famous "psychoanalyst" game. doctor
dunnet
Major mode for playing an adventure game. dunnet
gomoku
Major mode for playing Gomoku. gomoku
hanoi
Solve the Towers of Hanoi puzzle for you. hanoi
life
Explore cellular automata using John Conway's "life" game rules. life
mpuz
Generate a random multiplication puzzle. mpuz
snake
Steer an animated snake towards food without hitting yourself or the walls. snake
solitaire
Play the peg solitaire game. solitaire
studly
Randomly capitalize letters for that polished, professional look. studlify-region
tetris
Guide falling tiles to complete rows. tetris
yow
Print a random quotation from Zippy the Pinhead. yow
zone
Rearrange your buffer in a hypnotic way. zone

* * *

Again, this is only a sampling of some available packages, to give you a sense of the breadth and depth of capabilities that ship with Emacs. The list isn't close to complete even with respect to what's available at this time, and new features are always being added. Your best bet is to explore for yourself using the tools mentioned at the beginning of this appendix. And don't forget to search the Web for nonstandard additions that might be just what you need for your own environment and projects!

Загрузка...