aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2011-12-12 15:25:58 +0800
committerChong Yidong2011-12-12 15:25:58 +0800
commit29eabb8efff24750fd18b98d2e4217e04abcb4ab (patch)
treeee74a57f85796096684ebbb67363fa592caac013
parent333f9019e29e9b6de3a7ec07448be1d364ba540b (diff)
downloademacs-29eabb8efff24750fd18b98d2e4217e04abcb4ab.tar.gz
emacs-29eabb8efff24750fd18b98d2e4217e04abcb4ab.zip
More updates to Building chapter of Emacs manual.
* doc/emacs/building.texi (Executing Lisp): Fix xref for C-M-x. (Lisp Libraries): Add xref to node explaining `load' in Lisp manual. Note that load-path is not customizable. (Lisp Eval): Note that listed commands are available globally. Explain the meaning of "defun" in the C-M-x context. (Lisp Interaction): Copyedits. (External Lisp): Fix name of inferior Lisp buffer. Mention Scheme. (Compilation): Define "inferior process".
-rw-r--r--doc/emacs/ChangeLog12
-rw-r--r--doc/emacs/building.texi436
-rw-r--r--doc/emacs/emacs.texi2
-rw-r--r--etc/NEWS3
4 files changed, 233 insertions, 220 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index d1dbbfd0831..c26f1a7e1ca 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,15 @@
12011-12-12 Chong Yidong <cyd@gnu.org>
2
3 * building.texi (Executing Lisp): Fix xref for C-M-x.
4 (Lisp Libraries): Add xref to node explaining `load' in Lisp
5 manual. Note that load-path is not customizable.
6 (Lisp Eval): Note that listed commands are available globally.
7 Explain the meaning of "defun" in the C-M-x context.
8 (Lisp Interaction): Copyedits.
9 (External Lisp): Fix name of inferior Lisp buffer. Mention
10 Scheme.
11 (Compilation): Define "inferior process".
12
12011-12-10 Eli Zaretskii <eliz@gnu.org> 132011-12-10 Eli Zaretskii <eliz@gnu.org>
2 14
3 * msdog.texi (Windows Fonts): Document how to force GDI font 15 * msdog.texi (Windows Fonts): Document how to force GDI font
diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi
index 5e2cb8119de..ab4a485cb87 100644
--- a/doc/emacs/building.texi
+++ b/doc/emacs/building.texi
@@ -24,9 +24,9 @@ assist in the process of compiling and testing programs.
24* Executing Lisp:: Various modes for editing Lisp programs, 24* Executing Lisp:: Various modes for editing Lisp programs,
25 with different facilities for running 25 with different facilities for running
26 the Lisp programs. 26 the Lisp programs.
27* Libraries: Lisp Libraries. Creating Lisp programs to run in Emacs. 27* Lisp Libraries:: How Lisp programs are loaded into Emacs.
28* Eval: Lisp Eval. Executing a single Lisp expression in Emacs. 28* Lisp Eval:: Executing a single Lisp expression in Emacs.
29* Interaction: Lisp Interaction. Executing Lisp in an Emacs buffer. 29* Lisp Interaction:: Executing Lisp in an Emacs buffer.
30* External Lisp:: Communicating through Emacs with a separate Lisp. 30* External Lisp:: Communicating through Emacs with a separate Lisp.
31@end menu 31@end menu
32 32
@@ -37,10 +37,9 @@ assist in the process of compiling and testing programs.
37@cindex compilation errors 37@cindex compilation errors
38@cindex error log 38@cindex error log
39 39
40 Emacs can run compilers for languages such as C and Fortran as 40 Emacs can run compilers for languages such as C and Fortran, feeding
41inferior processes, feeding the compilation log into an Emacs buffer. 41the compilation log into an Emacs buffer. It can also parse the error
42It can also parse the error messages and show you where the errors 42messages and show you where the errors occurred.
43occurred.
44 43
45@table @kbd 44@table @kbd
46@item M-x compile 45@item M-x compile
@@ -56,11 +55,11 @@ Kill the running compilation subprocess.
56@findex compile 55@findex compile
57 To run @code{make} or another compilation command, type @kbd{M-x 56 To run @code{make} or another compilation command, type @kbd{M-x
58compile}. This reads a shell command line using the minibuffer, and 57compile}. This reads a shell command line using the minibuffer, and
59then executes the command in an inferior shell, putting output in the 58then executes the command by running a shell as a subprocess (or
60buffer named @samp{*compilation*}. The current buffer's default 59@dfn{inferior process}) of Emacs. The output is inserted in a buffer
61directory is used as the working directory for the execution of the 60named @samp{*compilation*}. The current buffer's default directory is
62command; normally, therefore, compilation takes place in this 61used as the working directory for the execution of the command;
63directory. 62normally, therefore, compilation takes place in this directory.
64 63
65@vindex compile-command 64@vindex compile-command
66 The default compilation command is @samp{make -k}, which is usually 65 The default compilation command is @samp{make -k}, which is usually
@@ -1286,109 +1285,119 @@ that thread.
1286@node Executing Lisp 1285@node Executing Lisp
1287@section Executing Lisp Expressions 1286@section Executing Lisp Expressions
1288 1287
1289 Emacs has several different major modes for Lisp and Scheme. They are 1288 Emacs has major modes for several variants of Lisp. They use the
1290the same in terms of editing commands, but differ in the commands for 1289same editing commands as other programming language modes
1291executing Lisp expressions. Each mode has its own purpose. 1290(@pxref{Programs}). In addition, they provide special commands for
1291executing Lisp expressions.
1292 1292
1293@table @asis 1293@table @asis
1294@item Emacs-Lisp mode 1294@item Emacs Lisp mode
1295The mode for editing source files of programs to run in Emacs Lisp. 1295The mode for editing Emacs Lisp source files. It defines @kbd{C-M-x}
1296This mode defines @kbd{C-M-x} to evaluate the current defun. 1296to evaluate the current top-level Lisp expression. @xref{Lisp Eval}.
1297@xref{Lisp Libraries}. 1297
1298@item Lisp Interaction mode 1298@item Lisp Interaction mode
1299The mode for an interactive session with Emacs Lisp. It defines 1299The mode for an interactive Emacs Lisp session. It defines @kbd{C-j}
1300@kbd{C-j} to evaluate the sexp before point and insert its value in the 1300to evaluate the expression before point and insert its value in the
1301buffer. @xref{Lisp Interaction}. 1301buffer. @xref{Lisp Interaction}.
1302
1302@item Lisp mode 1303@item Lisp mode
1303The mode for editing source files of programs that run in Lisps other 1304The mode for editing source files of programs that run in Lisps other
1304than Emacs Lisp. This mode defines @kbd{C-M-x} to send the current defun 1305than Emacs Lisp. It defines @kbd{C-M-x} to evaluate the current
1305to an inferior Lisp process. @xref{External Lisp}. 1306top-level expression in an external Lisp. @xref{External Lisp}.
1307
1306@item Inferior Lisp mode 1308@item Inferior Lisp mode
1307The mode for an interactive session with an inferior Lisp process. 1309The mode for an interactive session with an external Lisp which is
1308This mode combines the special features of Lisp mode and Shell mode 1310being run as a subprocess (or @dfn{inferior process}) of Emacs.
1309(@pxref{Shell Mode}). 1311@ifnottex
1312@xref{External Lisp}.
1313@end ifnottex
1314
1310@item Scheme mode 1315@item Scheme mode
1311Like Lisp mode but for Scheme programs. 1316Like Lisp mode, but for Scheme programs.
1317
1312@item Inferior Scheme mode 1318@item Inferior Scheme mode
1313The mode for an interactive session with an inferior Scheme process. 1319Like Inferior Lisp mode, but for Scheme.
1314@end table 1320@end table
1315 1321
1316 Most editing commands for working with Lisp programs are in fact
1317available globally. @xref{Programs}.
1318
1319@node Lisp Libraries 1322@node Lisp Libraries
1320@section Libraries of Lisp Code for Emacs 1323@section Libraries of Lisp Code for Emacs
1321@cindex libraries 1324@cindex libraries
1322@cindex loading Lisp code 1325@cindex loading Lisp code
1323 1326
1324 Lisp code for Emacs editing commands is stored in files whose names 1327 Emacs Lisp code is stored in files whose names conventionally end in
1325conventionally end in @file{.el}. This ending tells Emacs to edit them in 1328@file{.el}. Such files are automatically visited in Emacs Lisp mode.
1326Emacs-Lisp mode (@pxref{Executing Lisp}).
1327 1329
1328@cindex byte code 1330@cindex byte code
1329 Emacs Lisp code can be compiled into byte-code, which loads faster, 1331 Emacs Lisp code can be compiled into byte-code, which loads faster,
1330takes up less space, and executes faster. @xref{Byte Compilation,, 1332takes up less space, and executes faster. By convention, compiled
1331Byte Compilation, elisp, the Emacs Lisp Reference Manual}. By 1333Emacs Lisp code goes in a separate file whose name ends in
1332convention, the compiled code for a library goes in a separate file 1334@samp{.elc}. For example, the compiled code for @file{foo.el} goes in
1333whose name ends in @samp{.elc}. Thus, the compiled code for 1335@file{foo.elc}. @xref{Byte Compilation,, Byte Compilation, elisp, the
1334@file{foo.el} goes in @file{foo.elc}. 1336Emacs Lisp Reference Manual}.
1335 1337
1336@findex load-file 1338@findex load-file
1337 To execute a file of Emacs Lisp code, use @kbd{M-x load-file}. This 1339 To @dfn{load} an Emacs Lisp file, type @kbd{M-x load-file}. This
1338command reads a file name using the minibuffer and then executes the 1340command reads a file name using the minibuffer, and executes the
1339contents of that file as Lisp code. It is not necessary to visit the 1341contents of that file as Emacs Lisp code. It is not necessary to
1340file first; in any case, this command reads the file as found on disk, 1342visit the file first; this command reads the file directly from disk,
1341not text in an Emacs buffer. 1343not from an existing Emacs buffer.
1342 1344
1343@findex load 1345@findex load
1344@findex load-library 1346@findex load-library
1345 Once a file of Lisp code is installed in the Emacs Lisp library 1347@cindex load path for Emacs Lisp
1346directories, users can load it using @kbd{M-x load-library}. Programs 1348 If an Emacs Lisp file is installed in the Emacs Lisp @dfn{load path}
1347can load it by calling @code{load}, a more primitive function that is 1349(defined below), you can load it by typing @kbd{M-x load-library},
1348similar but accepts some additional arguments. 1350instead of using @kbd{M-x load-file}. The @kbd{M-x load-library}
1349 1351command prompts for a @dfn{library name} rather than a file name; it
1350 @kbd{M-x load-library} differs from @kbd{M-x load-file} in that it 1352searches through each directory in the Emacs Lisp load path, trying to
1351searches a sequence of directories and tries three file names in each 1353find a file matching that library name. If the library name is
1352directory. Suppose your argument is @var{lib}; the three names are 1354@samp{@var{foo}}, it tries looking for files named
1353@file{@var{lib}.elc}, @file{@var{lib}.el}, and lastly just 1355@file{@var{foo}.elc}, @file{@var{foo}.el}, and lastly just
1354@file{@var{lib}}. If @file{@var{lib}.elc} exists, it is by convention 1356@file{@var{foo}}; the first one found is loaded. This command prefers
1355the result of compiling @file{@var{lib}.el}; it is better to load the 1357@file{.elc} files over @file{.el} files because compiled files load
1356compiled file, since it will load and run faster. 1358and run faster. If it finds that @file{@var{lib}.el} is newer than
1357 1359@file{@var{lib}.elc}, it issues a warning, in case someone made
1358 If @code{load-library} finds that @file{@var{lib}.el} is newer than 1360changes to the @file{.el} file and forgot to recompile it, but loads
1359@file{@var{lib}.elc} file, it issues a warning, because it's likely 1361the @file{.elc} file anyway. (Due to this behavior, you can save
1360that somebody made changes to the @file{.el} file and forgot to 1362unfinished edits to Emacs Lisp source files, and not recompile until
1361recompile it. Nonetheless, it loads @file{@var{lib}.elc}. This is 1363your changes are ready for use.)
1362because people often leave unfinished edits the source file, and don't 1364
1363recompile it until they think it is ready to use. 1365 Emacs Lisp programs usually load Emacs Lisp files using the
1366@code{load} function. This is similar to @code{load-library}, but is
1367lower-level and accepts additional arguments. @xref{How Programs Do
1368Loading,,, elisp, the Emacs Lisp Reference Manual}.
1364 1369
1365@vindex load-path 1370@vindex load-path
1366 The variable @code{load-path} specifies the sequence of directories 1371 The Emacs Lisp load path is specified by the variable
1367searched by @kbd{M-x load-library}. Its value should be a list of 1372@code{load-path}. Its value should be a list of directory names
1368strings that are directory names; in addition, @code{nil} in this list 1373(strings). These directories are searched, in the specified order, by
1369stands for the current default directory. (Generally, it is not a 1374the @kbd{M-x load-library} command, the lower-level @code{load}
1370good idea to put @code{nil} in the list; if you find yourself wishing 1375function, and other Emacs functions that find Emacs Lisp libraries. A
1376list entry in @code{load-path} can also have the special value
1377@code{nil}, which stands for the current default directory, but it is
1378almost always a bad idea to use this. (If you find yourself wishing
1371that @code{nil} were in the list, most likely what you really want is 1379that @code{nil} were in the list, most likely what you really want is
1372to do @kbd{M-x load-file} this once.) 1380to use @kbd{M-x load-file}.)
1373 1381
1374 The default value of @code{load-path} is a list of directories where 1382 The default value of @code{load-path} is a list of directories where
1375the Lisp code for Emacs itself is stored. If you have libraries of 1383the Lisp code for Emacs itself is stored. If you have libraries of
1376your own, put them in a single directory and add that directory to 1384your own in another directory, you can add that directory to the load
1377@code{load-path}, by adding a line like this to your init file 1385path. Unlike most other variables described in this manual,
1378(@pxref{Init File}): 1386@code{load-path} cannot be changed via the Customize interface
1387(@pxref{Easy Customization}), but you can add a directory to it by
1388putting a line like this in your init file (@pxref{Init File}):
1379 1389
1380@example 1390@example
1381(add-to-list 'load-path "/path/to/lisp/libraries") 1391(add-to-list 'load-path "/path/to/my/lisp/library")
1382@end example 1392@end example
1383 1393
1384@cindex autoload 1394@cindex autoload
1385 Some commands are @dfn{autoloaded}: when you run them, Emacs will 1395 Some commands are @dfn{autoloaded}: when you run them, Emacs
1386automatically load the associated library first. For instance, the 1396automatically loads the associated library first. For instance, the
1387@code{compile} and @code{compilation-mode} commands 1397@kbd{M-x compile} command (@pxref{Compilation}) is autoloaded; if you
1388(@pxref{Compilation}) are autoloaded; if you call either command, 1398call it, Emacs automatically loads the @code{compile} library first.
1389Emacs automatically loads the @code{compile} library. In contrast, 1399In contrast, the command @kbd{M-x recompile} is not autoloaded, so it
1390the command @code{recompile} is not autoloaded, so it is unavailable 1400is unavailable until you load the @code{compile} library.
1391until you load the @code{compile} library.
1392 1401
1393@vindex load-dangerous-libraries 1402@vindex load-dangerous-libraries
1394@cindex Lisp files byte-compiled by XEmacs 1403@cindex Lisp files byte-compiled by XEmacs
@@ -1399,38 +1408,35 @@ Emacs to crash. Set the variable @code{load-dangerous-libraries} to
1399 1408
1400@node Lisp Eval 1409@node Lisp Eval
1401@section Evaluating Emacs Lisp Expressions 1410@section Evaluating Emacs Lisp Expressions
1402@cindex Emacs-Lisp mode 1411@cindex Emacs Lisp mode
1403@cindex mode, Emacs-Lisp 1412@cindex mode, Emacs Lisp
1404 1413
1405@findex emacs-lisp-mode 1414@findex emacs-lisp-mode
1406 Lisp programs intended to be run in Emacs should be edited in 1415 Emacs Lisp mode is the major mode for editing Emacs Lisp. Its mode
1407Emacs-Lisp mode; this happens automatically for file names ending in 1416command is @kbd{M-x emacs-lisp-mode}.
1408@file{.el}. By contrast, Lisp mode itself is used for editing Lisp
1409programs intended for other Lisp systems. To switch to Emacs-Lisp mode
1410explicitly, use the command @kbd{M-x emacs-lisp-mode}.
1411
1412 For testing of Lisp programs to run in Emacs, it is often useful to
1413evaluate part of the program as it is found in the Emacs buffer. For
1414example, after changing the text of a Lisp function definition,
1415evaluating the definition installs the change for future calls to the
1416function. Evaluation of Lisp expressions is also useful in any kind of
1417editing, for invoking noninteractive functions (functions that are
1418not commands).
1419 1417
1420@table @kbd 1418 Emacs provides several commands for evaluating Emacs Lisp
1421@item M-: 1419expressions. You can use these commands in Emacs Lisp mode, to test
1422Read a single Lisp expression in the minibuffer, evaluate it, and print 1420your Emacs Lisp code as it is being written. For example, after
1423the value in the echo area (@code{eval-expression}). 1421re-writing a function, you can evaluate the function definition to
1424@item C-x C-e 1422make it take effect for subsequent function calls. These commands are
1425Evaluate the Lisp expression before point, and print the value in the 1423also available globally, and can be used outside Emacs Lisp mode.
1426echo area (@code{eval-last-sexp}). 1424
1427@item C-M-x 1425@table @asis
1426@item @kbd{M-:}
1427Read a single Emacs Lisp expression in the minibuffer, evaluate it,
1428and print the value in the echo area (@code{eval-expression}).
1429@item @kbd{C-x C-e}
1430Evaluate the Emacs Lisp expression before point, and print the value
1431in the echo area (@code{eval-last-sexp}).
1432@item @kbd{C-M-x} @r{(in Emacs Lisp mode)}
1433@itemx @kbd{M-x eval-defun}
1428Evaluate the defun containing or after point, and print the value in 1434Evaluate the defun containing or after point, and print the value in
1429the echo area (@code{eval-defun}). 1435the echo area (@code{eval-defun}).
1430@item M-x eval-region 1436@item @kbd{M-x eval-region}
1431Evaluate all the Lisp expressions in the region. 1437Evaluate all the Emacs Lisp expressions in the region.
1432@item M-x eval-buffer 1438@item @kbd{M-x eval-buffer}
1433Evaluate all the Lisp expressions in the buffer. 1439Evaluate all the Emacs Lisp expressions in the buffer.
1434@end table 1440@end table
1435 1441
1436@ifinfo 1442@ifinfo
@@ -1442,150 +1448,144 @@ Evaluate all the Lisp expressions in the buffer.
1442@kindex M-: 1448@kindex M-:
1443@end ifnotinfo 1449@end ifnotinfo
1444@findex eval-expression 1450@findex eval-expression
1445 @kbd{M-:} (@code{eval-expression}) is the most basic command for evaluating 1451 @kbd{M-:} (@code{eval-expression}) reads an expression using the
1446a Lisp expression interactively. It reads the expression using the 1452minibuffer, and evaluates it. (Before evaluating the expression, the
1447minibuffer, so you can execute any expression on a buffer regardless of 1453current buffer switches back to the buffer that was current when you
1448what the buffer contains. When the expression is evaluated, the current 1454typed @kbd{M-:}, not the minibuffer into which you typed the
1449buffer is once again the buffer that was current when @kbd{M-:} was 1455expression.)
1450typed.
1451
1452@kindex C-M-x @r{(Emacs-Lisp mode)}
1453@findex eval-defun
1454 In Emacs-Lisp mode, the key @kbd{C-M-x} is bound to the command
1455@code{eval-defun}, which parses the defun containing or following point
1456as a Lisp expression and evaluates it. The value is printed in the echo
1457area. This command is convenient for installing in the Lisp environment
1458changes that you have just made in the text of a function definition.
1459
1460 @kbd{C-M-x} treats @code{defvar} expressions specially. Normally,
1461evaluating a @code{defvar} expression does nothing if the variable it
1462defines already has a value. But @kbd{C-M-x} unconditionally resets the
1463variable to the initial value specified in the @code{defvar} expression.
1464@code{defcustom} expressions are treated similarly.
1465This special feature is convenient for debugging Lisp programs.
1466Typing @kbd{C-M-x} on a @code{defface} expression reinitializes
1467the face according to the @code{defface} specification.
1468 1456
1469@kindex C-x C-e 1457@kindex C-x C-e
1470@findex eval-last-sexp 1458@findex eval-last-sexp
1471 The command @kbd{C-x C-e} (@code{eval-last-sexp}) evaluates the Lisp 1459 The command @kbd{C-x C-e} (@code{eval-last-sexp}) evaluates the
1472expression preceding point in the buffer, and displays the value in the 1460Emacs Lisp expression preceding point in the buffer, and displays the
1473echo area. It is available in all major modes, not just Emacs-Lisp 1461value in the echo area. When the result of an evaluation is an
1474mode. It does not treat @code{defvar} specially. 1462integer, you can type @kbd{C-x C-e} a second time to display the value
1475 1463of the integer result in additional formats (octal, hexadecimal, and
1476 When the result of an evaluation is an integer, you can type 1464character).
1477@kbd{C-x C-e} a second time to display the value of the integer result 1465
1478in additional formats (octal, hexadecimal, and character). 1466 If @kbd{M-:} or @kbd{C-x C-e} is given a prefix argument, it inserts
1479 1467the value into the current buffer at point, rather than displaying it
1480 If @kbd{C-x C-e}, or @kbd{M-:} is given a numeric argument, it 1468in the echo area. The argument's value does not matter.
1481inserts the value into the current buffer at point, rather than 1469
1482displaying it in the echo area. The argument's value does not matter. 1470@kindex C-M-x @r{(Emacs Lisp mode)}
1483@kbd{C-M-x} with a numeric argument instruments the function 1471@findex eval-defun
1484definition for Edebug (@pxref{Instrumenting, Instrumenting for Edebug,, elisp, the Emacs Lisp Reference Manual}). 1472 The @code{eval-defun} command is bound to @kbd{C-M-x} in Emacs Lisp
1473mode. It evaluates the top-level Lisp expression containing or
1474following point, and prints the value in the echo area. In this
1475context, a top-level expression is referred to as a ``defun'', but it
1476need not be an actual @code{defun} (function definition). In
1477particular, this command treats @code{defvar} expressions specially.
1478Normally, evaluating a @code{defvar} expression does nothing if the
1479variable it defines already has a value. But this command
1480unconditionally resets the variable to the initial value specified by
1481the @code{defvar}; this is convenient for debugging Emacs Lisp
1482programs. @code{defcustom} and @code{defface} expressions are treated
1483similarly. Note that the other commands documented in this section do
1484not have this special feature.
1485
1486 With a prefix argument, @kbd{C-M-x} instruments the function
1487definition for Edebug, the Emacs Lisp Debugger. @xref{Instrumenting,
1488Instrumenting for Edebug,, elisp, the Emacs Lisp Reference Manual}.
1485 1489
1486@findex eval-region 1490@findex eval-region
1487@findex eval-buffer 1491@findex eval-buffer
1488 The most general command for evaluating Lisp expressions from a buffer 1492 The command @kbd{M-x eval-region} parses the text of the region as
1489is @code{eval-region}. @kbd{M-x eval-region} parses the text of the 1493one or more Lisp expressions, evaluating them one by one. @kbd{M-x
1490region as one or more Lisp expressions, evaluating them one by one. 1494eval-buffer} is similar but evaluates the entire buffer.
1491@kbd{M-x eval-buffer} is similar but evaluates the entire
1492buffer. This is a reasonable way to install the contents of a file of
1493Lisp code that you are ready to test. Later, as you find bugs and
1494change individual functions, use @kbd{C-M-x} on each function that you
1495change. This keeps the Lisp world in step with the source file.
1496 1495
1497@vindex eval-expression-print-level 1496@vindex eval-expression-print-level
1498@vindex eval-expression-print-length 1497@vindex eval-expression-print-length
1499@vindex eval-expression-debug-on-error 1498@vindex eval-expression-debug-on-error
1500 The two customizable variables @code{eval-expression-print-level} and 1499 The customizable variables @code{eval-expression-print-level} and
1501@code{eval-expression-print-length} control the maximum depth and length 1500@code{eval-expression-print-length} control the maximum depth and
1502of lists to print in the result of the evaluation commands before 1501length of lists to print in the result of the evaluation commands
1503abbreviating them. @code{eval-expression-debug-on-error} controls 1502before abbreviating them. @code{eval-expression-debug-on-error}
1504whether evaluation errors invoke the debugger when these commands are 1503controls whether evaluation errors invoke the debugger when these
1505used; its default is @code{t}. 1504commands are used; its default is @code{t}.
1506 1505
1507@node Lisp Interaction 1506@node Lisp Interaction
1508@section Lisp Interaction Buffers 1507@section Lisp Interaction Buffers
1509 1508
1509@findex lisp-interaction-mode
1510 When Emacs starts up, it contains a buffer named @samp{*scratch*}, 1510 When Emacs starts up, it contains a buffer named @samp{*scratch*},
1511which is provided for evaluating Lisp expressions interactively inside 1511which is provided for evaluating Emacs Lisp expressions interactively.
1512Emacs. Its major mode is Lisp Interaction mode. 1512Its major mode is Lisp Interaction mode. You can also enable Lisp
1513Interaction mode by typing @kbd{M-x lisp-interaction-mode}.
1513 1514
1514@findex eval-print-last-sexp 1515@findex eval-print-last-sexp
1515@kindex C-j @r{(Lisp Interaction mode)} 1516@kindex C-j @r{(Lisp Interaction mode)}
1516 The simplest way to use the @samp{*scratch*} buffer is to insert 1517 In the @samp{*scratch*} buffer, and other Lisp Interaction mode
1517Lisp expressions and type @kbd{C-j} (@code{eval-print-last-sexp}) 1518buffers, @kbd{C-j} (@code{eval-print-last-sexp}) evaluates the Lisp
1518after each expression. This command reads the Lisp expression before 1519expression before point, and inserts the value at point. Thus, as you
1519point, evaluates it, and inserts the value in printed representation 1520type expressions into the buffer followed by @kbd{C-j} after each
1520before point. The result is a complete typescript of the expressions 1521expression, the buffer records a transcript of the evaluated
1521you have evaluated and their values. 1522expressions and their values. All other commands in Lisp Interaction
1523mode are the same as in Emacs Lisp mode.
1522 1524
1523@vindex initial-scratch-message 1525@vindex initial-scratch-message
1524 At startup, the @samp{*scratch*} buffer contains a short message, in 1526 At startup, the @samp{*scratch*} buffer contains a short message, in
1525the form of a Lisp comment, that explains what it is for. This 1527the form of a Lisp comment, that explains what it is for. This
1526message is controlled by the variable @code{initial-scratch-message}, 1528message is controlled by the variable @code{initial-scratch-message},
1527which should be either a string or @code{nil}. If you set it to the 1529which should be either a string, or @code{nil} (which means to
1528empty string, or @code{nil}, the initial message is suppressed. 1530suppress the message).
1529
1530@findex lisp-interaction-mode
1531 All other commands in Lisp Interaction mode are the same as in Emacs
1532Lisp mode. You can enable Lisp Interaction mode by typing @kbd{M-x
1533lisp-interaction-mode}.
1534 1531
1535@findex ielm 1532@findex ielm
1536 An alternative way of evaluating Emacs Lisp expressions interactively 1533 An alternative way of evaluating Emacs Lisp expressions
1537is to use Inferior Emacs-Lisp mode, which provides an interface rather 1534interactively is to use Inferior Emacs Lisp mode, which provides an
1538like Shell mode (@pxref{Shell Mode}) for evaluating Emacs Lisp 1535interface rather like Shell mode (@pxref{Shell Mode}) for evaluating
1539expressions. Type @kbd{M-x ielm} to create an @samp{*ielm*} buffer 1536Emacs Lisp expressions. Type @kbd{M-x ielm} to create an
1540which uses this mode. For more information see that command's 1537@samp{*ielm*} buffer which uses this mode. For more information, see
1541documentation. 1538that command's documentation.
1542 1539
1543@node External Lisp 1540@node External Lisp
1544@section Running an External Lisp 1541@section Running an External Lisp
1542@cindex Lisp mode
1543@cindex mode, Lisp
1544@cindex Common Lisp
1545 1545
1546 Emacs has facilities for running programs in other Lisp systems. You can 1546 Lisp mode is the major mode for editing programs written in
1547run a Lisp process as an inferior of Emacs, and pass expressions to it to 1547general-purpose Lisp dialects, such as Common Lisp. Its mode command
1548be evaluated. You can also pass changed function definitions directly from 1548is @kbd{M-x lisp-mode}. Emacs uses Lisp mode automatically for files
1549the Emacs buffers in which you edit the Lisp programs to the inferior Lisp 1549whose names end in @file{.l}, @file{.lsp}, or @file{.lisp}.
1550process.
1551 1550
1552@findex run-lisp 1551@findex run-lisp
1553@vindex inferior-lisp-program 1552@vindex inferior-lisp-program
1554@kindex C-x C-z 1553@kindex C-x C-z
1555 To run an inferior Lisp process, type @kbd{M-x run-lisp}. This runs 1554 You can run an external Lisp session as a subprocess or
1556the program named @code{lisp}, the same program you would run by typing 1555@dfn{inferior process} of Emacs, and pass expressions to it to be
1557@code{lisp} as a shell command, with both input and output going through 1556evaluated. To begin an external Lisp session, type @kbd{M-x
1558an Emacs buffer named @samp{*lisp*}. That is to say, any ``terminal 1557run-lisp}. This runs the program named @command{lisp}, and sets it up
1559output'' from Lisp will go into the buffer, advancing point, and any 1558so that both input and output go through an Emacs buffer named
1560``terminal input'' for Lisp comes from text in the buffer. (You can 1559@samp{*inferior-lisp*}. To change the name of the Lisp program run by
1561change the name of the Lisp executable file by setting the variable 1560@kbd{M-x run-lisp}, change the variable @code{inferior-lisp-program}.
1562@code{inferior-lisp-program}.) 1561
1563 1562 The major mode for the @samp{*lisp*} buffer is Inferior Lisp mode,
1564 To give input to Lisp, go to the end of the buffer and type the input, 1563which combines the characteristics of Lisp mode and Shell mode
1565terminated by @key{RET}. The @samp{*lisp*} buffer is in Inferior Lisp 1564(@pxref{Shell Mode}). To send input to the Lisp session, go to the
1566mode, which combines the special characteristics of Lisp mode with most 1565end of the @samp{*lisp*} buffer and type the input, followed by
1567of the features of Shell mode (@pxref{Shell Mode}). The definition of 1566@key{RET}. Terminal output from the Lisp session is automatically
1568@key{RET} to send a line to a subprocess is one of the features of Shell 1567inserted in the buffer.
1569mode.
1570
1571@findex lisp-mode
1572 For the source files of programs to run in external Lisps, use Lisp
1573mode. You can switch to this mode with @kbd{M-x lisp-mode}, and it is
1574used automatically for files whose names end in @file{.l},
1575@file{.lsp}, or @file{.lisp}.
1576 1568
1577@kindex C-M-x @r{(Lisp mode)} 1569@kindex C-M-x @r{(Lisp mode)}
1578@findex lisp-eval-defun 1570@findex lisp-eval-defun
1579 When you edit a function in a Lisp program you are running, the easiest 1571 When you edit a Lisp program in Lisp mode, you can type @kbd{C-M-x}
1580way to send the changed definition to the inferior Lisp process is the key 1572(@code{lisp-eval-defun}) to send an expression from the Lisp mode
1581@kbd{C-M-x}. In Lisp mode, this runs the function @code{lisp-eval-defun}, 1573buffer to a Lisp session that you had started with @kbd{M-x run-lisp}.
1582which finds the defun around or following point and sends it as input to 1574The expression sent is the top-level Lisp expression at or following
1583the Lisp process. (Emacs can send input to any inferior process regardless 1575point. The resulting value goes as usual into the
1584of what buffer is current.) 1576@samp{*inferior-lisp*} buffer. Note that the effect of @kbd{C-M-x} in
1585 1577Lisp mode is thus very similar to its effect in Emacs Lisp mode
1586 Contrast the meanings of @kbd{C-M-x} in Lisp mode (for editing 1578(@pxref{Lisp Eval}), except that the expression is sent to a different
1587programs to be run in another Lisp system) and Emacs-Lisp mode (for 1579Lisp environment instead of being evaluated in Emacs.
1588editing Lisp programs to be run in Emacs; see @pxref{Lisp Eval}): in 1580
1589both modes it has the effect of installing the function definition 1581@findex scheme-mode
1590that point is in, but the way of doing so is different according to 1582@findex run-scheme
1591where the relevant Lisp environment is found. 1583@cindex Scheme mode
1584@cindex mode, Scheme
1585@kindex C-M-x @r{(Scheme mode)}
1586 The facilities for editing Scheme code, and for sending expressions
1587to a Scheme subprocess, are very similar. Scheme source files are
1588edited in Scheme mode, which can be explicitly enabled with @kbd{M-x
1589scheme-mode}. You can initiate a Scheme session by typing @kbd{M-x
1590run-scheme} (the buffer for interacting with Scheme is named
1591@samp{*scheme*}), and send expressions to it by typing @kbd{C-M-x}.
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi
index 8ecf0982e46..2cb02feee60 100644
--- a/doc/emacs/emacs.texi
+++ b/doc/emacs/emacs.texi
@@ -699,7 +699,7 @@ Compiling and Testing Programs
699* Executing Lisp:: Various modes for editing Lisp programs, 699* Executing Lisp:: Various modes for editing Lisp programs,
700 with different facilities for running 700 with different facilities for running
701 the Lisp programs. 701 the Lisp programs.
702* Lisp Libraries:: Creating Lisp programs to run in Emacs. 702* Lisp Libraries:: How Lisp programs are loaded into Emacs.
703* Lisp Eval:: Executing a single Lisp expression in Emacs. 703* Lisp Eval:: Executing a single Lisp expression in Emacs.
704* Lisp Interaction:: Executing Lisp in an Emacs buffer. 704* Lisp Interaction:: Executing Lisp in an Emacs buffer.
705* External Lisp:: Communicating through Emacs with a separate Lisp. 705* External Lisp:: Communicating through Emacs with a separate Lisp.
diff --git a/etc/NEWS b/etc/NEWS
index 7b778b64991..d778fe3e520 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -570,6 +570,7 @@ region (or with the left margin if there is no previous line).
570** browse-url has a new variable `browse-url-mailto-function' 570** browse-url has a new variable `browse-url-mailto-function'
571specifies how mailto: URLs are handled. The default is `browse-url-mail'. 571specifies how mailto: URLs are handled. The default is `browse-url-mail'.
572 572
573---
573** BibTeX mode 574** BibTeX mode
574 575
575*** BibTeX mode now supports biblatex. 576*** BibTeX mode now supports biblatex.
@@ -625,7 +626,7 @@ view-diary-entries, list-diary-entries, show-all-diary-entries
625** comint and modes derived from it use the generic completion code. 626** comint and modes derived from it use the generic completion code.
626 627
627** Compilation mode 628** Compilation mode
628 629---
629*** Compilation mode can be used without font-lock-mode. 630*** Compilation mode can be used without font-lock-mode.
630`compilation-parse-errors-function' is now obsolete. 631`compilation-parse-errors-function' is now obsolete.
631 632