#
This commit is contained in:
parent
f58395f66d
commit
6bf7aab684
52 changed files with 86258 additions and 0 deletions
465
man/ChangeLog
Normal file
465
man/ChangeLog
Normal file
|
@ -0,0 +1,465 @@
|
|||
1999-07-12 Richard Stallman <rms@gnu.org>
|
||||
|
||||
* Version 20.4 released.
|
||||
|
||||
1999-02-22 Andreas Schwab <schwab@gnu.org>
|
||||
|
||||
* gnus.texi: Fix punctuation after @xref.
|
||||
|
||||
1999-01-18 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* msdog.texi (MS-DOS and MULE): dos-unsupported-character-glyph is
|
||||
a triangle by default, not a solid box.
|
||||
|
||||
1999-01-17 Andrew Innes <andrewi@gnu.org>
|
||||
|
||||
* msdog.texi (MS-DOS Printing): Rewrite section.
|
||||
|
||||
* emacs.texi (Top): Include Windows 98 in the MS-DOS section.
|
||||
|
||||
1998-12-04 Markus Rost <rost@delysid.gnu.org>
|
||||
|
||||
* Makefile.in (INFO_TARGETS): Delete customize.info.
|
||||
(DVI_TARGETS): Delete customize.dvi.
|
||||
(../info/customize, customize.dvi): Targets deleted.
|
||||
|
||||
1998-11-18 Richard Stallman <rms@psilocin.ai.mit.edu>
|
||||
|
||||
* customize.texi: File deleted.
|
||||
|
||||
1998-11-08 Eli Zaretskii <eliz@mescaline.gnu.org>
|
||||
|
||||
* frames.texi: Change @xref to @pxref and add comma after @xref.
|
||||
* custom.texi (Locals): Likewise.
|
||||
* programs.texi (Fortran Autofill): Likewise.
|
||||
* text.texi (TeX Editing): Likewise.
|
||||
* viper.texi: Likewise.
|
||||
|
||||
1998-08-24 Andreas Schwab <schwab@delysid.gnu.org>
|
||||
|
||||
* reftex.texi: Fix info file name.
|
||||
|
||||
* forms.texi (Forms Commands): Change @item to @itemx for
|
||||
secondary items.
|
||||
* viper.texi (Groundwork): Likewise.
|
||||
(Commands): Remove extra Top from @node.
|
||||
|
||||
1998-08-19 Richard Stallman <rms@psilocin.ai.mit.edu>
|
||||
|
||||
* Version 20.3 released.
|
||||
|
||||
1998-08-10 Carsten Dominik <cd@delysid.gnu.org>
|
||||
|
||||
* reftex.texi: Updated to the latest RefTeX version.
|
||||
|
||||
1998-05-06 Richard Stallman <rms@psilocin.gnu.org>
|
||||
|
||||
* Makefile.in (EMACSSOURCES): Add mule.texi.
|
||||
Add msdog.texi, ack.texi. Remove gnu1.texi.
|
||||
|
||||
1998-04-06 Andreas Schwab <schwab@gnu.org>
|
||||
|
||||
* Makefile.in (ENVADD): Enviroment vars to pass to texi2dvi. Use
|
||||
it in dvi targets.
|
||||
(../etc/GNU): Change to $(srcdir) first.
|
||||
|
||||
1998-03-11 Carsten Dominik <cd@delysid.gnu.org>
|
||||
|
||||
* reftex.texi Updated for RefTeX version 3.22.
|
||||
|
||||
1998-02-08 Richard Stallman <rms@psilocin.gnu.org>
|
||||
|
||||
* Makefile.in (reftex.dvi, ../info/reftex): New targets.
|
||||
(INFO_TARGETS, DVI_TARGETS): Add the new targets.
|
||||
|
||||
1997-09-23 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* Makefile.in: Merge changes mistakenly made to `Makefile'.
|
||||
(INFO_TARGETS): Change ../info/custom to ../info/customize.
|
||||
(../info/customize): Renamed from ../info/custom.
|
||||
(../info/viper, viper.dvi): Remove dependency on viper-cmd.texi.
|
||||
|
||||
1997-09-19 Richard Stallman <rms@psilocin.gnu.ai.mit.edu>
|
||||
|
||||
* Version 20.2 released.
|
||||
|
||||
1997-09-15 Richard Stallman <rms@psilocin.gnu.ai.mit.edu>
|
||||
|
||||
* Version 20.1 released.
|
||||
|
||||
1997-08-24 Richard Stallman <rms@psilocin.gnu.ai.mit.edu>
|
||||
|
||||
* Makefile (../info/customize, customize.dvi): New targets.
|
||||
(INFO_TARGETS): Add ../info/customize.
|
||||
(DVI_TARGETS): Add customize.dvi.
|
||||
|
||||
1997-07-10 Richard Stallman <rms@psilocin.gnu.ai.mit.edu>
|
||||
|
||||
* Makefile (../info/viper, viper.dvi): Delete viper-cmd.texi dep.
|
||||
|
||||
1996-08-11 Richard Stallman <rms@psilocin.gnu.ai.mit.edu>
|
||||
|
||||
* Version 19.33 released.
|
||||
|
||||
1996-07-31 Richard Stallman <rms@psilocin.gnu.ai.mit.edu>
|
||||
|
||||
* Version 19.32 released.
|
||||
|
||||
1996-06-27 Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
|
||||
|
||||
* Makefile.in: Add rules for the Message manual.
|
||||
|
||||
1996-06-26 Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
|
||||
|
||||
* gnus.texi: New version.
|
||||
|
||||
* message.texi: New manual.
|
||||
|
||||
1996-06-20 Richard Stallman <rms@psilocin.gnu.ai.mit.edu>
|
||||
|
||||
* Makefile.in (All info targets): cd $(srcdir) to do the work.
|
||||
|
||||
1996-06-19 Richard Stallman <rms@psilocin.gnu.ai.mit.edu>
|
||||
|
||||
* Makefile.in (All info targets): Specify $(srcdir) in input files.
|
||||
Specify -I option.
|
||||
(All dvi targets): Set the TEXINPUTS variable.
|
||||
|
||||
1996-05-25 Karl Heuer <kwzh@gnu.ai.mit.edu>
|
||||
|
||||
* Version 19.31 released.
|
||||
|
||||
1996-01-07 Richard Stallman <rms@whiz-bang.gnu.ai.mit.edu>
|
||||
|
||||
* Makefile.in (../info/ccmode): Renamed from ../info/cc-mode.
|
||||
(INFO_TARGETS): Use new name. This avoids name conflict on MSDOS.
|
||||
|
||||
1995-11-29 Richard Stallman <rms@mole.gnu.ai.mit.edu>
|
||||
|
||||
* Makefile.in (../info/cc-mode, cc-mode.dvi): New targets.
|
||||
(INFO_TARGETS): Add ../info/cc-mode.
|
||||
(DVI_TARGETS): Add cc-mode.dvi.
|
||||
|
||||
1995-11-24 Richard Stallman <rms@mole.gnu.ai.mit.edu>
|
||||
|
||||
* Version 19.30 released.
|
||||
|
||||
1995-11-04 Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
|
||||
|
||||
* gnus.texi: New file.
|
||||
|
||||
1995-11-04 Erik Naggum <erik@naggum.no>
|
||||
|
||||
* gnus.texi: File deleted.
|
||||
|
||||
1995-11-02 Stephen Gildea <gildea@x.org>
|
||||
|
||||
* mh-e.texi: "Function Index" -> "Command Index" to work with
|
||||
Emacs 19.30 C-h C-k support of separately-documented commands.
|
||||
|
||||
1995-06-26 Richard Stallman <rms@mole.gnu.ai.mit.edu>
|
||||
|
||||
* Makefile.in (../info/ediff, ediff.dvi): New targets.
|
||||
(INFO_TARGETS, DVI_TARGETS): Add those new targets.
|
||||
|
||||
1995-04-24 Richard Stallman <rms@mole.gnu.ai.mit.edu>
|
||||
|
||||
* Makefile.in (INFO_TARGETS, DVI_TARGETS): Add viper targets.
|
||||
(../info/viper, viper.dvi): New targets.
|
||||
|
||||
1995-04-20 Kevin Rodgers <kevinr@ihs.com>
|
||||
|
||||
* dired-x.texi (Installation): Change the example to set
|
||||
buffer-local variables like dired-omit-files-p in
|
||||
dired-mode-hook.
|
||||
|
||||
1995-04-17 Richard Stallman <rms@mole.gnu.ai.mit.edu>
|
||||
|
||||
* Makefile.in (INFO_TARGETS, DVI_TARGETS): Add mh-e targets.
|
||||
(../info/mh-e, mh-e.dvi): New targets.
|
||||
|
||||
1995-02-07 Richard Stallman <rms@pogo.gnu.ai.mit.edu>
|
||||
|
||||
* Makefile.in (maintainer-clean): Renamed from realclean.
|
||||
|
||||
1994-11-23 Richard Stallman <rms@mole.gnu.ai.mit.edu>
|
||||
|
||||
* Makefile.in: New file.
|
||||
* Makefile: File deleted.
|
||||
|
||||
1994-11-19 Richard Stallman <rms@mole.gnu.ai.mit.edu>
|
||||
|
||||
* Makefile (TEXINDEX_OBJS): Variable deleted.
|
||||
(texindex, texindex.o, getopt.o): Rules deleted.
|
||||
All deps on texindex deleted.
|
||||
(distclean): Don't delete texindex.
|
||||
(mostlyclean): Don't delete *.o.
|
||||
* texindex.c, getopt.c: Files deleted.
|
||||
|
||||
1994-09-07 Richard Stallman <rms@mole.gnu.ai.mit.edu>
|
||||
|
||||
* Version 19.26 released.
|
||||
|
||||
1994-07-02 Richard Stallman (rms@gnu.ai.mit.edu)
|
||||
|
||||
* Makefile (EMACSSOURCES): Exclude undo.texi.
|
||||
|
||||
1994-05-30 Richard Stallman (rms@mole.gnu.ai.mit.edu)
|
||||
|
||||
* Version 19.25 released.
|
||||
|
||||
1994-05-23 Richard Stallman (rms@mole.gnu.ai.mit.edu)
|
||||
|
||||
* Version 19.24 released.
|
||||
|
||||
1994-05-16 Richard Stallman (rms@mole.gnu.ai.mit.edu)
|
||||
|
||||
* Version 19.23 released.
|
||||
|
||||
1994-04-17 Richard Stallman (rms@mole.gnu.ai.mit.edu)
|
||||
|
||||
* Makefile: Delete spurious tab.
|
||||
|
||||
1994-02-16 Richard Stallman (rms@mole.gnu.ai.mit.edu)
|
||||
|
||||
* Makefile (.SUFFIXES): New rule.
|
||||
|
||||
1994-01-15 Richard Stallman (rms@mole.gnu.ai.mit.edu)
|
||||
|
||||
* Makefile (dired-x.dvi, ../info/dired-x): New targets.
|
||||
(INFO_TARGETS, DVI_TARGETS): Add the new targets.
|
||||
|
||||
1994-01-08 Richard Stallman (rms@mole.gnu.ai.mit.edu)
|
||||
|
||||
* Makefile (../info/sc): Renamed frin sc.info.
|
||||
(../info/cl): Likewise.
|
||||
(INFO_TARGETS): Use new names.
|
||||
|
||||
1993-12-04 Richard Stallman (rms@srarc2)
|
||||
|
||||
* getopt.c: New file.
|
||||
* Makefile (TEXINDEX_OBJS): Use getopt.o in this dir, not ../lib-src.
|
||||
(getopt.o): New rule.
|
||||
(dvi): Don't depend on texindex.
|
||||
(emacs.dvi, cl.dvi, forms.dvi, vip.dvi, gnus.dvi, sc.dvi):
|
||||
Depend on texindex.
|
||||
|
||||
1993-12-03 Richard Stallman (rms@srarc2)
|
||||
|
||||
* Makefile (../info/sc.info): Renamed from ../info/sc.
|
||||
(TEXI2DVI): New variable.
|
||||
(emacs.dvi, cl.dvi forms.dvi, sc.dvi, vip.dvi, gnus.dvi, info.dvi):
|
||||
Add explicit commands.
|
||||
(TEXINDEX_OBJS): Delete duplicate getopt.o.
|
||||
|
||||
1993-11-27 Richard Stallman (rms@mole.gnu.ai.mit.edu)
|
||||
|
||||
* Version 19.22 released.
|
||||
|
||||
1993-11-18 Richard Stallman (rms@mole.gnu.ai.mit.edu)
|
||||
|
||||
* Makefile (TEXINDEX_OBJS): Delete spurious period.
|
||||
|
||||
1993-11-16 Richard Stallman (rms@mole.gnu.ai.mit.edu)
|
||||
|
||||
* Version 19.21 released.
|
||||
|
||||
1993-11-15 Paul Eggert (eggert@twinsun.com)
|
||||
|
||||
* man/Makefile (../info/cl.info): Renamed from ../info/cl.
|
||||
|
||||
1993-11-15 Richard Stallman (rms@mole.gnu.ai.mit.edu)
|
||||
|
||||
* Makefile (../etc/GNU): New target.
|
||||
(EMACSSOURCES): Add gnu1.texi.
|
||||
|
||||
1993-11-14 Richard Stallman (rms@mole.gnu.ai.mit.edu)
|
||||
|
||||
* Makefile (realclean): Don't delete the Info files.
|
||||
|
||||
1993-10-25 Brian Fox (bfox@albert.gnu.ai.mit.edu)
|
||||
|
||||
* forms.texi: Fix forms.texi so that it will format correctly.
|
||||
Added missing `@end iftex', fixed bad reference.
|
||||
|
||||
* info.texi, info-stn.texi: New files implement texinfo version of
|
||||
`info' file.
|
||||
|
||||
* frames.texi (Creating Frames): Mention `C-x 5' instead of `C-x
|
||||
4' where appropriate.
|
||||
|
||||
1993-10-20 Brian Fox (bfox@ai.mit.edu)
|
||||
|
||||
* Makefile: Fix targets for texindex, new info.texi files.
|
||||
* info-stnd.texi: New file implements info for standalone info
|
||||
reader.
|
||||
* info.texi: Updated to include recent changes to "../info/info".
|
||||
New source file for ../info/info; includes info-stnd.texi.
|
||||
|
||||
* texindex.c: Include "../src/config.h" if building in emacs.
|
||||
|
||||
* Makefile: Change all files to FILENAME.texi, force all targets
|
||||
to be FILENAME, not FILENAME.info. This changes sc.texinfo,
|
||||
vip.texinfo, forms.texinfo, cl.texinfo.
|
||||
Add target to build texindex.c, defining `emacs'.
|
||||
|
||||
* forms.texi: Install new file to match version 2.3 of forms.el.
|
||||
|
||||
1993-08-14 Richard Stallman (rms@mole.gnu.ai.mit.edu)
|
||||
|
||||
* Version 19.19 released.
|
||||
|
||||
1993-08-10 Simon Leinen (simon@lia.di.epfl.ch)
|
||||
|
||||
* sc.texinfo: Fix info file name.
|
||||
|
||||
* Makefile (info): Added gnus and sc.
|
||||
(dvi): Added gnus.dvi and sc.dvi.
|
||||
(../info/sc, sc.dvi): New targets.
|
||||
|
||||
1993-08-08 Richard Stallman (rms@mole.gnu.ai.mit.edu)
|
||||
|
||||
* Version 19.18 released.
|
||||
|
||||
1993-07-20 Richard Stallman (rms@mole.gnu.ai.mit.edu)
|
||||
|
||||
* Makefile: Fix source file names of the separate manuals.
|
||||
(gnus.dvi, ../info/gnus): New targets.
|
||||
|
||||
1993-07-18 Richard Stallman (rms@mole.gnu.ai.mit.edu)
|
||||
|
||||
* Version 19.17 released.
|
||||
|
||||
1993-07-10 Richard Stallman (rms@mole.gnu.ai.mit.edu)
|
||||
|
||||
* split-man: Fix typos in last change.
|
||||
|
||||
1993-07-06 Jim Blandy (jimb@geech.gnu.ai.mit.edu)
|
||||
|
||||
* Version 19.16 released.
|
||||
|
||||
1993-06-19 Jim Blandy (jimb@wookumz.gnu.ai.mit.edu)
|
||||
|
||||
* version 19.15 released.
|
||||
|
||||
1993-06-18 Jim Blandy (jimb@geech.gnu.ai.mit.edu)
|
||||
|
||||
* Makefile (distclean): It's rm, not rf.
|
||||
|
||||
1993-06-17 Jim Blandy (jimb@wookumz.gnu.ai.mit.edu)
|
||||
|
||||
* Version 19.14 released.
|
||||
|
||||
1993-06-16 Jim Blandy (jimb@wookumz.gnu.ai.mit.edu)
|
||||
|
||||
* Makefile: New file.
|
||||
|
||||
1993-06-08 Jim Blandy (jimb@wookumz.gnu.ai.mit.edu)
|
||||
|
||||
* Version 19.13 released.
|
||||
|
||||
1993-05-27 Jim Blandy (jimb@geech.gnu.ai.mit.edu)
|
||||
|
||||
* Version 19.9 released.
|
||||
|
||||
1993-05-25 Jim Blandy (jimb@wookumz.gnu.ai.mit.edu)
|
||||
|
||||
* Version 19.8 released.
|
||||
|
||||
1993-05-25 Jim Blandy (jimb@wookumz.gnu.ai.mit.edu)
|
||||
|
||||
* cmdargs.texi: Document the -i, -itype, and -iconic options.
|
||||
|
||||
* trouble.texi: It's `enable-flow-control-on', not
|
||||
`evade-flow-control-on'.
|
||||
|
||||
1993-05-24 Jim Blandy (jimb@wookumz.gnu.ai.mit.edu)
|
||||
|
||||
* display.texi: Document standard-display-european.
|
||||
|
||||
1993-05-22 Jim Blandy (jimb@geech.gnu.ai.mit.edu)
|
||||
|
||||
* Version 19.7 released.
|
||||
|
||||
* emacs.texi: Add a sentence to the top menu mentioning the
|
||||
specific version of Emacs this manual applies to.
|
||||
|
||||
1993-04-25 Eric S. Raymond (eric@mole.gnu.ai.mit.edu)
|
||||
|
||||
* basic.texi: Documented next-line-add-lines variable used to
|
||||
implement down-arrow.
|
||||
|
||||
* killing.texi: Documented kill-whole-line.
|
||||
|
||||
1993-04-18 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu)
|
||||
|
||||
* text.texi: Updated unix TeX ordering information.
|
||||
|
||||
1993-03-26 Eric S. Raymond (eric@geech.gnu.ai.mit.edu)
|
||||
|
||||
* news.texi: Mentioned fill-rectangle in keybinding list.
|
||||
|
||||
* killing.texi: Documented fill-rectangle.
|
||||
|
||||
1993-03-17 Eric S. Raymond (eric@mole.gnu.ai.mit.edu)
|
||||
|
||||
* vc.texi: Brought the docs up to date with VC 5.2.
|
||||
|
||||
1992-01-10 Eric S. Raymond (eric@mole.gnu.ai.mit.edu)
|
||||
|
||||
* emacs.tex: Mentioned blackbox and gomoku under Amusements.
|
||||
Assembler mode is now mentioned and appropriately
|
||||
indexed under Programming Modes.
|
||||
|
||||
1991-02-15 Robert J. Chassell (bob at wookumz.ai.mit.edu)
|
||||
|
||||
* emacs.tex: Updated TeX ordering information.
|
||||
|
||||
1990-08-30 David Lawrence (tale at pogo.ai.mit.edu)
|
||||
|
||||
* gnus.texinfo: New file. Removed installation instructions.
|
||||
|
||||
1990-06-26 David Lawrence (tale at geech)
|
||||
|
||||
* emacs.tex: Noted that completion-ignored-extensions is not used
|
||||
to filter out names when all completions are displayed in
|
||||
*Completions*.
|
||||
|
||||
1990-05-25 Richard Stallman (rms at sugar-bombs.ai.mit.edu)
|
||||
|
||||
* texindex.tex: If USG, include sys/types.h and sys/fcntl.h.
|
||||
|
||||
1990-03-21 Jim Kingdon (kingdon at pogo.ai.mit.edu)
|
||||
|
||||
* emacs.tex: Add @findex grep.
|
||||
|
||||
1989-01-17 Robert J. Chassell (bob at rice-chex.ai.mit.edu)
|
||||
|
||||
* texinfo.tex: Changed spelling of `\sc' font to `\smallcaps' and
|
||||
then defined `\sc' as the command for smallcaps in Texinfo. This
|
||||
measns that the @sc command will produce small caps. bfox has
|
||||
made the corresponding change to makeinfo and texinfm.el.
|
||||
|
||||
1988-08-16 Robert J. Chassell (bob at frosted-flakes.ai.mit.edu)
|
||||
|
||||
* emacs.tex: Corrected two typos. No other changes before
|
||||
Version 19 will be made.
|
||||
|
||||
* vip.texinfo: Removed menu entry Adding Lisp Code in node
|
||||
Customization since the menu entry did not point to anything.
|
||||
Also added an @finalout command to remove overfull hboxes from the
|
||||
printed output.
|
||||
|
||||
* cl.texinfo: Added @bye, \input line and @settitle to file.
|
||||
This file is clearly intended to be a chapter of some other work,
|
||||
but the other work does not yet exist.
|
||||
|
||||
1988-07-25 Robert J. Chassell (bob at frosted-flakes.ai.mit.edu)
|
||||
|
||||
* texinfo.texinfo: Three typos corrected.
|
||||
|
||||
1988-05-23 Robert J. Chassell (bob at frosted-flakes.ai.mit.edu)
|
||||
|
||||
* emacs.tex: Update information for obtaining TeX distribution from the
|
||||
University of Washington.
|
||||
|
420
man/abbrevs.texi
Normal file
420
man/abbrevs.texi
Normal file
|
@ -0,0 +1,420 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Abbrevs, Picture, Building, Top
|
||||
@chapter Abbrevs
|
||||
@cindex abbrevs
|
||||
@cindex expansion (of abbrevs)
|
||||
|
||||
A defined @dfn{abbrev} is a word which @dfn{expands}, if you insert
|
||||
it, into some different text. Abbrevs are defined by the user to expand
|
||||
in specific ways. For example, you might define @samp{foo} as an abbrev
|
||||
expanding to @samp{find outer otter}. Then you would be able to insert
|
||||
@samp{find outer otter } into the buffer by typing @kbd{f o o
|
||||
@key{SPC}}.
|
||||
|
||||
A second kind of abbreviation facility is called @dfn{dynamic abbrev
|
||||
expansion}. You use dynamic abbrev expansion with an explicit command
|
||||
to expand the letters in the buffer before point by looking for other
|
||||
words in the buffer that start with those letters. @xref{Dynamic
|
||||
Abbrevs}.
|
||||
|
||||
@menu
|
||||
* Abbrev Concepts:: Fundamentals of defined abbrevs.
|
||||
* Defining Abbrevs:: Defining an abbrev, so it will expand when typed.
|
||||
* Expanding Abbrevs:: Controlling expansion: prefixes, canceling expansion.
|
||||
* Editing Abbrevs:: Viewing or editing the entire list of defined abbrevs.
|
||||
* Saving Abbrevs:: Saving the entire list of abbrevs for another session.
|
||||
* Dynamic Abbrevs:: Abbreviations for words already in the buffer.
|
||||
* Dabbrev Customization:: What is a word, for dynamic abbrevs. Case handling.
|
||||
@end menu
|
||||
|
||||
@node Abbrev Concepts
|
||||
@section Abbrev Concepts
|
||||
|
||||
An @dfn{abbrev} is a word which has been defined to @dfn{expand} into
|
||||
a specified @dfn{expansion}. When you insert a word-separator character
|
||||
following the abbrev, that expands the abbrev---replacing the abbrev
|
||||
with its expansion. For example, if @samp{foo} is defined as an abbrev
|
||||
expanding to @samp{find outer otter}, then you can insert @samp{find
|
||||
outer otter.} into the buffer by typing @kbd{f o o .}.
|
||||
|
||||
@findex abbrev-mode
|
||||
@vindex abbrev-mode
|
||||
@cindex Abbrev mode
|
||||
@cindex mode, Abbrev
|
||||
Abbrevs expand only when Abbrev mode (a minor mode) is enabled.
|
||||
Disabling Abbrev mode does not cause abbrev definitions to be forgotten,
|
||||
but they do not expand until Abbrev mode is enabled again. The command
|
||||
@kbd{M-x abbrev-mode} toggles Abbrev mode; with a numeric argument, it
|
||||
turns Abbrev mode on if the argument is positive, off otherwise.
|
||||
@xref{Minor Modes}. @code{abbrev-mode} is also a variable; Abbrev mode is
|
||||
on when the variable is non-@code{nil}. The variable @code{abbrev-mode}
|
||||
automatically becomes local to the current buffer when it is set.
|
||||
|
||||
Abbrev definitions can be @dfn{mode-specific}---active only in one major
|
||||
mode. Abbrevs can also have @dfn{global} definitions that are active in
|
||||
all major modes. The same abbrev can have a global definition and various
|
||||
mode-specific definitions for different major modes. A mode-specific
|
||||
definition for the current major mode overrides a global definition.
|
||||
|
||||
Abbrevs can be defined interactively during the editing session. Lists
|
||||
of abbrev definitions can also be saved in files and reloaded in later
|
||||
sessions. Some users keep extensive lists of abbrevs that they load in
|
||||
every session.
|
||||
|
||||
@node Defining Abbrevs
|
||||
@section Defining Abbrevs
|
||||
|
||||
@table @kbd
|
||||
@item C-x a g
|
||||
Define an abbrev, using one or more words before point as its expansion
|
||||
(@code{add-global-abbrev}).
|
||||
@item C-x a l
|
||||
Similar, but define an abbrev specific to the current major mode
|
||||
(@code{add-mode-abbrev}).
|
||||
@item C-x a i g
|
||||
Define a word in the buffer as an abbrev (@code{inverse-add-global-abbrev}).
|
||||
@item C-x a i l
|
||||
Define a word in the buffer as a mode-specific abbrev
|
||||
(@code{inverse-add-mode-abbrev}).
|
||||
@item M-x kill-all-abbrevs
|
||||
This command discards all abbrev definitions currently in effect,
|
||||
leaving a blank slate.
|
||||
@end table
|
||||
|
||||
@kindex C-x a g
|
||||
@findex add-global-abbrev
|
||||
The usual way to define an abbrev is to enter the text you want the
|
||||
abbrev to expand to, position point after it, and type @kbd{C-x a g}
|
||||
(@code{add-global-abbrev}). This reads the abbrev itself using the
|
||||
minibuffer, and then defines it as an abbrev for one or more words before
|
||||
point. Use a numeric argument to say how many words before point should be
|
||||
taken as the expansion. For example, to define the abbrev @samp{foo} as
|
||||
mentioned above, insert the text @samp{find outer otter} and then type
|
||||
@kbd{C-u 3 C-x a g f o o @key{RET}}.
|
||||
|
||||
An argument of zero to @kbd{C-x a g} means to use the contents of the
|
||||
region as the expansion of the abbrev being defined.
|
||||
|
||||
@kindex C-x a l
|
||||
@findex add-mode-abbrev
|
||||
The command @kbd{C-x a l} (@code{add-mode-abbrev}) is similar, but
|
||||
defines a mode-specific abbrev. Mode-specific abbrevs are active only in a
|
||||
particular major mode. @kbd{C-x a l} defines an abbrev for the major mode
|
||||
in effect at the time @kbd{C-x a l} is typed. The arguments work the same
|
||||
as for @kbd{C-x a g}.
|
||||
|
||||
@kindex C-x a i g
|
||||
@findex inverse-add-global-abbrev
|
||||
@kindex C-x a i l
|
||||
@findex inverse-add-mode-abbrev
|
||||
If the text already in the buffer is the abbrev, rather than its
|
||||
expansion, use command @kbd{C-x a i g}
|
||||
(@code{inverse-add-global-abbrev}) instead of @kbd{C-x a g}, or use
|
||||
@kbd{C-x a i l} (@code{inverse-add-mode-abbrev}) instead of @kbd{C-x a
|
||||
l}. These commands are called ``inverse'' because they invert the
|
||||
meaning of the two text strings they use (one from the buffer and one
|
||||
read with the minibuffer).
|
||||
|
||||
To change the definition of an abbrev, just define a new definition.
|
||||
When the abbrev has a prior definition, the abbrev definition commands
|
||||
ask for confirmation for replacing it.
|
||||
|
||||
To remove an abbrev definition, give a negative argument to the abbrev
|
||||
definition command: @kbd{C-u - C-x a g} or @kbd{C-u - C-x a l}. The
|
||||
former removes a global definition, while the latter removes a
|
||||
mode-specific definition.
|
||||
|
||||
@findex kill-all-abbrevs
|
||||
@kbd{M-x kill-all-abbrevs} removes all the abbrev definitions there
|
||||
are, both global and local.
|
||||
|
||||
@node Expanding Abbrevs
|
||||
@section Controlling Abbrev Expansion
|
||||
|
||||
An abbrev expands whenever it is present in the buffer just before
|
||||
point and you type a self-inserting whitespace or punctuation character
|
||||
(@key{SPC}, comma, etc.@:). More precisely, any character that is not a
|
||||
word constituent expands an abbrev, and any word-constituent character
|
||||
can be part of an abbrev. The most common way to use an abbrev is to
|
||||
insert it and then insert a punctuation character to expand it.
|
||||
|
||||
@vindex abbrev-all-caps
|
||||
Abbrev expansion preserves case; thus, @samp{foo} expands into @samp{find
|
||||
outer otter}; @samp{Foo} into @samp{Find outer otter}, and @samp{FOO} into
|
||||
@samp{FIND OUTER OTTER} or @samp{Find Outer Otter} according to the
|
||||
variable @code{abbrev-all-caps} (a non-@code{nil} value chooses the first
|
||||
of the two expansions).
|
||||
|
||||
These commands are used to control abbrev expansion:
|
||||
|
||||
@table @kbd
|
||||
@item M-'
|
||||
Separate a prefix from a following abbrev to be expanded
|
||||
(@code{abbrev-prefix-mark}).
|
||||
@item C-x a e
|
||||
@findex expand-abbrev
|
||||
Expand the abbrev before point (@code{expand-abbrev}).
|
||||
This is effective even when Abbrev mode is not enabled.
|
||||
@item M-x expand-region-abbrevs
|
||||
Expand some or all abbrevs found in the region.
|
||||
@end table
|
||||
|
||||
@kindex M-'
|
||||
@findex abbrev-prefix-mark
|
||||
You may wish to expand an abbrev with a prefix attached; for example,
|
||||
if @samp{cnst} expands into @samp{construction}, you might want to use
|
||||
it to enter @samp{reconstruction}. It does not work to type
|
||||
@kbd{recnst}, because that is not necessarily a defined abbrev. What
|
||||
you can do is use the command @kbd{M-'} (@code{abbrev-prefix-mark}) in
|
||||
between the prefix @samp{re} and the abbrev @samp{cnst}. First, insert
|
||||
@samp{re}. Then type @kbd{M-'}; this inserts a hyphen in the buffer to
|
||||
indicate that it has done its work. Then insert the abbrev @samp{cnst};
|
||||
the buffer now contains @samp{re-cnst}. Now insert a non-word character
|
||||
to expand the abbrev @samp{cnst} into @samp{construction}. This
|
||||
expansion step also deletes the hyphen that indicated @kbd{M-'} had been
|
||||
used. The result is the desired @samp{reconstruction}.
|
||||
|
||||
If you actually want the text of the abbrev in the buffer, rather than
|
||||
its expansion, you can accomplish this by inserting the following
|
||||
punctuation with @kbd{C-q}. Thus, @kbd{foo C-q ,} leaves @samp{foo,} in
|
||||
the buffer.
|
||||
|
||||
@findex unexpand-abbrev
|
||||
If you expand an abbrev by mistake, you can undo the expansion and
|
||||
bring back the abbrev itself by typing @kbd{C-_} to undo (@pxref{Undo}).
|
||||
This also undoes the insertion of the non-word character that expanded
|
||||
the abbrev. If the result you want is the terminating non-word
|
||||
character plus the unexpanded abbrev, you must reinsert the terminating
|
||||
character, quoting it with @kbd{C-q}. You can also use the command
|
||||
@kbd{M-x unexpand-abbrev} to cancel the last expansion without
|
||||
deleting the terminating character.
|
||||
|
||||
@findex expand-region-abbrevs
|
||||
@kbd{M-x expand-region-abbrevs} searches through the region for defined
|
||||
abbrevs, and for each one found offers to replace it with its expansion.
|
||||
This command is useful if you have typed in text using abbrevs but forgot
|
||||
to turn on Abbrev mode first. It may also be useful together with a
|
||||
special set of abbrev definitions for making several global replacements at
|
||||
once. This command is effective even if Abbrev mode is not enabled.
|
||||
|
||||
Expanding an abbrev runs the hook @code{pre-abbrev-expand-hook}
|
||||
(@pxref{Hooks}).
|
||||
|
||||
@need 1500
|
||||
@node Editing Abbrevs
|
||||
@section Examining and Editing Abbrevs
|
||||
|
||||
@table @kbd
|
||||
@item M-x list-abbrevs
|
||||
Display a list of all abbrev definitions.
|
||||
@item M-x edit-abbrevs
|
||||
Edit a list of abbrevs; you can add, alter or remove definitions.
|
||||
@end table
|
||||
|
||||
@findex list-abbrevs
|
||||
The output from @kbd{M-x list-abbrevs} looks like this:
|
||||
|
||||
@example
|
||||
(lisp-mode-abbrev-table)
|
||||
"dk" 0 "define-key"
|
||||
(global-abbrev-table)
|
||||
"dfn" 0 "definition"
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
(Some blank lines of no semantic significance, and some other abbrev
|
||||
tables, have been omitted.)
|
||||
|
||||
A line containing a name in parentheses is the header for abbrevs in a
|
||||
particular abbrev table; @code{global-abbrev-table} contains all the global
|
||||
abbrevs, and the other abbrev tables that are named after major modes
|
||||
contain the mode-specific abbrevs.
|
||||
|
||||
Within each abbrev table, each nonblank line defines one abbrev. The
|
||||
word at the beginning of the line is the abbrev. The number that
|
||||
follows is the number of times the abbrev has been expanded. Emacs
|
||||
keeps track of this to help you see which abbrevs you actually use, so
|
||||
that you can eliminate those that you don't use often. The string at
|
||||
the end of the line is the expansion.
|
||||
|
||||
@findex edit-abbrevs
|
||||
@kindex C-c C-c @r{(Edit Abbrevs)}
|
||||
@kbd{M-x edit-abbrevs} allows you to add, change or kill abbrev
|
||||
definitions by editing a list of them in an Emacs buffer. The list has
|
||||
the same format described above. The buffer of abbrevs is called
|
||||
@samp{*Abbrevs*}, and is in Edit-Abbrevs mode. Type @kbd{C-c C-c} in
|
||||
this buffer to install the abbrev definitions as specified in the
|
||||
buffer---and delete any abbrev definitions not listed.
|
||||
|
||||
The command @code{edit-abbrevs} is actually the same as
|
||||
@code{list-abbrevs} except that it selects the buffer @samp{*Abbrevs*}
|
||||
whereas @code{list-abbrevs} merely displays it in another window.
|
||||
|
||||
@node Saving Abbrevs
|
||||
@section Saving Abbrevs
|
||||
|
||||
These commands allow you to keep abbrev definitions between editing
|
||||
sessions.
|
||||
|
||||
@table @kbd
|
||||
@item M-x write-abbrev-file @key{RET} @var{file} @key{RET}
|
||||
Write a file @var{file} describing all defined abbrevs.
|
||||
@item M-x read-abbrev-file @key{RET} @var{file} @key{RET}
|
||||
Read the file @var{file} and define abbrevs as specified therein.
|
||||
@item M-x quietly-read-abbrev-file @key{RET} @var{file} @key{RET}
|
||||
Similar but do not display a message about what is going on.
|
||||
@item M-x define-abbrevs
|
||||
Define abbrevs from definitions in current buffer.
|
||||
@item M-x insert-abbrevs
|
||||
Insert all abbrevs and their expansions into current buffer.
|
||||
@end table
|
||||
|
||||
@findex write-abbrev-file
|
||||
@kbd{M-x write-abbrev-file} reads a file name using the minibuffer and
|
||||
then writes a description of all current abbrev definitions into that
|
||||
file. This is used to save abbrev definitions for use in a later
|
||||
session. The text stored in the file is a series of Lisp expressions
|
||||
that, when executed, define the same abbrevs that you currently have.
|
||||
|
||||
@findex read-abbrev-file
|
||||
@findex quietly-read-abbrev-file
|
||||
@vindex abbrev-file-name
|
||||
@kbd{M-x read-abbrev-file} reads a file name using the minibuffer and
|
||||
then reads the file, defining abbrevs according to the contents of the
|
||||
file. @kbd{M-x quietly-read-abbrev-file} is the same except that it
|
||||
does not display a message in the echo area saying that it is doing its
|
||||
work; it is actually useful primarily in the @file{.emacs} file. If an
|
||||
empty argument is given to either of these functions, they use the file
|
||||
name specified in the variable @code{abbrev-file-name}, which is by
|
||||
default @code{"~/.abbrev_defs"}.
|
||||
|
||||
@vindex save-abbrevs
|
||||
Emacs will offer to save abbrevs automatically if you have changed any of
|
||||
them, whenever it offers to save all files (for @kbd{C-x s} or @kbd{C-x
|
||||
C-c}). This feature can be inhibited by setting the variable
|
||||
@code{save-abbrevs} to @code{nil}.
|
||||
|
||||
@findex insert-abbrevs
|
||||
@findex define-abbrevs
|
||||
The commands @kbd{M-x insert-abbrevs} and @kbd{M-x define-abbrevs} are
|
||||
similar to the previous commands but work on text in an Emacs buffer.
|
||||
@kbd{M-x insert-abbrevs} inserts text into the current buffer before point,
|
||||
describing all current abbrev definitions; @kbd{M-x define-abbrevs} parses
|
||||
the entire current buffer and defines abbrevs accordingly.@refill
|
||||
|
||||
@node Dynamic Abbrevs
|
||||
@section Dynamic Abbrev Expansion
|
||||
|
||||
The abbrev facility described above operates automatically as you insert
|
||||
text, but all abbrevs must be defined explicitly. By contrast,
|
||||
@dfn{dynamic abbrevs} allow the meanings of abbrevs to be determined
|
||||
automatically from the contents of the buffer, but dynamic abbrev expansion
|
||||
happens only when you request it explicitly.
|
||||
|
||||
@kindex M-/
|
||||
@kindex C-M-/
|
||||
@findex dabbrev-expand
|
||||
@findex dabbrev-completion
|
||||
@table @kbd
|
||||
@item M-/
|
||||
Expand the word in the buffer before point as a @dfn{dynamic abbrev},
|
||||
by searching in the buffer for words starting with that abbreviation
|
||||
(@code{dabbrev-expand}).
|
||||
|
||||
@item C-M-/
|
||||
Complete the word before point as a dynamic abbrev
|
||||
(@code{dabbrev-completion}).
|
||||
@end table
|
||||
|
||||
@vindex dabbrev-limit
|
||||
For example, if the buffer contains @samp{does this follow } and you
|
||||
type @kbd{f o M-/}, the effect is to insert @samp{follow} because that
|
||||
is the last word in the buffer that starts with @samp{fo}. A numeric
|
||||
argument to @kbd{M-/} says to take the second, third, etc.@: distinct
|
||||
expansion found looking backward from point. Repeating @kbd{M-/}
|
||||
searches for an alternative expansion by looking farther back. After
|
||||
scanning all the text before point, it searches the text after point.
|
||||
The variable @code{dabbrev-limit}, if non-@code{nil}, specifies how far
|
||||
in the buffer to search for an expansion.
|
||||
|
||||
@vindex dabbrev-check-all-buffers
|
||||
After scanning the current buffer, @kbd{M-/} normally searches other
|
||||
buffers, unless you have set @code{dabbrev-check-all-buffers} to
|
||||
@code{nil}.
|
||||
|
||||
A negative argument to @kbd{M-/}, as in @kbd{C-u - M-/}, says to
|
||||
search first for expansions after point, and second for expansions
|
||||
before point. If you repeat the @kbd{M-/} to look for another
|
||||
expansion, do not specify an argument. This tries all the expansions
|
||||
after point and then the expansions before point.
|
||||
|
||||
After you have expanded a dynamic abbrev, you can copy additional
|
||||
words that follow the expansion in its original context. Simply type
|
||||
@kbd{@key{SPC} M-/} for each word you want to copy. The spacing and
|
||||
punctuation between words is copied along with the words.
|
||||
|
||||
The command @kbd{C-M-/} (@code{dabbrev-completion}) performs
|
||||
completion of a dynamic abbreviation. Instead of trying the possible
|
||||
expansions one by one, it finds all of them, then inserts the text that
|
||||
they have in common. If they have nothing in common, @kbd{C-M-/}
|
||||
displays a list of completions, from which you can select a choice in
|
||||
the usual manner. @xref{Completion}.
|
||||
|
||||
Dynamic abbrev expansion is completely independent of Abbrev mode; the
|
||||
expansion of a word with @kbd{M-/} is completely independent of whether
|
||||
it has a definition as an ordinary abbrev.
|
||||
|
||||
@node Dabbrev Customization
|
||||
@section Customizing Dynamic Abbreviation
|
||||
|
||||
Normally, dynamic abbrev expansion ignores case when searching for
|
||||
expansions. That is, the expansion need not agree in case with the word
|
||||
you are expanding.
|
||||
|
||||
@vindex dabbrev-case-fold-search
|
||||
This feature is controlled by the variable
|
||||
@code{dabbrev-case-fold-search}. If it is @code{t}, case is ignored in
|
||||
this search; if @code{nil}, the word and the expansion must match in
|
||||
case. If the value of @code{dabbrev-case-fold-search} is
|
||||
@code{case-fold-search}, which is true by default, then the variable
|
||||
@code{case-fold-search} controls whether to ignore case while searching
|
||||
for expansions.
|
||||
|
||||
@vindex dabbrev-case-replace
|
||||
Normally, dynamic abbrev expansion preserves the case pattern @emph{of
|
||||
the abbrev you have typed}, by converting the expansion to that case
|
||||
pattern.
|
||||
|
||||
@vindex dabbrev-case-fold-search
|
||||
The variable @code{dabbrev-case-replace} controls whether to preserve
|
||||
the case pattern of the abbrev. If it is @code{t}, the abbrev's case
|
||||
pattern is preserved in most cases; if @code{nil}, the expansion is
|
||||
always copied verbatim. If the value of @code{dabbrev-case-replace} is
|
||||
@code{case-replace}, which is true by default, then the variable
|
||||
@code{case-replace} controls whether to copy the expansion verbatim.
|
||||
|
||||
However, if the expansion contains a complex mixed case pattern, and
|
||||
the abbrev matches this pattern as far as it goes, then the expansion is
|
||||
always copied verbatim, regardless of those variables. Thus, for
|
||||
example, if the buffer contains @code{variableWithSillyCasePattern}, and
|
||||
you type @kbd{v a M-/}, it copies the expansion verbatim including its
|
||||
case pattern.
|
||||
|
||||
@vindex dabbrev-abbrev-char-regexp
|
||||
The variable @code{dabbrev-abbrev-char-regexp}, if non-@code{nil},
|
||||
controls which characters are considered part of a word, for dynamic expansion
|
||||
purposes. The regular expression must match just one character, never
|
||||
two or more. The same regular expression also determines which
|
||||
characters are part of an expansion. The value @code{nil} has a special
|
||||
meaning: abbreviations are made of word characters, but expansions are
|
||||
made of word and symbol characters.
|
||||
|
||||
@vindex dabbrev-abbrev-skip-leading-regexp
|
||||
In shell scripts and makefiles, a variable name is sometimes prefixed
|
||||
with @samp{$} and sometimes not. Major modes for this kind of text can
|
||||
customize dynamic abbreviation to handle optional prefixes by setting
|
||||
the variable @code{dabbrev-abbrev-skip-leading-regexp}. Its value
|
||||
should be a regular expression that matches the optional prefix that
|
||||
dynamic abbreviation should ignore.
|
902
man/ack.texi
Normal file
902
man/ack.texi
Normal file
|
@ -0,0 +1,902 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1994, 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Acknowledgments, Screen, Concept Index, Top
|
||||
@chapter Acknowledgments
|
||||
|
||||
Many people have contributed code included in the Free Software
|
||||
Foundation's distribution of GNU Emacs. To show our appreciation for
|
||||
their public spirit, we list here those who have written substantial
|
||||
portions.
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Per Abrahamsen wrote the customization buffer facilities, as well as
|
||||
@file{double.el} for typing accented characters not normally available
|
||||
from the keyboard, @file{xt-mouse.el} which handles mouse commands
|
||||
through Xterm, and @file{cpp.el} which hides or highlights parts of C
|
||||
programs according to preprocessor conditionals.
|
||||
|
||||
@item
|
||||
Jay K. Adams wrote @file{jka-compr.el}, providing automatic
|
||||
decompression and recompression for compressed files.
|
||||
|
||||
@item
|
||||
Joe Arceneaux wrote the original text property implementation, and
|
||||
implemented support for X11.
|
||||
|
||||
@item
|
||||
Boaz Ben-Zvi wrote @file{profile.el}, to time Emacs Lisp functions.
|
||||
|
||||
@item
|
||||
Jim Blandy wrote Emacs 19's input system, brought its configuration and
|
||||
build process up to the GNU coding standards, and contributed to the
|
||||
frame support and multi-face support.
|
||||
|
||||
@item
|
||||
Terrence M. Brannon wrote @file{landmark.el}, a neural-network robot
|
||||
that learns landmarks.
|
||||
|
||||
@item
|
||||
Frank Bresz wrote @file{diff.el}, a program to display @code{diff}
|
||||
output.
|
||||
|
||||
@item
|
||||
Peter Breton implemented @file{dirtrack} which does better tracking of
|
||||
directory changes in shell buffers, @file{filecache.el} which records
|
||||
which directories your files are in, @file{locate.el} which interfaces
|
||||
to the @code{locate} command, @file{net-utils.el}, and the ``generic
|
||||
mode'' feature.
|
||||
|
||||
@item
|
||||
Kevin Broadey wrote @file{foldout.el}, providing folding extensions to
|
||||
Emacs's outline modes.
|
||||
|
||||
@item
|
||||
Vincent Broman wrote @file{ada.el}, a mode for editing Ada code
|
||||
(since replaced by @file{ada-mode.el}).
|
||||
|
||||
@item
|
||||
David M. Brown wrote @file{array.el}, for editing arrays and other
|
||||
tabular data.
|
||||
|
||||
@item
|
||||
Bill Carpenter provided @file{feedmail.el}.
|
||||
|
||||
@item
|
||||
Hans Chalupsky wrote @file{advice.el}, an overloading mechanism for
|
||||
Emacs Lisp functions, and @file{trace.el}, a tracing facility for Emacs
|
||||
Lisp.
|
||||
|
||||
@item
|
||||
Bob Chassell wrote @file{texnfo-upd.el} and @file{makeinfo.el}, modes
|
||||
and utilities for working with Texinfo files.
|
||||
|
||||
@item
|
||||
James Clark wrote @file{sgml-mode.el}, a mode for editing SGML
|
||||
documents, and contributed to Emacs's dumping procedures.
|
||||
|
||||
@item
|
||||
Mike Clarkson wrote @file{edt.el}, an emulation of DEC's EDT editor.
|
||||
|
||||
@item
|
||||
Glynn Clements provided @file{gamegrid.el} and a couple of games that
|
||||
use it, Snake and Tetris.
|
||||
|
||||
@item
|
||||
Andrew Csillag wrote M4 mode (@file{m4-mode.el}).
|
||||
|
||||
@item
|
||||
Doug Cutting and Jamie Zawinski wrote @file{disass.el}, a disassembler
|
||||
for compiled Emacs Lisp code.
|
||||
|
||||
@item
|
||||
Michael DeCorte wrote @file{emacs.csh}, a C-shell script that starts a
|
||||
new Emacs job, or restarts a paused Emacs if one exists.
|
||||
|
||||
@item
|
||||
Gary Delp wrote @file{mailpost.el}, an interface between RMAIL and the
|
||||
@file{/usr/uci/post} mailer.
|
||||
|
||||
@item
|
||||
Matthieu Devin wrote @file{delsel.el}, a package to make newly-typed
|
||||
text replace the current selection.
|
||||
|
||||
@item
|
||||
Eric Ding contributed @file{goto-addr.el},
|
||||
|
||||
@item
|
||||
Carsten Dominik wrote @file{reftex.el}, a package for setting up
|
||||
labels and cross-references for La@TeX{}.
|
||||
|
||||
@item
|
||||
Scott Draves wrote @file{tq.el}, help functions for maintaining
|
||||
transaction queues between Emacs and its subprocesses.
|
||||
|
||||
@item
|
||||
Viktor Dukhovni wrote support for dumping under SunOS version 4.
|
||||
|
||||
@item
|
||||
John Eaton co-wrote Octave mode (@file{octave.el} and related files).
|
||||
|
||||
@item
|
||||
Rolf Ebert co-wrote Ada mode (@file{ada-mode.el}).
|
||||
|
||||
@item
|
||||
Stephen Eglen implemented @file{mspools.el}, for use with Procmail,
|
||||
which tells you which mail folders have mail waiting in them, and
|
||||
@file{iswitchb.el}, a feature for incremental reading and completion of
|
||||
buffer names.
|
||||
|
||||
@item
|
||||
@c iftex
|
||||
Torbj@"orn
|
||||
@c end iftex
|
||||
@c ifinfo
|
||||
@c Torbjorn
|
||||
@c end ifinfo
|
||||
Einarsson contributed F90 mode (@file{f90.el}).
|
||||
|
||||
@item
|
||||
Tsugutomo Enami co-wrote the support for international character sets.
|
||||
|
||||
@item
|
||||
Hans Henrik Eriksen wrote @file{simula.el}, a mode for editing SIMULA 87
|
||||
code.
|
||||
|
||||
@item
|
||||
Michael Ernst wrote @file{reposition.el}, a command for recentering a
|
||||
function's source code and preceding comment on the screen.
|
||||
|
||||
@item
|
||||
Ata Etemadi wrote @file{cdl.el}, functions for working with Common Data
|
||||
Language source code.
|
||||
|
||||
@item
|
||||
Frederick Farnback implemented @file{morse.el}, which converts text to
|
||||
morse code.
|
||||
|
||||
@item
|
||||
Fred Fish wrote the support for dumping COFF executable files.
|
||||
|
||||
@item
|
||||
Karl Fogel wrote:
|
||||
@itemize @bullet
|
||||
@item
|
||||
@file{bookmark.el}, for creating named placeholders, saving them and
|
||||
jumping to them later,
|
||||
@item
|
||||
@file{mail-hist.el}, a history mechanism for outgoing mail messages, and
|
||||
@item
|
||||
@file{saveplace.el}, for preserving point's location in files between
|
||||
editing sessions.
|
||||
@end itemize
|
||||
|
||||
@item
|
||||
Gary Foster wrote the emulation for CRiSP: @file{crisp.el} and
|
||||
@file{scroll-lock.el}.
|
||||
|
||||
@item
|
||||
Noah Friedman wrote @file{rlogin.el}, an interface to Rlogin, and
|
||||
@file{type-break.el}, which reminds you to take periodic breaks from
|
||||
typing. With Roland McGrath, he wrote @file{rsz-mini.el}, a minor mode
|
||||
to automatically resize the minibuffer to fit the text it contains.
|
||||
|
||||
@item
|
||||
Keith Gabryelski wrote @file{hexl.el}, a mode for editing binary files.
|
||||
|
||||
@item
|
||||
Kevin Gallagher rewrote and enhanced the EDT emulation, and wrote
|
||||
@file{flow-ctrl.el}, a package for coping with unsuppressible XON/XOFF
|
||||
flow control.
|
||||
|
||||
@item
|
||||
Kevin Gallo added multiple-frame support for Windows NT.
|
||||
|
||||
@item
|
||||
Howard Gayle wrote:
|
||||
@itemize @bullet
|
||||
@item
|
||||
the C and lisp code for display tables and case tables,
|
||||
@item
|
||||
@file{rot13.el}, a command to display the plaintext form of a buffer
|
||||
encoded with the Caesar cipher,
|
||||
@item
|
||||
much of the support for the ISO-8859 European character set (which
|
||||
includes @file{iso-ascii.el}, @file{iso-insert.el}, @file{iso-swed.el},
|
||||
@file{iso-syntax.el}, @file{iso-transl.el}, and @file{swedish.el}), and
|
||||
@item
|
||||
@file{vt100-led.el}, a package for controlling the LED's on
|
||||
VT100-compatible terminals.
|
||||
@end itemize
|
||||
|
||||
@item
|
||||
Stephen Gildea made the Emacs quick reference card.
|
||||
|
||||
@item
|
||||
David Gillespie wrote:
|
||||
@itemize @bullet
|
||||
@item
|
||||
Emacs 19's Common Lisp compatibility packages, replacing the old package
|
||||
by Cesar Augusto Quiroz Gonzalez,
|
||||
@item
|
||||
@file{complete.el}, a partial completion mechanism, and
|
||||
@item
|
||||
@file{edmacro.el}, a package for editing keyboard macros.
|
||||
@end itemize
|
||||
|
||||
@item
|
||||
Bob Glickstein contributed the @file{sregex.el} feature.
|
||||
|
||||
@item
|
||||
Boris Goldowsky wrote @file{avoid.el}, a package to keep the mouse
|
||||
cursor out of the way of the text cursor; @file{shadowfile.el}, a
|
||||
package for keeping identical copies of files in more than one place;
|
||||
@file{enriched.el}, a package for saving text properties in files;
|
||||
and @file{facemenu.el}, a package for specifying faces.
|
||||
|
||||
@item
|
||||
Michelangelo Grigni wrote @file{ffap.el} which visits a file,
|
||||
taking the file name from the buffer.
|
||||
|
||||
@item
|
||||
Odd Gripenstam wrote @file{dcl-mode.el}.
|
||||
|
||||
@item
|
||||
Michael Gschwind wrote @file{iso-cvt.el}, a package to convert between
|
||||
the ISO 8859-1 character set and the notations for non-@code{ASCII}
|
||||
characters used by @TeX{} and net tradition.
|
||||
|
||||
@item
|
||||
Henry Guillaume wrote @file{find-file.el}, a package to visit files
|
||||
related to the currently visited file.
|
||||
|
||||
@item
|
||||
Doug Gwyn wrote the portable @code{alloca} implementation.
|
||||
|
||||
@item
|
||||
Ken'ichi Handa implemented most of the support for international
|
||||
character sets.
|
||||
|
||||
@item
|
||||
Chris Hanson wrote @file{netuname.el}, a package to use HP-UX's Remote
|
||||
File Access facility from Emacs.
|
||||
|
||||
@item
|
||||
K. Shane Hartman wrote:
|
||||
@itemize @bullet
|
||||
@item
|
||||
@file{chistory.el} and @file{echistory.el}, packages for browsing
|
||||
command history lists,
|
||||
@item
|
||||
@file{electric.el} and @file{helper.el}, providing an alternative
|
||||
command loop and appropriate help facilities,
|
||||
@item
|
||||
@file{emacsbug.el}, a package for reporting Emacs bugs,
|
||||
@item
|
||||
@file{picture.el}, a mode for editing ASCII pictures, and
|
||||
@item
|
||||
@file{view.el}, a package for perusing files and buffers without editing
|
||||
them.
|
||||
@end itemize
|
||||
|
||||
@item
|
||||
John Heidemann wrote @file{mouse-copy.el} and @file{mouse-drag.el},
|
||||
which provide alternative mouse-based editing and scrolling features.
|
||||
|
||||
@item
|
||||
Markus Heritsch co-wrote Ada mode (@file{ada-mode.el}).
|
||||
|
||||
@item
|
||||
Karl Heuer wrote the original blessmail script, implemented the
|
||||
@code{intangible} text property, and rearranged the structure of the
|
||||
@code{Lisp_Object} type to allow for more data bits.
|
||||
|
||||
@item
|
||||
Manabu Higashida ported Emacs to the MS-DOS operating system.
|
||||
|
||||
@item
|
||||
Anders Holst wrote @file{hippie-exp.el}, a versatile completion and
|
||||
expansion package.
|
||||
|
||||
@item
|
||||
Kurt Hornik co-wrote Octave mode (@file{octave.el} and related files).
|
||||
|
||||
@item
|
||||
Tom Houlder wrote @file{mantemp.el}, which generates manual C++ template
|
||||
instantiations.
|
||||
|
||||
@item
|
||||
Lars Ingebrigtsen did a major redesign of the GNUS newsreader.
|
||||
|
||||
@item
|
||||
Andrew Innes contributed extensively to the Windows NT support.
|
||||
|
||||
@item
|
||||
Kyle Jones wrote @file{life.el}, a package to play Conway's ``life'' game,
|
||||
and @file{mldrag.el}, a package which allows the user to resize windows
|
||||
by dragging mode lines and vertical window separators with the mouse.
|
||||
|
||||
@item
|
||||
Tomoji Kagatani implemented @file{smtpmail.el}, used for sending out
|
||||
mail with SMTP.
|
||||
|
||||
@item
|
||||
David Kaufman wrote @file{yow.c}, an essential utility program for the
|
||||
hopelessly pinheaded.
|
||||
|
||||
@item
|
||||
Henry Kautz wrote @file{bib-mode.el}, a mode for maintaining
|
||||
bibliography databases compatible with @code{refer} (the @code{troff}
|
||||
version) and @code{lookbib}, and @file{refbib.el}, a package to convert
|
||||
those databases to the format used by the LaTeX text formatting package.
|
||||
|
||||
@item
|
||||
Howard Kaye wrote @file{sort.el}, commands to sort text in Emacs
|
||||
buffers.
|
||||
|
||||
@item
|
||||
Michael Kifer wrote @file{ediff.el}, an interactive interface to the
|
||||
@code{diff} and @code{patch} programs, and Viper, the newest emulation
|
||||
for VI.
|
||||
|
||||
@item
|
||||
Richard King wrote the first version of @file{userlock.el} and
|
||||
@file{filelock.c}, which provide simple support for multiple users
|
||||
editing the same file.
|
||||
@c We're not using his backquote.el any more.
|
||||
|
||||
@item
|
||||
Larry K. Kolodney wrote @file{cvtmail.c}, a program to convert the mail
|
||||
directories used by Gosling Emacs into RMAIL format.
|
||||
|
||||
@item
|
||||
Robert Krawitz wrote the original @file{xmenu.c}, part of Emacs's pop-up
|
||||
menu support.
|
||||
|
||||
@item
|
||||
Sebastian Kremer wrote Emacs 19's @code{dired-mode}, with contributions
|
||||
by Lawrence R. Dodd.
|
||||
|
||||
@item
|
||||
Geoff Kuenning wrote Emacs 19's @file{ispell.el}, based on work by Ken
|
||||
Stevens and others.
|
||||
|
||||
@item
|
||||
David K@ringaccent{a}gedal wrote @file{tempo.el}, providing support for
|
||||
easy insertion of boilerplate text and other common constructions.
|
||||
|
||||
@item
|
||||
Daniel LaLiberte wrote:
|
||||
@itemize @bullet
|
||||
@item
|
||||
@file{edebug.el}, a source-level debugger for Emacs Lisp,
|
||||
@item
|
||||
@file{cl-specs.el}, specifications to help @code{edebug} debug code
|
||||
written using David Gillespie's Common Lisp support,
|
||||
@item
|
||||
@file{cust-print.el}, a customizable package for printing lisp objects,
|
||||
@item
|
||||
@file{eval-reg.el}, a re-implementation of @code{eval-region} in Emacs
|
||||
Lisp, and
|
||||
@item
|
||||
@file{isearch.el}, Emacs 19's incremental search minor mode.
|
||||
@end itemize
|
||||
|
||||
@item
|
||||
James R. Larus wrote @file{mh-e.el}, an interface to the MH mail system.
|
||||
|
||||
@item
|
||||
Frederic Lepied contributed @file{expand.el}, which uses the abbrev
|
||||
mechanism for inserting programming constructs.
|
||||
|
||||
@item
|
||||
Lars Lindberg wrote @file{msb.el}, which provides more flexible menus
|
||||
for buffer selection, and rewrote @file{dabbrev.el}.
|
||||
|
||||
@item
|
||||
Eric Ludlam wrote the Speedbar package and @file{checkdoc.el}.
|
||||
|
||||
@item
|
||||
Neil M. Mager wrote @file{appt.el}, functions to notify users of their
|
||||
appointments. It finds appointments recorded in the diary files
|
||||
generated by Edward M. Reingold's @code{calendar} package.
|
||||
|
||||
@item
|
||||
Ken Manheimer wrote @file{allout.el}, a mode for manipulating and
|
||||
formatting outlines, and @file{icomplete.el}, which provides incremental
|
||||
completion feedback in the minibuffer.
|
||||
|
||||
@item
|
||||
Bill Mann wrote @file{perl-mode.el}, a mode for editing Perl code.
|
||||
|
||||
@item
|
||||
Brian Marick and Daniel LaLiberte wrote @file{hideif.el}, support for
|
||||
hiding selected code within C @code{#ifdef} clauses.
|
||||
|
||||
@item
|
||||
Simon Marshall wrote:
|
||||
@itemize @bullet
|
||||
@item
|
||||
@file{fast-lock.el}, which caches the face data computed by Font Lock mode,
|
||||
@item
|
||||
@file{lazy-lock.el}, which delays fontification in Font Lock mode
|
||||
until text is actually displayed, and
|
||||
@item
|
||||
@file{regexp-opt.el}, which generates a regular expression from a list
|
||||
of strings.
|
||||
@end itemize
|
||||
|
||||
@item
|
||||
Bengt Martensson, Mark Shapiro, Mike Newton, Aaron Larson, and Stefan
|
||||
Schoef, wrote @file{bibtex.el}, a mode for editing Bib@TeX{}
|
||||
bibliography files.
|
||||
|
||||
@item
|
||||
Charlie Martin wrote @file{autoinsert.el}, which provides automatic
|
||||
mode-sensitive insertion of text into new files.
|
||||
|
||||
@item
|
||||
Thomas May wrote @file{blackbox.el}, a version of the traditional
|
||||
blackbox game.
|
||||
|
||||
@item
|
||||
Roland McGrath wrote:
|
||||
@itemize @bullet
|
||||
@item
|
||||
@file{compile.el}, a package for running compilations in a buffer, and
|
||||
then visiting the locations reported in error messages,
|
||||
@item
|
||||
@file{etags.el}, a package for jumping to function definitions and
|
||||
searching or replacing in all the files mentioned in a @file{TAGS} file,
|
||||
@item
|
||||
@file{find-dired.el}, for using @code{dired} commands on output from the
|
||||
@code{find} program, with Sebastian Kremer,
|
||||
@item
|
||||
@file{map-ynp.el}, a general purpose boolean question-asker,
|
||||
@item
|
||||
@file{autoload.el}, providing semi-automatic maintenance of autoload
|
||||
files, and
|
||||
@item
|
||||
@file{upd-copyr.el}, providing semi-automatic maintenance of copyright
|
||||
notices in source code.
|
||||
@end itemize
|
||||
|
||||
@item
|
||||
David Megginson wrote @file{derived.el}, which allows one to define new
|
||||
major modes by inheriting key bindings and commands from existing major
|
||||
modes.
|
||||
|
||||
@item
|
||||
Wayne Mesard wrote @file{hscroll.el} which does horizontal scrolling
|
||||
automatically.
|
||||
|
||||
@item
|
||||
Richard Mlynarik wrote:
|
||||
@itemize @bullet
|
||||
@item
|
||||
@file{cl-indent.el}, a package for indenting Common Lisp code,
|
||||
@item
|
||||
@file{ebuff-menu.el}, an ``electric'' browser for buffer listings,
|
||||
@item
|
||||
@file{ehelp.el}, bindings for browsing help screens,
|
||||
@item
|
||||
@file{rfc822.el}, a parser for E-mail addresses in the RFC-822 format,
|
||||
used in mail messages and news articles,
|
||||
@item
|
||||
@file{terminal.el}, a terminal emulator for Emacs subprocesses, and
|
||||
@item
|
||||
@file{yow.el}, an essential utility (try @kbd{M-x yow}).
|
||||
@end itemize
|
||||
|
||||
@item
|
||||
Keith Moore wrote @file{aixcc.lex}, a pre-processor designed to help
|
||||
Emacs parse the error messages produced by the AIX C compiler.
|
||||
|
||||
@item
|
||||
Erik Naggum wrote the time-conversion functions, and has tested the
|
||||
latest source code daily.
|
||||
|
||||
@item
|
||||
Thomas Neumann and Eric Raymond wrote @file{makefile.el}, a mode for
|
||||
editing makefiles.
|
||||
|
||||
@item
|
||||
Jurgen Nickelsen wrote @file{ws-mode.el}, providing WordStar emulation.
|
||||
|
||||
@item
|
||||
Jeff Norden wrote @file{kermit.el}, a package to help the Kermit
|
||||
dialup communications program run comfortably in an Emacs shell buffer.
|
||||
|
||||
@item
|
||||
Andrew Norman wrote @file{ange-ftp.el}, providing transparent FTP support.
|
||||
|
||||
@item
|
||||
Jeff Peck wrote:
|
||||
@itemize @bullet
|
||||
@item
|
||||
@file{emacstool.c}, support for running Emacs under SunView/Sun Windows,
|
||||
@item
|
||||
@file{sun-curs.el}, cursor definitions for Sun Windows, and
|
||||
@item
|
||||
@file{sun-fns.el}, providing mouse support for Sun Windows.
|
||||
@end itemize
|
||||
|
||||
@item
|
||||
Damon Anton Permezel wrote @file{hanoi.el}, an animated demonstration of
|
||||
the ``Towers of Hanoi'' puzzle.
|
||||
|
||||
@item
|
||||
Jens Petersen wrote @file{find-func.el}, which makes it easy to find
|
||||
the source code for an Emacs Lisp function or variable.
|
||||
|
||||
@item
|
||||
Daniel Pfeiffer wrote:
|
||||
@itemize @bullet
|
||||
@item
|
||||
@file{executable.el}
|
||||
@item
|
||||
@file{sh-script.el}, a mode for editing shell scripts,
|
||||
@item
|
||||
@file{skeleton.el}, implementing a concise language for writing
|
||||
statement skeletons, and
|
||||
@item
|
||||
@file{two-column.el}, a minor mode for simultaneous two-column editing.
|
||||
@end itemize
|
||||
|
||||
@item
|
||||
Fred Pierresteguy and Paul Reilly made Emacs work with X Toolkit
|
||||
widgets.
|
||||
|
||||
@item
|
||||
Christian Plaunt wrote @file{soundex.el}, an implementation of the
|
||||
Soundex algorithm for comparing English words by their pronunciation.
|
||||
|
||||
@item
|
||||
Francesco A. Potorti wrote @file{cmacexp.el}, providing a command which
|
||||
runs the C preprocessor on a region of a file and displays the results.
|
||||
|
||||
@item
|
||||
Michael D. Prange and Steven A. Wood wrote @file{fortran.el}, a mode for
|
||||
editing FORTRAN code.
|
||||
@c We're not distributing his tex-mode.el anymore; we're using Ed Reingold's.
|
||||
|
||||
@item
|
||||
Ashwin Ram wrote @file{refer.el}, commands to look up references in
|
||||
bibliography files by keyword.
|
||||
|
||||
@item
|
||||
Eric S. Raymond wrote:
|
||||
@itemize @bullet
|
||||
@item
|
||||
@file{vc.el}, an interface to the RCS and SCCS source code version
|
||||
control systems, with Paul Eggert,
|
||||
@item
|
||||
@file{gud.el}, a package for running source-level debuggers like GDB
|
||||
and SDB in Emacs,
|
||||
@item
|
||||
@file{asm-mode.el}, a mode for editing assembly language code,
|
||||
@item
|
||||
@file{cookie1.el}, support for ``fortune-cookie'' programs like
|
||||
@file{yow.el} and @file{spook.el},
|
||||
@item
|
||||
@file{finder.el}, a package for finding Emacs Lisp packages by keyword
|
||||
and topic,
|
||||
@item
|
||||
@file{lisp-mnt.el}, functions for working with the special headers used
|
||||
in Emacs Lisp library files, and
|
||||
@item
|
||||
code to set and make use of the @code{load-history} lisp variable, which
|
||||
records the source file from which each lisp function loaded into Emacs
|
||||
came.
|
||||
@end itemize
|
||||
|
||||
@item
|
||||
Edward M. Reingold wrote the extensive calendar and diary support (try
|
||||
@kbd{M-x calendar}), with contributions from Stewart Clamen, Paul
|
||||
Eggert, and Lara Rios. Andy Oram contributed to its documentation.
|
||||
Reingold has also contributed to @file{tex-mode.el}, a mode for editing
|
||||
@TeX{} files, as have William F. Schelter, Dick King, Stephen Gildea,
|
||||
Michael Prange, and Jacob Gore.
|
||||
|
||||
@item
|
||||
Rob Riepel contributed @file{tpu-edt.el} and its associated files,
|
||||
providing an emulation of the VMS TPU text editor emulating the VMS EDT
|
||||
editor, and @file{vt-control.el}, providing some control functions for
|
||||
the DEC VT line of terminals.
|
||||
|
||||
@item
|
||||
Roland B. Roberts contributed much of the VMS support distributed with
|
||||
Emacs 19, along with Joseph M. Kelsey, and @file{vms-pmail.el}, support
|
||||
for using Emacs within VMS MAIL.
|
||||
|
||||
@item
|
||||
John Robinson wrote @file{bg-mouse.el}, support for the mouse on the BBN
|
||||
Bitgraph terminal.
|
||||
|
||||
@item
|
||||
Danny Roozendaal implemented @file{handwrite.el}, which converts text
|
||||
into ``handwriting.''
|
||||
|
||||
@item
|
||||
William Rosenblatt wrote @file{float.el}, implementing a floating-point
|
||||
numeric type using Lisp cons cells and integers.
|
||||
|
||||
@item
|
||||
Guillermo J. Rozas wrote @file{scheme.el}, a mode for editing Scheme
|
||||
code, and @file{fakemail.c}, an interface to the System V mailer.
|
||||
|
||||
@item
|
||||
Ivar Rummelhoff provided @file{winner.el}, which records
|
||||
recent window configurations so you can move back to them.
|
||||
|
||||
@item
|
||||
Wolfgang Rupprecht contributed Emacs 19's floating-point support
|
||||
(including @file{float-sup.el} and @file{floatfns.c}), and
|
||||
@file{sup-mouse.el}, support for the Supdup mouse on lisp machines.
|
||||
|
||||
@item
|
||||
James B. Salem and Brewster Kahle wrote @file{completion.el}, providing
|
||||
dynamic word completion.
|
||||
|
||||
@item
|
||||
Masahiko Sato wrote @file{vip.el}, an emulation of the VI editor.
|
||||
|
||||
@item
|
||||
William Schelter wrote @file{telnet.el}, support for @code{telnet}
|
||||
sessions within Emacs.
|
||||
|
||||
@item
|
||||
Ralph Schleicher contributed @file{battery.el}, a package for displaying
|
||||
laptop computer battery status, and @file{info-look.el}, a package for
|
||||
looking up Info documentation for symbols in the buffer.
|
||||
|
||||
@item
|
||||
Gregor Schmid wrote @file{tcl.el}, a mode for editing Tcl/Tk scripts.
|
||||
|
||||
@item
|
||||
Michael Schmidt and Tom Perrine wrote @file{modula2.el}, a mode for
|
||||
editing Modula-2 code, based on work by Mick Jordan and Peter Robinson.
|
||||
|
||||
@item
|
||||
Ronald S. Schnell wrote @file{dunnet.el}, a text adventure game.
|
||||
|
||||
@item
|
||||
Philippe Schnoebelen wrote @file{gomoku.el}, a Go Moku game played
|
||||
against Emacs, and @file{mpuz.el}, a multiplication puzzle.
|
||||
|
||||
@item
|
||||
Randal Schwartz wrote @file{pp.el}, a pretty-printer for lisp objects.
|
||||
|
||||
@item
|
||||
Manuel Serrano contributed the Flyspell package that does spell checking
|
||||
as you type.
|
||||
|
||||
@item
|
||||
Stanislav Shalunov wrote @file{uce.el}, for responding to unsolicited
|
||||
commercial email.
|
||||
|
||||
@item
|
||||
Richard Sharman contributed @file{hilit-chg.el}, which uses colors
|
||||
to inclidate recent editing changes.
|
||||
|
||||
@item
|
||||
Olin Shivers wrote:
|
||||
@itemize @bullet
|
||||
@item
|
||||
@file{comint.el}, a library for modes running interactive command-line-
|
||||
oriented subprocesses,
|
||||
@item
|
||||
@file{cmuscheme.el}, for running inferior Scheme processes,
|
||||
@item
|
||||
@file{inf-lisp.el}, for running inferior Lisp process, and
|
||||
@item
|
||||
@file{shell.el}, for running inferior shells.
|
||||
@end itemize
|
||||
|
||||
@item
|
||||
Sam Shteingold wrote @file{gulp.el}.
|
||||
|
||||
@item
|
||||
Espen Skoglund wrote @file{pascal.el}, a mode for editing Pascal code.
|
||||
|
||||
@item
|
||||
Rick Sladkey wrote @file{backquote.el}, a lisp macro for creating
|
||||
mostly-constant data.
|
||||
|
||||
@item
|
||||
Lynn Slater wrote @file{help-macro.el}, a macro for writing interactive
|
||||
help for key bindings.
|
||||
|
||||
@item
|
||||
Chris Smith wrote @file{icon.el}, a mode for editing Icon code.
|
||||
|
||||
@item
|
||||
David Smith wrote @file{ielm.el}, a mode for interacting with the Emacs
|
||||
Lisp interpreter as a subprocess.
|
||||
|
||||
@item
|
||||
Paul D. Smith wrote @file{snmp-mode.el}.
|
||||
|
||||
@item
|
||||
William Sommerfeld wrote @file{scribe.el}, a mode for editing Scribe
|
||||
files, and @file{server.el}, a package allowing programs to send files
|
||||
to an extant Emacs job to be edited.
|
||||
|
||||
@item
|
||||
Michael Staats wrote @file{pc-select.el}, which rebinds keys for
|
||||
selecting regions to follow many other systems.
|
||||
|
||||
@item
|
||||
Ake Stenhoff and Lars Lindberg wrote @file{imenu.el}, a framework for
|
||||
browsing indices made from buffer contents.
|
||||
|
||||
@item
|
||||
Peter Stephenson contributed @file{vcursor.el}, which implements a
|
||||
``virtual cursor'' that you can move with the keyboard and use for
|
||||
copying text.
|
||||
|
||||
@item
|
||||
Sam Steingold wrote @file{midnight.el}.
|
||||
|
||||
@item
|
||||
Jonathan Stigelman wrote @file{hilit19.el}, a package providing
|
||||
automatic highlighting in source code buffers, mail readers, and other
|
||||
contexts.
|
||||
|
||||
@item
|
||||
Steve Strassman did not write @file{spook.el}, and even if he did, he
|
||||
really didn't mean for you to use it in an anarchistic way.
|
||||
|
||||
@item
|
||||
Jens T. Berger Thielemann wrote @file{word-help.el}, which is
|
||||
part of the basis for @file{info-look.el}.
|
||||
|
||||
@item
|
||||
Spencer Thomas wrote the original @file{dabbrev.el}, providing a command
|
||||
which completes the partial word before point, based on other nearby
|
||||
words for which it is a prefix. He also wrote the original dumping
|
||||
support.
|
||||
|
||||
@item
|
||||
Jim Thompson wrote @file{ps-print.el}, which converts
|
||||
Emacs text to Postscript.
|
||||
|
||||
@item
|
||||
Masanobu Umeda wrote:
|
||||
@itemize @bullet
|
||||
@item
|
||||
GNUS, a featureful reader for Usenet news,
|
||||
@item
|
||||
@file{prolog.el}, a mode for editing Prolog code,
|
||||
@item
|
||||
@file{rmailsort.el}, a package for sorting messages in RMAIL folders,
|
||||
@item
|
||||
@file{metamail.el}, an interface to the Metamail program,
|
||||
@item
|
||||
@file{tcp.el}, emulation of the @code{open-network-stream} function for
|
||||
some Emacs configurations which lack it, and
|
||||
@item
|
||||
@file{timezone.el}, providing functions for dealing with time zones.
|
||||
@end itemize
|
||||
|
||||
@item
|
||||
Neil W. Van Dyke wrote @file{webjump.el}, a ``hot links'' package.
|
||||
|
||||
@item
|
||||
Ulrik Vieth implemented @file{meta-mode.el}, for editing MetaFont code.
|
||||
|
||||
@item
|
||||
Geoffrey Voelker wrote the Windows NT support.
|
||||
|
||||
@item
|
||||
Johan Vromans wrote @file{forms.el} and its associated files, defining a
|
||||
mode for filling in forms, and @file{iso-acc.el}, a minor mode providing
|
||||
electric accent keys for text using the ISO-8859 character set.
|
||||
|
||||
@item
|
||||
Barry Warsaw wrote:
|
||||
@itemize @bullet
|
||||
@item
|
||||
@file{assoc.el}, a set of utility functions for working with association
|
||||
lists,
|
||||
@item
|
||||
@file{cc-mode.el}, a major mode for editing C and C++ code, based on
|
||||
earlier work by Dave Detlefs, Stewart Clamen, and Richard Stallman,
|
||||
@item
|
||||
@file{elp.el}, a new profiler for Emacs Lisp programs.
|
||||
@item
|
||||
@file{man.el}, a mode for reading UNIX manual pages,
|
||||
@item
|
||||
@file{regi.el}, providing an AWK-like control structure for
|
||||
use in lisp programs, and
|
||||
@item
|
||||
@file{reporter.el}, providing customizable bug reporting for lisp
|
||||
packages.
|
||||
@item
|
||||
@file{supercite.el}, a minor mode for quoting sections of mail messages
|
||||
and news articles,
|
||||
@end itemize
|
||||
|
||||
@item
|
||||
Morten Welinder wrote:
|
||||
@itemize @bullet
|
||||
@item
|
||||
@file{desktop.el}, facilities for saving some of Emacs's state between
|
||||
sessions,
|
||||
@item
|
||||
@file{s-region.el}, commands for setting the region using the shift key
|
||||
and motion commands, and
|
||||
@item
|
||||
@file{dos-fns.el}, functions for use under MS-DOS.
|
||||
@end itemize
|
||||
|
||||
He also helped port Emacs to MS-DOS.
|
||||
|
||||
@item
|
||||
Joseph Brian Wells wrote:
|
||||
@itemize @bullet
|
||||
@item
|
||||
@file{apropos.el}, a command to find commands, functions, and variables
|
||||
whose names contain matches for a regular expression,
|
||||
@item
|
||||
@file{resume.el}, support for processing command-line arguments after
|
||||
resuming a suspended Emacs job, and
|
||||
@item
|
||||
@file{mail-extr.el}, a package for extracting names and addresses from
|
||||
mail headers, with contributions from Jamie Zawinski.
|
||||
@end itemize
|
||||
|
||||
@item
|
||||
Rodney Whitby and Reto Zimmermann wrote @file{vhdl-mode.el}.
|
||||
|
||||
@item
|
||||
Ed Wilkinson wrote @file{b2m.c}, a program to convert mail files from
|
||||
RMAIL format to Unix @code{mbox} format.
|
||||
|
||||
@item
|
||||
Mike Williams wrote @file{mouse-sel.el}, providing enhanced mouse
|
||||
selection, and @file{thingatpt.el}, a library of functions for finding
|
||||
the ``thing'' (word, line, s-expression) containing point.
|
||||
|
||||
@item
|
||||
Dale R. Worley wrote @file{emerge.el}, a package for interactively
|
||||
merging two versions of a file.
|
||||
|
||||
@item
|
||||
Tom Wurgler wrote @file{emacs-lock.el}, which makes it harder
|
||||
to exit with valuable buffers unsaved.
|
||||
|
||||
@item
|
||||
Eli Zaretskii made many standard Emacs features work on MS-DOS.
|
||||
|
||||
@item
|
||||
Jamie Zawinski wrote:
|
||||
@itemize @bullet
|
||||
@item
|
||||
Emacs 19's optimizing byte compiler, with Hallvard Furuseth,
|
||||
@item
|
||||
much of the support for faces and X selections,
|
||||
@item
|
||||
@file{mailabbrev.el}, a package providing automatic expansion of mail
|
||||
aliases, and
|
||||
@item
|
||||
@file{tar-mode.el}, providing simple viewing and editing commands for
|
||||
tar files.
|
||||
@end itemize
|
||||
|
||||
@item
|
||||
Ian T. Zimmerman wrote @file{gametree.el}.
|
||||
|
||||
@item
|
||||
Neal Ziring and Felix S. T. Wu wrote @file{vi.el}, an emulation of the
|
||||
VI text editor.
|
||||
@end itemize
|
||||
|
||||
Others too numerous to mention have reported and fixed bugs, and added
|
||||
features to many parts of Emacs. We thank them for their generosity as
|
||||
well.
|
||||
|
||||
This list intended to mention every contributor of a major package or
|
||||
feature we currently distribute; if you know of someone we have omitted,
|
||||
please report that as a manual bug.
|
166
man/anti.texi
Normal file
166
man/anti.texi
Normal file
|
@ -0,0 +1,166 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1997, 1999 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
|
||||
@node Antinews, MS-DOS, Command Arguments, Top
|
||||
@appendix Emacs 19 Antinews
|
||||
|
||||
For those users who live backwards in time, here is information about
|
||||
downgrading to Emacs version 19. We hope you will enjoy the greater
|
||||
simplicity that results from the absence of certain Emacs 20 features.
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
The multibyte character and end-of-line conversion support have been
|
||||
eliminated entirely. (Some users consider this a tremendous
|
||||
improvement.) Character codes are limited to the range 0 through 255
|
||||
and files imported onto Unix-like systems may have a ^M at the end of
|
||||
each line to remind you to control MS-DOG type files.
|
||||
|
||||
@item
|
||||
Fontsets, coding systems and input methods have been eliminated as well.
|
||||
|
||||
@item
|
||||
The mode line normally displays the string @samp{Emacs}, in case you
|
||||
forget what editor you are using.
|
||||
|
||||
@item
|
||||
Scroll bars always appear on the right-hand side of the window.
|
||||
This clearly separates them from the text in the window.
|
||||
|
||||
@item
|
||||
The @kbd{M-x customize} feature has been replaced with a very simple
|
||||
feature, @kbd{M-x edit-options}. This shows you @emph{all} the user
|
||||
options right from the start, so you don't have to hunt for the ones you
|
||||
want. It also provides a few commands, such as @kbd{s} and @kbd{x}, to
|
||||
set a user option.
|
||||
|
||||
@item
|
||||
The @key{DELETE} key does nothing special in Emacs 19 when you use it
|
||||
after selecting a region with the mouse. It does exactly the same thing
|
||||
in that situation as it does at all other times: delete one character
|
||||
backwards.
|
||||
|
||||
@item
|
||||
@kbd{C-x C-w} no longer changes the major mode according to the new file
|
||||
name. If you want to change the mode, use @kbd{M-x normal-mode}.
|
||||
|
||||
@item
|
||||
In Transient Mark mode, each window displays highlighting for the region
|
||||
as it exists in that window.
|
||||
|
||||
@item
|
||||
Outline mode doesn't use overlay properties; instead, it hides a line by
|
||||
converting the preceding newline into code 015. Magically, however, if
|
||||
you save the file, the 015 character appears in the file as a newline.
|
||||
|
||||
@item
|
||||
There is now a clever way you can activate the minibuffer recursively
|
||||
even if @code{enable-recursive-minibuffers} is @code{nil}. All you have
|
||||
to do is @emph{switch windows} to a non-minibuffer window, and then use a
|
||||
minibuffer command. You can pile up any number of minibuffer levels
|
||||
this way, but @kbd{M-x top-level} will get you out of all of them.
|
||||
|
||||
@item
|
||||
We have removed the limit on the length of minibuffer history lists;
|
||||
they now contain all the minibuffer arguments you have used since the
|
||||
beginning of the session.
|
||||
|
||||
@item
|
||||
Dynamic abbrev expansion now handles case conversion in a very simple
|
||||
and straightforward way. If you have requested preserving case, it
|
||||
always converts the entire expansion to the case pattern of the abbrev
|
||||
that you have typed in.
|
||||
|
||||
@item
|
||||
The @code{compose-mail} command does not exist; @kbd{C-x m} now
|
||||
runs @code{mail} directly.
|
||||
|
||||
@item
|
||||
There is no way to quote a file name with special characters in it.
|
||||
What you see is what you get: if the name looks remote, it is remote.
|
||||
|
||||
@item
|
||||
@kbd{M-x grep-find} has been eliminated, because @code{grep} has never
|
||||
been lost.
|
||||
|
||||
@ignore
|
||||
@item
|
||||
Truth in advertising: @kbd{M-x grep} by default uses @code{grep}, the
|
||||
whole @code{grep}, and nothing but the @code{grep}. If you want it to
|
||||
use @code{zgrep}, you'll have to edit the search command by hand.
|
||||
@end ignore
|
||||
|
||||
@item
|
||||
Some Dired commands have been rearranged: two-character sequences
|
||||
have been replaced with quick single-character commands:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
For @code{dired-mark-executables}, type @kbd{*}.
|
||||
@item
|
||||
For @code{dired-mark-directories}, type @kbd{/}.
|
||||
@item
|
||||
For @code{dired-mark-symlinks}, type @kbd{@@}.
|
||||
@item
|
||||
For @code{dired-change-marks}, type @kbd{c}.
|
||||
@item
|
||||
For @code{dired-unmark-all-files}, type @kbd{C-M-?}.
|
||||
@item
|
||||
For @code{dired-unmark-all-marks}, type @kbd{C-M-? @key{RET}}.
|
||||
@end itemize
|
||||
|
||||
But if you want to use @code{dired-flag-garbage-files}, @kbd{&}, you'll
|
||||
just have to stop living in the past.
|
||||
|
||||
@item
|
||||
In C mode, you can now specify your preferred style for block comments.
|
||||
If you want to use the style
|
||||
|
||||
@example
|
||||
/*
|
||||
blah
|
||||
blah
|
||||
*/
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
then you should set the variable @code{c-block-comments-indent-p} to
|
||||
@code{t}.
|
||||
|
||||
@item
|
||||
To customize faces used by Font Lock mode, use the variable
|
||||
@code{font-lock-face-attributes}. See its documentation string for
|
||||
details.
|
||||
|
||||
@item
|
||||
For efficiency, Font Lock mode now uses by default the minimum supported
|
||||
level of decoration for the selected major mode.
|
||||
|
||||
@item
|
||||
If you kill a buffer, any registers holding saved positions in that
|
||||
buffer are changed to point into limbo.
|
||||
|
||||
@item
|
||||
The function @code{set-frame-font} has been renamed to
|
||||
@code{set-default-font}.
|
||||
|
||||
@item
|
||||
The variable @code{tex-main-file} doesn't exist. Of course, you can
|
||||
create the variable by setting it, but that won't do anything special.
|
||||
|
||||
@item
|
||||
The @code{scroll-preserve-screen-position} variable has been eliminated;
|
||||
and so has the feature that it controls.
|
||||
|
||||
@item
|
||||
We have eliminated the functions @code{add-untranslated-filesystem} and
|
||||
@code{remove-untranslated-filesystem}, and replaced them with a simpler
|
||||
function, @code{using-unix-filesystems}.
|
||||
|
||||
@item
|
||||
To keep up with decreasing computer memory capacity, many other
|
||||
functions and files have been eliminated in Emacs 19. There's no need
|
||||
to mention them all here. If you try to use one of them, you'll get an
|
||||
error message to tell you that it is undefined or unbound.
|
||||
@end itemize
|
721
man/basic.texi
Normal file
721
man/basic.texi
Normal file
|
@ -0,0 +1,721 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Basic, Minibuffer, Exiting, Top
|
||||
@chapter Basic Editing Commands
|
||||
|
||||
@kindex C-h t
|
||||
@findex help-with-tutorial
|
||||
We now give the basics of how to enter text, make corrections, and
|
||||
save the text in a file. If this material is new to you, you might
|
||||
learn it more easily by running the Emacs learn-by-doing tutorial. To
|
||||
use the tutorial, run Emacs and type @kbd{Control-h t}
|
||||
(@code{help-with-tutorial}).
|
||||
|
||||
To clear the screen and redisplay, type @kbd{C-l} (@code{recenter}).
|
||||
|
||||
@menu
|
||||
|
||||
* Inserting Text:: Inserting text by simply typing it.
|
||||
* Moving Point:: How to move the cursor to the place where you want to
|
||||
change something.
|
||||
* Erasing:: Deleting and killing text.
|
||||
* Undo:: Undoing recent changes in the text.
|
||||
* Files: Basic Files. Visiting, creating, and saving files.
|
||||
* Help: Basic Help. Asking what a character does.
|
||||
* Blank Lines:: Commands to make or delete blank lines.
|
||||
* Continuation Lines:: Lines too wide for the screen.
|
||||
* Position Info:: What page, line, row, or column is point on?
|
||||
* Arguments:: Numeric arguments for repeating a command.
|
||||
* Repeating:: A short-cut for repeating the previous command.
|
||||
@end menu
|
||||
|
||||
@node Inserting Text
|
||||
@section Inserting Text
|
||||
|
||||
@cindex insertion
|
||||
@cindex graphic characters
|
||||
To insert printing characters into the text you are editing, just type
|
||||
them. This inserts the characters you type into the buffer at the
|
||||
cursor (that is, at @dfn{point}; @pxref{Point}). The cursor moves
|
||||
forward, and any text after the cursor moves forward too. If the text
|
||||
in the buffer is @samp{FOOBAR}, with the cursor before the @samp{B},
|
||||
then if you type @kbd{XX}, you get @samp{FOOXXBAR}, with the cursor
|
||||
still before the @samp{B}.
|
||||
|
||||
To @dfn{delete} text you have just inserted, use @key{DEL}. @key{DEL}
|
||||
deletes the character @emph{before} the cursor (not the one that the cursor
|
||||
is on top of or under; that is the character @var{after} the cursor). The
|
||||
cursor and all characters after it move backwards. Therefore, if you type
|
||||
a printing character and then type @key{DEL}, they cancel out.
|
||||
|
||||
@kindex RET
|
||||
@cindex newline
|
||||
To end a line and start typing a new one, type @key{RET}. This
|
||||
inserts a newline character in the buffer. If point is in the middle of
|
||||
a line, @key{RET} splits the line. Typing @key{DEL} when the cursor is
|
||||
at the beginning of a line deletes the preceding newline, thus joining
|
||||
the line with the preceding line.
|
||||
|
||||
Emacs can split lines automatically when they become too long, if you
|
||||
turn on a special minor mode called @dfn{Auto Fill} mode.
|
||||
@xref{Filling}, for how to use Auto Fill mode.
|
||||
|
||||
If you prefer to have text characters replace (overwrite) existing
|
||||
text rather than shove it to the right, you can enable Overwrite mode,
|
||||
a minor mode. @xref{Minor Modes}.
|
||||
|
||||
@cindex quoting
|
||||
@kindex C-q
|
||||
@findex quoted-insert
|
||||
Direct insertion works for printing characters and @key{SPC}, but other
|
||||
characters act as editing commands and do not insert themselves. If you
|
||||
need to insert a control character or a character whose code is above 200
|
||||
octal, you must @dfn{quote} it by typing the character @kbd{Control-q}
|
||||
(@code{quoted-insert}) first. (This character's name is normally written
|
||||
@kbd{C-q} for short.) There are two ways to use @kbd{C-q}:@refill
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
@kbd{C-q} followed by any non-graphic character (even @kbd{C-g})
|
||||
inserts that character.
|
||||
|
||||
@item
|
||||
@kbd{C-q} followed by a sequence of octal digits inserts the character
|
||||
with the specified octal character code. You can use any number of
|
||||
octal digits; any non-digit terminates the sequence. If the terminating
|
||||
character is @key{RET}, it serves only to terminate the sequence; any
|
||||
other non-digit is itself used as input after terminating the sequence.
|
||||
(The use of octal sequences is disabled in ordinary non-binary Overwrite
|
||||
mode, to give you a convenient way to insert a digit instead of
|
||||
overwriting with it.)
|
||||
@end itemize
|
||||
|
||||
@noindent
|
||||
When multibyte characters are enabled, octal codes 0200 through 0377 are
|
||||
not valid as characters; if you specify a code in this range, @kbd{C-q}
|
||||
assumes that you intend to use some ISO Latin-@var{n} character set, and
|
||||
converts the specified code to the corresponding Emacs character code.
|
||||
@xref{Enabling Multibyte}. You select @emph{which} ISO Latin character
|
||||
set though your choice of language environment (@pxref{Language
|
||||
Environments}).
|
||||
|
||||
@vindex read-quoted-char-radix
|
||||
To use decimal or hexadecimal instead of octal, set the variable
|
||||
@code{read-quoted-char-radix} to 10 or 16. If the radix is greater than
|
||||
10, some letters starting with @kbd{a} serve as part of a character
|
||||
code, just like digits.
|
||||
|
||||
A numeric argument to @kbd{C-q} specifies how many copies of the
|
||||
quoted character should be inserted (@pxref{Arguments}).
|
||||
|
||||
@findex newline
|
||||
@findex self-insert
|
||||
Customization information: @key{DEL} in most modes runs the command
|
||||
@code{delete-backward-char}; @key{RET} runs the command @code{newline}, and
|
||||
self-inserting printing characters run the command @code{self-insert},
|
||||
which inserts whatever character was typed to invoke it. Some major modes
|
||||
rebind @key{DEL} to other commands.
|
||||
|
||||
@node Moving Point
|
||||
@section Changing the Location of Point
|
||||
|
||||
@cindex arrow keys
|
||||
@kindex LEFT
|
||||
@kindex RIGHT
|
||||
@kindex UP
|
||||
@kindex DOWN
|
||||
@cindex moving point
|
||||
@cindex movement
|
||||
@cindex cursor motion
|
||||
@cindex moving the cursor
|
||||
To do more than insert characters, you have to know how to move point
|
||||
(@pxref{Point}). The simplest way to do this is with arrow keys, or by
|
||||
clicking the left mouse button where you want to move to.
|
||||
|
||||
There are also control and meta characters for cursor motion. Some
|
||||
are equivalent to the arrow keys (these date back to the days before
|
||||
terminals had arrow keys, and are usable on terminals which don't have
|
||||
them). Others do more sophisticated things.
|
||||
|
||||
@kindex C-a
|
||||
@kindex C-e
|
||||
@kindex C-f
|
||||
@kindex C-b
|
||||
@kindex C-n
|
||||
@kindex C-p
|
||||
@kindex M->
|
||||
@kindex M-<
|
||||
@kindex M-r
|
||||
@findex beginning-of-line
|
||||
@findex end-of-line
|
||||
@findex forward-char
|
||||
@findex backward-char
|
||||
@findex next-line
|
||||
@findex previous-line
|
||||
@findex beginning-of-buffer
|
||||
@findex end-of-buffer
|
||||
@findex goto-char
|
||||
@findex goto-line
|
||||
@findex move-to-window-line
|
||||
@table @kbd
|
||||
@item C-a
|
||||
Move to the beginning of the line (@code{beginning-of-line}).
|
||||
@item C-e
|
||||
Move to the end of the line (@code{end-of-line}).
|
||||
@item C-f
|
||||
Move forward one character (@code{forward-char}).
|
||||
@item C-b
|
||||
Move backward one character (@code{backward-char}).
|
||||
@item M-f
|
||||
Move forward one word (@code{forward-word}).
|
||||
@item M-b
|
||||
Move backward one word (@code{backward-word}).
|
||||
@item C-n
|
||||
Move down one line, vertically (@code{next-line}). This command
|
||||
attempts to keep the horizontal position unchanged, so if you start in
|
||||
the middle of one line, you end in the middle of the next. When on
|
||||
the last line of text, @kbd{C-n} creates a new line and moves onto it.
|
||||
@item C-p
|
||||
Move up one line, vertically (@code{previous-line}).
|
||||
@item M-r
|
||||
Move point to left margin, vertically centered in the window
|
||||
(@code{move-to-window-line}). Text does not move on the screen.
|
||||
|
||||
A numeric argument says which screen line to place point on. It counts
|
||||
screen lines down from the top of the window (zero for the top line). A
|
||||
negative argument counts lines from the bottom (@minus{}1 for the bottom
|
||||
line).
|
||||
@item M-<
|
||||
Move to the top of the buffer (@code{beginning-of-buffer}). With
|
||||
numeric argument @var{n}, move to @var{n}/10 of the way from the top.
|
||||
@xref{Arguments}, for more information on numeric arguments.@refill
|
||||
@item M->
|
||||
Move to the end of the buffer (@code{end-of-buffer}).
|
||||
@item M-x goto-char
|
||||
Read a number @var{n} and move point to buffer position @var{n}.
|
||||
Position 1 is the beginning of the buffer.
|
||||
@item M-x goto-line
|
||||
Read a number @var{n} and move point to line number @var{n}. Line 1
|
||||
is the beginning of the buffer.
|
||||
@item C-x C-n
|
||||
@findex set-goal-column
|
||||
@kindex C-x C-n
|
||||
Use the current column of point as the @dfn{semipermanent goal column} for
|
||||
@kbd{C-n} and @kbd{C-p} (@code{set-goal-column}). Henceforth, those
|
||||
commands always move to this column in each line moved into, or as
|
||||
close as possible given the contents of the line. This goal column remains
|
||||
in effect until canceled.
|
||||
@item C-u C-x C-n
|
||||
Cancel the goal column. Henceforth, @kbd{C-n} and @kbd{C-p} once
|
||||
again try to stick to a fixed horizontal position, as usual.
|
||||
@end table
|
||||
|
||||
@vindex track-eol
|
||||
If you set the variable @code{track-eol} to a non-@code{nil} value,
|
||||
then @kbd{C-n} and @kbd{C-p} when at the end of the starting line move
|
||||
to the end of another line. Normally, @code{track-eol} is @code{nil}.
|
||||
@xref{Variables}, for how to set variables such as @code{track-eol}.
|
||||
|
||||
@vindex next-line-add-newlines
|
||||
Normally, @kbd{C-n} on the last line of a buffer appends a newline to
|
||||
it. If the variable @code{next-line-add-newlines} is @code{nil}, then
|
||||
@kbd{C-n} gets an error instead (like @kbd{C-p} on the first line).
|
||||
|
||||
@node Erasing
|
||||
@section Erasing Text
|
||||
|
||||
@table @kbd
|
||||
@item @key{DEL}
|
||||
Delete the character before point (@code{delete-backward-char}).
|
||||
@item C-d
|
||||
Delete the character after point (@code{delete-char}).
|
||||
@item C-k
|
||||
Kill to the end of the line (@code{kill-line}).
|
||||
@item M-d
|
||||
Kill forward to the end of the next word (@code{kill-word}).
|
||||
@item M-@key{DEL}
|
||||
Kill back to the beginning of the previous word
|
||||
(@code{backward-kill-word}).
|
||||
@end table
|
||||
|
||||
@cindex killing characters and lines
|
||||
@cindex deleting characters and lines
|
||||
@cindex erasing characters and lines
|
||||
You already know about the @key{DEL} key which deletes the character
|
||||
before point (that is, before the cursor). Another key, @kbd{Control-d}
|
||||
(@kbd{C-d} for short), deletes the character after point (that is, the
|
||||
character that the cursor is on). This shifts the rest of the text on
|
||||
the line to the left. If you type @kbd{C-d} at the end of a line, it
|
||||
joins together that line and the next line.
|
||||
|
||||
To erase a larger amount of text, use the @kbd{C-k} key, which kills a
|
||||
line at a time. If you type @kbd{C-k} at the beginning or middle of a
|
||||
line, it kills all the text up to the end of the line. If you type
|
||||
@kbd{C-k} at the end of a line, it joins that line and the next line.
|
||||
|
||||
@xref{Killing}, for more flexible ways of killing text.
|
||||
|
||||
@node Undo
|
||||
@section Undoing Changes
|
||||
@cindex undo
|
||||
@cindex changes, undoing
|
||||
|
||||
You can undo all the recent changes in the buffer text, up to a
|
||||
certain point. Each buffer records changes individually, and the undo
|
||||
command always applies to the current buffer. Usually each editing
|
||||
command makes a separate entry in the undo records, but some commands
|
||||
such as @code{query-replace} make many entries, and very simple commands
|
||||
such as self-inserting characters are often grouped to make undoing less
|
||||
tedious.
|
||||
|
||||
@table @kbd
|
||||
@item C-x u
|
||||
Undo one batch of changes---usually, one command worth (@code{undo}).
|
||||
@item C-_
|
||||
The same.
|
||||
@item C-u C-x u
|
||||
Undo one batch of changes in the region.
|
||||
@end table
|
||||
|
||||
@kindex C-x u
|
||||
@kindex C-_
|
||||
@findex undo
|
||||
The command @kbd{C-x u} or @kbd{C-_} is how you undo. The first time
|
||||
you give this command, it undoes the last change. Point moves back to
|
||||
where it was before the command that made the change.
|
||||
|
||||
Consecutive repetitions of @kbd{C-_} or @kbd{C-x u} undo earlier and
|
||||
earlier changes, back to the limit of the undo information available.
|
||||
If all recorded changes have already been undone, the undo command
|
||||
prints an error message and does nothing.
|
||||
|
||||
Any command other than an undo command breaks the sequence of undo
|
||||
commands. Starting from that moment, the previous undo commands become
|
||||
ordinary changes that you can undo. Thus, to redo changes you have
|
||||
undone, type @kbd{C-f} or any other command that will harmlessly break
|
||||
the sequence of undoing, then type more undo commands.
|
||||
|
||||
@cindex selective undo
|
||||
@kindex C-u C-x u
|
||||
Ordinary undo applies to all changes made in the current buffer. You
|
||||
can also perform @dfn{selective undo}, limited to the current region.
|
||||
To do this, specify the region you want, then run the @code{undo}
|
||||
command with a prefix argument (the value does not matter): @kbd{C-u C-x
|
||||
u} or @kbd{C-u C-_}. This undoes the most recent change in the region.
|
||||
To undo further changes in the same region, repeat the @code{undo}
|
||||
command (no prefix argument is needed). In Transient Mark mode, any use
|
||||
of @code{undo} when there is an active region performs selective undo;
|
||||
you do not need a prefix argument.
|
||||
|
||||
If you notice that a buffer has been modified accidentally, the
|
||||
easiest way to recover is to type @kbd{C-_} repeatedly until the stars
|
||||
disappear from the front of the mode line. At this time, all the
|
||||
modifications you made have been canceled. Whenever an undo command
|
||||
makes the stars disappear from the mode line, it means that the buffer
|
||||
contents are the same as they were when the file was last read in or
|
||||
saved.
|
||||
|
||||
If you do not remember whether you changed the buffer deliberately,
|
||||
type @kbd{C-_} once. When you see the last change you made undone, you
|
||||
will see whether it was an intentional change. If it was an accident,
|
||||
leave it undone. If it was deliberate, redo the change as described
|
||||
above.
|
||||
|
||||
Not all buffers record undo information. Buffers whose names start with
|
||||
spaces don't; these buffers are used internally by Emacs and its extensions
|
||||
to hold text that users don't normally look at or edit.
|
||||
|
||||
You cannot undo mere cursor motion; only changes in the buffer
|
||||
contents save undo information. However, some cursor motion commands
|
||||
set the mark, so if you use these commands from time to time, you can
|
||||
move back to the neighborhoods you have moved through by popping the
|
||||
mark ring (@pxref{Mark Ring}).
|
||||
|
||||
@vindex undo-limit
|
||||
@vindex undo-strong-limit
|
||||
@cindex undo limit
|
||||
When the undo information for a buffer becomes too large, Emacs
|
||||
discards the oldest undo information from time to time (during garbage
|
||||
collection). You can specify how much undo information to keep by
|
||||
setting two variables: @code{undo-limit} and @code{undo-strong-limit}.
|
||||
Their values are expressed in units of bytes of space.
|
||||
|
||||
The variable @code{undo-limit} sets a soft limit: Emacs keeps undo
|
||||
data for enough commands to reach this size, and perhaps exceed it, but
|
||||
does not keep data for any earlier commands beyond that. Its default
|
||||
value is 20000. The variable @code{undo-strong-limit} sets a stricter
|
||||
limit: the command which pushes the size past this amount is itself
|
||||
forgotten. Its default value is 30000.
|
||||
|
||||
Regardless of the values of those variables, the most recent change is
|
||||
never discarded, so there is no danger that garbage collection occurring
|
||||
right after an unintentional large change might prevent you from undoing
|
||||
it.
|
||||
|
||||
The reason the @code{undo} command has two keys, @kbd{C-x u} and
|
||||
@kbd{C-_}, set up to run it is that it is worthy of a single-character
|
||||
key, but on some keyboards it is not obvious how to type @kbd{C-_}.
|
||||
@kbd{C-x u} is an alternative you can type straightforwardly on any
|
||||
terminal.
|
||||
|
||||
@node Basic Files
|
||||
@section Files
|
||||
|
||||
The commands described above are sufficient for creating and altering
|
||||
text in an Emacs buffer; the more advanced Emacs commands just make
|
||||
things easier. But to keep any text permanently you must put it in a
|
||||
@dfn{file}. Files are named units of text which are stored by the
|
||||
operating system for you to retrieve later by name. To look at or use
|
||||
the contents of a file in any way, including editing the file with
|
||||
Emacs, you must specify the file name.
|
||||
|
||||
Consider a file named @file{/usr/rms/foo.c}. In Emacs, to begin editing
|
||||
this file, type
|
||||
|
||||
@example
|
||||
C-x C-f /usr/rms/foo.c @key{RET}
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
Here the file name is given as an @dfn{argument} to the command @kbd{C-x
|
||||
C-f} (@code{find-file}). That command uses the @dfn{minibuffer} to
|
||||
read the argument, and you type @key{RET} to terminate the argument
|
||||
(@pxref{Minibuffer}).@refill
|
||||
|
||||
Emacs obeys the command by @dfn{visiting} the file: creating a buffer,
|
||||
copying the contents of the file into the buffer, and then displaying
|
||||
the buffer for you to edit. If you alter the text, you can @dfn{save}
|
||||
the new text in the file by typing @kbd{C-x C-s} (@code{save-buffer}).
|
||||
This makes the changes permanent by copying the altered buffer contents
|
||||
back into the file @file{/usr/rms/foo.c}. Until you save, the changes
|
||||
exist only inside Emacs, and the file @file{foo.c} is unaltered.
|
||||
|
||||
To create a file, just visit the file with @kbd{C-x C-f} as if it
|
||||
already existed. This creates an empty buffer in which you can insert
|
||||
the text you want to put in the file. The file is actually created when
|
||||
you save this buffer with @kbd{C-x C-s}.
|
||||
|
||||
Of course, there is a lot more to learn about using files. @xref{Files}.
|
||||
|
||||
@node Basic Help
|
||||
@section Help
|
||||
|
||||
@cindex getting help with keys
|
||||
If you forget what a key does, you can find out with the Help
|
||||
character, which is @kbd{C-h} (or @key{F1}, which is an alias for
|
||||
@kbd{C-h}). Type @kbd{C-h k} followed by the key you want to know
|
||||
about; for example, @kbd{C-h k C-n} tells you all about what @kbd{C-n}
|
||||
does. @kbd{C-h} is a prefix key; @kbd{C-h k} is just one of its
|
||||
subcommands (the command @code{describe-key}). The other subcommands of
|
||||
@kbd{C-h} provide different kinds of help. Type @kbd{C-h} twice to get
|
||||
a description of all the help facilities. @xref{Help}.@refill
|
||||
|
||||
@node Blank Lines
|
||||
@section Blank Lines
|
||||
|
||||
@cindex inserting blank lines
|
||||
@cindex deleting blank lines
|
||||
Here are special commands and techniques for putting in and taking out
|
||||
blank lines.
|
||||
|
||||
@c widecommands
|
||||
@table @kbd
|
||||
@item C-o
|
||||
Insert one or more blank lines after the cursor (@code{open-line}).
|
||||
@item C-x C-o
|
||||
Delete all but one of many consecutive blank lines
|
||||
(@code{delete-blank-lines}).
|
||||
@end table
|
||||
|
||||
@kindex C-o
|
||||
@kindex C-x C-o
|
||||
@cindex blank lines
|
||||
@findex open-line
|
||||
@findex delete-blank-lines
|
||||
When you want to insert a new line of text before an existing line, you
|
||||
can do it by typing the new line of text, followed by @key{RET}.
|
||||
However, it may be easier to see what you are doing if you first make a
|
||||
blank line and then insert the desired text into it. This is easy to do
|
||||
using the key @kbd{C-o} (@code{open-line}), which inserts a newline
|
||||
after point but leaves point in front of the newline. After @kbd{C-o},
|
||||
type the text for the new line. @kbd{C-o F O O} has the same effect as
|
||||
@w{@kbd{F O O @key{RET}}}, except for the final location of point.
|
||||
|
||||
You can make several blank lines by typing @kbd{C-o} several times, or
|
||||
by giving it a numeric argument to tell it how many blank lines to make.
|
||||
@xref{Arguments}, for how. If you have a fill prefix, then @kbd{C-o}
|
||||
command inserts the fill prefix on the new line, when you use it at the
|
||||
beginning of a line. @xref{Fill Prefix}.
|
||||
|
||||
The easy way to get rid of extra blank lines is with the command
|
||||
@kbd{C-x C-o} (@code{delete-blank-lines}). @kbd{C-x C-o} in a run of
|
||||
several blank lines deletes all but one of them. @kbd{C-x C-o} on a
|
||||
solitary blank line deletes that blank line. When point is on a
|
||||
nonblank line, @kbd{C-x C-o} deletes any blank lines following that
|
||||
nonblank line.
|
||||
|
||||
@node Continuation Lines
|
||||
@section Continuation Lines
|
||||
|
||||
@cindex continuation line
|
||||
@cindex wrapping
|
||||
@cindex line wrapping
|
||||
If you add too many characters to one line without breaking it with
|
||||
@key{RET}, the line will grow to occupy two (or more) lines on the screen,
|
||||
with a @samp{\} at the extreme right margin of all but the last of them.
|
||||
The @samp{\} says that the following screen line is not really a distinct
|
||||
line in the text, but just the @dfn{continuation} of a line too long to fit
|
||||
the screen. Continuation is also called @dfn{line wrapping}.
|
||||
|
||||
Sometimes it is nice to have Emacs insert newlines automatically when
|
||||
a line gets too long. Continuation on the screen does not do that. Use
|
||||
Auto Fill mode (@pxref{Filling}) if that's what you want.
|
||||
|
||||
@vindex truncate-lines
|
||||
@cindex truncation
|
||||
As an alternative to continuation, Emacs can display long lines by
|
||||
@dfn{truncation}. This means that all the characters that do not fit in
|
||||
the width of the screen or window do not appear at all. They remain in
|
||||
the buffer, temporarily invisible. @samp{$} is used in the last column
|
||||
instead of @samp{\} to inform you that truncation is in effect.
|
||||
|
||||
Truncation instead of continuation happens whenever horizontal
|
||||
scrolling is in use, and optionally in all side-by-side windows
|
||||
(@pxref{Windows}). You can enable truncation for a particular buffer by
|
||||
setting the variable @code{truncate-lines} to non-@code{nil} in that
|
||||
buffer. (@xref{Variables}.) Altering the value of
|
||||
@code{truncate-lines} makes it local to the current buffer; until that
|
||||
time, the default value is in effect. The default is initially
|
||||
@code{nil}. @xref{Locals}.
|
||||
|
||||
@xref{Display Vars}, for additional variables that affect how text is
|
||||
displayed.
|
||||
|
||||
@node Position Info
|
||||
@section Cursor Position Information
|
||||
|
||||
Here are commands to get information about the size and position of
|
||||
parts of the buffer, and to count lines.
|
||||
|
||||
@table @kbd
|
||||
@item M-x what-page
|
||||
Print page number of point, and line number within page.
|
||||
@item M-x what-line
|
||||
Print line number of point in the buffer.
|
||||
@item M-x line-number-mode
|
||||
Toggle automatic display of current line number.
|
||||
@item M-=
|
||||
Print number of lines in the current region (@code{count-lines-region}).
|
||||
@xref{Mark}, for information about the region.
|
||||
@item C-x =
|
||||
Print character code of character after point, character position of
|
||||
point, and column of point (@code{what-cursor-position}).
|
||||
@end table
|
||||
|
||||
@findex what-page
|
||||
@findex what-line
|
||||
@cindex line number commands
|
||||
@cindex location of point
|
||||
@cindex cursor location
|
||||
@cindex point location
|
||||
There are two commands for working with line numbers. @kbd{M-x
|
||||
what-line} computes the current line number and displays it in the echo
|
||||
area. To go to a given line by number, use @kbd{M-x goto-line}; it
|
||||
prompts you for the number. These line numbers count from one at the
|
||||
beginning of the buffer.
|
||||
|
||||
You can also see the current line number in the mode line; @xref{Mode
|
||||
Line}. If you narrow the buffer, then the line number in the mode line
|
||||
is relative to the accessible portion (@pxref{Narrowing}). By contrast,
|
||||
@code{what-line} shows both the line number relative to the narrowed
|
||||
region and the line number relative to the whole buffer.
|
||||
|
||||
By contrast, @kbd{M-x what-page} counts pages from the beginning of
|
||||
the file, and counts lines within the page, printing both numbers.
|
||||
@xref{Pages}.
|
||||
|
||||
@kindex M-=
|
||||
@findex count-lines-region
|
||||
While on this subject, we might as well mention @kbd{M-=} (@code{count-lines-region}),
|
||||
which prints the number of lines in the region (@pxref{Mark}).
|
||||
@xref{Pages}, for the command @kbd{C-x l} which counts the lines in the
|
||||
current page.
|
||||
|
||||
@kindex C-x =
|
||||
@findex what-cursor-position
|
||||
The command @kbd{C-x =} (@code{what-cursor-position}) can be used to find out
|
||||
the column that the cursor is in, and other miscellaneous information about
|
||||
point. It prints a line in the echo area that looks like this:
|
||||
|
||||
@smallexample
|
||||
Char: c (0143, 99, 0x63) point=21044 of 26883(78%) column 53
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
(In fact, this is the output produced when point is before the
|
||||
@samp{column} in the example.)
|
||||
|
||||
The four values after @samp{Char:} describe the character that follows
|
||||
point, first by showing it and then by giving its character code in
|
||||
octal, decimal and hex. For a non-ASCII multibyte character, these are
|
||||
followed by @samp{ext} and the character's representation, in hex, in
|
||||
the buffer's coding system, if that coding system encodes the character
|
||||
safely and with a single byte (@pxref{Coding Systems}). If the
|
||||
character's encoding is longer than one byte, Emacs shows @samp{ext ...}.
|
||||
|
||||
@samp{point=} is followed by the position of point expressed as a character
|
||||
count. The front of the buffer counts as position 1, one character later
|
||||
as 2, and so on. The next, larger, number is the total number of characters
|
||||
in the buffer. Afterward in parentheses comes the position expressed as a
|
||||
percentage of the total size.
|
||||
|
||||
@samp{column} is followed by the horizontal position of point, in
|
||||
columns from the left edge of the window.
|
||||
|
||||
If the buffer has been narrowed, making some of the text at the
|
||||
beginning and the end temporarily inaccessible, @kbd{C-x =} prints
|
||||
additional text describing the currently accessible range. For example, it
|
||||
might display this:
|
||||
|
||||
@smallexample
|
||||
Char: C (0103, 67, 0x43) point=252 of 889(28%) <231 - 599> column 0
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
where the two extra numbers give the smallest and largest character
|
||||
position that point is allowed to assume. The characters between those
|
||||
two positions are the accessible ones. @xref{Narrowing}.
|
||||
|
||||
If point is at the end of the buffer (or the end of the accessible
|
||||
part), the @w{@kbd{C-x =}} output does not describe a character after
|
||||
point. The output might look like this:
|
||||
|
||||
@smallexample
|
||||
point=26957 of 26956(100%) column 0
|
||||
@end smallexample
|
||||
|
||||
@w{@kbd{C-u C-x =}} displays additional information about a character,
|
||||
in place of the buffer coordinates and column: the character set name
|
||||
and the codes that identify the character within that character set;
|
||||
ASCII characters are identified as belonging to the @code{ASCII}
|
||||
character set. In addition, the full character encoding, even if it
|
||||
takes more than a single byte, is shown after @samp{ext}. Here's an
|
||||
example for a Latin-1 character A with a grave accent in a buffer whose
|
||||
coding system is iso-2022-7bit@footnote{On terminals that support
|
||||
Latin-1 characters, the character shown after @samp{Char:} is displayed
|
||||
as the actual glyph of A with grave accent.}:
|
||||
|
||||
@example
|
||||
Char: @`A (04300, 2240, 0x8c0, ext ESC , A @@) (latin-iso8859-1 64)
|
||||
@end example
|
||||
|
||||
@node Arguments
|
||||
@section Numeric Arguments
|
||||
@cindex numeric arguments
|
||||
@cindex prefix arguments
|
||||
@cindex arguments, numeric
|
||||
@cindex arguments, prefix
|
||||
|
||||
In mathematics and computer usage, the word @dfn{argument} means
|
||||
``data provided to a function or operation.'' You can give any Emacs
|
||||
command a @dfn{numeric argument} (also called a @dfn{prefix argument}).
|
||||
Some commands interpret the argument as a repetition count. For
|
||||
example, @kbd{C-f} with an argument of ten moves forward ten characters
|
||||
instead of one. With these commands, no argument is equivalent to an
|
||||
argument of one. Negative arguments tell most such commands to move or
|
||||
act in the opposite direction.
|
||||
|
||||
@kindex M-1
|
||||
@kindex M-@t{-}
|
||||
@findex digit-argument
|
||||
@findex negative-argument
|
||||
If your terminal keyboard has a @key{META} key, the easiest way to
|
||||
specify a numeric argument is to type digits and/or a minus sign while
|
||||
holding down the @key{META} key. For example,
|
||||
@example
|
||||
M-5 C-n
|
||||
@end example
|
||||
@noindent
|
||||
would move down five lines. The characters @kbd{Meta-1}, @kbd{Meta-2},
|
||||
and so on, as well as @kbd{Meta--}, do this because they are keys bound
|
||||
to commands (@code{digit-argument} and @code{negative-argument}) that
|
||||
are defined to contribute to an argument for the next command. Digits
|
||||
and @kbd{-} modified with Control, or Control and Meta, also specify
|
||||
numeric arguments.
|
||||
|
||||
@kindex C-u
|
||||
@findex universal-argument
|
||||
Another way of specifying an argument is to use the @kbd{C-u}
|
||||
(@code{universal-argument}) command followed by the digits of the
|
||||
argument. With @kbd{C-u}, you can type the argument digits without
|
||||
holding down modifier keys; @kbd{C-u} works on all terminals. To type a
|
||||
negative argument, type a minus sign after @kbd{C-u}. Just a minus sign
|
||||
without digits normally means @minus{}1.
|
||||
|
||||
@kbd{C-u} followed by a character which is neither a digit nor a minus
|
||||
sign has the special meaning of ``multiply by four.'' It multiplies the
|
||||
argument for the next command by four. @kbd{C-u} twice multiplies it by
|
||||
sixteen. Thus, @kbd{C-u C-u C-f} moves forward sixteen characters. This
|
||||
is a good way to move forward ``fast,'' since it moves about 1/5 of a line
|
||||
in the usual size screen. Other useful combinations are @kbd{C-u C-n},
|
||||
@kbd{C-u C-u C-n} (move down a good fraction of a screen), @kbd{C-u C-u
|
||||
C-o} (make ``a lot'' of blank lines), and @kbd{C-u C-k} (kill four
|
||||
lines).@refill
|
||||
|
||||
Some commands care only about whether there is an argument, and not about
|
||||
its value. For example, the command @kbd{M-q} (@code{fill-paragraph}) with
|
||||
no argument fills text; with an argument, it justifies the text as well.
|
||||
(@xref{Filling}, for more information on @kbd{M-q}.) Plain @kbd{C-u} is a
|
||||
handy way of providing an argument for such commands.
|
||||
|
||||
Some commands use the value of the argument as a repeat count, but do
|
||||
something peculiar when there is no argument. For example, the command
|
||||
@kbd{C-k} (@code{kill-line}) with argument @var{n} kills @var{n} lines,
|
||||
including their terminating newlines. But @kbd{C-k} with no argument is
|
||||
special: it kills the text up to the next newline, or, if point is right at
|
||||
the end of the line, it kills the newline itself. Thus, two @kbd{C-k}
|
||||
commands with no arguments can kill a nonblank line, just like @kbd{C-k}
|
||||
with an argument of one. (@xref{Killing}, for more information on
|
||||
@kbd{C-k}.)@refill
|
||||
|
||||
A few commands treat a plain @kbd{C-u} differently from an ordinary
|
||||
argument. A few others may treat an argument of just a minus sign
|
||||
differently from an argument of @minus{}1. These unusual cases are
|
||||
described when they come up; they are always for reasons of convenience
|
||||
of use of the individual command.
|
||||
|
||||
You can use a numeric argument to insert multiple copies of a
|
||||
character. This is straightforward unless the character is a digit; for
|
||||
example, @kbd{C-u 6 4 a} inserts 64 copies of the character @samp{a}.
|
||||
But this does not work for inserting digits; @kbd{C-u 6 4 1} specifies
|
||||
an argument of 641, rather than inserting anything. To separate the
|
||||
digit to insert from the argument, type another @kbd{C-u}; for example,
|
||||
@kbd{C-u 6 4 C-u 1} does insert 64 copies of the character @samp{1}.
|
||||
|
||||
We use the term ``prefix argument'' as well as ``numeric argument'' to
|
||||
emphasize that you type the argument before the command, and to
|
||||
distinguish these arguments from minibuffer arguments that come after
|
||||
the command.
|
||||
|
||||
@node Repeating
|
||||
@section Repeating a Command
|
||||
@cindex repeating a command
|
||||
|
||||
@kindex C-x z
|
||||
@findex repeat
|
||||
The command @kbd{C-x z} (@code{repeat}) provides another way to repeat
|
||||
an Emacs command many times. This command repeats the previous Emacs
|
||||
command, whatever that was. Repeating a command uses the same arguments
|
||||
that were used before; it does not read new arguments each time.
|
||||
|
||||
To repeat the command more than once, type additional @kbd{z}'s: each
|
||||
@kbd{z} repeats the command one more time. Repetition ends when you
|
||||
type a character other than @kbd{z}, or press a mouse button.
|
||||
|
||||
For example, suppose you type @kbd{C-u 2 0 C-d} to delete 20
|
||||
characters. You can repeat that command (including its argument) three
|
||||
additional times, to delete a total of 80 characters, by typing @kbd{C-x
|
||||
z z z}. The first @kbd{C-x z} repeats the command once, and each
|
||||
subsequent @kbd{z} repeats it once again.
|
||||
|
413
man/buffers.texi
Normal file
413
man/buffers.texi
Normal file
|
@ -0,0 +1,413 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Buffers, Windows, Files, Top
|
||||
@chapter Using Multiple Buffers
|
||||
|
||||
@cindex buffers
|
||||
The text you are editing in Emacs resides in an object called a
|
||||
@dfn{buffer}. Each time you visit a file, a buffer is created to hold the
|
||||
file's text. Each time you invoke Dired, a buffer is created to hold the
|
||||
directory listing. If you send a message with @kbd{C-x m}, a buffer named
|
||||
@samp{*mail*} is used to hold the text of the message. When you ask for a
|
||||
command's documentation, that appears in a buffer called @samp{*Help*}.
|
||||
|
||||
@cindex selected buffer
|
||||
@cindex current buffer
|
||||
At any time, one and only one buffer is @dfn{selected}. It is also
|
||||
called the @dfn{current buffer}. Often we say that a command operates on
|
||||
``the buffer'' as if there were only one; but really this means that the
|
||||
command operates on the selected buffer (most commands do).
|
||||
|
||||
When Emacs has multiple windows, each window has a chosen buffer which
|
||||
is displayed there, but at any time only one of the windows is selected and
|
||||
its chosen buffer is the selected buffer. Each window's mode line displays
|
||||
the name of the buffer that the window is displaying (@pxref{Windows}).
|
||||
|
||||
Each buffer has a name, which can be of any length, and you can select
|
||||
any buffer by giving its name. Most buffers are made by visiting files,
|
||||
and their names are derived from the files' names. But you can also create
|
||||
an empty buffer with any name you want. A newly started Emacs has a buffer
|
||||
named @samp{*scratch*} which can be used for evaluating Lisp expressions in
|
||||
Emacs. The distinction between upper and lower case matters in buffer
|
||||
names.
|
||||
|
||||
Each buffer records individually what file it is visiting, whether it is
|
||||
modified, and what major mode and minor modes are in effect in it
|
||||
(@pxref{Major Modes}). Any Emacs variable can be made @dfn{local to} a
|
||||
particular buffer, meaning its value in that buffer can be different from
|
||||
the value in other buffers. @xref{Locals}.
|
||||
|
||||
@menu
|
||||
* Select Buffer:: Creating a new buffer or reselecting an old one.
|
||||
* List Buffers:: Getting a list of buffers that exist.
|
||||
* Misc Buffer:: Renaming; changing read-onlyness; copying text.
|
||||
* Kill Buffer:: Killing buffers you no longer need.
|
||||
* Several Buffers:: How to go through the list of all buffers
|
||||
and operate variously on several of them.
|
||||
* Indirect Buffers:: An indirect buffer shares the text of another buffer.
|
||||
@end menu
|
||||
|
||||
@node Select Buffer
|
||||
@section Creating and Selecting Buffers
|
||||
@cindex change buffers
|
||||
@cindex switch buffers
|
||||
|
||||
@table @kbd
|
||||
@item C-x b @var{buffer} @key{RET}
|
||||
Select or create a buffer named @var{buffer} (@code{switch-to-buffer}).
|
||||
@item C-x 4 b @var{buffer} @key{RET}
|
||||
Similar, but select @var{buffer} in another window
|
||||
(@code{switch-to-buffer-other-window}).
|
||||
@item C-x 5 b @var{buffer} @key{RET}
|
||||
Similar, but select @var{buffer} in a separate frame
|
||||
(@code{switch-to-buffer-other-frame}).
|
||||
@end table
|
||||
|
||||
@kindex C-x 4 b
|
||||
@findex switch-to-buffer-other-window
|
||||
@kindex C-x 5 b
|
||||
@findex switch-to-buffer-other-frame
|
||||
@kindex C-x b
|
||||
@findex switch-to-buffer
|
||||
To select the buffer named @var{bufname}, type @kbd{C-x b @var{bufname}
|
||||
@key{RET}}. This runs the command @code{switch-to-buffer} with argument
|
||||
@var{bufname}. You can use completion on an abbreviation for the buffer
|
||||
name you want (@pxref{Completion}). An empty argument to @kbd{C-x b}
|
||||
specifies the most recently selected buffer that is not displayed in any
|
||||
window.@refill
|
||||
|
||||
Most buffers are created by visiting files, or by Emacs commands that
|
||||
want to display some text, but you can also create a buffer explicitly
|
||||
by typing @kbd{C-x b @var{bufname} @key{RET}}. This makes a new, empty
|
||||
buffer that is not visiting any file, and selects it for editing. Such
|
||||
buffers are used for making notes to yourself. If you try to save one,
|
||||
you are asked for the file name to use. The new buffer's major mode is
|
||||
determined by the value of @code{default-major-mode} (@pxref{Major
|
||||
Modes}).
|
||||
|
||||
Note that @kbd{C-x C-f}, and any other command for visiting a file,
|
||||
can also be used to switch to an existing file-visiting buffer.
|
||||
@xref{Visiting}.
|
||||
|
||||
Emacs uses buffer names that start with a space for internal purposes.
|
||||
It treats these buffers specially in minor ways---for example, by
|
||||
default they do not record undo information. It is best to avoid using
|
||||
such buffer names yourself.
|
||||
|
||||
@node List Buffers
|
||||
@section Listing Existing Buffers
|
||||
|
||||
@table @kbd
|
||||
@item C-x C-b
|
||||
List the existing buffers (@code{list-buffers}).
|
||||
@end table
|
||||
|
||||
@cindex listing current buffers
|
||||
@kindex C-x C-b
|
||||
@findex list-buffers
|
||||
To display a list of all the buffers that exist, type @kbd{C-x C-b}.
|
||||
Each line in the list shows one buffer's name, major mode and visited
|
||||
file. The buffers are listed in the order that they were current; the
|
||||
buffers that were current most recently come first.
|
||||
|
||||
@samp{*} at the beginning of a line indicates the buffer is ``modified.''
|
||||
If several buffers are modified, it may be time to save some with @kbd{C-x s}
|
||||
(@pxref{Saving}). @samp{%} indicates a read-only buffer. @samp{.} marks the
|
||||
selected buffer. Here is an example of a buffer list:@refill
|
||||
|
||||
@smallexample
|
||||
MR Buffer Size Mode File
|
||||
-- ------ ---- ---- ----
|
||||
.* emacs.tex 383402 Texinfo /u2/emacs/man/emacs.tex
|
||||
*Help* 1287 Fundamental
|
||||
files.el 23076 Emacs-Lisp /u2/emacs/lisp/files.el
|
||||
% RMAIL 64042 RMAIL /u/rms/RMAIL
|
||||
*% man 747 Dired /u2/emacs/man/
|
||||
net.emacs 343885 Fundamental /u/rms/net.emacs
|
||||
fileio.c 27691 C /u2/emacs/src/fileio.c
|
||||
NEWS 67340 Text /u2/emacs/etc/NEWS
|
||||
*scratch* 0 Lisp Interaction
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
Note that the buffer @samp{*Help*} was made by a help request; it is not
|
||||
visiting any file. The buffer @code{man} was made by Dired on the
|
||||
directory @file{/u2/emacs/man/}.
|
||||
|
||||
@need 2000
|
||||
@node Misc Buffer
|
||||
@section Miscellaneous Buffer Operations
|
||||
|
||||
@table @kbd
|
||||
@item C-x C-q
|
||||
Toggle read-only status of buffer (@code{vc-toggle-read-only}).
|
||||
@item M-x rename-buffer @key{RET} @var{name} @key{RET}
|
||||
Change the name of the current buffer.
|
||||
@item M-x rename-uniquely
|
||||
Rename the current buffer by adding @samp{<@var{number}>} to the end.
|
||||
@item M-x view-buffer @key{RET} @var{buffer} @key{RET}
|
||||
Scroll through buffer @var{buffer}.
|
||||
@end table
|
||||
|
||||
@kindex C-x C-q
|
||||
@findex vc-toggle-read-only
|
||||
@vindex buffer-read-only
|
||||
@cindex read-only buffer
|
||||
A buffer can be @dfn{read-only}, which means that commands to change
|
||||
its contents are not allowed. The mode line indicates read-only buffers
|
||||
with @samp{%%} or @samp{%*} near the left margin. Read-only buffers are
|
||||
usually made by subsystems such as Dired and Rmail that have special
|
||||
commands to operate on the text; also by visiting a file whose access
|
||||
control says you cannot write it.
|
||||
|
||||
If you wish to make changes in a read-only buffer, use the command
|
||||
@kbd{C-x C-q} (@code{vc-toggle-read-only}). It makes a read-only buffer
|
||||
writable, and makes a writable buffer read-only. In most cases, this
|
||||
works by setting the variable @code{buffer-read-only}, which has a local
|
||||
value in each buffer and makes the buffer read-only if its value is
|
||||
non-@code{nil}. If the file is maintained with version control,
|
||||
@kbd{C-x C-q} works through the version control system to change the
|
||||
read-only status of the file as well as the buffer. @xref{Version
|
||||
Control}.
|
||||
|
||||
@findex rename-buffer
|
||||
@kbd{M-x rename-buffer} changes the name of the current buffer. Specify
|
||||
the new name as a minibuffer argument. There is no default. If you
|
||||
specify a name that is in use for some other buffer, an error happens and
|
||||
no renaming is done.
|
||||
|
||||
@kbd{M-x rename-uniquely} renames the current buffer to a similar name
|
||||
with a numeric suffix added to make it both different and unique. This
|
||||
command does not need an argument. It is useful for creating multiple
|
||||
shell buffers: if you rename the @samp{*Shell*} buffer, then do @kbd{M-x
|
||||
shell} again, it makes a new shell buffer named @samp{*Shell*};
|
||||
meanwhile, the old shell buffer continues to exist under its new name.
|
||||
This method is also good for mail buffers, compilation buffers, and most
|
||||
Emacs features that create special buffers with particular names.
|
||||
|
||||
@findex view-buffer
|
||||
@kbd{M-x view-buffer} is much like @kbd{M-x view-file} (@pxref{Misc
|
||||
File Ops}) except that it examines an already existing Emacs buffer.
|
||||
View mode provides commands for scrolling through the buffer
|
||||
conveniently but not for changing it. When you exit View mode with
|
||||
@kbd{q}, that switches back to the buffer (and the position) which was
|
||||
previously displayed in the window. Alternatively, if you exit View
|
||||
mode with @kbd{e}, the buffer and the value of point that resulted from
|
||||
your perusal remain in effect.
|
||||
|
||||
The commands @kbd{M-x append-to-buffer} and @kbd{M-x insert-buffer}
|
||||
can be used to copy text from one buffer to another. @xref{Accumulating
|
||||
Text}.@refill
|
||||
|
||||
@node Kill Buffer
|
||||
@section Killing Buffers
|
||||
|
||||
@cindex killing buffers
|
||||
If you continue an Emacs session for a while, you may accumulate a
|
||||
large number of buffers. You may then find it convenient to @dfn{kill}
|
||||
the buffers you no longer need. On most operating systems, killing a
|
||||
buffer releases its space back to the operating system so that other
|
||||
programs can use it. Here are some commands for killing buffers:
|
||||
|
||||
@c WideCommands
|
||||
@table @kbd
|
||||
@item C-x k @var{bufname} @key{RET}
|
||||
Kill buffer @var{bufname} (@code{kill-buffer}).
|
||||
@item M-x kill-some-buffers
|
||||
Offer to kill each buffer, one by one.
|
||||
@end table
|
||||
|
||||
@findex kill-buffer
|
||||
@findex kill-some-buffers
|
||||
@kindex C-x k
|
||||
|
||||
@kbd{C-x k} (@code{kill-buffer}) kills one buffer, whose name you
|
||||
specify in the minibuffer. The default, used if you type just @key{RET}
|
||||
in the minibuffer, is to kill the current buffer. If you kill the
|
||||
current buffer, another buffer is selected; one that has been selected
|
||||
recently but does not appear in any window now. If you ask to kill a
|
||||
file-visiting buffer that is modified (has unsaved editing), then you
|
||||
must confirm with @kbd{yes} before the buffer is killed.
|
||||
|
||||
The command @kbd{M-x kill-some-buffers} asks about each buffer, one by
|
||||
one. An answer of @kbd{y} means to kill the buffer. Killing the current
|
||||
buffer or a buffer containing unsaved changes selects a new buffer or asks
|
||||
for confirmation just like @code{kill-buffer}.
|
||||
|
||||
The buffer menu feature (@pxref{Several Buffers}) is also convenient
|
||||
for killing various buffers.
|
||||
|
||||
@vindex kill-buffer-hook
|
||||
If you want to do something special every time a buffer is killed, you
|
||||
can add hook functions to the hook @code{kill-buffer-hook} (@pxref{Hooks}).
|
||||
|
||||
@findex clean-buffer-list
|
||||
If you run one Emacs session for a period of days, as many people do,
|
||||
it can fill up with buffers that you used several days ago. The command
|
||||
@kbd{M-x clean-buffer-list} is a convenient way to purge them; it kills
|
||||
all the unmodified buffers that you have not used for a long time. An
|
||||
ordinary buffer is killed if it has not been displayed for three days;
|
||||
however, you can specify certain buffers that should never be killed
|
||||
automatically, and others that should be killed if they have been unused
|
||||
for a mere hour.
|
||||
|
||||
@cindex Midnight mode
|
||||
@vindex midnight-mode
|
||||
@vindex midnight-hook
|
||||
You can also have this buffer purging done for you, every day at
|
||||
midnight, by enabling Midnight mode. Midnight mode operates each day at
|
||||
midnight; at that time, it runs @code{clean-buffer-list}, or whichever
|
||||
functions you have placed in the normal hook @code{midnight-hook}
|
||||
(@pxref{Hooks}).
|
||||
|
||||
To enable Midnight mode, use the Customization buffer to set the
|
||||
variable @code{midnight-mode} to @code{t}. @xref{Easy Customization}.
|
||||
|
||||
@node Several Buffers
|
||||
@section Operating on Several Buffers
|
||||
@cindex buffer menu
|
||||
|
||||
The @dfn{buffer-menu} facility is like a ``Dired for buffers''; it allows
|
||||
you to request operations on various Emacs buffers by editing an Emacs
|
||||
buffer containing a list of them. You can save buffers, kill them
|
||||
(here called @dfn{deleting} them, for consistency with Dired), or display
|
||||
them.
|
||||
|
||||
@table @kbd
|
||||
@item M-x buffer-menu
|
||||
Begin editing a buffer listing all Emacs buffers.
|
||||
@end table
|
||||
|
||||
@findex buffer-menu
|
||||
The command @code{buffer-menu} writes a list of all Emacs buffers into
|
||||
the buffer @samp{*Buffer List*}, and selects that buffer in Buffer Menu
|
||||
mode. The buffer is read-only, and can be changed only through the
|
||||
special commands described in this section. The usual Emacs cursor
|
||||
motion commands can be used in the @samp{*Buffer List*} buffer. The
|
||||
following commands apply to the buffer described on the current line.
|
||||
|
||||
@table @kbd
|
||||
@item d
|
||||
Request to delete (kill) the buffer, then move down. The request
|
||||
shows as a @samp{D} on the line, before the buffer name. Requested
|
||||
deletions take place when you type the @kbd{x} command.
|
||||
@item C-d
|
||||
Like @kbd{d} but move up afterwards instead of down.
|
||||
@item s
|
||||
Request to save the buffer. The request shows as an @samp{S} on the
|
||||
line. Requested saves take place when you type the @kbd{x} command.
|
||||
You may request both saving and deletion for the same buffer.
|
||||
@item x
|
||||
Perform previously requested deletions and saves.
|
||||
@item u
|
||||
Remove any request made for the current line, and move down.
|
||||
@item @key{DEL}
|
||||
Move to previous line and remove any request made for that line.
|
||||
@end table
|
||||
|
||||
The @kbd{d}, @kbd{C-d}, @kbd{s} and @kbd{u} commands to add or remove
|
||||
flags also move down (or up) one line. They accept a numeric argument
|
||||
as a repeat count.
|
||||
|
||||
These commands operate immediately on the buffer listed on the current
|
||||
line:
|
||||
|
||||
@table @kbd
|
||||
@item ~
|
||||
Mark the buffer ``unmodified.'' The command @kbd{~} does this
|
||||
immediately when you type it.
|
||||
@item %
|
||||
Toggle the buffer's read-only flag. The command @kbd{%} does
|
||||
this immediately when you type it.
|
||||
@item t
|
||||
Visit the buffer as a tags table. @xref{Select Tags Table}.
|
||||
@end table
|
||||
|
||||
There are also commands to select another buffer or buffers:
|
||||
|
||||
@table @kbd
|
||||
@item q
|
||||
Quit the buffer menu---immediately display the most recent formerly
|
||||
visible buffer in its place.
|
||||
@item @key{RET}
|
||||
@itemx f
|
||||
Immediately select this line's buffer in place of the @samp{*Buffer
|
||||
List*} buffer.
|
||||
@item o
|
||||
Immediately select this line's buffer in another window as if by
|
||||
@kbd{C-x 4 b}, leaving @samp{*Buffer List*} visible.
|
||||
@item C-o
|
||||
Immediately display this line's buffer in another window, but don't
|
||||
select the window.
|
||||
@item 1
|
||||
Immediately select this line's buffer in a full-screen window.
|
||||
@item 2
|
||||
Immediately set up two windows, with this line's buffer in one, and the
|
||||
previously selected buffer (aside from the buffer @samp{*Buffer List*})
|
||||
in the other.
|
||||
@item b
|
||||
Bury the buffer listed on this line.
|
||||
@item m
|
||||
Mark this line's buffer to be displayed in another window if you exit
|
||||
with the @kbd{v} command. The request shows as a @samp{>} at the
|
||||
beginning of the line. (A single buffer may not have both a delete
|
||||
request and a display request.)
|
||||
@item v
|
||||
Immediately select this line's buffer, and also display in other windows
|
||||
any buffers previously marked with the @kbd{m} command. If you have not
|
||||
marked any buffers, this command is equivalent to @kbd{1}.
|
||||
@end table
|
||||
|
||||
All that @code{buffer-menu} does directly is create and switch to a
|
||||
suitable buffer, and turn on Buffer Menu mode. Everything else
|
||||
described above is implemented by the special commands provided in
|
||||
Buffer Menu mode. One consequence of this is that you can switch from
|
||||
the @samp{*Buffer List*} buffer to another Emacs buffer, and edit there.
|
||||
You can reselect the @samp{*Buffer List*} buffer later, to perform the
|
||||
operations already requested, or you can kill it, or pay no further
|
||||
attention to it.
|
||||
|
||||
The only difference between @code{buffer-menu} and @code{list-buffers}
|
||||
is that @code{buffer-menu} switches to the @samp{*Buffer List*} buffer
|
||||
in the selected window; @code{list-buffers} displays it in another
|
||||
window. If you run @code{list-buffers} (that is, type @kbd{C-x C-b})
|
||||
and select the buffer list manually, you can use all of the commands
|
||||
described here.
|
||||
|
||||
The buffer @samp{*Buffer List*} is not updated automatically when
|
||||
buffers are created and killed; its contents are just text. If you have
|
||||
created, deleted or renamed buffers, the way to update @samp{*Buffer
|
||||
List*} to show what you have done is to type @kbd{g}
|
||||
(@code{revert-buffer}) or repeat the @code{buffer-menu} command.
|
||||
|
||||
@node Indirect Buffers
|
||||
@section Indirect Buffers
|
||||
@cindex indirect buffer
|
||||
@cindex base buffer
|
||||
|
||||
An @dfn{indirect buffer} shares the text of some other buffer, which
|
||||
is called the @dfn{base buffer} of the indirect buffer. In some ways it
|
||||
is the analogue, for buffers, of a symbolic link between files.
|
||||
|
||||
@table @kbd
|
||||
@findex make-indirect-buffer
|
||||
@item M-x make-indirect-buffer @var{base-buffer} @key{RET} @var{indirect-name} @key{RET}
|
||||
Create an indirect buffer named @var{indirect-name} whose base buffer
|
||||
is @var{base-buffer}.
|
||||
@end table
|
||||
|
||||
The text of the indirect buffer is always identical to the text of its
|
||||
base buffer; changes made by editing either one are visible immediately
|
||||
in the other. But in all other respects, the indirect buffer and its
|
||||
base buffer are completely separate. They have different names,
|
||||
different values of point, different narrowing, different markers,
|
||||
different major modes, and different local variables.
|
||||
|
||||
An indirect buffer cannot visit a file, but its base buffer can. If
|
||||
you try to save the indirect buffer, that actually works by saving the
|
||||
base buffer. Killing the base buffer effectively kills the indirect
|
||||
buffer, but killing an indirect buffer has no effect on its base buffer.
|
||||
|
||||
One way to use indirect buffers is to display multiple views of an
|
||||
outline. @xref{Outline Views}.
|
796
man/building.texi
Normal file
796
man/building.texi
Normal file
|
@ -0,0 +1,796 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Building, Abbrevs, Programs, Top
|
||||
@chapter Compiling and Testing Programs
|
||||
@cindex building programs
|
||||
@cindex program building
|
||||
@cindex running Lisp functions
|
||||
|
||||
The previous chapter discusses the Emacs commands that are useful for
|
||||
making changes in programs. This chapter deals with commands that assist
|
||||
in the larger process of developing and maintaining programs.
|
||||
|
||||
@menu
|
||||
* Compilation:: Compiling programs in languages other
|
||||
than Lisp (C, Pascal, etc.).
|
||||
* Grep Searching:: Running grep as if it were a compiler.
|
||||
* Compilation Mode:: The mode for visiting compiler errors.
|
||||
* Compilation Shell:: Customizing your shell properly
|
||||
for use in the compilation buffer.
|
||||
* Debuggers:: Running symbolic debuggers for non-Lisp programs.
|
||||
* Executing Lisp:: Various modes for editing Lisp programs,
|
||||
with different facilities for running
|
||||
the Lisp programs.
|
||||
* Libraries: Lisp Libraries. Creating Lisp programs to run in Emacs.
|
||||
* Interaction: Lisp Interaction. Executing Lisp in an Emacs buffer.
|
||||
* Eval: Lisp Eval. Executing a single Lisp expression in Emacs.
|
||||
* External Lisp:: Communicating through Emacs with a separate Lisp.
|
||||
@end menu
|
||||
|
||||
@node Compilation
|
||||
@section Running Compilations under Emacs
|
||||
@cindex inferior process
|
||||
@cindex make
|
||||
@cindex compilation errors
|
||||
@cindex error log
|
||||
|
||||
Emacs can run compilers for noninteractive languages such as C and
|
||||
Fortran as inferior processes, feeding the error log into an Emacs buffer.
|
||||
It can also parse the error messages and show you the source lines where
|
||||
compilation errors occurred.
|
||||
|
||||
@table @kbd
|
||||
@item M-x compile
|
||||
Run a compiler asynchronously under Emacs, with error messages to
|
||||
@samp{*compilation*} buffer.
|
||||
@item M-x grep
|
||||
Run @code{grep} asynchronously under Emacs, with matching lines
|
||||
listed in the buffer named @samp{*grep*}.
|
||||
@item M-x grep-find
|
||||
Run @code{grep} via @code{find}, with user-specified arguments, and
|
||||
collect output in the buffer named @samp{*grep*}.
|
||||
@item M-x kill-compilation
|
||||
@itemx M-x kill-grep
|
||||
Kill the running compilation or @code{grep} subprocess.
|
||||
@end table
|
||||
|
||||
@findex compile
|
||||
To run @code{make} or another compilation command, do @kbd{M-x
|
||||
compile}. This command reads a shell command line using the minibuffer,
|
||||
and then executes the command in an inferior shell, putting output in
|
||||
the buffer named @samp{*compilation*}. The current buffer's default
|
||||
directory is used as the working directory for the execution of the
|
||||
command; normally, therefore, the compilation happens in this
|
||||
directory.
|
||||
|
||||
@vindex compile-command
|
||||
When the shell command line is read, the minibuffer appears containing
|
||||
a default command line, which is the command you used the last time you
|
||||
did @kbd{M-x compile}. If you type just @key{RET}, the same command
|
||||
line is used again. For the first @kbd{M-x compile}, the default is
|
||||
@samp{make -k}. The default compilation command comes from the variable
|
||||
@code{compile-command}; if the appropriate compilation command for a
|
||||
file is something other than @samp{make -k}, it can be useful for the
|
||||
file to specify a local value for @code{compile-command} (@pxref{File
|
||||
Variables}).
|
||||
|
||||
Starting a compilation displays the buffer @samp{*compilation*} in
|
||||
another window but does not select it. The buffer's mode line tells you
|
||||
whether compilation is finished, with the word @samp{run} or @samp{exit}
|
||||
inside the parentheses. You do not have to keep this buffer visible;
|
||||
compilation continues in any case. While a compilation is going on, the
|
||||
string @samp{Compiling} appears in the mode lines of all windows. When
|
||||
this string disappears, the compilation is finished.
|
||||
|
||||
If you want to watch the compilation transcript as it appears, switch
|
||||
to the @samp{*compilation*} buffer and move point to the end of the
|
||||
buffer. When point is at the end, new compilation output is inserted
|
||||
above point, which remains at the end. If point is not at the end of
|
||||
the buffer, it remains fixed while more compilation output is added at
|
||||
the end of the buffer.
|
||||
|
||||
@vindex compilation-scroll-output
|
||||
If you set the variable @code{compilation-scroll-output} to a
|
||||
non-@code{nil} value, then the compilation buffer always scrolls to
|
||||
follow output as it comes in.
|
||||
|
||||
@findex kill-compilation
|
||||
To kill the compilation process, do @kbd{M-x kill-compilation}. When
|
||||
the compiler process terminates, the mode line of the
|
||||
@samp{*compilation*} buffer changes to say @samp{signal} instead of
|
||||
@samp{run}. Starting a new compilation also kills any running
|
||||
compilation, as only one can exist at any time. However, @kbd{M-x
|
||||
compile} asks for confirmation before actually killing a compilation
|
||||
that is running.
|
||||
|
||||
@node Grep Searching
|
||||
@section Searching with Grep under Emacs
|
||||
|
||||
@findex grep
|
||||
Just as you can run a compiler from Emacs and then visit the lines
|
||||
where there were compilation errors, you can also run @code{grep} and
|
||||
then visit the lines on which matches were found. This works by
|
||||
treating the matches reported by @code{grep} as if they were ``errors.''
|
||||
|
||||
To do this, type @kbd{M-x grep}, then enter a command line that
|
||||
specifies how to run @code{grep}. Use the same arguments you would give
|
||||
@code{grep} when running it normally: a @code{grep}-style regexp
|
||||
(usually in single-quotes to quote the shell's special characters)
|
||||
followed by file names, which may use wildcards. The output from
|
||||
@code{grep} goes in the @samp{*grep*} buffer. You can find the
|
||||
corresponding lines in the original files using @kbd{C-x `} and
|
||||
@key{RET}, as with compilation errors.
|
||||
|
||||
If you specify a prefix argument for @kbd{M-x grep}, it figures out
|
||||
the tag (@pxref{Tags}) around point, and puts that into the default
|
||||
@code{grep} command.
|
||||
|
||||
@findex grep-find
|
||||
The command @kbd{M-x grep-find} is similar to @kbd{M-x grep}, but it
|
||||
supplies a different initial default for the command---one that runs
|
||||
both @code{find} and @code{grep}, so as to search every file in a
|
||||
directory tree. See also the @code{find-grep-dired} command,
|
||||
in @ref{Dired and Find}.
|
||||
|
||||
@node Compilation Mode
|
||||
@section Compilation Mode
|
||||
|
||||
@findex compile-goto-error
|
||||
@cindex Compilation mode
|
||||
@cindex mode, Compilation
|
||||
The @samp{*compilation*} buffer uses a special major mode, Compilation
|
||||
mode, whose main feature is to provide a convenient way to look at the
|
||||
source line where the error happened.
|
||||
|
||||
@table @kbd
|
||||
@item C-x `
|
||||
Visit the locus of the next compiler error message or @code{grep} match.
|
||||
@item @key{RET}
|
||||
Visit the locus of the error message that point is on.
|
||||
This command is used in the compilation buffer.
|
||||
@item Mouse-2
|
||||
Visit the locus of the error message that you click on.
|
||||
@end table
|
||||
|
||||
@kindex C-x `
|
||||
@findex next-error
|
||||
You can visit the source for any particular error message by moving
|
||||
point in @samp{*compilation*} to that error message and typing @key{RET}
|
||||
(@code{compile-goto-error}). Or click @kbd{Mouse-2} on the error message;
|
||||
you need not switch to the @samp{*compilation*} buffer first.
|
||||
|
||||
To parse the compiler error messages sequentially, type @kbd{C-x `}
|
||||
(@code{next-error}). The character following the @kbd{C-x} is the
|
||||
backquote or ``grave accent,'' not the single-quote. This command is
|
||||
available in all buffers, not just in @samp{*compilation*}; it displays
|
||||
the next error message at the top of one window and source location of
|
||||
the error in another window.
|
||||
|
||||
The first time @kbd{C-x `} is used after the start of a compilation,
|
||||
it moves to the first error's location. Subsequent uses of @kbd{C-x `}
|
||||
advance down to subsequent errors. If you visit a specific error
|
||||
message with @key{RET} or @kbd{Mouse-2}, subsequent @kbd{C-x `}
|
||||
commands advance from there. When @kbd{C-x `} gets to the end of the
|
||||
buffer and finds no more error messages to visit, it fails and signals
|
||||
an Emacs error.
|
||||
|
||||
@kbd{C-u C-x `} starts scanning from the beginning of the compilation
|
||||
buffer. This is one way to process the same set of errors again.
|
||||
|
||||
Compilation mode also redefines the keys @key{SPC} and @key{DEL} to
|
||||
scroll by screenfuls, and @kbd{M-n} and @kbd{M-p} to move to the next or
|
||||
previous error message. You can also use @kbd{M-@{} and @kbd{M-@}} to
|
||||
move up or down to an error message for a different source file.
|
||||
|
||||
The features of Compilation mode are also available in a minor mode
|
||||
called Compilation Minor mode. This lets you parse error messages in
|
||||
any buffer, not just a normal compilation output buffer. Type @kbd{M-x
|
||||
compilation-minor-mode} to enable the minor mode. This defines the keys
|
||||
@key{RET} and @kbd{Mouse-2}, as in the Compilation major mode.
|
||||
|
||||
Compilation minor mode works in any buffer, as long as the contents
|
||||
are in a format that it understands. In an Rlogin buffer (@pxref{Remote
|
||||
Host}), Compilation minor mode automatically accesses remote source
|
||||
files by FTP (@pxref{File Names}).
|
||||
|
||||
@node Compilation Shell
|
||||
@section Subshells for Compilation
|
||||
|
||||
Emacs uses a shell to run the compilation command, but specifies
|
||||
the option for a noninteractive shell. This means, in particular, that
|
||||
the shell should start with no prompt. If you find your usual shell
|
||||
prompt making an unsightly appearance in the @samp{*compilation*}
|
||||
buffer, it means you have made a mistake in your shell's init file by
|
||||
setting the prompt unconditionally. (This init file's name may be
|
||||
@file{.bashrc}, @file{.profile}, @file{.cshrc}, @file{.shrc}, or various
|
||||
other things, depending on the shell you use.) The shell init file
|
||||
should set the prompt only if there already is a prompt. In csh, here
|
||||
is how to do it:
|
||||
|
||||
@example
|
||||
if ($?prompt) set prompt = @dots{}
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
And here's how to do it in bash:
|
||||
|
||||
@example
|
||||
if [ "$@{PS1+set@}" = set ]
|
||||
then PS1=@dots{}
|
||||
fi
|
||||
@end example
|
||||
|
||||
There may well be other things that your shell's init file
|
||||
ought to do only for an interactive shell. You can use the same
|
||||
method to conditionalize them.
|
||||
|
||||
The MS-DOS ``operating system'' does not support asynchronous
|
||||
subprocesses; to work around this lack, @kbd{M-x compile} runs the
|
||||
compilation command synchronously on MS-DOS. As a consequence, you must
|
||||
wait until the command finishes before you can do anything else in
|
||||
Emacs. @xref{MS-DOS}.
|
||||
|
||||
@node Debuggers
|
||||
@section Running Debuggers Under Emacs
|
||||
@cindex debuggers
|
||||
@cindex GUD library
|
||||
@cindex GDB
|
||||
@cindex DBX
|
||||
@cindex SDB
|
||||
@cindex XDB
|
||||
@cindex Perldb
|
||||
@cindex JDB
|
||||
@cindex PDB
|
||||
|
||||
@c Do you believe in GUD?
|
||||
The GUD (Grand Unified Debugger) library provides an interface to
|
||||
various symbolic debuggers from within Emacs. We recommend the debugger
|
||||
GDB, which is free software, but you can also run DBX, SDB or XDB if you
|
||||
have them. GUD can also serve as an interface to the Perl's debugging
|
||||
mode, the Python debugger PDB, and to JDB, the Java Debugger.
|
||||
|
||||
@menu
|
||||
* Starting GUD:: How to start a debugger subprocess.
|
||||
* Debugger Operation:: Connection between the debugger and source buffers.
|
||||
* Commands of GUD:: Key bindings for common commands.
|
||||
* GUD Customization:: Defining your own commands for GUD.
|
||||
@end menu
|
||||
|
||||
@node Starting GUD
|
||||
@subsection Starting GUD
|
||||
|
||||
There are several commands for starting a debugger, each corresponding
|
||||
to a particular debugger program.
|
||||
|
||||
@table @kbd
|
||||
@item M-x gdb @key{RET} @var{file} @key{RET}
|
||||
@findex gdb
|
||||
Run GDB as a subprocess of Emacs. This command creates a buffer for
|
||||
input and output to GDB, and switches to it. If a GDB buffer already
|
||||
exists, it just switches to that buffer.
|
||||
|
||||
@item M-x dbx @key{RET} @var{file} @key{RET}
|
||||
@findex dbx
|
||||
Similar, but run DBX instead of GDB.
|
||||
|
||||
@item M-x xdb @key{RET} @var{file} @key{RET}
|
||||
@findex xdb
|
||||
@vindex gud-xdb-directories
|
||||
Similar, but run XDB instead of GDB. Use the variable
|
||||
@code{gud-xdb-directories} to specify directories to search for source
|
||||
files.
|
||||
|
||||
@item M-x sdb @key{RET} @var{file} @key{RET}
|
||||
@findex sdb
|
||||
Similar, but run SDB instead of GDB.
|
||||
|
||||
Some versions of SDB do not mention source file names in their
|
||||
messages. When you use them, you need to have a valid tags table
|
||||
(@pxref{Tags}) in order for GUD to find functions in the source code.
|
||||
If you have not visited a tags table or the tags table doesn't list one
|
||||
of the functions, you get a message saying @samp{The sdb support
|
||||
requires a valid tags table to work}. If this happens, generate a valid
|
||||
tags table in the working directory and try again.
|
||||
|
||||
@item M-x perldb @key{RET} @var{file} @key{RET}
|
||||
@findex perldb
|
||||
Run the Perl interpreter in debug mode to debug @var{file}, a Perl program.
|
||||
|
||||
@item M-x jdb @key{RET} @var{file} @key{RET}
|
||||
@findex jdb
|
||||
Run the Java debugger to debug @var{file}.
|
||||
|
||||
@item M-x pdb @key{RET} @var{file} @key{RET}
|
||||
@findex pdb
|
||||
Run the Python debugger to debug @var{file}.
|
||||
@end table
|
||||
|
||||
Each of these commands takes one argument: a command line to invoke
|
||||
the debugger. In the simplest case, specify just the name of the
|
||||
executable file you want to debug. You may also use options that the
|
||||
debugger supports. However, shell wildcards and variables are not
|
||||
allowed. GUD assumes that the first argument not starting with a
|
||||
@samp{-} is the executable file name.
|
||||
|
||||
Emacs can only run one debugger process at a time.
|
||||
|
||||
@node Debugger Operation
|
||||
@subsection Debugger Operation
|
||||
|
||||
When you run a debugger with GUD, the debugger uses an Emacs buffer
|
||||
for its ordinary input and output. This is called the GUD buffer. The
|
||||
debugger displays the source files of the program by visiting them in
|
||||
Emacs buffers. An arrow (@samp{=>}) in one of these buffers indicates
|
||||
the current execution line. Moving point in this buffer does not move
|
||||
the arrow.
|
||||
|
||||
You can start editing these source files at any time in the buffers
|
||||
that were made to display them. The arrow is not part of the file's
|
||||
text; it appears only on the screen. If you do modify a source file,
|
||||
keep in mind that inserting or deleting lines will throw off the arrow's
|
||||
positioning; GUD has no way of figuring out which line corresponded
|
||||
before your changes to the line number in a debugger message. Also,
|
||||
you'll typically have to recompile and restart the program for your
|
||||
changes to be reflected in the debugger's tables.
|
||||
|
||||
If you wish, you can control your debugger process entirely through the
|
||||
debugger buffer, which uses a variant of Shell mode. All the usual
|
||||
commands for your debugger are available, and you can use the Shell mode
|
||||
history commands to repeat them. @xref{Shell Mode}.
|
||||
|
||||
@node Commands of GUD
|
||||
@subsection Commands of GUD
|
||||
|
||||
The GUD interaction buffer uses a variant of Shell mode, so the
|
||||
commands of Shell mode are available (@pxref{Shell Mode}). GUD mode
|
||||
also provides commands for setting and clearing breakpoints, for
|
||||
selecting stack frames, and for stepping through the program. These
|
||||
commands are available both in the GUD buffer and globally, but with
|
||||
different key bindings.
|
||||
|
||||
The breakpoint commands are usually used in source file buffers,
|
||||
because that is the way to specify where to set or clear the breakpoint.
|
||||
Here's the global command to set a breakpoint:
|
||||
|
||||
@table @kbd
|
||||
@item C-x @key{SPC}
|
||||
@kindex C-x SPC
|
||||
Set a breakpoint on the source line that point is on.
|
||||
@end table
|
||||
|
||||
@kindex C-x C-a @r{(GUD)}
|
||||
Here are the other special commands provided by GUD. The keys
|
||||
starting with @kbd{C-c} are available only in the GUD interaction
|
||||
buffer. The key bindings that start with @kbd{C-x C-a} are available in
|
||||
the GUD interaction buffer and also in source files.
|
||||
|
||||
@table @kbd
|
||||
@item C-c C-l
|
||||
@kindex C-c C-l @r{(GUD)}
|
||||
@itemx C-x C-a C-l
|
||||
@findex gud-refresh
|
||||
Display in another window the last line referred to in the GUD
|
||||
buffer (that is, the line indicated in the last location message).
|
||||
This runs the command @code{gud-refresh}.
|
||||
|
||||
@item C-c C-s
|
||||
@kindex C-c C-s @r{(GUD)}
|
||||
@itemx C-x C-a C-s
|
||||
@findex gud-step
|
||||
Execute a single line of code (@code{gud-step}). If the line contains
|
||||
a function call, execution stops after entering the called function.
|
||||
|
||||
@item C-c C-n
|
||||
@kindex C-c C-n @r{(GUD)}
|
||||
@itemx C-x C-a C-n
|
||||
@findex gud-next
|
||||
Execute a single line of code, stepping across entire function calls
|
||||
at full speed (@code{gud-next}).
|
||||
|
||||
@item C-c C-i
|
||||
@kindex C-c C-i @r{(GUD)}
|
||||
@itemx C-x C-a C-i
|
||||
@findex gud-stepi
|
||||
Execute a single machine instruction (@code{gud-stepi}).
|
||||
|
||||
@need 3000
|
||||
@item C-c C-r
|
||||
@kindex C-c C-r @r{(GUD)}
|
||||
@itemx C-x C-a C-r
|
||||
@findex gud-cont
|
||||
Continue execution without specifying any stopping point. The program
|
||||
will run until it hits a breakpoint, terminates, or gets a signal that
|
||||
the debugger is checking for (@code{gud-cont}).
|
||||
|
||||
@need 1000
|
||||
@item C-c C-d
|
||||
@kindex C-c C-d @r{(GUD)}
|
||||
@itemx C-x C-a C-d
|
||||
@findex gud-remove
|
||||
Delete the breakpoint(s) on the current source line, if any
|
||||
(@code{gud-remove}). If you use this command in the GUD interaction
|
||||
buffer, it applies to the line where the program last stopped.
|
||||
|
||||
@item C-c C-t
|
||||
@kindex C-c C-t @r{(GUD)}
|
||||
@itemx C-x C-a C-t
|
||||
@findex gud-tbreak
|
||||
Set a temporary breakpoint on the current source line, if any.
|
||||
If you use this command in the GUD interaction buffer,
|
||||
it applies to the line where the program last stopped.
|
||||
@end table
|
||||
|
||||
The above commands are common to all supported debuggers. If you are
|
||||
using GDB or (some versions of) DBX, these additional commands are available:
|
||||
|
||||
@table @kbd
|
||||
@item C-c <
|
||||
@kindex C-c < @r{(GUD)}
|
||||
@itemx C-x C-a <
|
||||
@findex gud-up
|
||||
Select the next enclosing stack frame (@code{gud-up}). This is
|
||||
equivalent to the @samp{up} command.
|
||||
|
||||
@item C-c >
|
||||
@kindex C-c > @r{(GUD)}
|
||||
@itemx C-x C-a >
|
||||
@findex gud-down
|
||||
Select the next inner stack frame (@code{gud-down}). This is
|
||||
equivalent to the @samp{down} command.
|
||||
@end table
|
||||
|
||||
If you are using GDB, these additional key bindings are available:
|
||||
|
||||
@table @kbd
|
||||
@item @key{TAB}
|
||||
@kindex TAB @r{(GUD)}
|
||||
@findex gud-gdb-complete-command
|
||||
With GDB, complete a symbol name (@code{gud-gdb-complete-command}).
|
||||
This key is available only in the GUD interaction buffer, and requires
|
||||
GDB versions 4.13 and later.
|
||||
|
||||
@item C-c C-f
|
||||
@kindex C-c C-f @r{(GUD)}
|
||||
@itemx C-x C-a C-f
|
||||
@findex gud-finish
|
||||
Run the program until the selected stack frame returns (or until it
|
||||
stops for some other reason).
|
||||
@end table
|
||||
|
||||
These commands interpret a numeric argument as a repeat count, when
|
||||
that makes sense.
|
||||
|
||||
Because @key{TAB} serves as a completion command, you can't use it to
|
||||
enter a tab as input to the program you are debugging with GDB.
|
||||
Instead, type @kbd{C-q @key{TAB}} to enter a tab.
|
||||
|
||||
@node GUD Customization
|
||||
@subsection GUD Customization
|
||||
|
||||
@vindex gdb-mode-hook
|
||||
@vindex dbx-mode-hook
|
||||
@vindex sdb-mode-hook
|
||||
@vindex xdb-mode-hook
|
||||
@vindex perldb-mode-hook
|
||||
@vindex pdb-mode-hook
|
||||
@vindex jdb-mode-hook
|
||||
On startup, GUD runs one of the following hooks: @code{gdb-mode-hook},
|
||||
if you are using GDB; @code{dbx-mode-hook}, if you are using DBX;
|
||||
@code{sdb-mode-hook}, if you are using SDB; @code{xdb-mode-hook}, if you
|
||||
are using XDB; @code{perldb-mode-hook}, for Perl debugging mode;
|
||||
@code{jdb-mode-hook}, for PDB; @code{jdb-mode-hook}, for JDB. You can
|
||||
use these hooks to define custom key bindings for the debugger
|
||||
interaction buffer. @xref{Hooks}.
|
||||
|
||||
Here is a convenient way to define a command that sends a particular
|
||||
command string to the debugger, and set up a key binding for it in the
|
||||
debugger interaction buffer:
|
||||
|
||||
@findex gud-def
|
||||
@example
|
||||
(gud-def @var{function} @var{cmdstring} @var{binding} @var{docstring})
|
||||
@end example
|
||||
|
||||
This defines a command named @var{function} which sends
|
||||
@var{cmdstring} to the debugger process, and gives it the documentation
|
||||
string @var{docstring}. You can use the command thus defined in any
|
||||
buffer. If @var{binding} is non-@code{nil}, @code{gud-def} also binds
|
||||
the command to @kbd{C-c @var{binding}} in the GUD buffer's mode and to
|
||||
@kbd{C-x C-a @var{binding}} generally.
|
||||
|
||||
The command string @var{cmdstring} may contain certain
|
||||
@samp{%}-sequences that stand for data to be filled in at the time
|
||||
@var{function} is called:
|
||||
|
||||
@table @samp
|
||||
@item %f
|
||||
The name of the current source file. If the current buffer is the GUD
|
||||
buffer, then the ``current source file'' is the file that the program
|
||||
stopped in.
|
||||
@c This said, ``the name of the file the program counter was in at the last breakpoint.''
|
||||
@c But I suspect it is really the last stop file.
|
||||
|
||||
@item %l
|
||||
The number of the current source line. If the current buffer is the GUD
|
||||
buffer, then the ``current source line'' is the line that the program
|
||||
stopped in.
|
||||
|
||||
@item %e
|
||||
The text of the C lvalue or function-call expression at or adjacent to point.
|
||||
|
||||
@item %a
|
||||
The text of the hexadecimal address at or adjacent to point.
|
||||
|
||||
@item %p
|
||||
The numeric argument of the called function, as a decimal number. If
|
||||
the command is used without a numeric argument, @samp{%p} stands for the
|
||||
empty string.
|
||||
|
||||
If you don't use @samp{%p} in the command string, the command you define
|
||||
ignores any numeric argument.
|
||||
@end table
|
||||
|
||||
@node Executing Lisp
|
||||
@section Executing Lisp Expressions
|
||||
|
||||
Emacs has several different major modes for Lisp and Scheme. They are
|
||||
the same in terms of editing commands, but differ in the commands for
|
||||
executing Lisp expressions. Each mode has its own purpose.
|
||||
|
||||
@table @asis
|
||||
@item Emacs-Lisp mode
|
||||
The mode for editing source files of programs to run in Emacs Lisp.
|
||||
This mode defines @kbd{C-M-x} to evaluate the current defun.
|
||||
@xref{Lisp Libraries}.
|
||||
@item Lisp Interaction mode
|
||||
The mode for an interactive session with Emacs Lisp. It defines
|
||||
@kbd{C-j} to evaluate the sexp before point and insert its value in the
|
||||
buffer. @xref{Lisp Interaction}.
|
||||
@item Lisp mode
|
||||
The mode for editing source files of programs that run in Lisps other
|
||||
than Emacs Lisp. This mode defines @kbd{C-M-x} to send the current defun
|
||||
to an inferior Lisp process. @xref{External Lisp}.
|
||||
@item Inferior Lisp mode
|
||||
The mode for an interactive session with an inferior Lisp process.
|
||||
This mode combines the special features of Lisp mode and Shell mode
|
||||
(@pxref{Shell Mode}).
|
||||
@item Scheme mode
|
||||
Like Lisp mode but for Scheme programs.
|
||||
@item Inferior Scheme mode
|
||||
The mode for an interactive session with an inferior Scheme process.
|
||||
@end table
|
||||
|
||||
Most editing commands for working with Lisp programs are in fact
|
||||
available globally. @xref{Programs}.
|
||||
|
||||
@node Lisp Libraries
|
||||
@section Libraries of Lisp Code for Emacs
|
||||
@cindex libraries
|
||||
@cindex loading Lisp code
|
||||
|
||||
Lisp code for Emacs editing commands is stored in files whose names
|
||||
conventionally end in @file{.el}. This ending tells Emacs to edit them in
|
||||
Emacs-Lisp mode (@pxref{Executing Lisp}).
|
||||
|
||||
@findex load-file
|
||||
To execute a file of Emacs Lisp code, use @kbd{M-x load-file}. This
|
||||
command reads a file name using the minibuffer and then executes the
|
||||
contents of that file as Lisp code. It is not necessary to visit the
|
||||
file first; in any case, this command reads the file as found on disk,
|
||||
not text in an Emacs buffer.
|
||||
|
||||
@findex load
|
||||
@findex load-library
|
||||
Once a file of Lisp code is installed in the Emacs Lisp library
|
||||
directories, users can load it using @kbd{M-x load-library}. Programs can
|
||||
load it by calling @code{load-library}, or with @code{load}, a more primitive
|
||||
function that is similar but accepts some additional arguments.
|
||||
|
||||
@kbd{M-x load-library} differs from @kbd{M-x load-file} in that it
|
||||
searches a sequence of directories and tries three file names in each
|
||||
directory. Suppose your argument is @var{lib}; the three names are
|
||||
@file{@var{lib}.elc}, @file{@var{lib}.el}, and lastly just
|
||||
@file{@var{lib}}. If @file{@var{lib}.elc} exists, it is by convention
|
||||
the result of compiling @file{@var{lib}.el}; it is better to load the
|
||||
compiled file, since it will load and run faster.
|
||||
|
||||
If @code{load-library} finds that @file{@var{lib}.el} is newer than
|
||||
@file{@var{lib}.elc} file, it prints a warning, because it's likely that
|
||||
somebody made changes to the @file{.el} file and forgot to recompile
|
||||
it.
|
||||
|
||||
Because the argument to @code{load-library} is usually not in itself
|
||||
a valid file name, file name completion is not available. Indeed, when
|
||||
using this command, you usually do not know exactly what file name
|
||||
will be used.
|
||||
|
||||
@vindex load-path
|
||||
The sequence of directories searched by @kbd{M-x load-library} is
|
||||
specified by the variable @code{load-path}, a list of strings that are
|
||||
directory names. The default value of the list contains the directory where
|
||||
the Lisp code for Emacs itself is stored. If you have libraries of
|
||||
your own, put them in a single directory and add that directory
|
||||
to @code{load-path}. @code{nil} in this list stands for the current default
|
||||
directory, but it is probably not a good idea to put @code{nil} in the
|
||||
list. If you find yourself wishing that @code{nil} were in the list,
|
||||
most likely what you really want to do is use @kbd{M-x load-file}
|
||||
this once.
|
||||
|
||||
@cindex autoload
|
||||
Often you do not have to give any command to load a library, because
|
||||
the commands defined in the library are set up to @dfn{autoload} that
|
||||
library. Trying to run any of those commands calls @code{load} to load
|
||||
the library; this replaces the autoload definitions with the real ones
|
||||
from the library.
|
||||
|
||||
@cindex byte code
|
||||
Emacs Lisp code can be compiled into byte-code which loads faster,
|
||||
takes up less space when loaded, and executes faster. @xref{Byte
|
||||
Compilation,, Byte Compilation, elisp, the Emacs Lisp Reference Manual}.
|
||||
By convention, the compiled code for a library goes in a separate file
|
||||
whose name consists of the library source file with @samp{c} appended.
|
||||
Thus, the compiled code for @file{foo.el} goes in @file{foo.elc}.
|
||||
That's why @code{load-library} searches for @samp{.elc} files first.
|
||||
|
||||
@node Lisp Eval
|
||||
@section Evaluating Emacs-Lisp Expressions
|
||||
@cindex Emacs-Lisp mode
|
||||
@cindex mode, Emacs-Lisp
|
||||
|
||||
@findex emacs-lisp-mode
|
||||
Lisp programs intended to be run in Emacs should be edited in
|
||||
Emacs-Lisp mode; this happens automatically for file names ending in
|
||||
@file{.el}. By contrast, Lisp mode itself is used for editing Lisp
|
||||
programs intended for other Lisp systems. To switch to Emacs-Lisp mode
|
||||
explicitly, use the command @kbd{M-x emacs-lisp-mode}.
|
||||
|
||||
For testing of Lisp programs to run in Emacs, it is often useful to
|
||||
evaluate part of the program as it is found in the Emacs buffer. For
|
||||
example, after changing the text of a Lisp function definition,
|
||||
evaluating the definition installs the change for future calls to the
|
||||
function. Evaluation of Lisp expressions is also useful in any kind of
|
||||
editing, for invoking noninteractive functions (functions that are
|
||||
not commands).
|
||||
|
||||
@table @kbd
|
||||
@item M-:
|
||||
Read a single Lisp expression in the minibuffer, evaluate it, and print
|
||||
the value in the echo area (@code{eval-expression}).
|
||||
@item C-x C-e
|
||||
Evaluate the Lisp expression before point, and print the value in the
|
||||
echo area (@code{eval-last-sexp}).
|
||||
@item C-M-x
|
||||
Evaluate the defun containing or after point, and print the value in
|
||||
the echo area (@code{eval-defun}).
|
||||
@item M-x eval-region
|
||||
Evaluate all the Lisp expressions in the region.
|
||||
@item M-x eval-current-buffer
|
||||
Evaluate all the Lisp expressions in the buffer.
|
||||
@end table
|
||||
|
||||
@kindex M-:
|
||||
@findex eval-expression
|
||||
@kbd{M-:} (@code{eval-expression}) is the most basic command for evaluating
|
||||
a Lisp expression interactively. It reads the expression using the
|
||||
minibuffer, so you can execute any expression on a buffer regardless of
|
||||
what the buffer contains. When the expression is evaluated, the current
|
||||
buffer is once again the buffer that was current when @kbd{M-:} was
|
||||
typed.
|
||||
|
||||
@kindex C-M-x @r{(Emacs-Lisp mode)}
|
||||
@findex eval-defun
|
||||
In Emacs-Lisp mode, the key @kbd{C-M-x} is bound to the command
|
||||
@code{eval-defun}, which parses the defun containing or following point
|
||||
as a Lisp expression and evaluates it. The value is printed in the echo
|
||||
area. This command is convenient for installing in the Lisp environment
|
||||
changes that you have just made in the text of a function definition.
|
||||
|
||||
@kbd{C-M-x} treats @code{defvar} expressions specially. Normally,
|
||||
evaluating a @code{defvar} expression does nothing if the variable it
|
||||
defines already has a value. But @kbd{C-M-x} unconditionally resets the
|
||||
variable to the initial value specified in the @code{defvar} expression.
|
||||
This special feature is convenient for debugging Lisp programs.
|
||||
|
||||
@kindex C-x C-e
|
||||
@findex eval-last-sexp
|
||||
The command @kbd{C-x C-e} (@code{eval-last-sexp}) evaluates the Lisp
|
||||
expression preceding point in the buffer, and displays the value in the
|
||||
echo area. It is available in all major modes, not just Emacs-Lisp
|
||||
mode. It does not treat @code{defvar} specially.
|
||||
|
||||
If @kbd{C-M-x}, @kbd{C-x C-e}, or @kbd{M-:} is given a numeric
|
||||
argument, it inserts the value into the current buffer at point, rather
|
||||
than displaying it in the echo area. The argument's value does not
|
||||
matter.
|
||||
|
||||
@findex eval-region
|
||||
@findex eval-current-buffer
|
||||
The most general command for evaluating Lisp expressions from a buffer
|
||||
is @code{eval-region}. @kbd{M-x eval-region} parses the text of the
|
||||
region as one or more Lisp expressions, evaluating them one by one.
|
||||
@kbd{M-x eval-current-buffer} is similar but evaluates the entire
|
||||
buffer. This is a reasonable way to install the contents of a file of
|
||||
Lisp code that you are just ready to test. Later, as you find bugs and
|
||||
change individual functions, use @kbd{C-M-x} on each function that you
|
||||
change. This keeps the Lisp world in step with the source file.
|
||||
|
||||
@node Lisp Interaction
|
||||
@section Lisp Interaction Buffers
|
||||
|
||||
The buffer @samp{*scratch*} which is selected when Emacs starts up is
|
||||
provided for evaluating Lisp expressions interactively inside Emacs.
|
||||
|
||||
The simplest way to use the @samp{*scratch*} buffer is to insert Lisp
|
||||
expressions and type @kbd{C-j} after each expression. This command
|
||||
reads the Lisp expression before point, evaluates it, and inserts the
|
||||
value in printed representation before point. The result is a complete
|
||||
typescript of the expressions you have evaluated and their values.
|
||||
|
||||
The @samp{*scratch*} buffer's major mode is Lisp Interaction mode, which
|
||||
is the same as Emacs-Lisp mode except for the binding of @kbd{C-j}.
|
||||
|
||||
@findex lisp-interaction-mode
|
||||
The rationale for this feature is that Emacs must have a buffer when
|
||||
it starts up, but that buffer is not useful for editing files since a
|
||||
new buffer is made for every file that you visit. The Lisp interpreter
|
||||
typescript is the most useful thing I can think of for the initial
|
||||
buffer to do. Type @kbd{M-x lisp-interaction-mode} to put the current
|
||||
buffer in Lisp Interaction mode.
|
||||
|
||||
@findex ielm
|
||||
An alternative way of evaluating Emacs Lisp expressions interactively
|
||||
is to use Inferior Emacs-Lisp mode, which provides an interface rather
|
||||
like Shell mode (@pxref{Shell Mode}) for evaluating Emacs Lisp
|
||||
expressions. Type @kbd{M-x ielm} to create an @samp{*ielm*} buffer
|
||||
which uses this mode.
|
||||
|
||||
@node External Lisp
|
||||
@section Running an External Lisp
|
||||
|
||||
Emacs has facilities for running programs in other Lisp systems. You can
|
||||
run a Lisp process as an inferior of Emacs, and pass expressions to it to
|
||||
be evaluated. You can also pass changed function definitions directly from
|
||||
the Emacs buffers in which you edit the Lisp programs to the inferior Lisp
|
||||
process.
|
||||
|
||||
@findex run-lisp
|
||||
@vindex inferior-lisp-program
|
||||
@kindex C-x C-z
|
||||
To run an inferior Lisp process, type @kbd{M-x run-lisp}. This runs
|
||||
the program named @code{lisp}, the same program you would run by typing
|
||||
@code{lisp} as a shell command, with both input and output going through
|
||||
an Emacs buffer named @samp{*lisp*}. That is to say, any ``terminal
|
||||
output'' from Lisp will go into the buffer, advancing point, and any
|
||||
``terminal input'' for Lisp comes from text in the buffer. (You can
|
||||
change the name of the Lisp executable file by setting the variable
|
||||
@code{inferior-lisp-program}.)
|
||||
|
||||
To give input to Lisp, go to the end of the buffer and type the input,
|
||||
terminated by @key{RET}. The @samp{*lisp*} buffer is in Inferior Lisp
|
||||
mode, which combines the special characteristics of Lisp mode with most
|
||||
of the features of Shell mode (@pxref{Shell Mode}). The definition of
|
||||
@key{RET} to send a line to a subprocess is one of the features of Shell
|
||||
mode.
|
||||
|
||||
@findex lisp-mode
|
||||
For the source files of programs to run in external Lisps, use Lisp
|
||||
mode. This mode can be selected with @kbd{M-x lisp-mode}, and is used
|
||||
automatically for files whose names end in @file{.l}, @file{.lsp}, or
|
||||
@file{.lisp}, as most Lisp systems usually expect.
|
||||
|
||||
@kindex C-M-x @r{(Lisp mode)}
|
||||
@findex lisp-eval-defun
|
||||
When you edit a function in a Lisp program you are running, the easiest
|
||||
way to send the changed definition to the inferior Lisp process is the key
|
||||
@kbd{C-M-x}. In Lisp mode, this runs the function @code{lisp-eval-defun},
|
||||
which finds the defun around or following point and sends it as input to
|
||||
the Lisp process. (Emacs can send input to any inferior process regardless
|
||||
of what buffer is current.)
|
||||
|
||||
Contrast the meanings of @kbd{C-M-x} in Lisp mode (for editing programs
|
||||
to be run in another Lisp system) and Emacs-Lisp mode (for editing Lisp
|
||||
programs to be run in Emacs): in both modes it has the effect of installing
|
||||
the function definition that point is in, but the way of doing so is
|
||||
different according to where the relevant Lisp environment is found.
|
||||
@xref{Executing Lisp}.
|
1438
man/calendar.texi
Normal file
1438
man/calendar.texi
Normal file
File diff suppressed because it is too large
Load diff
3560
man/cc-mode.texi
Normal file
3560
man/cc-mode.texi
Normal file
File diff suppressed because it is too large
Load diff
5701
man/cl.texi
Normal file
5701
man/cl.texi
Normal file
File diff suppressed because it is too large
Load diff
1158
man/cmdargs.texi
Normal file
1158
man/cmdargs.texi
Normal file
File diff suppressed because it is too large
Load diff
251
man/commands.texi
Normal file
251
man/commands.texi
Normal file
|
@ -0,0 +1,251 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@iftex
|
||||
@chapter Characters, Keys and Commands
|
||||
|
||||
This chapter explains the character sets used by Emacs for input
|
||||
commands and for the contents of files, and also explains the concepts
|
||||
of @dfn{keys} and @dfn{commands}, which are fundamental for understanding
|
||||
how Emacs interprets your keyboard and mouse input.
|
||||
@end iftex
|
||||
|
||||
@node User Input, Keys, Screen, Top
|
||||
@section Kinds of User Input
|
||||
@cindex input with the keyboard
|
||||
@cindex keyboard input
|
||||
@cindex character set (keyboard)
|
||||
@cindex ASCII
|
||||
@cindex C-
|
||||
@cindex Control
|
||||
@cindex control characters
|
||||
|
||||
GNU Emacs uses an extension of the ASCII character set for keyboard
|
||||
input; it also accepts non-character input events including function
|
||||
keys and mouse button actions.
|
||||
|
||||
ASCII consists of 128 character codes. Some of these codes are
|
||||
assigned graphic symbols such as @samp{a} and @samp{=}; the rest are
|
||||
control characters, such as @kbd{Control-a} (usually written @kbd{C-a}
|
||||
for short). @kbd{C-a} gets its name from the fact that you type it by
|
||||
holding down the @key{CTRL} key while pressing @kbd{a}.
|
||||
|
||||
Some ASCII control characters have special names, and most terminals
|
||||
have special keys you can type them with: for example, @key{RET},
|
||||
@key{TAB}, @key{DEL} and @key{ESC}. The space character is usually
|
||||
referred to below as @key{SPC}, even though strictly speaking it is a
|
||||
graphic character whose graphic happens to be blank. Some keyboards
|
||||
have a key labeled ``linefeed'' which is an alias for @kbd{C-j}.
|
||||
|
||||
Emacs extends the ASCII character set with thousands more printing
|
||||
characters (@pxref{International}), additional control characters, and a
|
||||
few more modifiers that can be combined with any character.
|
||||
|
||||
On ASCII terminals, there are only 32 possible control characters.
|
||||
These are the control variants of letters and @samp{@@[]\^_}. In
|
||||
addition, the shift key is meaningless with control characters:
|
||||
@kbd{C-a} and @kbd{C-A} are the same character, and Emacs cannot
|
||||
distinguish them.
|
||||
|
||||
But the Emacs character set has room for control variants of all
|
||||
printing characters, and for distinguishing between @kbd{C-a} and
|
||||
@kbd{C-A}. X Windows makes it possible to enter all these characters.
|
||||
For example, @kbd{C--} (that's Control-Minus) and @kbd{C-5} are
|
||||
meaningful Emacs commands under X.
|
||||
|
||||
Another Emacs character-set extension is additional modifier bits.
|
||||
Only one modifier bit is commonly used; it is called Meta. Every
|
||||
character has a Meta variant; examples include @kbd{Meta-a} (normally
|
||||
written @kbd{M-a}, for short), @kbd{M-A} (not the same character as
|
||||
@kbd{M-a}, but those two characters normally have the same meaning in
|
||||
Emacs), @kbd{M-@key{RET}}, and @kbd{M-C-a}. For reasons of tradition,
|
||||
we usually write @kbd{C-M-a} rather than @kbd{M-C-a}; logically
|
||||
speaking, the order in which the modifier keys @key{CTRL} and @key{META}
|
||||
are mentioned does not matter.
|
||||
|
||||
@cindex Meta
|
||||
@cindex M-
|
||||
@cindex @key{ESC} replacing @key{META} key
|
||||
Some terminals have a @key{META} key, and allow you to type Meta
|
||||
characters by holding this key down. Thus, @kbd{Meta-a} is typed by
|
||||
holding down @key{META} and pressing @kbd{a}. The @key{META} key works
|
||||
much like the @key{SHIFT} key. Such a key is not always labeled
|
||||
@key{META}, however, as this function is often a special option for a key
|
||||
with some other primary purpose.@refill
|
||||
|
||||
If there is no @key{META} key, you can still type Meta characters
|
||||
using two-character sequences starting with @key{ESC}. Thus, to enter
|
||||
@kbd{M-a}, you could type @kbd{@key{ESC} a}. To enter @kbd{C-M-a}, you
|
||||
would type @kbd{@key{ESC} C-a}. @key{ESC} is allowed on terminals with
|
||||
@key{META} keys, too, in case you have formed a habit of using it.
|
||||
|
||||
X Windows provides several other modifier keys that can be applied to
|
||||
any input character. These are called @key{SUPER}, @key{HYPER} and
|
||||
@key{ALT}. We write @samp{s-}, @samp{H-} and @samp{A-} to say that a
|
||||
character uses these modifiers. Thus, @kbd{s-H-C-x} is short for
|
||||
@kbd{Super-Hyper-Control-x}. Not all X terminals actually provide keys
|
||||
for these modifier flags---in fact, many terminals have a key labeled
|
||||
@key{ALT} which is really a @key{META} key. The standard key bindings
|
||||
of Emacs do not include any characters with these modifiers. But you
|
||||
can assign them meanings of your own by customizing Emacs.
|
||||
|
||||
Keyboard input includes keyboard keys that are not characters at all:
|
||||
for example function keys and arrow keys. Mouse buttons are also
|
||||
outside the gamut of characters. You can modify these events with the
|
||||
modifier keys @key{CTRL}, @key{META}, @key{SUPER}, @key{HYPER} and
|
||||
@key{ALT}, just like keyboard characters.
|
||||
|
||||
@cindex input event
|
||||
Input characters and non-character inputs are collectively called
|
||||
@dfn{input events}. @xref{Input Events,,, elisp, The Emacs Lisp
|
||||
Reference Manual}, for more information. If you are not doing Lisp
|
||||
programming, but simply want to redefine the meaning of some characters
|
||||
or non-character events, see @ref{Customization}.
|
||||
|
||||
ASCII terminals cannot really send anything to the computer except
|
||||
ASCII characters. These terminals use a sequence of characters to
|
||||
represent each function key. But that is invisible to the Emacs user,
|
||||
because the keyboard input routines recognize these special sequences
|
||||
and convert them to function key events before any other part of Emacs
|
||||
gets to see them.
|
||||
|
||||
@node Keys, Commands, User Input, Top
|
||||
@section Keys
|
||||
|
||||
@cindex key sequence
|
||||
@cindex key
|
||||
A @dfn{key sequence} (@dfn{key}, for short) is a sequence of input
|
||||
events that are meaningful as a unit---as ``a single command.''
|
||||
Some Emacs command sequences are just one character or one event; for
|
||||
example, just @kbd{C-f} is enough to move forward one character. But
|
||||
Emacs also has commands that take two or more events to invoke.
|
||||
|
||||
@cindex complete key
|
||||
@cindex prefix key
|
||||
If a sequence of events is enough to invoke a command, it is a
|
||||
@dfn{complete key}. Examples of complete keys include @kbd{C-a},
|
||||
@kbd{X}, @key{RET}, @key{NEXT} (a function key), @key{DOWN} (an arrow
|
||||
key), @kbd{C-x C-f}, and @kbd{C-x 4 C-f}. If it isn't long enough to be
|
||||
complete, we call it a @dfn{prefix key}. The above examples show that
|
||||
@kbd{C-x} and @kbd{C-x 4} are prefix keys. Every key sequence is either
|
||||
a complete key or a prefix key.
|
||||
|
||||
Most single characters constitute complete keys in the standard Emacs
|
||||
command bindings. A few of them are prefix keys. A prefix key combines
|
||||
with the following input event to make a longer key sequence, which may
|
||||
itself be complete or a prefix. For example, @kbd{C-x} is a prefix key,
|
||||
so @kbd{C-x} and the next input event combine to make a two-character
|
||||
key sequence. Most of these key sequences are complete keys, including
|
||||
@kbd{C-x C-f} and @kbd{C-x b}. A few, such as @kbd{C-x 4} and @kbd{C-x
|
||||
r}, are themselves prefix keys that lead to three-character key
|
||||
sequences. There's no limit to the length of a key sequence, but in
|
||||
practice people rarely use sequences longer than four events.
|
||||
|
||||
By contrast, you can't add more events onto a complete key. For
|
||||
example, the two-character sequence @kbd{C-f C-k} is not a key, because
|
||||
the @kbd{C-f} is a complete key in itself. It's impossible to give
|
||||
@kbd{C-f C-k} an independent meaning as a command. @kbd{C-f C-k} is two
|
||||
key sequences, not one.@refill
|
||||
|
||||
All told, the prefix keys in Emacs are @kbd{C-c}, @kbd{C-h},
|
||||
@kbd{C-x}, @kbd{C-x @key{RET}}, @kbd{C-x @@}, @kbd{C-x a}, @kbd{C-x n}, @w{@kbd{C-x
|
||||
r}}, @kbd{C-x v}, @kbd{C-x 4}, @kbd{C-x 5}, @kbd{C-x 6}, @key{ESC},
|
||||
@kbd{M-g} and @kbd{M-j}. But this list is not cast in concrete; it is
|
||||
just a matter of Emacs's standard key bindings. If you customize Emacs,
|
||||
you can make new prefix keys, or eliminate these. @xref{Key Bindings}.
|
||||
|
||||
If you do make or eliminate prefix keys, that changes the set of
|
||||
possible key sequences. For example, if you redefine @kbd{C-f} as a
|
||||
prefix, @kbd{C-f C-k} automatically becomes a key (complete, unless you
|
||||
define it too as a prefix). Conversely, if you remove the prefix
|
||||
definition of @kbd{C-x 4}, then @kbd{C-x 4 f} (or @kbd{C-x 4
|
||||
@var{anything}}) is no longer a key.
|
||||
|
||||
Typing the help character (@kbd{C-h} or @key{F1}) after a prefix
|
||||
character displays a list of the commands starting with that prefix.
|
||||
There are a few prefix characters for which @kbd{C-h} does not
|
||||
work---for historical reasons, they have other meanings for @kbd{C-h}
|
||||
which are not easy to change. But @key{F1} should work for all prefix
|
||||
characters.
|
||||
|
||||
@node Commands, Text Characters, Keys, Top
|
||||
@section Keys and Commands
|
||||
|
||||
@cindex binding
|
||||
@cindex function
|
||||
@cindex command
|
||||
@cindex function definition
|
||||
This manual is full of passages that tell you what particular keys
|
||||
do. But Emacs does not assign meanings to keys directly. Instead,
|
||||
Emacs assigns meanings to named @dfn{commands}, and then gives keys
|
||||
their meanings by @dfn{binding} them to commands.
|
||||
|
||||
Every command has a name chosen by a programmer. The name is usually
|
||||
made of a few English words separated by dashes; for example,
|
||||
@code{next-line} or @code{forward-word}. A command also has a
|
||||
@dfn{function definition} which is a Lisp program; this is what makes
|
||||
the command do what it does. In Emacs Lisp, a command is actually a
|
||||
special kind of Lisp function; one which specifies how to read arguments
|
||||
for it and call it interactively. For more information on commands and
|
||||
functions, see @ref{What Is a Function,, What Is a Function, elisp, The
|
||||
Emacs Lisp Reference Manual}. (The definition we use in this manual is
|
||||
simplified slightly.)
|
||||
|
||||
The bindings between keys and commands are recorded in various tables
|
||||
called @dfn{keymaps}. @xref{Keymaps}.
|
||||
|
||||
When we say that ``@kbd{C-n} moves down vertically one line'' we are
|
||||
glossing over a distinction that is irrelevant in ordinary use but is vital
|
||||
in understanding how to customize Emacs. It is the command
|
||||
@code{next-line} that is programmed to move down vertically. @kbd{C-n} has
|
||||
this effect @emph{because} it is bound to that command. If you rebind
|
||||
@kbd{C-n} to the command @code{forward-word} then @kbd{C-n} will move
|
||||
forward by words instead. Rebinding keys is a common method of
|
||||
customization.@refill
|
||||
|
||||
In the rest of this manual, we usually ignore this subtlety to keep
|
||||
things simple. To give the information needed for customization, we
|
||||
state the name of the command which really does the work in parentheses
|
||||
after mentioning the key that runs it. For example, we will say that
|
||||
``The command @kbd{C-n} (@code{next-line}) moves point vertically
|
||||
down,'' meaning that @code{next-line} is a command that moves vertically
|
||||
down and @kbd{C-n} is a key that is standardly bound to it.
|
||||
|
||||
While we are on the subject of information for customization only,
|
||||
it's a good time to tell you about @dfn{variables}. Often the
|
||||
description of a command will say, ``To change this, set the variable
|
||||
@code{mumble-foo}.'' A variable is a name used to remember a value.
|
||||
Most of the variables documented in this manual exist just to facilitate
|
||||
customization: some command or other part of Emacs examines the variable
|
||||
and behaves differently according to the value that you set. Until you
|
||||
are interested in customizing, you can ignore the information about
|
||||
variables. When you are ready to be interested, read the basic
|
||||
information on variables, and then the information on individual
|
||||
variables will make sense. @xref{Variables}.
|
||||
|
||||
@node Text Characters, Entering Emacs, Commands, Top
|
||||
@section Character Set for Text
|
||||
@cindex characters (in text)
|
||||
|
||||
Text in Emacs buffers is a sequence of 8-bit bytes. Each byte can
|
||||
hold a single ASCII character. Both ASCII control characters (octal
|
||||
codes 000 through 037, and 0177) and ASCII printing characters (codes
|
||||
040 through 0176) are allowed; however, non-ASCII control characters
|
||||
cannot appear in a buffer. The other modifier flags used in keyboard
|
||||
input, such as Meta, are not allowed in buffers either.
|
||||
|
||||
Some ASCII control characters serve special purposes in text, and have
|
||||
special names. For example, the newline character (octal code 012) is
|
||||
used in the buffer to end a line, and the tab character (octal code 011)
|
||||
is used for indenting to the next tab stop column (normally every 8
|
||||
columns). @xref{Text Display}.
|
||||
|
||||
Non-ASCII printing characters can also appear in buffers. When
|
||||
multibyte characters are enabled, you can use any of the non-ASCII
|
||||
printing characters that Emacs supports. They have character codes
|
||||
starting at 256, octal 0400, and each one is represented as a sequence
|
||||
of two or more bytes. @xref{International}.
|
||||
|
||||
If you disable multibyte characters, then you can use only one
|
||||
alphabet of non-ASCII characters, but they all fit in one byte. They
|
||||
use codes 0200 through 0377. @xref{Single-Byte European Support}.
|
2290
man/custom.texi
Normal file
2290
man/custom.texi
Normal file
File diff suppressed because it is too large
Load diff
1375
man/dired-x.texi
Normal file
1375
man/dired-x.texi
Normal file
File diff suppressed because it is too large
Load diff
950
man/dired.texi
Normal file
950
man/dired.texi
Normal file
|
@ -0,0 +1,950 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Dired, Calendar/Diary, Rmail, Top
|
||||
@chapter Dired, the Directory Editor
|
||||
@cindex Dired
|
||||
|
||||
Dired makes an Emacs buffer containing a listing of a directory, and
|
||||
optionally some of its subdirectories as well. You can use the normal
|
||||
Emacs commands to move around in this buffer, and special Dired commands
|
||||
to operate on the files listed.
|
||||
|
||||
@menu
|
||||
* Enter: Dired Enter. How to invoke Dired.
|
||||
* Commands: Dired Commands. Commands in the Dired buffer.
|
||||
* Deletion: Dired Deletion. Deleting files with Dired.
|
||||
* Flagging Many Files:: Flagging files based on their names.
|
||||
* Visit: Dired Visiting. Other file operations through Dired.
|
||||
* Marks vs Flags:: Flagging for deletion vs marking.
|
||||
* Operating on Files:: How to copy, rename, print, compress, etc.
|
||||
either one file or several files.
|
||||
* Shell Commands in Dired:: Running a shell command on the marked files.
|
||||
* Transforming File Names:: Using patterns to rename multiple files.
|
||||
* Comparison in Dired:: Running `diff' by way of Dired.
|
||||
* Subdirectories in Dired:: Adding subdirectories to the Dired buffer.
|
||||
* Subdirectory Motion:: Moving across subdirectories, and up and down.
|
||||
* Hiding Subdirectories:: Making subdirectories visible or invisible.
|
||||
* Updating: Dired Updating. Discarding lines for files of no interest.
|
||||
* Find: Dired and Find. Using `find' to choose the files for Dired.
|
||||
@end menu
|
||||
|
||||
@node Dired Enter
|
||||
@section Entering Dired
|
||||
|
||||
@findex dired
|
||||
@kindex C-x d
|
||||
@vindex dired-listing-switches
|
||||
To invoke Dired, do @kbd{C-x d} or @kbd{M-x dired}. The command reads
|
||||
a directory name or wildcard file name pattern as a minibuffer argument
|
||||
to specify which files to list. Where @code{dired} differs from
|
||||
@code{list-directory} is in putting the buffer into Dired mode so that
|
||||
the special commands of Dired are available.
|
||||
|
||||
The variable @code{dired-listing-switches} specifies the options to
|
||||
give to @code{ls} for listing directory; this string @emph{must} contain
|
||||
@samp{-l}. If you use a numeric prefix argument with the @code{dired}
|
||||
command, you can specify the @code{ls} switches with the minibuffer
|
||||
before you enter the directory specification.
|
||||
|
||||
@findex dired-other-window
|
||||
@kindex C-x 4 d
|
||||
@findex dired-other-frame
|
||||
@kindex C-x 5 d
|
||||
To display the Dired buffer in another window rather than in the
|
||||
selected window, use @kbd{C-x 4 d} (@code{dired-other-window}) instead
|
||||
of @kbd{C-x d}. @kbd{C-x 5 d} (@code{dired-other-frame}) uses a
|
||||
separate frame to display the Dired buffer.
|
||||
|
||||
@node Dired Commands
|
||||
@section Commands in the Dired Buffer
|
||||
|
||||
The Dired buffer is ``read-only,'' and inserting text in it is not
|
||||
useful, so ordinary printing characters such as @kbd{d} and @kbd{x} are
|
||||
used for special Dired commands. Some Dired commands @dfn{mark} or
|
||||
@dfn{flag} the @dfn{current file} (that is, the file on the current
|
||||
line); other commands operate on the marked files or on the flagged
|
||||
files.
|
||||
|
||||
@kindex C-n @r{(Dired)}
|
||||
@kindex C-p @r{(Dired)}
|
||||
All the usual Emacs cursor motion commands are available in Dired
|
||||
buffers. Some special-purpose cursor motion commands are also
|
||||
provided. The keys @kbd{C-n} and @kbd{C-p} are redefined to put the
|
||||
cursor at the beginning of the file name on the line, rather than at the
|
||||
beginning of the line.
|
||||
|
||||
@kindex SPC @r{(Dired)}
|
||||
For extra convenience, @key{SPC} and @kbd{n} in Dired are equivalent
|
||||
to @kbd{C-n}. @kbd{p} is equivalent to @kbd{C-p}. (Moving by lines is
|
||||
so common in Dired that it deserves to be easy to type.) @key{DEL}
|
||||
(move up and unflag) is often useful simply for moving up.
|
||||
|
||||
@node Dired Deletion
|
||||
@section Deleting Files with Dired
|
||||
@cindex flagging files (in Dired)
|
||||
@cindex deleting files (in Dired)
|
||||
|
||||
The primary use of Dired is to @dfn{flag} files for deletion and then
|
||||
delete the files previously flagged.
|
||||
|
||||
@table @kbd
|
||||
@item d
|
||||
Flag this file for deletion.
|
||||
@item u
|
||||
Remove deletion flag on this line.
|
||||
@item @key{DEL}
|
||||
Move point to previous line and remove the deletion flag on that line.
|
||||
@item x
|
||||
Delete the files that are flagged for deletion.
|
||||
@end table
|
||||
|
||||
@kindex d @r{(Dired)}
|
||||
@findex dired-flag-file-deletion
|
||||
You can flag a file for deletion by moving to the line describing the
|
||||
file and typing @kbd{d} (@code{dired-flag-file-deletion}). The deletion flag is visible as a @samp{D} at
|
||||
the beginning of the line. This command moves point to the next line,
|
||||
so that repeated @kbd{d} commands flag successive files. A numeric
|
||||
argument serves as a repeat count.
|
||||
|
||||
@kindex u @r{(Dired deletion)}
|
||||
@kindex DEL @r{(Dired)}
|
||||
The files are flagged for deletion rather than deleted immediately to
|
||||
reduce the danger of deleting a file accidentally. Until you direct
|
||||
Dired to expunge the flagged files, you can remove deletion flags using
|
||||
the commands @kbd{u} and @key{DEL}. @kbd{u} (@code{dired-unmark}) works
|
||||
just like @kbd{d}, but removes flags rather than making flags.
|
||||
@key{DEL} (@code{dired-unmark-backward}) moves upward, removing flags;
|
||||
it is like @kbd{u} with argument @minus{}1.
|
||||
|
||||
@kindex x @r{(Dired)}
|
||||
@findex dired-expunge
|
||||
@cindex expunging (Dired)
|
||||
To delete the flagged files, type @kbd{x} (@code{dired-expunge}).
|
||||
This command first displays a list of all the file names flagged for
|
||||
deletion, and requests confirmation with @kbd{yes}. If you confirm,
|
||||
Dired deletes the flagged files, then deletes their lines from the text
|
||||
of the Dired buffer. The shortened Dired buffer remains selected.
|
||||
|
||||
If you answer @kbd{no} or quit with @kbd{C-g} when asked to confirm, you
|
||||
return immediately to Dired, with the deletion flags still present in
|
||||
the buffer, and no files actually deleted.
|
||||
|
||||
@node Flagging Many Files
|
||||
@section Flagging Many Files at Once
|
||||
|
||||
@table @kbd
|
||||
@item #
|
||||
Flag all auto-save files (files whose names start and end with @samp{#})
|
||||
for deletion (@pxref{Auto Save}).
|
||||
|
||||
@item ~
|
||||
Flag all backup files (files whose names end with @samp{~}) for deletion
|
||||
(@pxref{Backup}).
|
||||
|
||||
@item &
|
||||
Flag for deletion all files with certain kinds of names, names that
|
||||
suggest you could easily create the files again.
|
||||
|
||||
@item .@: @r{(Period)}
|
||||
Flag excess numeric backup files for deletion. The oldest and newest
|
||||
few backup files of any one file are exempt; the middle ones are
|
||||
flagged.
|
||||
|
||||
@item % d @var{regexp} @key{RET}
|
||||
Flag for deletion all files whose names match the regular expression
|
||||
@var{regexp}.
|
||||
@end table
|
||||
|
||||
The @kbd{#}, @kbd{~}, @kbd{&}, and @kbd{.} commands flag many files for
|
||||
deletion, based on their file names. These commands are useful
|
||||
precisely because they do not themselves delete any files; you can
|
||||
remove the deletion flags from any flagged files that you really wish to
|
||||
keep.@refill
|
||||
|
||||
@kindex & @r{(Dired)}
|
||||
@findex dired-flag-garbage-files
|
||||
@vindex dired-garbage-files-regexp
|
||||
@kbd{&} (@code{dired-flag-garbage-files}) flags files whose names
|
||||
match the regular expression specified by the variable
|
||||
@code{dired-garbage-files-regexp}. By default, this matches certain
|
||||
files produced by @TeX{}, and the @samp{.orig} and @samp{.rej} files
|
||||
produced by @code{patch}.
|
||||
|
||||
@kindex # @r{(Dired)}
|
||||
@kindex ~ @r{(Dired)}
|
||||
@findex dired-flag-auto-save-files
|
||||
@findex dired-flag-backup-files
|
||||
@kbd{#} (@code{dired-flag-auto-save-files}) flags for deletion all
|
||||
files whose names look like auto-save files (@pxref{Auto Save})---that
|
||||
is, files whose names begin and end with @samp{#}. @kbd{~}
|
||||
(@code{dired-flag-backup-files}) flags for deletion all files whose
|
||||
names say they are backup files (@pxref{Backup})---that is, whose names
|
||||
end in @samp{~}.
|
||||
|
||||
@kindex . @r{(Dired)}
|
||||
@vindex dired-kept-versions
|
||||
@findex dired-clean-directory
|
||||
@kbd{.} (period, @code{dired-clean-directory}) flags just some of the
|
||||
backup files for deletion: all but the oldest few and newest few backups
|
||||
of any one file. Normally @code{dired-kept-versions} (@strong{not}
|
||||
@code{kept-new-versions}; that applies only when saving) specifies the
|
||||
number of newest versions of each file to keep, and
|
||||
@code{kept-old-versions} specifies the number of oldest versions to
|
||||
keep.
|
||||
|
||||
Period with a positive numeric argument, as in @kbd{C-u 3 .},
|
||||
specifies the number of newest versions to keep, overriding
|
||||
@code{dired-kept-versions}. A negative numeric argument overrides
|
||||
@code{kept-old-versions}, using minus the value of the argument to
|
||||
specify the number of oldest versions of each file to keep.
|
||||
|
||||
@findex dired-flag-files-regexp
|
||||
@kindex % d @r{(Dired)}
|
||||
The @kbd{% d} command flags all files whose names match a specified
|
||||
regular expression (@code{dired-flag-files-regexp}). Only the
|
||||
non-directory part of the file name is used in matching. You can use
|
||||
@samp{^} and @samp{$} to anchor matches. You can exclude subdirectories
|
||||
by hiding them (@pxref{Hiding Subdirectories}).
|
||||
|
||||
@node Dired Visiting
|
||||
@section Visiting Files in Dired
|
||||
|
||||
There are several Dired commands for visiting or examining the files
|
||||
listed in the Dired buffer. All of them apply to the current line's
|
||||
file; if that file is really a directory, these commands invoke Dired on
|
||||
that subdirectory (making a separate Dired buffer).
|
||||
|
||||
@table @kbd
|
||||
@item f
|
||||
@kindex f @r{(Dired)}
|
||||
@findex dired-find-file
|
||||
Visit the file described on the current line, like typing @kbd{C-x C-f}
|
||||
and supplying that file name (@code{dired-find-file}). @xref{Visiting}.
|
||||
|
||||
@item @key{RET}
|
||||
@kindex RET @r{(Dired)}
|
||||
Equivalent to @kbd{f}.
|
||||
|
||||
@item o
|
||||
@kindex o @r{(Dired)}
|
||||
@findex dired-find-file-other-window
|
||||
Like @kbd{f}, but uses another window to display the file's buffer
|
||||
(@code{dired-find-file-other-window}). The Dired buffer remains visible
|
||||
in the first window. This is like using @kbd{C-x 4 C-f} to visit the
|
||||
file. @xref{Windows}.
|
||||
|
||||
@item C-o
|
||||
@kindex C-o @r{(Dired)}
|
||||
@findex dired-display-file
|
||||
Visit the file described on the current line, and display the buffer in
|
||||
another window, but do not select that window (@code{dired-display-file}).
|
||||
|
||||
@item Mouse-2
|
||||
@findex dired-mouse-find-file-other-window
|
||||
Visit the file named by the line you click on
|
||||
(@code{dired-mouse-find-file-other-window}). This uses another window
|
||||
to display the file, like the @kbd{o} command.
|
||||
|
||||
@item v
|
||||
@kindex v @r{(Dired)}
|
||||
@findex dired-view-file
|
||||
View the file described on the current line, using @kbd{M-x view-file}
|
||||
(@code{dired-view-file}).
|
||||
|
||||
Viewing a file is like visiting it, but is slanted toward moving around
|
||||
in the file conveniently and does not allow changing the file.
|
||||
@xref{Misc File Ops,View File}.
|
||||
@end table
|
||||
|
||||
@node Marks vs Flags
|
||||
@section Dired Marks vs. Flags
|
||||
|
||||
@cindex marking in Dired
|
||||
Instead of flagging a file with @samp{D}, you can @dfn{mark} the file
|
||||
with some other character (usually @samp{*}). Most Dired commands to
|
||||
operate on files, aside from ``expunge'' (@kbd{x}), look for files
|
||||
marked with @samp{*}.
|
||||
|
||||
Here are some commands for marking with @samp{*}, or for unmarking or
|
||||
operating on marks. (@xref{Dired Deletion}, for commands to flag and
|
||||
unflag files.)
|
||||
|
||||
@table @kbd
|
||||
@item m
|
||||
@itemx * m
|
||||
@kindex m @r{(Dired)}
|
||||
@kindex * m @r{(Dired)}
|
||||
@findex dired-mark
|
||||
Mark the current file with @samp{*} (@code{dired-mark}). With a numeric
|
||||
argument @var{n}, mark the next @var{n} files starting with the current
|
||||
file. (If @var{n} is negative, mark the previous @minus{}@var{n}
|
||||
files.)
|
||||
|
||||
@item * *
|
||||
@kindex * * @r{(Dired)}
|
||||
@findex dired-mark-executables
|
||||
Mark all executable files with @samp{*}
|
||||
(@code{dired-mark-executables}). With a numeric argument, unmark all
|
||||
those files.
|
||||
|
||||
@item * @@
|
||||
@kindex * @@ @r{(Dired)}
|
||||
@findex dired-mark-symlinks
|
||||
Mark all symbolic links with @samp{*} (@code{dired-mark-symlinks}).
|
||||
With a numeric argument, unmark all those files.
|
||||
|
||||
@item * /
|
||||
@kindex * / @r{(Dired)}
|
||||
@findex dired-mark-directories
|
||||
Mark with @samp{*} all files which are actually directories, except for
|
||||
@file{.} and @file{..} (@code{dired-mark-directories}). With a numeric
|
||||
argument, unmark all those files.
|
||||
|
||||
@item * s
|
||||
@kindex * s @r{(Dired)}
|
||||
@findex dired-mark-subdir-files
|
||||
Mark all the files in the current subdirectory, aside from @file{.}
|
||||
and @file{..} (@code{dired-mark-subdir-files}).
|
||||
|
||||
@item u
|
||||
@itemx * u
|
||||
@kindex u @r{(Dired)}
|
||||
@kindex * u @r{(Dired)}
|
||||
@findex dired-unmark
|
||||
Remove any mark on this line (@code{dired-unmark}).
|
||||
|
||||
@item @key{DEL}
|
||||
@itemx * @key{DEL}
|
||||
@kindex * DEL @r{(Dired)}
|
||||
@findex dired-unmark-backward
|
||||
Move point to previous line and remove any mark on that line
|
||||
(@code{dired-unmark-backward}).
|
||||
|
||||
@item * !
|
||||
@kindex * ! @r{(Dired)}
|
||||
@findex dired-unmark-all-files-no-query
|
||||
Remove all marks from all the files in this Dired buffer
|
||||
(@code{dired-unmark-all-files-no-query}).
|
||||
|
||||
@item * ? @var{markchar}
|
||||
@kindex * ? @r{(Dired)}
|
||||
@findex dired-unmark-all-files
|
||||
Remove all marks that use the character @var{markchar}
|
||||
(@code{dired-unmark-all-files}). The argument is a single
|
||||
character---do not use @key{RET} to terminate it.
|
||||
|
||||
With a numeric argument, this command queries about each marked file,
|
||||
asking whether to remove its mark. You can answer @kbd{y} meaning yes,
|
||||
@kbd{n} meaning no, or @kbd{!} to remove the marks from the remaining
|
||||
files without asking about them.
|
||||
|
||||
@item * C-n
|
||||
@findex dired-next-marked-file
|
||||
@kindex * C-n @r{(Dired)}
|
||||
Move down to the next marked file (@code{dired-next-marked-file})
|
||||
A file is ``marked'' if it has any kind of mark.
|
||||
|
||||
@item * C-p
|
||||
@findex dired-prev-marked-file
|
||||
@kindex * C-p @r{(Dired)}
|
||||
Move up to the previous marked file (@code{dired-prev-marked-file})
|
||||
|
||||
@item * t
|
||||
@kindex * t @r{(Dired)}
|
||||
@findex dired-do-toggle
|
||||
Toggle all marks (@code{dired-do-toggle}): files marked with @samp{*}
|
||||
become unmarked, and unmarked files are marked with @samp{*}. Files
|
||||
marked in any other way are not affected.
|
||||
|
||||
@item * c @var{old} @var{new}
|
||||
@kindex * c @r{(Dired)}
|
||||
@findex dired-change-marks
|
||||
Replace all marks that use the character @var{old} with marks that use
|
||||
the character @var{new} (@code{dired-change-marks}). This command is
|
||||
the primary way to create or use marks other than @samp{*} or @samp{D}.
|
||||
The arguments are single characters---do not use @key{RET} to terminate
|
||||
them.
|
||||
|
||||
You can use almost any character as a mark character by means of this
|
||||
command, to distinguish various classes of files. If @var{old} is a
|
||||
space (@samp{ }), then the command operates on all unmarked files; if
|
||||
@var{new} is a space, then the command unmarks the files it acts on.
|
||||
|
||||
To illustrate the power of this command, here is how to put @samp{D}
|
||||
flags on all the files that have no marks, while unflagging all those
|
||||
that already have @samp{D} flags:
|
||||
|
||||
@example
|
||||
* c D t * c SPC D * c t SPC
|
||||
@end example
|
||||
|
||||
This assumes that no files are marked with @samp{t}.
|
||||
|
||||
@item % m @var{regexp} @key{RET}
|
||||
@itemx * % @var{regexp} @key{RET}
|
||||
@findex dired-mark-files-regexp
|
||||
@kindex % m @r{(Dired)}
|
||||
@kindex * % @r{(Dired)}
|
||||
Mark (with @samp{*}) all files whose names match the regular expression
|
||||
@var{regexp} (@code{dired-mark-files-regexp}). This command is like
|
||||
@kbd{% d}, except that it marks files with @samp{*} instead of flagging
|
||||
with @samp{D}. @xref{Flagging Many Files}.
|
||||
|
||||
Only the non-directory part of the file name is used in matching. Use
|
||||
@samp{^} and @samp{$} to anchor matches. Exclude subdirectories by
|
||||
hiding them (@pxref{Hiding Subdirectories}).
|
||||
|
||||
@item % g @var{regexp} @key{RET}
|
||||
@findex dired-mark-files-containing-regexp
|
||||
@kindex % m @r{(Dired)}
|
||||
Mark (with @samp{*}) all files whose @emph{contents} contain a match for
|
||||
the regular expression @var{regexp}
|
||||
(@code{dired-mark-files-containing-regexp}). This command is like
|
||||
@kbd{% m}, except that it searches the file contents instead of the file
|
||||
name.
|
||||
|
||||
@item C-_
|
||||
@kindex C-_ @r{(Dired)}
|
||||
@findex dired-undo
|
||||
Undo changes in the Dired buffer, such as adding or removing
|
||||
marks (@code{dired-undo}).
|
||||
@end table
|
||||
|
||||
@node Operating on Files
|
||||
@section Operating on Files
|
||||
@cindex operating on files in Dired
|
||||
|
||||
This section describes the basic Dired commands to operate on one file
|
||||
or several files. All of these commands are capital letters; all of
|
||||
them use the minibuffer, either to read an argument or to ask for
|
||||
confirmation, before they act. All of them give you several ways to
|
||||
specify which files to manipulate:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
If you give the command a numeric prefix argument @var{n}, it operates
|
||||
on the next @var{n} files, starting with the current file. (If @var{n}
|
||||
is negative, the command operates on the @minus{}@var{n} files preceding
|
||||
the current line.)
|
||||
|
||||
@item
|
||||
Otherwise, if some files are marked with @samp{*}, the command operates
|
||||
on all those files.
|
||||
|
||||
@item
|
||||
Otherwise, the command operates on the current file only.
|
||||
@end itemize
|
||||
|
||||
Here are the file-manipulating commands that operate on files in this
|
||||
way. (Some other Dired commands, such as @kbd{!} and the @samp{%}
|
||||
commands, also use these conventions to decide which files to work on.)
|
||||
|
||||
@table @kbd
|
||||
@findex dired-do-copy
|
||||
@kindex C @r{(Dired)}
|
||||
@item C @var{new} @key{RET}
|
||||
Copy the specified files (@code{dired-do-copy}). The argument @var{new}
|
||||
is the directory to copy into, or (if copying a single file) the new
|
||||
name.
|
||||
|
||||
@vindex dired-copy-preserve-time
|
||||
If @code{dired-copy-preserve-time} is non-@code{nil}, then copying with
|
||||
this command sets the modification time of the new file to be the same
|
||||
as that of the old file.
|
||||
|
||||
@item D
|
||||
@findex dired-do-delete
|
||||
@kindex D @r{(Dired)}
|
||||
Delete the specified files (@code{dired-do-delete}). Like the other
|
||||
commands in this section, this command operates on the @emph{marked}
|
||||
files, or the next @var{n} files. By contrast, @kbd{x}
|
||||
(@code{dired-expunge}) deletes all @dfn{flagged} files.
|
||||
|
||||
@findex dired-do-rename
|
||||
@kindex R @r{(Dired)}
|
||||
@item R @var{new} @key{RET}
|
||||
Rename the specified files (@code{dired-do-rename}). The argument
|
||||
@var{new} is the directory to rename into, or (if renaming a single
|
||||
file) the new name.
|
||||
|
||||
Dired automatically changes the visited file name of buffers associated
|
||||
with renamed files so that they refer to the new names.
|
||||
|
||||
@findex dired-do-hardlink
|
||||
@kindex H @r{(Dired)}
|
||||
@item H @var{new} @key{RET}
|
||||
Make hard links to the specified files (@code{dired-do-hardlink}). The
|
||||
argument @var{new} is the directory to make the links in, or (if making
|
||||
just one link) the name to give the link.
|
||||
|
||||
@findex dired-do-symlink
|
||||
@kindex S @r{(Dired)}
|
||||
@item S @var{new} @key{RET}
|
||||
Make symbolic links to the specified files (@code{dired-do-symlink}).
|
||||
The argument @var{new} is the directory to make the links in, or (if
|
||||
making just one link) the name to give the link.
|
||||
|
||||
@findex dired-do-chmod
|
||||
@kindex M @r{(Dired)}
|
||||
@item M @var{modespec} @key{RET}
|
||||
Change the mode (also called ``permission bits'') of the specified files
|
||||
(@code{dired-do-chmod}). This uses the @code{chmod} program, so
|
||||
@var{modespec} can be any argument that @code{chmod} can handle.
|
||||
|
||||
@findex dired-do-chgrp
|
||||
@kindex G @r{(Dired)}
|
||||
@item G @var{newgroup} @key{RET}
|
||||
Change the group of the specified files to @var{newgroup}
|
||||
(@code{dired-do-chgrp}).
|
||||
|
||||
@findex dired-do-chown
|
||||
@kindex O @r{(Dired)}
|
||||
@item O @var{newowner} @key{RET}
|
||||
Change the owner of the specified files to @var{newowner}
|
||||
(@code{dired-do-chown}). (On most systems, only the superuser can do
|
||||
this.)
|
||||
|
||||
@vindex dired-chown-program
|
||||
The variable @code{dired-chown-program} specifies the name of the
|
||||
program to use to do the work (different systems put @code{chown} in
|
||||
different places).
|
||||
|
||||
@findex dired-do-print
|
||||
@kindex P @r{(Dired)}
|
||||
@item P @var{command} @key{RET}
|
||||
Print the specified files (@code{dired-do-print}). You must specify the
|
||||
command to print them with, but the minibuffer starts out with a
|
||||
suitable guess made using the variables @code{lpr-command} and
|
||||
@code{lpr-switches} (the same variables that @code{lpr-buffer} uses;
|
||||
@pxref{Hardcopy}).
|
||||
|
||||
@findex dired-do-compress
|
||||
@kindex Z @r{(Dired)}
|
||||
@item Z
|
||||
Compress the specified files (@code{dired-do-compress}). If the file
|
||||
appears to be a compressed file already, it is uncompressed instead.
|
||||
|
||||
@findex dired-do-load
|
||||
@kindex L @r{(Dired)}
|
||||
@item L
|
||||
Load the specified Emacs Lisp files (@code{dired-do-load}).
|
||||
@xref{Lisp Libraries}.
|
||||
|
||||
@findex dired-do-byte-compile
|
||||
@kindex B @r{(Dired)}
|
||||
@item B
|
||||
Byte compile the specified Emacs Lisp files
|
||||
(@code{dired-do-byte-compile}). @xref{Byte Compilation,, Byte
|
||||
Compilation, elisp, The Emacs Lisp Reference Manual}.
|
||||
|
||||
@kindex A @r{(Dired)}
|
||||
@findex dired-do-search
|
||||
@item A @var{regexp} @key{RET}
|
||||
Search all the specified files for the regular expression @var{regexp}
|
||||
(@code{dired-do-search}).
|
||||
|
||||
This command is a variant of @code{tags-search}. The search stops at
|
||||
the first match it finds; use @kbd{M-,} to resume the search and find
|
||||
the next match. @xref{Tags Search}.
|
||||
|
||||
@kindex Q @r{(Dired)}
|
||||
@findex dired-do-query-replace
|
||||
@item Q @var{from} @key{RET} @var{to} @key{RET}
|
||||
Perform @code{query-replace-regexp} on each of the specified files,
|
||||
replacing matches for @var{from} (a regular expression) with the string
|
||||
@var{to} (@code{dired-do-query-replace}).
|
||||
|
||||
This command is a variant of @code{tags-query-replace}. If you exit the
|
||||
query replace loop, you can use @kbd{M-,} to resume the scan and replace
|
||||
more matches. @xref{Tags Search}.
|
||||
@end table
|
||||
|
||||
@kindex + @r{(Dired)}
|
||||
@findex dired-create-directory
|
||||
One special file-operation command is @kbd{+}
|
||||
(@code{dired-create-directory}). This command reads a directory name and
|
||||
creates the directory if it does not already exist.
|
||||
|
||||
@node Shell Commands in Dired
|
||||
@section Shell Commands in Dired
|
||||
@cindex shell commands, Dired
|
||||
|
||||
@findex dired-do-shell-command
|
||||
@kindex ! @r{(Dired)}
|
||||
The dired command @kbd{!} (@code{dired-do-shell-command}) reads a shell
|
||||
command string in the minibuffer and runs that shell command on all the
|
||||
specified files. You can specify the files to operate on in the usual
|
||||
ways for Dired commands (@pxref{Operating on Files}). There are two
|
||||
ways of applying a shell command to multiple files:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
If you use @samp{*} in the shell command, then it runs just once, with
|
||||
the list of file names substituted for the @samp{*}. The order of file
|
||||
names is the order of appearance in the Dired buffer.
|
||||
|
||||
Thus, @kbd{! tar cf foo.tar * @key{RET}} runs @code{tar} on the entire
|
||||
list of file names, putting them into one tar file @file{foo.tar}.
|
||||
|
||||
@item
|
||||
If the command string doesn't contain @samp{*}, then it runs once
|
||||
@emph{for each file}, with the file name added at the end.
|
||||
|
||||
For example, @kbd{! uudecode @key{RET}} runs @code{uudecode} on each
|
||||
file.
|
||||
@end itemize
|
||||
|
||||
What if you want to run the shell command once for each file but with
|
||||
the file name inserted in the middle? Or if you want to use the file
|
||||
names in a more complicated fashion? Use a shell loop. For example,
|
||||
this shell command would run @code{uuencode} on each of the specified
|
||||
files, writing the output into a corresponding @file{.uu} file:
|
||||
|
||||
@example
|
||||
for file in *; do uuencode $file $file >$file.uu; done
|
||||
@end example
|
||||
|
||||
The working directory for the shell command is the top-level directory
|
||||
of the Dired buffer.
|
||||
|
||||
The @kbd{!} command does not attempt to update the Dired buffer to show
|
||||
new or modified files, because it doesn't really understand shell
|
||||
commands, and does not know what files the shell command changed. Use
|
||||
the @kbd{g} command to update the Dired buffer (@pxref{Dired
|
||||
Updating}).
|
||||
|
||||
@node Transforming File Names
|
||||
@section Transforming File Names in Dired
|
||||
|
||||
Here are commands that alter file names in a systematic way:
|
||||
|
||||
@table @kbd
|
||||
@findex dired-upcase
|
||||
@kindex % u @r{(Dired)}
|
||||
@item % u
|
||||
Rename each of the selected files to an upper-case name
|
||||
(@code{dired-upcase}). If the old file names are @file{Foo}
|
||||
and @file{bar}, the new names are @file{FOO} and @file{BAR}.
|
||||
|
||||
@item % l
|
||||
@findex dired-downcase
|
||||
@kindex % l @r{(Dired)}
|
||||
Rename each of the selected files to a lower-case name
|
||||
(@code{dired-downcase}). If the old file names are @file{Foo} and
|
||||
@file{bar}, the new names are @file{foo} and @file{bar}.
|
||||
|
||||
@item % R @var{from} @key{RET} @var{to} @key{RET}
|
||||
@kindex % R @r{(Dired)}
|
||||
@findex dired-do-rename-regexp
|
||||
@itemx % C @var{from} @key{RET} @var{to} @key{RET}
|
||||
@kindex % C @r{(Dired)}
|
||||
@findex dired-do-copy-regexp
|
||||
@itemx % H @var{from} @key{RET} @var{to} @key{RET}
|
||||
@kindex % H @r{(Dired)}
|
||||
@findex dired-do-hardlink-regexp
|
||||
@itemx % S @var{from} @key{RET} @var{to} @key{RET}
|
||||
@kindex % S @r{(Dired)}
|
||||
@findex dired-do-symlink-regexp
|
||||
These four commands rename, copy, make hard links and make soft links,
|
||||
in each case computing the new name by regular-expression substitution
|
||||
from the name of the old file.
|
||||
@end table
|
||||
|
||||
The four regular-expression substitution commands effectively perform
|
||||
a search-and-replace on the selected file names in the Dired buffer.
|
||||
They read two arguments: a regular expression @var{from}, and a
|
||||
substitution pattern @var{to}.
|
||||
|
||||
The commands match each ``old'' file name against the regular
|
||||
expression @var{from}, and then replace the matching part with @var{to}.
|
||||
You can use @samp{\&} and @samp{\@var{digit}} in @var{to} to refer to
|
||||
all or part of what the pattern matched in the old file name, as in
|
||||
@code{replace-regexp} (@pxref{Regexp Replace}). If the regular expression
|
||||
matches more than once in a file name, only the first match is replaced.
|
||||
|
||||
For example, @kbd{% R ^.*$ @key{RET} x-\& @key{RET}} renames each
|
||||
selected file by prepending @samp{x-} to its name. The inverse of this,
|
||||
removing @samp{x-} from the front of each file name, is also possible:
|
||||
one method is @kbd{% R ^x-\(.*\)$ @key{RET} \1 @key{RET}}; another is
|
||||
@kbd{% R ^x- @key{RET} @key{RET}}. (Use @samp{^} and @samp{$} to anchor
|
||||
matches that should span the whole filename.)
|
||||
|
||||
Normally, the replacement process does not consider the files'
|
||||
directory names; it operates on the file name within the directory. If
|
||||
you specify a numeric argument of zero, then replacement affects the
|
||||
entire absolute file name including directory name.
|
||||
|
||||
Often you will want to select the set of files to operate on using the
|
||||
same @var{regexp} that you will use to operate on them. To do this,
|
||||
mark those files with @kbd{% m @var{regexp} @key{RET}}, then use the
|
||||
same regular expression in the command to operate on the files. To make
|
||||
this easier, the @kbd{%} commands to operate on files use the last
|
||||
regular expression specified in any @kbd{%} command as a default.
|
||||
|
||||
@node Comparison in Dired
|
||||
@section File Comparison with Dired
|
||||
|
||||
Here are two Dired commands that compare specified files using
|
||||
@code{diff}.
|
||||
|
||||
@table @kbd
|
||||
@item =
|
||||
@findex dired-diff
|
||||
@kindex = @r{(Dired)}
|
||||
Compare the current file (the file at point) with another file (the file
|
||||
at the mark) using the @code{diff} program (@code{dired-diff}). The
|
||||
file at the mark is the first argument of @code{diff}, and the file at
|
||||
point is the second argument.
|
||||
|
||||
@findex dired-backup-diff
|
||||
@kindex M-= @r{(Dired)}
|
||||
@item M-=
|
||||
Compare the current file with its latest backup file
|
||||
(@code{dired-backup-diff}). If the current file is itself a backup,
|
||||
compare it with the file it is a backup of; this way, you can compare
|
||||
a file with any backup version of your choice.
|
||||
|
||||
The backup file is the first file given to @code{diff}.
|
||||
@end table
|
||||
|
||||
@node Subdirectories in Dired
|
||||
@section Subdirectories in Dired
|
||||
@cindex subdirectories in Dired
|
||||
@cindex expanding subdirectories in Dired
|
||||
|
||||
A Dired buffer displays just one directory in the normal case;
|
||||
but you can optionally include its subdirectories as well.
|
||||
|
||||
The simplest way to include multiple directories in one Dired buffer is
|
||||
to specify the options @samp{-lR} for running @code{ls}. (If you give a
|
||||
numeric argument when you run Dired, then you can specify these options
|
||||
in the minibuffer.) That produces a recursive directory listing showing
|
||||
all subdirectories at all levels.
|
||||
|
||||
But usually all the subdirectories are too many; usually you will
|
||||
prefer to include specific subdirectories only. You can do this with
|
||||
the @kbd{i} command:
|
||||
|
||||
@table @kbd
|
||||
@findex dired-maybe-insert-subdir
|
||||
@kindex i @r{(Dired)}
|
||||
@item i
|
||||
@cindex inserted subdirectory (Dired)
|
||||
@cindex in-situ subdirectory (Dired)
|
||||
Insert the contents of a subdirectory later in the buffer.
|
||||
@end table
|
||||
|
||||
Use the @kbd{i} (@code{dired-maybe-insert-subdir}) command on a line
|
||||
that describes a file which is a directory. It inserts the contents of
|
||||
that directory into the same Dired buffer, and moves there. Inserted
|
||||
subdirectory contents follow the top-level directory of the Dired
|
||||
buffer, just as they do in @samp{ls -lR} output.
|
||||
|
||||
If the subdirectory's contents are already present in the buffer, the
|
||||
@kbd{i} command just moves to it.
|
||||
|
||||
In either case, @kbd{i} sets the Emacs mark before moving, so @kbd{C-u
|
||||
C-@key{SPC}} takes you back to the old position in the buffer (the line
|
||||
describing that subdirectory).
|
||||
|
||||
Use the @kbd{l} command (@code{dired-do-redisplay}) to update the
|
||||
subdirectory's contents. Use @kbd{k} to delete the subdirectory.
|
||||
@xref{Dired Updating}.
|
||||
|
||||
@node Subdirectory Motion
|
||||
@section Moving Over Subdirectories
|
||||
|
||||
When a Dired buffer lists subdirectories, you can use the page motion
|
||||
commands @kbd{C-x [} and @kbd{C-x ]} to move by entire directories.
|
||||
|
||||
@cindex header line (Dired)
|
||||
@cindex directory header lines
|
||||
The following commands move across, up and down in the tree of
|
||||
directories within one Dired buffer. They move to @dfn{directory header
|
||||
lines}, which are the lines that give a directory's name, at the
|
||||
beginning of the directory's contents.
|
||||
|
||||
@table @kbd
|
||||
@findex dired-next-subdir
|
||||
@kindex C-M-n @r{(Dired)}
|
||||
@item C-M-n
|
||||
Go to next subdirectory header line, regardless of level
|
||||
(@code{dired-next-subdir}).
|
||||
|
||||
@findex dired-prev-subdir
|
||||
@kindex C-M-p @r{(Dired)}
|
||||
@item C-M-p
|
||||
Go to previous subdirectory header line, regardless of level
|
||||
(@code{dired-prev-subdir}).
|
||||
|
||||
@findex dired-tree-up
|
||||
@kindex C-M-u @r{(Dired)}
|
||||
@item C-M-u
|
||||
Go up to the parent directory's header line (@code{dired-tree-up}).
|
||||
|
||||
@findex dired-tree-down
|
||||
@kindex C-M-d @r{(Dired)}
|
||||
@item C-M-d
|
||||
Go down in the directory tree, to the first subdirectory's header line
|
||||
(@code{dired-tree-down}).
|
||||
|
||||
@findex dired-prev-dirline
|
||||
@kindex < @r{(Dired)}
|
||||
@item <
|
||||
Move up to the previous directory-file line (@code{dired-prev-dirline}).
|
||||
These lines are the ones that describe a directory as a file in its
|
||||
parent directory.
|
||||
|
||||
@findex dired-next-dirline
|
||||
@kindex > @r{(Dired)}
|
||||
@item >
|
||||
Move down to the next directory-file line (@code{dired-prev-dirline}).
|
||||
@end table
|
||||
|
||||
@node Hiding Subdirectories
|
||||
@section Hiding Subdirectories
|
||||
|
||||
@cindex hiding in Dired (Dired)
|
||||
@dfn{Hiding} a subdirectory means to make it invisible, except for its
|
||||
header line, via selective display (@pxref{Selective Display}).
|
||||
|
||||
@table @kbd
|
||||
@item $
|
||||
@findex dired-hide-subdir
|
||||
@kindex $ @r{(Dired)}
|
||||
Hide or reveal the subdirectory that point is in, and move point to the
|
||||
next subdirectory (@code{dired-hide-subdir}). A numeric argument serves
|
||||
as a repeat count.
|
||||
|
||||
@item M-$
|
||||
@findex dired-hide-all
|
||||
@kindex M-$ @r{(Dired)}
|
||||
Hide all subdirectories in this Dired buffer, leaving only their header
|
||||
lines (@code{dired-hide-all}). Or, if any subdirectory is currently
|
||||
hidden, make all subdirectories visible again. You can use this command
|
||||
to get an overview in very deep directory trees or to move quickly to
|
||||
subdirectories far away.
|
||||
@end table
|
||||
|
||||
Ordinary Dired commands never consider files inside a hidden
|
||||
subdirectory. For example, the commands to operate on marked files
|
||||
ignore files in hidden directories even if they are marked. Thus you
|
||||
can use hiding to temporarily exclude subdirectories from operations
|
||||
without having to remove the markers.
|
||||
|
||||
The subdirectory hiding commands toggle; that is, they hide what was
|
||||
visible, and show what was hidden.
|
||||
|
||||
@node Dired Updating
|
||||
@section Updating the Dired Buffer
|
||||
|
||||
This section describes commands to update the Dired buffer to reflect
|
||||
outside (non-Dired) changes in the directories and files, and to delete
|
||||
part of the Dired buffer.
|
||||
|
||||
@table @kbd
|
||||
@item g
|
||||
Update the entire contents of the Dired buffer (@code{revert-buffer}).
|
||||
|
||||
@item l
|
||||
Update the specified files (@code{dired-do-redisplay}).
|
||||
|
||||
@item k
|
||||
Delete the specified @emph{file lines}---not the files, just the lines
|
||||
(@code{dired-do-kill-lines}).
|
||||
|
||||
@item s
|
||||
Toggle between alphabetical order and date/time order
|
||||
(@code{dired-sort-toggle-or-edit}).
|
||||
|
||||
@item C-u s @var{switches} @key{RET}
|
||||
Refresh the Dired buffer using @var{switches} as
|
||||
@code{dired-listing-switches}.
|
||||
@end table
|
||||
|
||||
@kindex g @r{(Dired)}
|
||||
@findex revert-buffer @r{(Dired)}
|
||||
Type @kbd{g} (@code{revert-buffer}) to update the contents of the
|
||||
Dired buffer, based on changes in the files and directories listed.
|
||||
This preserves all marks except for those on files that have vanished.
|
||||
Hidden subdirectories are updated but remain hidden.
|
||||
|
||||
@kindex l @r{(Dired)}
|
||||
@findex dired-do-redisplay
|
||||
To update only some of the files, type @kbd{l}
|
||||
(@code{dired-do-redisplay}). This command applies to the next @var{n}
|
||||
files, or to the marked files if any, or to the current file. Updating
|
||||
them means reading their current status from the file system and
|
||||
changing the buffer to reflect it properly.
|
||||
|
||||
If you use @kbd{l} on a subdirectory header line, it updates the
|
||||
contents of the corresponding subdirectory.
|
||||
|
||||
@kindex k @r{(Dired)}
|
||||
@findex dired-do-kill-lines
|
||||
To delete the specified @emph{file lines}---not the files, just the
|
||||
lines---type @kbd{k} (@code{dired-do-kill-lines}). With a numeric
|
||||
argument @var{n}, this command applies to the next @var{n} files;
|
||||
otherwise, it applies to the marked files.
|
||||
|
||||
If you kill the line for a file that is a directory, the directory's
|
||||
contents are also deleted from the buffer. Typing @kbd{C-u k} on the
|
||||
header line for a subdirectory is another way to delete a subdirectory
|
||||
from the Dired buffer.
|
||||
|
||||
The @kbd{g} command brings back any individual lines that you have
|
||||
killed in this way, but not subdirectories---you must use @kbd{i} to
|
||||
reinsert each subdirectory.
|
||||
|
||||
@cindex Dired sorting
|
||||
@cindex sorting Dired buffer
|
||||
@kindex s @r{(Dired)}
|
||||
@findex dired-sort-toggle-or-edit
|
||||
The files in a Dired buffers are normally listed in alphabetical order
|
||||
by file names. Alternatively Dired can sort them by date/time. The
|
||||
Dired command @kbd{s} (@code{dired-sort-toggle-or-edit}) switches
|
||||
between these two sorting modes. The mode line in a Dired buffer
|
||||
indicates which way it is currently sorted---by name, or by date.
|
||||
|
||||
@kbd{C-u s @var{switches} @key{RET}} lets you specify a new value for
|
||||
@code{dired-listing-switches}.
|
||||
|
||||
@node Dired and Find
|
||||
@section Dired and @code{find}
|
||||
@cindex @code{find} and Dired
|
||||
|
||||
You can select a set of files for display in a Dired buffer more
|
||||
flexibly by using the @code{find} utility to choose the files.
|
||||
|
||||
@findex find-name-dired
|
||||
To search for files with names matching a wildcard pattern use
|
||||
@kbd{M-x find-name-dired}. It reads arguments @var{directory} and
|
||||
@var{pattern}, and chooses all the files in @var{directory} or its
|
||||
subdirectories whose individual names match @var{pattern}.
|
||||
|
||||
The files thus chosen are displayed in a Dired buffer in which the
|
||||
ordinary Dired commands are available.
|
||||
|
||||
@findex find-grep-dired
|
||||
If you want to test the contents of files, rather than their names,
|
||||
use @kbd{M-x find-grep-dired}. This command reads two minibuffer
|
||||
arguments, @var{directory} and @var{regexp}; it chooses all the files in
|
||||
@var{directory} or its subdirectories that contain a match for
|
||||
@var{regexp}. It works by running the programs @code{find} and
|
||||
@code{grep}. See also @kbd{M-x grep-find}, in @ref{Compilation}.
|
||||
Remember to write the regular expression for @code{grep}, not for Emacs.
|
||||
|
||||
@findex find-dired
|
||||
The most general command in this series is @kbd{M-x find-dired}, which
|
||||
lets you specify any condition that @code{find} can test. It takes two
|
||||
minibuffer arguments, @var{directory} and @var{find-args}; it runs
|
||||
@code{find} in @var{directory}, passing @var{find-args} to tell
|
||||
@code{find} what condition to test. To use this command, you need to
|
||||
know how to use @code{find}.
|
||||
|
||||
@vindex find-ls-option
|
||||
The format of listing produced by these commands is controlled by the
|
||||
variable @code{find-ls-option}, whose default value specifies using
|
||||
options @samp{-ld} for @code{ls}. If your listings are corrupted, you
|
||||
may need to change the value of this variable.
|
397
man/display.texi
Normal file
397
man/display.texi
Normal file
|
@ -0,0 +1,397 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Display, Search, Registers, Top
|
||||
@chapter Controlling the Display
|
||||
|
||||
Since only part of a large buffer fits in the window, Emacs tries to
|
||||
show a part that is likely to be interesting. Display-control commands
|
||||
allow you to specify which part of the text you want to see, and how to
|
||||
display it.
|
||||
|
||||
@menu
|
||||
* Scrolling:: Moving text up and down in a window.
|
||||
* Horizontal Scrolling:: Moving text left and right in a window.
|
||||
* Follow Mode:: Follow mode lets two windows scroll as one.
|
||||
* Selective Display:: Hiding lines with lots of indentation.
|
||||
* Optional Mode Line:: Optional mode line display features.
|
||||
* Text Display:: How text characters are normally displayed.
|
||||
* Display Vars:: Information on variables for customizing display.
|
||||
@end menu
|
||||
|
||||
@node Scrolling
|
||||
@section Scrolling
|
||||
|
||||
If a buffer contains text that is too large to fit entirely within a
|
||||
window that is displaying the buffer, Emacs shows a contiguous portion of
|
||||
the text. The portion shown always contains point.
|
||||
|
||||
@cindex scrolling
|
||||
@dfn{Scrolling} means moving text up or down in the window so that
|
||||
different parts of the text are visible. Scrolling forward means that text
|
||||
moves up, and new text appears at the bottom. Scrolling backward moves
|
||||
text down and new text appears at the top.
|
||||
|
||||
Scrolling happens automatically if you move point past the bottom or top
|
||||
of the window. You can also explicitly request scrolling with the commands
|
||||
in this section.
|
||||
|
||||
@table @kbd
|
||||
@item C-l
|
||||
Clear screen and redisplay, scrolling the selected window to center
|
||||
point vertically within it (@code{recenter}).
|
||||
@item C-v
|
||||
Scroll forward (a windowful or a specified number of lines) (@code{scroll-up}).
|
||||
@item @key{NEXT}
|
||||
Likewise, scroll forward.
|
||||
@item M-v
|
||||
Scroll backward (@code{scroll-down}).
|
||||
@item @key{PRIOR}
|
||||
Likewise, scroll backward.
|
||||
@item @var{arg} C-l
|
||||
Scroll so point is on line @var{arg} (@code{recenter}).
|
||||
@item C-M-l
|
||||
Scroll heuristically to bring useful information onto the screen
|
||||
(@code{reposition-window}).
|
||||
@end table
|
||||
|
||||
@kindex C-l
|
||||
@findex recenter
|
||||
The most basic scrolling command is @kbd{C-l} (@code{recenter}) with
|
||||
no argument. It clears the entire screen and redisplays all windows.
|
||||
In addition, it scrolls the selected window so that point is halfway
|
||||
down from the top of the window.
|
||||
|
||||
@kindex C-v
|
||||
@kindex M-v
|
||||
@kindex NEXT
|
||||
@kindex PRIOR
|
||||
@findex scroll-up
|
||||
@findex scroll-down
|
||||
The scrolling commands @kbd{C-v} and @kbd{M-v} let you move all the text
|
||||
in the window up or down a few lines. @kbd{C-v} (@code{scroll-up}) with an
|
||||
argument shows you that many more lines at the bottom of the window, moving
|
||||
the text and point up together as @kbd{C-l} might. @kbd{C-v} with a
|
||||
negative argument shows you more lines at the top of the window.
|
||||
@kbd{M-v} (@code{scroll-down}) is like @kbd{C-v}, but moves in the
|
||||
opposite direction. The function keys @key{NEXT} and @key{PRIOR} are
|
||||
equivalent to @kbd{C-v} and @kbd{M-v}.
|
||||
|
||||
The names of scroll commands are based on the direction that the text
|
||||
moves in the window. Thus, the command to scroll forward is called
|
||||
@code{scroll-up} because it moves the text upward on the screen.
|
||||
|
||||
@vindex next-screen-context-lines
|
||||
To read the buffer a windowful at a time, use @kbd{C-v} with no argument.
|
||||
It takes the last two lines at the bottom of the window and puts them at
|
||||
the top, followed by nearly a whole windowful of lines not previously
|
||||
visible. If point was in the text scrolled off the top, it moves to the
|
||||
new top of the window. @kbd{M-v} with no argument moves backward with
|
||||
overlap similarly. The number of lines of overlap across a @kbd{C-v} or
|
||||
@kbd{M-v} is controlled by the variable @code{next-screen-context-lines}; by
|
||||
default, it is 2.
|
||||
|
||||
@vindex scroll-preserve-screen-position
|
||||
Some users like the full-screen scroll commands to keep point at the
|
||||
same screen line. To enable this behavior, set the variable
|
||||
@code{scroll-preserve-screen-position} to a non-@code{nil} value. This
|
||||
mode is convenient for browsing through a file by scrolling by
|
||||
screenfuls; if you come back to the screen where you started, point goes
|
||||
back to the line where it started. However, this mode is inconvenient
|
||||
when you move to the next screen in order to move point to the text
|
||||
there.
|
||||
|
||||
Another way to do scrolling is with @kbd{C-l} with a numeric argument.
|
||||
@kbd{C-l} does not clear the screen when given an argument; it only scrolls
|
||||
the selected window. With a positive argument @var{n}, it repositions text
|
||||
to put point @var{n} lines down from the top. An argument of zero puts
|
||||
point on the very top line. Point does not move with respect to the text;
|
||||
rather, the text and point move rigidly on the screen. @kbd{C-l} with a
|
||||
negative argument puts point that many lines from the bottom of the window.
|
||||
For example, @kbd{C-u - 1 C-l} puts point on the bottom line, and @kbd{C-u
|
||||
- 5 C-l} puts it five lines from the bottom. Just @kbd{C-u} as argument,
|
||||
as in @kbd{C-u C-l}, scrolls point to the center of the selected window.
|
||||
|
||||
@kindex C-M-l
|
||||
@findex reposition-window
|
||||
The @kbd{C-M-l} command (@code{reposition-window}) scrolls the current
|
||||
window heuristically in a way designed to get useful information onto
|
||||
the screen. For example, in a Lisp file, this command tries to get the
|
||||
entire current defun onto the screen if possible.
|
||||
|
||||
@vindex scroll-conservatively
|
||||
Scrolling happens automatically if point has moved out of the visible
|
||||
portion of the text when it is time to display. Normally, automatic
|
||||
scrolling centers point vertically within the window. However, if you
|
||||
set @code{scroll-conservatively} to a small number @var{n}, then if you
|
||||
move point just a little off the screen---less than @var{n} lines---then
|
||||
Emacs scrolls the text just far enough to bring point back on screen.
|
||||
By default, @code{scroll-conservatively} is 0.
|
||||
|
||||
@vindex scroll-margin
|
||||
The variable @code{scroll-margin} restricts how close point can come
|
||||
to the top or bottom of a window. Its value is a number of screen
|
||||
lines; if point comes within that many lines of the top or bottom of the
|
||||
window, Emacs recenters the window. By default, @code{scroll-margin} is
|
||||
0.
|
||||
|
||||
@node Horizontal Scrolling
|
||||
@section Horizontal Scrolling
|
||||
@cindex horizontal scrolling
|
||||
|
||||
@dfn{Horizontal scrolling} means shifting all the lines sideways
|
||||
within a window---so that some of the text near the left margin
|
||||
is not displayed at all.
|
||||
|
||||
@table @kbd
|
||||
@item C-x <
|
||||
Scroll text in current window to the left (@code{scroll-left}).
|
||||
@item C-x >
|
||||
Scroll to the right (@code{scroll-right}).
|
||||
@end table
|
||||
|
||||
When a window has been scrolled horizontally, text lines are truncated
|
||||
rather than continued (@pxref{Continuation Lines}), with a @samp{$}
|
||||
appearing in the first column when there is text truncated to the left,
|
||||
and in the last column when there is text truncated to the right.
|
||||
|
||||
@kindex C-x <
|
||||
@kindex C-x >
|
||||
@findex scroll-left
|
||||
@findex scroll-right
|
||||
The command @kbd{C-x <} (@code{scroll-left}) scrolls the selected
|
||||
window to the left by @var{n} columns with argument @var{n}. This moves
|
||||
part of the beginning of each line off the left edge of the window.
|
||||
With no argument, it scrolls by almost the full width of the window (two
|
||||
columns less, to be precise).
|
||||
|
||||
@kbd{C-x >} (@code{scroll-right}) scrolls similarly to the right. The
|
||||
window cannot be scrolled any farther to the right once it is displayed
|
||||
normally (with each line starting at the window's left margin);
|
||||
attempting to do so has no effect. This means that you don't have to
|
||||
calculate the argument precisely for @w{@kbd{C-x >}}; any sufficiently large
|
||||
argument will restore the normal display.
|
||||
|
||||
@cindex Hscroll mode
|
||||
@cindex mode, Hscroll
|
||||
@findex hscroll-mode
|
||||
You can request automatic horizontal scrolling by enabling Hscroll
|
||||
mode. When this mode is enabled, Emacs scrolls a window horizontally
|
||||
whenever that is necessary to keep point visible and not too far from
|
||||
the left or right edge. The command to enable or disable this mode is
|
||||
@kbd{M-x hscroll-mode}.
|
||||
|
||||
@node Follow Mode
|
||||
@section Follow Mode
|
||||
@cindex Follow mode
|
||||
@cindex mode, Follow
|
||||
|
||||
@dfn{Follow mode} is a minor mode that makes two windows showing the
|
||||
same buffer scroll as one tall ``virtual window.'' To use Follow mode,
|
||||
go to a frame with just one window, split it into two side-by-side
|
||||
windows using @kbd{C-x 3}, and then type @kbd{M-x follow-mode}. From
|
||||
then on, you can edit the buffer in either of the two windows, or scroll
|
||||
either one; the other window follows it.
|
||||
|
||||
To turn off Follow mode, type @kbd{M-x follow-mode} a second time.
|
||||
|
||||
@node Selective Display
|
||||
@section Selective Display
|
||||
@findex set-selective-display
|
||||
@kindex C-x $
|
||||
|
||||
Emacs has the ability to hide lines indented more than a certain number
|
||||
of columns (you specify how many columns). You can use this to get an
|
||||
overview of a part of a program.
|
||||
|
||||
To hide lines, type @kbd{C-x $} (@code{set-selective-display}) with a
|
||||
numeric argument @var{n}. Then lines with at least @var{n} columns of
|
||||
indentation disappear from the screen. The only indication of their
|
||||
presence is that three dots (@samp{@dots{}}) appear at the end of each
|
||||
visible line that is followed by one or more hidden ones.
|
||||
|
||||
The commands @kbd{C-n} and @kbd{C-p} move across the hidden lines as
|
||||
if they were not there.
|
||||
|
||||
The hidden lines are still present in the buffer, and most editing
|
||||
commands see them as usual, so you may find point in the middle of the
|
||||
hidden text. When this happens, the cursor appears at the end of the
|
||||
previous line, after the three dots. If point is at the end of the
|
||||
visible line, before the newline that ends it, the cursor appears before
|
||||
the three dots.
|
||||
|
||||
To make all lines visible again, type @kbd{C-x $} with no argument.
|
||||
|
||||
@vindex selective-display-ellipses
|
||||
If you set the variable @code{selective-display-ellipses} to
|
||||
@code{nil}, the three dots do not appear at the end of a line that
|
||||
precedes hidden lines. Then there is no visible indication of the
|
||||
hidden lines. This variable becomes local automatically when set.
|
||||
|
||||
@node Optional Mode Line
|
||||
@section Optional Mode Line Features
|
||||
|
||||
@cindex Line Number mode
|
||||
@cindex mode, Line Number
|
||||
@findex line-number-mode
|
||||
The current line number of point appears in the mode line when Line
|
||||
Number mode is enabled. Use the command @kbd{M-x line-number-mode} to
|
||||
turn this mode on and off; normally it is on. The line number appears
|
||||
before the buffer percentage @var{pos}, with the letter @samp{L} to
|
||||
indicate what it is. @xref{Minor Modes}, for more information about
|
||||
minor modes and about how to use this command.
|
||||
|
||||
@vindex line-number-display-limit
|
||||
If the buffer is very large (larger than the value of
|
||||
@code{line-number-display-limit}), then the line number doesn't appear.
|
||||
Emacs doesn't compute the line number when the buffer is large, because
|
||||
that would be too slow. If you have narrowed the buffer
|
||||
(@pxref{Narrowing}), the displayed line number is relative to the
|
||||
accessible portion of the buffer.
|
||||
|
||||
@cindex Column Number mode
|
||||
@cindex mode, Column Number
|
||||
@findex column-number-mode
|
||||
You can also display the current column number by turning on Column
|
||||
Number mode. It displays the current column number preceded by the
|
||||
letter @samp{C}. Type @kbd{M-x column-number-mode} to toggle this mode.
|
||||
|
||||
@findex display-time
|
||||
@cindex time (on mode line)
|
||||
Emacs can optionally display the time and system load in all mode
|
||||
lines. To enable this feature, type @kbd{M-x display-time}. The
|
||||
information added to the mode line usually appears after the buffer
|
||||
name, before the mode names and their parentheses. It looks like this:
|
||||
|
||||
@example
|
||||
@var{hh}:@var{mm}pm @var{l.ll}
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
@vindex display-time-24hr-format
|
||||
Here @var{hh} and @var{mm} are the hour and minute, followed always by
|
||||
@samp{am} or @samp{pm}. @var{l.ll} is the average number of running
|
||||
processes in the whole system recently. (Some fields may be missing if
|
||||
your operating system cannot support them.) If you prefer time display
|
||||
in 24-hour format, set the variable @code{display-time-24hr-format}
|
||||
to @code{t}.
|
||||
|
||||
@cindex mail (on mode line)
|
||||
The word @samp{Mail} appears after the load level if there is mail
|
||||
for you that you have not read yet.
|
||||
|
||||
@node Text Display
|
||||
@section How Text Is Displayed
|
||||
@cindex characters (in text)
|
||||
|
||||
ASCII printing characters (octal codes 040 through 0176) in Emacs
|
||||
buffers are displayed with their graphics. So are non-ASCII multibyte
|
||||
printing characters (octal codes above 0400).
|
||||
|
||||
Some ASCII control characters are displayed in special ways. The
|
||||
newline character (octal code 012) is displayed by starting a new line.
|
||||
The tab character (octal code 011) is displayed by moving to the next
|
||||
tab stop column (normally every 8 columns).
|
||||
|
||||
Other ASCII control characters are normally displayed as a caret
|
||||
(@samp{^}) followed by the non-control version of the character; thus,
|
||||
control-A is displayed as @samp{^A}.
|
||||
|
||||
Non-ASCII characters 0200 through 0377 are displayed with octal escape
|
||||
sequences; thus, character code 0243 (octal) is displayed as
|
||||
@samp{\243}. However, if you enable European display, most of these
|
||||
characters become non-ASCII printing characters, and are displayed using
|
||||
their graphics (assuming your terminal supports them).
|
||||
@xref{Single-Byte European Support}.
|
||||
|
||||
@node Display Vars
|
||||
@section Variables Controlling Display
|
||||
|
||||
This section contains information for customization only. Beginning
|
||||
users should skip it.
|
||||
|
||||
@vindex mode-line-inverse-video
|
||||
The variable @code{mode-line-inverse-video} controls whether the mode
|
||||
line is displayed in inverse video (assuming the terminal supports it);
|
||||
@code{nil} means don't do so. @xref{Mode Line}. If you specify the
|
||||
foreground color for the @code{modeline} face, and
|
||||
@code{mode-line-inverse-video} is non-@code{nil}, then the default
|
||||
background color for that face is the usual foreground color.
|
||||
@xref{Faces}.
|
||||
|
||||
@vindex inverse-video
|
||||
If the variable @code{inverse-video} is non-@code{nil}, Emacs attempts
|
||||
to invert all the lines of the display from what they normally are.
|
||||
|
||||
@vindex visible-bell
|
||||
If the variable @code{visible-bell} is non-@code{nil}, Emacs attempts
|
||||
to make the whole screen blink when it would normally make an audible bell
|
||||
sound. This variable has no effect if your terminal does not have a way
|
||||
to make the screen blink.@refill
|
||||
|
||||
@vindex no-redraw-on-reenter
|
||||
When you reenter Emacs after suspending, Emacs normally clears the
|
||||
screen and redraws the entire display. On some terminals with more than
|
||||
one page of memory, it is possible to arrange the termcap entry so that
|
||||
the @samp{ti} and @samp{te} strings (output to the terminal when Emacs
|
||||
is entered and exited, respectively) switch between pages of memory so
|
||||
as to use one page for Emacs and another page for other output. Then
|
||||
you might want to set the variable @code{no-redraw-on-reenter}
|
||||
non-@code{nil}; this tells Emacs to assume, when resumed, that the
|
||||
screen page it is using still contains what Emacs last wrote there.
|
||||
|
||||
@vindex echo-keystrokes
|
||||
The variable @code{echo-keystrokes} controls the echoing of multi-character
|
||||
keys; its value is the number of seconds of pause required to cause echoing
|
||||
to start, or zero meaning don't echo at all. @xref{Echo Area}.
|
||||
|
||||
@vindex ctl-arrow
|
||||
If the variable @code{ctl-arrow} is @code{nil}, control characters in
|
||||
the buffer are displayed with octal escape sequences, except for newline
|
||||
and tab. Altering the value of @code{ctl-arrow} makes it local to the
|
||||
current buffer; until that time, the default value is in effect. The
|
||||
default is initially @code{t}. @xref{Display Tables,, Display Tables,
|
||||
elisp, The Emacs Lisp Reference Manual}.
|
||||
|
||||
@vindex tab-width
|
||||
Normally, a tab character in the buffer is displayed as whitespace which
|
||||
extends to the next display tab stop position, and display tab stops come
|
||||
at intervals equal to eight spaces. The number of spaces per tab is
|
||||
controlled by the variable @code{tab-width}, which is made local by
|
||||
changing it, just like @code{ctl-arrow}. Note that how the tab character
|
||||
in the buffer is displayed has nothing to do with the definition of
|
||||
@key{TAB} as a command. The variable @code{tab-width} must have an
|
||||
integer value between 1 and 1000, inclusive.
|
||||
|
||||
@c @vindex truncate-lines @c No index entry here, because we have one
|
||||
@c in the continuation section.
|
||||
If the variable @code{truncate-lines} is non-@code{nil}, then each
|
||||
line of text gets just one screen line for display; if the text line is
|
||||
too long, display shows only the part that fits. If
|
||||
@code{truncate-lines} is @code{nil}, then long text lines display as
|
||||
more than one screen line, enough to show the whole text of the line.
|
||||
@xref{Continuation Lines}. Altering the value of @code{truncate-lines}
|
||||
makes it local to the current buffer; until that time, the default value
|
||||
is in effect. The default is initially @code{nil}.
|
||||
|
||||
@c @vindex truncate-partial-width-windows @c Idx entry is in Split Windows.
|
||||
If the variable @code{truncate-partial-width-windows} is
|
||||
non-@code{nil}, it forces truncation rather than continuation in any
|
||||
window less than the full width of the screen or frame, regardless of
|
||||
the value of @code{truncate-lines}. For information about side-by-side
|
||||
windows, see @ref{Split Window}. See also @ref{Display,, Display,
|
||||
elisp, The Emacs Lisp Reference Manual}.
|
||||
|
||||
@vindex baud-rate
|
||||
The variable @code{baud-rate} holds the output speed of the
|
||||
terminal, as far as Emacs knows. Setting this variable does not change
|
||||
the speed of actual data transmission, but the value is used for
|
||||
calculations such as padding. It also affects decisions about whether
|
||||
to scroll part of the screen or redraw it instead---even when using a
|
||||
window system. (We designed it this way, despite the fact that a window
|
||||
system has no true ``output speed,'' to give you a way to tune these
|
||||
decisions.)
|
||||
|
||||
You can customize the way any particular character code is displayed
|
||||
by means of a display table. @xref{Display Tables,, Display Tables,
|
||||
elisp, The Emacs Lisp Reference Manual}.
|
2275
man/ediff.texi
Normal file
2275
man/ediff.texi
Normal file
File diff suppressed because it is too large
Load diff
136
man/entering.texi
Normal file
136
man/entering.texi
Normal file
|
@ -0,0 +1,136 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Entering Emacs, Exiting, Text Characters, Top
|
||||
@chapter Entering and Exiting Emacs
|
||||
@cindex entering Emacs
|
||||
@cindex starting Emacs
|
||||
|
||||
The usual way to invoke Emacs is with the shell command @samp{emacs}.
|
||||
Emacs clears the screen and then displays an initial help message and
|
||||
copyright notice. Some operating systems discard all type-ahead when
|
||||
Emacs starts up; they give Emacs no way to prevent this. Therefore, it
|
||||
is advisable to wait until Emacs clears the screen before typing your
|
||||
first editing command.
|
||||
|
||||
If you run Emacs from a shell window under the X Window System, run it
|
||||
in the background with @samp{emacs&}. This way, Emacs does not tie up
|
||||
the shell window, so you can use that to run other shell commands while
|
||||
Emacs operates its own X windows. You can begin typing Emacs commands
|
||||
as soon as you direct your keyboard input to the Emacs frame.
|
||||
|
||||
@vindex initial-major-mode
|
||||
When Emacs starts up, it makes a buffer named @samp{*scratch*}.
|
||||
That's the buffer you start out in. The @samp{*scratch*} buffer uses Lisp
|
||||
Interaction mode; you can use it to type Lisp expressions and evaluate
|
||||
them, or you can ignore that capability and simply doodle. (You can
|
||||
specify a different major mode for this buffer by setting the variable
|
||||
@code{initial-major-mode} in your init file. @xref{Init File}.)
|
||||
|
||||
It is possible to specify files to be visited, Lisp files to be
|
||||
loaded, and functions to be called, by giving Emacs arguments in the
|
||||
shell command line. @xref{Command Arguments}. But we don't recommend
|
||||
doing this. The feature exists mainly for compatibility with other
|
||||
editors.
|
||||
|
||||
Many other editors are designed to be started afresh each time you
|
||||
want to edit. You edit one file and then exit the editor. The next
|
||||
time you want to edit either another file or the same one, you must run
|
||||
the editor again. With these editors, it makes sense to use a
|
||||
command-line argument to say which file to edit.
|
||||
|
||||
But starting a new Emacs each time you want to edit a different file
|
||||
does not make sense. For one thing, this would be annoyingly slow. For
|
||||
another, this would fail to take advantage of Emacs's ability to visit
|
||||
more than one file in a single editing session. And it would lose the
|
||||
other accumulated context, such as registers, undo history, and the mark
|
||||
ring.
|
||||
|
||||
The recommended way to use GNU Emacs is to start it only once, just
|
||||
after you log in, and do all your editing in the same Emacs session.
|
||||
Each time you want to edit a different file, you visit it with the
|
||||
existing Emacs, which eventually comes to have many files in it ready
|
||||
for editing. Usually you do not kill the Emacs until you are about to
|
||||
log out. @xref{Files}, for more information on visiting more than one
|
||||
file.
|
||||
|
||||
@node Exiting, Basic, Entering Emacs, Top
|
||||
@section Exiting Emacs
|
||||
@cindex exiting
|
||||
@cindex killing Emacs
|
||||
@cindex suspending
|
||||
@cindex leaving Emacs
|
||||
@cindex quitting Emacs
|
||||
|
||||
There are two commands for exiting Emacs because there are two kinds
|
||||
of exiting: @dfn{suspending} Emacs and @dfn{killing} Emacs.
|
||||
|
||||
@dfn{Suspending} means stopping Emacs temporarily and returning
|
||||
control to its parent process (usually a shell), allowing you to resume
|
||||
editing later in the same Emacs job, with the same buffers, same kill
|
||||
ring, same undo history, and so on. This is the usual way to exit.
|
||||
|
||||
@dfn{Killing} Emacs means destroying the Emacs job. You can run Emacs
|
||||
again later, but you will get a fresh Emacs; there is no way to resume
|
||||
the same editing session after it has been killed.
|
||||
|
||||
@table @kbd
|
||||
@item C-z
|
||||
Suspend Emacs (@code{suspend-emacs}) or iconify a frame
|
||||
(@code{iconify-or-deiconify-frame}).
|
||||
@item C-x C-c
|
||||
Kill Emacs (@code{save-buffers-kill-emacs}).
|
||||
@end table
|
||||
|
||||
@kindex C-z
|
||||
@findex suspend-emacs
|
||||
To suspend Emacs, type @kbd{C-z} (@code{suspend-emacs}). This takes
|
||||
you back to the shell from which you invoked Emacs. You can resume
|
||||
Emacs with the shell command @samp{%emacs} in most common shells.
|
||||
|
||||
On systems that do not support suspending programs, @kbd{C-z} starts
|
||||
an inferior shell that communicates directly with the terminal.
|
||||
Emacs waits until you exit the subshell. (The way to do that is
|
||||
probably with @kbd{C-d} or @samp{exit}, but it depends on which shell
|
||||
you use.) The only way on these systems to get back to the shell from
|
||||
which Emacs was run (to log out, for example) is to kill Emacs.
|
||||
|
||||
Suspending also fails if you run Emacs under a shell that doesn't
|
||||
support suspending programs, even if the system itself does support it.
|
||||
In such a case, you can set the variable @code{cannot-suspend} to a
|
||||
non-@code{nil} value to force @kbd{C-z} to start an inferior shell.
|
||||
(One might also describe Emacs's parent shell as ``inferior'' for
|
||||
failing to support job control properly, but that is a matter of taste.)
|
||||
|
||||
When Emacs communicates directly with an X server and creates its own
|
||||
dedicated X windows, @kbd{C-z} has a different meaning. Suspending an
|
||||
applications that uses its own X windows is not meaningful or useful.
|
||||
Instead, @kbd{C-z} runs the command @code{iconify-or-deiconify-frame},
|
||||
which temporarily closes up the selected Emacs frame (@pxref{Frames}).
|
||||
The way to get back to a shell window is with the window manager.
|
||||
|
||||
@kindex C-x C-c
|
||||
@findex save-buffers-kill-emacs
|
||||
To kill Emacs, type @kbd{C-x C-c} (@code{save-buffers-kill-emacs}). A
|
||||
two-character key is used for this to make it harder to type. This
|
||||
command first offers to save any modified file-visiting buffers. If you
|
||||
do not save them all, it asks for reconfirmation with @kbd{yes} before
|
||||
killing Emacs, since any changes not saved will be lost forever. Also,
|
||||
if any subprocesses are still running, @kbd{C-x C-c} asks for
|
||||
confirmation about them, since killing Emacs will kill the subprocesses
|
||||
immediately.
|
||||
|
||||
There is no way to restart an Emacs session once you have killed it.
|
||||
You can, however, arrange for Emacs to record certain session
|
||||
information, such as which files are visited, when you kill it, so that
|
||||
the next time you restart Emacs it will try to visit the same files and
|
||||
so on. @xref{Saving Emacs Sessions}.
|
||||
|
||||
The operating system usually listens for certain special characters
|
||||
whose meaning is to kill or suspend the program you are running.
|
||||
@b{This operating system feature is turned off while you are in Emacs.}
|
||||
The meanings of @kbd{C-z} and @kbd{C-x C-c} as keys in Emacs were
|
||||
inspired by the use of @kbd{C-z} and @kbd{C-c} on several operating
|
||||
systems as the characters for stopping or killing a program, but that is
|
||||
their only relationship with the operating system. You can customize
|
||||
these keys to run any commands of your choice (@pxref{Keymaps}).
|
2413
man/files.texi
Normal file
2413
man/files.texi
Normal file
File diff suppressed because it is too large
Load diff
317
man/fixit.texi
Normal file
317
man/fixit.texi
Normal file
|
@ -0,0 +1,317 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Fixit, Files, Search, Top
|
||||
@chapter Commands for Fixing Typos
|
||||
@cindex typos, fixing
|
||||
@cindex mistakes, correcting
|
||||
|
||||
In this chapter we describe the commands that are especially useful for
|
||||
the times when you catch a mistake in your text just after you have made
|
||||
it, or change your mind while composing text on the fly.
|
||||
|
||||
The most fundamental command for correcting erroneous editing is the
|
||||
undo command, @kbd{C-x u} or @kbd{C-_}. This command undoes a single
|
||||
command (usually), a part of a command (in the case of
|
||||
@code{query-replace}), or several consecutive self-inserting characters.
|
||||
Consecutive repetitions of @kbd{C-_} or @kbd{C-x u} undo earlier and
|
||||
earlier changes, back to the limit of the undo information available.
|
||||
@xref{Undo}, for for more information.
|
||||
|
||||
@menu
|
||||
* Kill Errors:: Commands to kill a batch of recently entered text.
|
||||
* Transpose:: Exchanging two characters, words, lines, lists...
|
||||
* Fixing Case:: Correcting case of last word entered.
|
||||
* Spelling:: Apply spelling checker to a word, or a whole file.
|
||||
@end menu
|
||||
|
||||
@node Kill Errors
|
||||
@section Killing Your Mistakes
|
||||
|
||||
@table @kbd
|
||||
@item @key{DEL}
|
||||
Delete last character (@code{delete-backward-char}).
|
||||
@item M-@key{DEL}
|
||||
Kill last word (@code{backward-kill-word}).
|
||||
@item C-x @key{DEL}
|
||||
Kill to beginning of sentence (@code{backward-kill-sentence}).
|
||||
@end table
|
||||
|
||||
The @key{DEL} character (@code{delete-backward-char}) is the most
|
||||
important correction command. It deletes the character before point.
|
||||
When @key{DEL} follows a self-inserting character command, you can think
|
||||
of it as canceling that command. However, avoid the mistake of thinking
|
||||
of @key{DEL} as a general way to cancel a command!
|
||||
|
||||
When your mistake is longer than a couple of characters, it might be
|
||||
more convenient to use @kbd{M-@key{DEL}} or @kbd{C-x @key{DEL}}.
|
||||
@kbd{M-@key{DEL}} kills back to the start of the last word, and @kbd{C-x
|
||||
@key{DEL}} kills back to the start of the last sentence. @kbd{C-x
|
||||
@key{DEL}} is particularly useful when you change your mind about the
|
||||
phrasing of the text you are writing. @kbd{M-@key{DEL}} and @kbd{C-x
|
||||
@key{DEL}} save the killed text for @kbd{C-y} and @kbd{M-y} to
|
||||
retrieve. @xref{Yanking}.@refill
|
||||
|
||||
@kbd{M-@key{DEL}} is often useful even when you have typed only a few
|
||||
characters wrong, if you know you are confused in your typing and aren't
|
||||
sure exactly what you typed. At such a time, you cannot correct with
|
||||
@key{DEL} except by looking at the screen to see what you did. Often it
|
||||
requires less thought to kill the whole word and start again.
|
||||
|
||||
@node Transpose
|
||||
@section Transposing Text
|
||||
|
||||
@table @kbd
|
||||
@item C-t
|
||||
Transpose two characters (@code{transpose-chars}).
|
||||
@item M-t
|
||||
Transpose two words (@code{transpose-words}).
|
||||
@item C-M-t
|
||||
Transpose two balanced expressions (@code{transpose-sexps}).
|
||||
@item C-x C-t
|
||||
Transpose two lines (@code{transpose-lines}).
|
||||
@end table
|
||||
|
||||
@kindex C-t
|
||||
@findex transpose-chars
|
||||
The common error of transposing two characters can be fixed, when they
|
||||
are adjacent, with the @kbd{C-t} command (@code{transpose-chars}). Normally,
|
||||
@kbd{C-t} transposes the two characters on either side of point. When
|
||||
given at the end of a line, rather than transposing the last character of
|
||||
the line with the newline, which would be useless, @kbd{C-t} transposes the
|
||||
last two characters on the line. So, if you catch your transposition error
|
||||
right away, you can fix it with just a @kbd{C-t}. If you don't catch it so
|
||||
fast, you must move the cursor back to between the two transposed
|
||||
characters. If you transposed a space with the last character of the word
|
||||
before it, the word motion commands are a good way of getting there.
|
||||
Otherwise, a reverse search (@kbd{C-r}) is often the best way.
|
||||
@xref{Search}.
|
||||
|
||||
|
||||
@kindex C-x C-t
|
||||
@findex transpose-lines
|
||||
@kindex M-t
|
||||
@findex transpose-words
|
||||
@kindex C-M-t
|
||||
@findex transpose-sexps
|
||||
@kbd{M-t} (@code{transpose-words}) transposes the word before point
|
||||
with the word after point. It moves point forward over a word, dragging
|
||||
the word preceding or containing point forward as well. The punctuation
|
||||
characters between the words do not move. For example, @w{@samp{FOO, BAR}}
|
||||
transposes into @w{@samp{BAR, FOO}} rather than @samp{@w{BAR FOO,}}.
|
||||
|
||||
@kbd{C-M-t} (@code{transpose-sexps}) is a similar command for transposing
|
||||
two expressions (@pxref{Lists}), and @kbd{C-x C-t} (@code{transpose-lines})
|
||||
exchanges lines. They work like @kbd{M-t} except in determining the
|
||||
division of the text into syntactic units.
|
||||
|
||||
A numeric argument to a transpose command serves as a repeat count: it
|
||||
tells the transpose command to move the character (word, sexp, line)
|
||||
before or containing point across several other characters (words,
|
||||
sexps, lines). For example, @kbd{C-u 3 C-t} moves the character before
|
||||
point forward across three other characters. It would change
|
||||
@samp{f@point{}oobar} into @samp{oobf@point{}ar}. This is equivalent to
|
||||
repeating @kbd{C-t} three times. @kbd{C-u - 4 M-t} moves the word
|
||||
before point backward across four words. @kbd{C-u - C-M-t} would cancel
|
||||
the effect of plain @kbd{C-M-t}.@refill
|
||||
|
||||
A numeric argument of zero is assigned a special meaning (because
|
||||
otherwise a command with a repeat count of zero would do nothing): to
|
||||
transpose the character (word, sexp, line) ending after point with the
|
||||
one ending after the mark.
|
||||
|
||||
@node Fixing Case
|
||||
@section Case Conversion
|
||||
|
||||
@table @kbd
|
||||
@item M-- M-l
|
||||
Convert last word to lower case. Note @kbd{Meta--} is Meta-minus.
|
||||
@item M-- M-u
|
||||
Convert last word to all upper case.
|
||||
@item M-- M-c
|
||||
Convert last word to lower case with capital initial.
|
||||
@end table
|
||||
|
||||
@kindex M-@t{-} M-l
|
||||
@kindex M-@t{-} M-u
|
||||
@kindex M-@t{-} M-c
|
||||
A very common error is to type words in the wrong case. Because of this,
|
||||
the word case-conversion commands @kbd{M-l}, @kbd{M-u} and @kbd{M-c} have a
|
||||
special feature when used with a negative argument: they do not move the
|
||||
cursor. As soon as you see you have mistyped the last word, you can simply
|
||||
case-convert it and go on typing. @xref{Case}.@refill
|
||||
|
||||
@node Spelling
|
||||
@section Checking and Correcting Spelling
|
||||
@cindex spelling, checking and correcting
|
||||
@cindex checking spelling
|
||||
@cindex correcting spelling
|
||||
|
||||
This section describes the commands to check the spelling of a single
|
||||
word or of a portion of a buffer. These commands work with the spelling
|
||||
checker program Ispell, which is not part of Emacs.
|
||||
@ifinfo
|
||||
@xref{Top, Ispell, Overview ispell, ispell.info, The Ispell Manual}.
|
||||
@end ifinfo
|
||||
|
||||
@table @kbd
|
||||
@item M-x flyspell-mode
|
||||
Enable Flyspell mode, which highlights all misspelled words.
|
||||
@item M-$
|
||||
Check and correct spelling of the word at point (@code{ispell-word}).
|
||||
@item M-@key{TAB}
|
||||
Complete the word before point based on the spelling dictionary
|
||||
(@code{ispell-complete-word}).
|
||||
@item M-x ispell-buffer
|
||||
Check and correct spelling of each word in the buffer.
|
||||
@item M-x ispell-region
|
||||
Check and correct spelling of each word in the region.
|
||||
@item M-x ispell-message
|
||||
Check and correct spelling of each word in a draft mail message,
|
||||
excluding cited material.
|
||||
@item M-x ispell-change-dictionary @key{RET} @var{dict} @key{RET}
|
||||
Restart the Ispell process, using @var{dict} as the dictionary.
|
||||
@item M-x ispell-kill-ispell
|
||||
Kill the Ispell subprocess.
|
||||
@end table
|
||||
|
||||
@cindex Flyspell mode
|
||||
@findex flyspell-mode
|
||||
Flyspell mode is a fully-automatic way to check spelling as you edit
|
||||
in Emacs. It operates by checking words as you change or insert them.
|
||||
When it finds a word that it does not recognize, it highlights that
|
||||
word. This does not interfere with your editing, but when you see the
|
||||
highlighted word, you can move to it and fix it. Type @kbd{M-x
|
||||
flyspell-mode} to enable or disable this mode in the current buffer.
|
||||
|
||||
When Flyspell mode highlights a word as misspelled, you can click on
|
||||
it with @kbd{Mouse-2} to display a menu of possible corrections and
|
||||
actions. You can also correct the word by editing it manually in any
|
||||
way you like.
|
||||
|
||||
The other Emacs spell-checking features check or look up words when
|
||||
you give an explicit command to do so. Checking all or part of the
|
||||
buffer is useful when you have text that was written outside of this
|
||||
Emacs session and might contain any number of misspellings.
|
||||
|
||||
@kindex M-$
|
||||
@findex ispell-word
|
||||
To check the spelling of the word around or next to point, and
|
||||
optionally correct it as well, use the command @kbd{M-$}
|
||||
(@code{ispell-word}). If the word is not correct, the command offers
|
||||
you various alternatives for what to do about it.
|
||||
|
||||
@findex ispell-buffer
|
||||
@findex ispell-region
|
||||
To check the entire current buffer, use @kbd{M-x ispell-buffer}. Use
|
||||
@kbd{M-x ispell-region} to check just the current region. To check
|
||||
spelling in an email message you are writing, use @kbd{M-x
|
||||
ispell-message}; that checks the whole buffer, but does not check
|
||||
material that is indented or appears to be cited from other messages.
|
||||
|
||||
Each time these commands encounter an incorrect word, they ask you
|
||||
what to do. They display a list of alternatives, usually including
|
||||
several ``near-misses''---words that are close to the word being
|
||||
checked. Then you must type a character. Here are the valid responses:
|
||||
|
||||
@table @kbd
|
||||
@item @key{SPC}
|
||||
Skip this word---continue to consider it incorrect, but don't change it
|
||||
here.
|
||||
|
||||
@item r @var{new} @key{RET}
|
||||
Replace the word (just this time) with @var{new}.
|
||||
|
||||
@item R @var{new} @key{RET}
|
||||
Replace the word with @var{new}, and do a @code{query-replace} so you
|
||||
can replace it elsewhere in the buffer if you wish.
|
||||
|
||||
@item @var{digit}
|
||||
Replace the word (just this time) with one of the displayed
|
||||
near-misses. Each near-miss is listed with a digit; type that digit to
|
||||
select it.
|
||||
|
||||
@item a
|
||||
Accept the incorrect word---treat it as correct, but only in this
|
||||
editing session.
|
||||
|
||||
@item A
|
||||
Accept the incorrect word---treat it as correct, but only in this
|
||||
editing session and for this buffer.
|
||||
|
||||
@item i
|
||||
Insert this word in your private dictionary file so that Ispell will
|
||||
consider it correct it from now on, even in future sessions.
|
||||
|
||||
@item u
|
||||
Insert the lower-case version of this word in your private dictionary
|
||||
file.
|
||||
|
||||
@item m
|
||||
Like @kbd{i}, but you can also specify dictionary completion
|
||||
information.
|
||||
|
||||
@item l @var{word} @key{RET}
|
||||
Look in the dictionary for words that match @var{word}. These words
|
||||
become the new list of ``near-misses''; you can select one of them to
|
||||
replace with by typing a digit. You can use @samp{*} in @var{word} as a
|
||||
wildcard.
|
||||
|
||||
@item C-g
|
||||
Quit interactive spell checking. You can restart it again afterward
|
||||
with @kbd{C-u M-$}.
|
||||
|
||||
@item X
|
||||
Same as @kbd{C-g}.
|
||||
|
||||
@item x
|
||||
Quit interactive spell checking and move point back to where it was
|
||||
when you started spell checking.
|
||||
|
||||
@item q
|
||||
Quit interactive spell checking and kill the Ispell subprocess.
|
||||
|
||||
@item C-l
|
||||
Refresh the screen.
|
||||
|
||||
@item C-z
|
||||
This key has its normal command meaning (suspend Emacs or iconify this
|
||||
frame).
|
||||
@end table
|
||||
|
||||
@findex ispell-complete-word
|
||||
The command @code{ispell-complete-word}, which is bound to the key
|
||||
@kbd{M-@key{TAB}} in Text mode and related modes, shows a list of
|
||||
completions based on spelling correction. Insert the beginning of a
|
||||
word, and then type @kbd{M-@key{TAB}}; the command displays a completion
|
||||
list window. To choose one of the completions listed, click
|
||||
@kbd{Mouse-2} on it, or move the cursor there in the completions window
|
||||
and type @key{RET}. @xref{Text Mode}.
|
||||
|
||||
@ignore
|
||||
@findex reload-ispell
|
||||
The first time you use any of the spell checking commands, it starts
|
||||
an Ispell subprocess. The first thing the subprocess does is read your
|
||||
private dictionary, which defaults to the file @file{~/ispell.words}.
|
||||
Words that you ``insert'' with the @kbd{i} command are added to that
|
||||
file, but not right away---only at the end of the interactive
|
||||
replacement procedure. Use the @kbd{M-x reload-ispell} command to
|
||||
reload your private dictionary if you edit the file outside of Ispell.
|
||||
@end ignore
|
||||
|
||||
@cindex @code{ispell} program
|
||||
@findex ispell-kill-ispell
|
||||
Once started, the Ispell subprocess continues to run (waiting for
|
||||
something to do), so that subsequent spell checking commands complete
|
||||
more quickly. If you want to get rid of the Ispell process, use
|
||||
@kbd{M-x ispell-kill-ispell}. This is not usually necessary, since the
|
||||
process uses no time except when you do spelling correction.
|
||||
|
||||
@vindex ispell-dictionary
|
||||
Ispell uses two dictionaries: the standard dictionary and your private
|
||||
dictionary. The variable @code{ispell-dictionary} specifies the file
|
||||
name of the standard dictionary to use. A value of @code{nil} says to
|
||||
use the default dictionary. The command @kbd{M-x
|
||||
ispell-change-dictionary} sets this variable and then restarts the
|
||||
Ispell subprocess, so that it will use a different dictionary.
|
||||
|
974
man/forms.texi
Normal file
974
man/forms.texi
Normal file
|
@ -0,0 +1,974 @@
|
|||
\input texinfo @c -*-texinfo-*-
|
||||
@c documentation for forms-mode
|
||||
@c Written by Johan Vromans, and edited by Richard Stallman
|
||||
|
||||
@comment %**start of header (This is for running Texinfo on a region.)
|
||||
@setfilename ../info/forms
|
||||
@settitle Forms Mode User's Manual
|
||||
@syncodeindex vr cp
|
||||
@syncodeindex fn cp
|
||||
@syncodeindex ky cp
|
||||
@iftex
|
||||
@finalout
|
||||
@setchapternewpage odd
|
||||
@end iftex
|
||||
@c @smallbook
|
||||
@comment %**end of header (This is for running Texinfo on a region.)
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
* Forms: (forms). Emacs package for editing data bases
|
||||
by filling in forms.
|
||||
@end direntry
|
||||
|
||||
@ifinfo
|
||||
This file documents Forms mode, a form-editing major mode for GNU Emacs.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this
|
||||
manual provided the copyright notice and this permission notice are
|
||||
preserved on all copies.
|
||||
|
||||
@ignore
|
||||
Permission is granted to process this file through TeX and print the
|
||||
results, provided the printed document carries copying permission notice
|
||||
identical to this one except for the removal of this paragraph (this
|
||||
paragraph not being relevant to the printed manual).
|
||||
|
||||
@end ignore
|
||||
@end ifinfo
|
||||
|
||||
@iftex
|
||||
@titlepage
|
||||
@sp 6
|
||||
@center @titlefont{Forms Mode User's Manual}
|
||||
@sp 4
|
||||
@center Forms-Mode version 2
|
||||
@sp 1
|
||||
@center for GNU Emacs 20.1
|
||||
@sp 1
|
||||
@center June 1997
|
||||
@sp 5
|
||||
@center Johan Vromans
|
||||
@center @i{jvromans@@squirrel.nl}
|
||||
@page
|
||||
|
||||
@vskip 0pt plus 1filll
|
||||
Copyright @copyright{} 1989, 1997 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
@page
|
||||
@end titlepage
|
||||
@end iftex
|
||||
|
||||
@ifinfo
|
||||
@node Top
|
||||
@top Forms Mode
|
||||
|
||||
Forms mode is an Emacs major mode for working with simple textual data
|
||||
bases in a forms-oriented manner. In Forms mode, the information in
|
||||
these files is presented in an Emacs window in a user-defined format,
|
||||
one record at a time. The user can view records or modify their
|
||||
contents.
|
||||
|
||||
Forms mode is not a simple major mode, but requires two files to do its
|
||||
job: a control file and a data file. The data file holds the
|
||||
actual data to be presented. The control file describes
|
||||
how to present it.
|
||||
|
||||
@menu
|
||||
* Forms Example:: An example: editing the password data base.
|
||||
* Entering and Exiting Forms Mode::
|
||||
How to visit a file in Forms mode.
|
||||
* Forms Commands:: Special commands to use while in Forms mode.
|
||||
* Data File Format:: How to format the data file.
|
||||
* Control File Format:: How to control forms mode.
|
||||
* Format Description:: How to define the forms layout.
|
||||
* Modifying Forms Contents:: How to modify.
|
||||
* Miscellaneous:: Forms mode messages and other remarks.
|
||||
* Error Messages:: List of error messages forms mode can produce.
|
||||
* Long Example:: A more complex control file example.
|
||||
* Credits:: Thanks everyone.
|
||||
* Index:: Index to this manual.
|
||||
@end menu
|
||||
@end ifinfo
|
||||
|
||||
@node Forms Example
|
||||
@chapter Forms Example
|
||||
|
||||
Let's illustrate Forms mode with an example. Suppose you are looking at
|
||||
the @file{/etc/passwd} file, and the screen looks like this:
|
||||
|
||||
@example
|
||||
====== /etc/passwd ======
|
||||
|
||||
User : root Uid: 0 Gid: 1
|
||||
|
||||
Name : Super User
|
||||
|
||||
Home : /
|
||||
|
||||
Shell: /bin/sh
|
||||
@end example
|
||||
|
||||
As you can see, the familiar fields from the entry for the super user
|
||||
are all there, but instead of being colon-separated on one single line,
|
||||
they make up a forms.
|
||||
|
||||
The contents of the forms consist of the contents of the fields of the
|
||||
record (e.g. @samp{root}, @samp{0}, @samp{1}, @samp{Super User})
|
||||
interspersed with normal text (e.g @samp{User : }, @samp{Uid: }).
|
||||
|
||||
If you modify the contents of the fields, Forms mode will analyze your
|
||||
changes and update the file appropriately. You cannot modify the
|
||||
interspersed explanatory text (unless you go to some trouble about it),
|
||||
because that is marked read-only (@pxref{Text Properties,,, elisp, The
|
||||
Emacs Lisp Reference Manual}).
|
||||
|
||||
The Forms mode control file specifies the relationship between the
|
||||
format of @file{/etc/passwd} and what appears on the screen in Forms
|
||||
mode. @xref{Control File Format}.
|
||||
|
||||
@node Entering and Exiting Forms Mode
|
||||
@chapter Entering and Exiting Forms Mode
|
||||
|
||||
@table @kbd
|
||||
@findex forms-find-file
|
||||
@item M-x forms-find-file @key{RET} @var{control-file} @key{RET}
|
||||
Visit a database using Forms mode. Specify the name of the
|
||||
@strong{control file}, not the data file!
|
||||
|
||||
@findex forms-find-file-other-window
|
||||
@item M-x forms-find-file-other-window @key{RET} @var{control-file} @key{RET}
|
||||
Similar, but displays the file in another window.
|
||||
@end table
|
||||
|
||||
The command @code{forms-find-file} evaluates the file
|
||||
@var{control-file}, and also visits it in Forms mode. What you see in
|
||||
its buffer is not the contents of this file, but rather a single record
|
||||
of the corresponding data file that is visited in its own buffer. So
|
||||
there are two buffers involved in Forms mode: the @dfn{forms buffer}
|
||||
that is initially used to visit the control file and that shows the
|
||||
records being browsed, and the @dfn{data buffer} that holds the data
|
||||
file being visited. The latter buffer is normally not visible.
|
||||
|
||||
Initially, the first record is displayed in the forms buffer.
|
||||
The mode line displays the major mode name @samp{Forms}, followed by the
|
||||
minor mode @samp{View} if the data base is read-only. The number of the
|
||||
current record (@var{n}) and the total number of records in the
|
||||
file(@var{t}) are shown in the mode line as @samp{@var{n}/@var{t}}. For
|
||||
example:
|
||||
|
||||
@example
|
||||
--%%-Emacs: passwd-demo (Forms View 1/54)----All-------
|
||||
@end example
|
||||
|
||||
If the buffer is not read-only, you may change the buffer to modify the
|
||||
fields in the record. When you move to a different record, the contents
|
||||
of the buffer are parsed using the specifications in
|
||||
@code{forms-format-list}, and the data file is updated. If the record
|
||||
has fields that aren't included in the display, they are not changed.
|
||||
|
||||
@vindex forms-mode-hooks
|
||||
Entering Forms mode runs the normal hook @code{forms-mode-hooks} to
|
||||
perform user-defined customization.
|
||||
|
||||
To save any modified data, you can use @kbd{C-x C-s}
|
||||
(@code{forms-save-buffer}). This does not save the forms buffer (which would
|
||||
be rather useless), but instead saves the buffer visiting the data file.
|
||||
|
||||
To terminate Forms mode, you can use @kbd{C-x C-s} (@code{forms-save-buffer})
|
||||
and then kill the forms buffer. However, the data buffer will still
|
||||
remain. If this is not desired, you have to kill this buffer too.
|
||||
|
||||
@node Forms Commands
|
||||
@chapter Forms Commands
|
||||
|
||||
The commands of Forms mode belong to the @kbd{C-c} prefix, with one
|
||||
exception: @key{TAB}, which moves to the next field. Forms mode uses
|
||||
different key maps for normal mode and read-only mode. In read-only
|
||||
Forms mode, you can access most of the commands without the @kbd{C-c}
|
||||
prefix, but you must type ordinary letters instead of control
|
||||
characters; for example, type @kbd{n} instead of @kbd{C-c C-n}.
|
||||
|
||||
If your Emacs has been built with X-toolkit support, Forms mode will
|
||||
provide its own menu with a number of Forms mode commands.
|
||||
|
||||
@table @kbd
|
||||
@findex forms-next-record
|
||||
@kindex C-c C-n
|
||||
@item C-c C-n
|
||||
Show the next record (@code{forms-next-record}). With a numeric
|
||||
argument @var{n}, show the @var{n}th next record.
|
||||
|
||||
@findex forms-prev-record
|
||||
@kindex C-c C-p
|
||||
@item C-c C-p
|
||||
Show the previous record (@code{forms-prev-record}). With a numeric
|
||||
argument @var{n}, show the @var{n}th previous record.
|
||||
|
||||
@findex forms-jump-record
|
||||
@kindex C-c C-l
|
||||
@item C-c C-l
|
||||
Jump to a record by number (@code{forms-jump-record}). Specify
|
||||
the record number with a numeric argument.
|
||||
|
||||
@findex forms-first-record
|
||||
@kindex C-c <
|
||||
@item C-c <
|
||||
Jump to the first record (@code{forms-first-record}).
|
||||
|
||||
@findex forms-last-record
|
||||
@kindex C-c >
|
||||
@item C-c >
|
||||
Jump to the last record (@code{forms-last-record}). This command also
|
||||
recalculates the number of records in the data file.
|
||||
|
||||
@findex forms-next-field
|
||||
@kindex TAB
|
||||
@item @key{TAB}
|
||||
@kindex C-c TAB
|
||||
@itemx C-c @key{TAB}
|
||||
Jump to the next field in the current record (@code{forms-next-field}).
|
||||
With a numeric argument @var{n}, jump forward @var{n} fields. If this command
|
||||
would move past the last field, it wraps around to the first field.
|
||||
|
||||
@findex forms-toggle-read-only
|
||||
@kindex C-c C-q
|
||||
@item C-c C-q
|
||||
Toggles read-only mode (@code{forms-toggle-read-only}). In read-only
|
||||
Forms mode, you cannot edit the fields; most Forms mode commands can be
|
||||
accessed without the prefix @kbd{C-c} if you use the normal letter
|
||||
instead (for example, type @kbd{n} instead of @kbd{C-c C-n}). In edit
|
||||
mode, you can edit the fields and thus change the contents of the data
|
||||
base; you must begin Forms mode commands with @code{C-c}. Switching
|
||||
to edit mode is allowed only if you have write access to the data file.
|
||||
|
||||
@findex forms-insert-record
|
||||
@kindex C-c C-o
|
||||
@item C-c C-o
|
||||
Create a new record and insert it before the current record
|
||||
(@code{forms-insert-record}). It starts out with empty (or default)
|
||||
contents for its fields; you can then edit the fields. With a numeric
|
||||
argument, the new record is created @emph{after} the current one.
|
||||
See also @code{forms-modified-record-filter} in @ref{Modifying Forms
|
||||
Contents}.
|
||||
|
||||
@findex forms-delete-record
|
||||
@kindex C-c C-k
|
||||
@item C-c C-k
|
||||
Delete the current record (@code{forms-delete-record}). You are
|
||||
prompted for confirmation before the record is deleted unless a numeric
|
||||
argument has been provided.
|
||||
|
||||
@findex forms-search-forward
|
||||
@kindex C-c C-s @var{regexp} @key{RET}
|
||||
@item C-c C-s @var{regexp} @key{RET}
|
||||
Search forward for @var{regexp} in all records following this one
|
||||
(@code{forms-search-forward}). If found, this record is shown.
|
||||
If you give an empty argument, the previous regexp is used again.
|
||||
|
||||
@findex forms-search-backward
|
||||
@kindex C-c C-r @var{regexp} @key{RET}
|
||||
@item C-c C-r @var{regexp} @key{RET}
|
||||
Search backward for @var{regexp} in all records following this one
|
||||
(@code{forms-search-backward}). If found, this record is shown.
|
||||
If you give an empty argument, the previous regexp is used again.
|
||||
|
||||
@ignore
|
||||
@findex forms-exit
|
||||
@kindex C-c C-x
|
||||
@item C-c C-x
|
||||
Terminate Forms mode processing (@code{forms-exit}). The data file is
|
||||
saved if it has been modified.
|
||||
|
||||
@findex forms-exit-no-save
|
||||
@item M-x forms-exit-no-save
|
||||
Terminates forms mode processing without saving modified data first.
|
||||
@end ignore
|
||||
|
||||
@findex forms-prev-field
|
||||
@item M-x forms-prev-field
|
||||
Similar to @code{forms-next-field} but moves backwards.
|
||||
|
||||
@findex forms-save-buffer
|
||||
@item M-x forms-save-buffer
|
||||
@kindex C-x C-s
|
||||
@itemx C-x C-s
|
||||
Forms mode replacement for @code{save-buffer}. When executed in the
|
||||
forms buffer it will save the contents of the (modified) data buffer
|
||||
instead. In Forms mode this function will be bound to @kbd{C-x C-s}.
|
||||
|
||||
@findex forms-print
|
||||
@item M-x forms-print
|
||||
This command can be used to make a formatted print
|
||||
of the contents of the data file.
|
||||
|
||||
@end table
|
||||
|
||||
In addition the command @kbd{M-x revert-buffer} is useful in Forms mode
|
||||
just as in other modes.
|
||||
|
||||
@ignore
|
||||
@vindex forms-forms-scroll
|
||||
@findex scroll-up
|
||||
@findex scroll-down
|
||||
If the variable @code{forms-forms-scrolls} is set to a value other
|
||||
than @code{nil} (which it is, by default), the Emacs functions
|
||||
@code{scroll-up} and @code{scroll-down} will perform a
|
||||
@code{forms-next-record} and @code{forms-prev-record} when in forms
|
||||
mode. So you can use your favourite page commands to page through the
|
||||
data file.
|
||||
|
||||
@vindex forms-forms-jump
|
||||
@findex beginning-of-buffer
|
||||
@findex end-of-buffer
|
||||
Likewise, if the variable @code{forms-forms-jump} is not @code{nil}
|
||||
(which it is, by default), Emacs functions @code{beginning-of-buffer}
|
||||
and @code{end-of-buffer} will perform @code{forms-first-record} and
|
||||
@code{forms-last-record} when in forms mode.
|
||||
@end ignore
|
||||
|
||||
The following function key definitions are set up in Forms mode
|
||||
(whether read-only or not):
|
||||
|
||||
@table @kbd
|
||||
@kindex next
|
||||
@item next
|
||||
forms-next-record
|
||||
|
||||
@kindex prior
|
||||
@item prior
|
||||
forms-prev-record
|
||||
|
||||
@kindex begin
|
||||
@item begin
|
||||
forms-first-record
|
||||
|
||||
@kindex end
|
||||
@item end
|
||||
forms-last-record
|
||||
|
||||
@kindex S-Tab
|
||||
@findex forms-prev-field
|
||||
@item S-Tab
|
||||
forms-prev-field
|
||||
@end table
|
||||
|
||||
@node Data File Format
|
||||
@chapter Data File Format
|
||||
|
||||
@cindex record
|
||||
@cindex field
|
||||
@vindex forms-field-sep
|
||||
Files for use with Forms mode are very simple---each @dfn{record}
|
||||
(usually one line) forms the contents of one form. Each record consists
|
||||
of a number of @dfn{fields}, which are separated by the value of the
|
||||
string @code{forms-field-sep}, which is @code{"\t"} (a Tab) by default.
|
||||
|
||||
@vindex forms-read-file-filter
|
||||
@vindex forms-write-file-filter
|
||||
If the format of the data file is not suitable enough you can define the
|
||||
filter functions @code{forms-read-file-filter} and
|
||||
@code{forms-write-file-filter}. @code{forms-read-file-filter} is called
|
||||
when the data file is read from disk into the data buffer. It operates
|
||||
on the data buffer, ignoring read-only protections. When the data file
|
||||
is saved to disk @code{forms-write-file-filter} is called to cancel the
|
||||
effects of @code{forms-read-file-filter}. After being saved,
|
||||
@code{forms-read-file-filter} is called again to prepare the data buffer
|
||||
for further processing.
|
||||
|
||||
@cindex pseudo-newline
|
||||
@vindex forms-multi-line
|
||||
Fields may contain text which shows up in the forms in multiple lines.
|
||||
These lines are separated in the field using a ``pseudo-newline''
|
||||
character which is defined by the value of the string
|
||||
@code{forms-multi-line}. Its default value is @code{"\^k"} (a Control-K
|
||||
character). If it is
|
||||
set to @code{nil}, multiple line fields are prohibited.
|
||||
|
||||
If the data file does not exist, it is automatically created.
|
||||
|
||||
@node Control File Format
|
||||
@chapter Control File Format
|
||||
|
||||
@cindex control file
|
||||
The Forms mode @dfn{control file} serves two purposes. First, it names
|
||||
the data file to use, and defines its format and properties. Second,
|
||||
the Emacs buffer it occupies is used by Forms mode to display the forms.
|
||||
|
||||
The contents of the control file are evaluated as a Lisp program. It
|
||||
should set the following Lisp variables to suitable values:
|
||||
|
||||
@table @code
|
||||
@vindex forms-file
|
||||
@item forms-file
|
||||
This variable specifies the name of the data file. Example:
|
||||
|
||||
@example
|
||||
(setq forms-file "my/data-file")
|
||||
@end example
|
||||
|
||||
If the control file doesn't set @code{forms-file}, Forms mode
|
||||
reports an error.
|
||||
|
||||
@vindex forms-format-list
|
||||
@item forms-format-list
|
||||
This variable describes the way the fields of the record are formatted on
|
||||
the screen. For details, see @ref{Format Description}.
|
||||
|
||||
@vindex forms-number-of-fields
|
||||
@item forms-number-of-fields
|
||||
This variable holds the number of fields in each record of the data
|
||||
file. Example:
|
||||
|
||||
@example
|
||||
(setq forms-number-of-fields 10)
|
||||
@end example
|
||||
@end table
|
||||
|
||||
If the control file does not set @code{forms-format-list} a default
|
||||
format is used. In this situation, Forms mode will deduce the number of
|
||||
fields from the data file providing this file exists and
|
||||
@code{forms-number-of-records} has not been set in the control file.
|
||||
|
||||
The control file can optionally set the following additional Forms mode
|
||||
variables. Most of them have default values that are good for most
|
||||
applications.
|
||||
|
||||
@table @code
|
||||
@vindex forms-field-sep
|
||||
@item forms-field-sep
|
||||
This variable may be used to designate the string which separates the
|
||||
fields in the records of the data file. If not set, it defaults to the
|
||||
string @code{"\t"} (a Tab character). Example:
|
||||
|
||||
@example
|
||||
(setq forms-field-sep "\t")
|
||||
@end example
|
||||
|
||||
@vindex forms-read-only
|
||||
@item forms-read-only
|
||||
If the value is non-@code{nil}, the data file is treated read-only. (Forms
|
||||
mode also treats the data file as read-only if you don't have access to
|
||||
write it.) Example:
|
||||
|
||||
@example
|
||||
(set forms-read-only t)
|
||||
@end example
|
||||
|
||||
@vindex forms-multi-line
|
||||
@item forms-multi-line
|
||||
This variable specifies the @dfn{pseudo newline} separator that allows
|
||||
multi-line fields. This separator goes between the ``lines'' within a
|
||||
field---thus, the field doesn't really contain multiple lines, but it
|
||||
appears that way when displayed in Forms mode. If the value is
|
||||
@code{nil}, multi-line text fields are prohibited. The pseudo newline
|
||||
must not be a character contained in @code{forms-field-sep}.
|
||||
|
||||
The default value is @code{"\^k"}, the character Control-K. Example:
|
||||
|
||||
@example
|
||||
(setq forms-multi-line "\^k")
|
||||
@end example
|
||||
|
||||
@ignore
|
||||
@vindex forms-forms-scroll
|
||||
@item forms-forms-scroll
|
||||
@xref{Forms Mode Commands}, for details.
|
||||
|
||||
@vindex forms-forms-jump
|
||||
@item forms-forms-jump
|
||||
@xref{Forms Mode Commands}, for details.
|
||||
@end ignore
|
||||
|
||||
@findex forms-read-file-filter
|
||||
@item forms-read-file-filter
|
||||
This variable holds the name of a function to be called after the data
|
||||
file has been read in. This can be used to transform the contents of the
|
||||
data file into a format more suitable for forms processing.
|
||||
If it is @code{nil}, no function is called. For example, to maintain a
|
||||
gzipped database:
|
||||
|
||||
@example
|
||||
(defun gzip-read-file-filter ()
|
||||
(shell-command-on-region (point-min) (point-max)
|
||||
"gzip -d" t t))
|
||||
(setq forms-read-file-filter 'gzip-read-file-filter)
|
||||
@end example
|
||||
|
||||
@findex forms-write-file-filter
|
||||
@item forms-write-file-filter
|
||||
This variable holds the name of a function to be called before writing
|
||||
out the contents of the data file.
|
||||
This can be used to undo the effects of @code{forms-read-file-filter}.
|
||||
If it is @code{nil}, no function is called. Example:
|
||||
|
||||
@example
|
||||
(defun gzip-write-file-filter ()
|
||||
(make-variable-buffer-local 'require-final-newline)
|
||||
(setq require-final-newline nil)
|
||||
(shell-command-on-region (point-min) (point-max)
|
||||
"gzip" t t))
|
||||
(setq forms-write-file-filter 'gzip-write-file-filter)
|
||||
@end example
|
||||
|
||||
@findex forms-new-record-filter
|
||||
@item forms-new-record-filter
|
||||
This variable holds a function to be called whenever a new record is created
|
||||
to supply default values for fields. If it is @code{nil}, no function is
|
||||
called.
|
||||
@xref{Modifying Forms Contents}, for details.
|
||||
|
||||
@findex forms-modified-record-filter
|
||||
@item forms-modified-record-filter
|
||||
This variable holds a function to be called whenever a record is
|
||||
modified, just before updating the Forms data file. If it is
|
||||
@code{nil}, no function is called.
|
||||
@xref{Modifying Forms Contents}, for details.
|
||||
|
||||
@findex forms-insert-after
|
||||
@item forms-insert-after
|
||||
If this variable is not @code{nil}, new records are created @emph{after} the
|
||||
current record. Also, upon visiting a file, the initial position will be
|
||||
at the last record instead of the first one.
|
||||
|
||||
@findex forms-check-number-of-fields
|
||||
@item forms-check-number-of-fields
|
||||
Normally each record is checked to contain the correct number of fields.
|
||||
Under certain circumstances, this can be undesirable.
|
||||
If this variable is set to @code{nil}, these checks will be bypassed.
|
||||
@end table
|
||||
|
||||
@node Format Description
|
||||
@chapter The Format Description
|
||||
|
||||
@vindex forms-format-list
|
||||
The variable @code{forms-format-list} specifies the format of the data
|
||||
in the data file, and how to convert the data for display in Forms mode.
|
||||
Its value must be a list of Forms mode @dfn{formatting elements}, each
|
||||
of which can be a string, a number, a Lisp list, or a Lisp symbol that
|
||||
evaluates to one of those. The formatting elements are processed in the
|
||||
order they appear in the list.
|
||||
|
||||
@table @var
|
||||
@item string
|
||||
A string formatting element is inserted in the forms ``as is,'' as text
|
||||
that the user cannot alter.
|
||||
|
||||
@item number
|
||||
A number element selects a field of the record. The contents of this
|
||||
field are inserted in the display at this point. Field numbers count
|
||||
starting from 1 (one).
|
||||
|
||||
@item list
|
||||
A formatting element that is a list specifies a function call. This
|
||||
function is called every time a record is displayed, and its result,
|
||||
which must be a string, is inserted in the display text. The function
|
||||
should do nothing but returning a string.
|
||||
|
||||
@vindex forms-fields
|
||||
The function you call can access the fields of the record as a list in
|
||||
the variable
|
||||
@code{forms-fields}.
|
||||
|
||||
@item symbol
|
||||
A symbol used as a formatting element should evaluate to a string, number,
|
||||
or list; the value is interpreted as a formatting element, as described
|
||||
above.
|
||||
@end table
|
||||
|
||||
If a record does not contain the number of fields as specified in
|
||||
@code{forms-number-of-fields}, a warning message will be printed. Excess
|
||||
fields are ignored, missing fields are set to empty.
|
||||
|
||||
The control file which displays @file{/etc/passwd} file as demonstrated
|
||||
in the beginning of this manual might look as follows:
|
||||
|
||||
@example
|
||||
;; @r{This demo visits @file{/etc/passwd}.}
|
||||
|
||||
(setq forms-file "/etc/passwd")
|
||||
(setq forms-number-of-fields 7)
|
||||
(setq forms-read-only t) ; @r{to make sure}
|
||||
(setq forms-field-sep ":")
|
||||
;; @r{Don't allow multi-line fields.}
|
||||
(setq forms-multi-line nil)
|
||||
|
||||
(setq forms-format-list
|
||||
(list
|
||||
"====== /etc/passwd ======\n\n"
|
||||
"User : " 1
|
||||
" Uid: " 3
|
||||
" Gid: " 4
|
||||
"\n\n"
|
||||
"Name : " 5
|
||||
"\n\n"
|
||||
"Home : " 6
|
||||
"\n\n"
|
||||
"Shell: " 7
|
||||
"\n"))
|
||||
@end example
|
||||
|
||||
When you construct the value of @code{forms-format-list}, you should
|
||||
usually either quote the whole value, like this,
|
||||
|
||||
@example
|
||||
(setq forms-format-list
|
||||
'(
|
||||
"====== " forms-file " ======\n\n"
|
||||
"User : " 1
|
||||
(make-string 20 ?-)
|
||||
@dots{}
|
||||
))
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
or quote the elements which are lists, like this:
|
||||
|
||||
@example
|
||||
(setq forms-format-list
|
||||
(list
|
||||
"====== " forms-file " ======\n\n"
|
||||
"User : " 1
|
||||
'(make-string 20 ?-)
|
||||
@dots{}
|
||||
))
|
||||
@end example
|
||||
|
||||
Forms mode validates the contents of @code{forms-format-list} when you
|
||||
visit a database. If there are errors, processing is aborted with an
|
||||
error message which includes a descriptive text. @xref{Error Messages},
|
||||
for a detailed list of error messages.
|
||||
|
||||
If no @code{forms-format-list} is specified, Forms mode will supply a
|
||||
default format list. This list contains the name of the file being
|
||||
visited, and a simple label for each field indicating the field number.
|
||||
|
||||
@node Modifying Forms Contents
|
||||
@chapter Modifying The Forms Contents
|
||||
|
||||
If @code{forms-read-only} is @code{nil}, the user can modify the fields
|
||||
and records of the database.
|
||||
|
||||
All normal editing commands are available for editing the contents of the
|
||||
displayed record. You cannot delete or modify the fixed, explanatory
|
||||
text that comes from string formatting elements, but you can modify the
|
||||
actual field contents.
|
||||
|
||||
@ignore
|
||||
@c This is for the Emacs 18 version only.
|
||||
If the contents of the forms cannot be recognized properly, this is
|
||||
signaled using a descriptive text. @xref{Error Messages}, for more info.
|
||||
The cursor will indicate the last part of the forms which was
|
||||
successfully parsed. It's important to avoid entering field contents
|
||||
that would cause confusion with the field-separating fixed text.
|
||||
@end ignore
|
||||
|
||||
If the variable @code{forms-modified-record-filter} is non-@code{nil},
|
||||
it is called as a function before the new data is written to the data
|
||||
file. The function receives one argument, a vector that contains the
|
||||
contents of the fields of the record.
|
||||
|
||||
The function can refer to fields with @code{aref} and modify them with
|
||||
@code{aset}. The first field has number 1 (one); thus, element 0 of the
|
||||
vector is not used. The function should return the same vector it was
|
||||
passed; the (possibly modified) contents of the vector determine what is
|
||||
actually written in the file. Here is an example:
|
||||
|
||||
@example
|
||||
(defun my-modified-record-filter (record)
|
||||
;; @r{Modify second field.}
|
||||
(aset record 2 (current-time-string))
|
||||
;; @r{Return the field vector.}
|
||||
record)
|
||||
|
||||
(setq forms-modified-record-filter 'my-modified-record-filter)
|
||||
@end example
|
||||
|
||||
If the variable @code{forms-new-record-filter} is non-@code{nil}, its
|
||||
value is a function to be called to fill in default values for the
|
||||
fields of a new record. The function is passed a vector of empty
|
||||
strings, one for each field; it should return the same vector, with
|
||||
the desired field values stored in it. Fields are numbered starting
|
||||
from 1 (one). Example:
|
||||
|
||||
@example
|
||||
(defun my-new-record-filter (fields)
|
||||
(aset fields 5 (login-name))
|
||||
(aset fields 1 (current-time-string))
|
||||
fields)
|
||||
|
||||
(setq forms-new-record-filter 'my-new-record-filter)
|
||||
@end example
|
||||
|
||||
@node Miscellaneous
|
||||
@chapter Miscellaneous
|
||||
|
||||
@vindex forms-version
|
||||
The global variable @code{forms-version} holds the version information
|
||||
of the Forms mode software.
|
||||
|
||||
@findex forms-enumerate
|
||||
It is very convenient to use symbolic names for the fields in a record.
|
||||
The function @code{forms-enumerate} provides an elegant means to define
|
||||
a series of variables whose values are consecutive integers. The
|
||||
function returns the highest number used, so it can be used to set
|
||||
@code{forms-number-of-fields} also. For example:
|
||||
|
||||
@example
|
||||
(setq forms-number-of-fields
|
||||
(forms-enumerate
|
||||
'(field1 field2 field3 @dots{})))
|
||||
@end example
|
||||
|
||||
This sets @code{field1} to 1, @code{field2} to 2, and so on.
|
||||
|
||||
Care has been taken to keep the Forms mode variables buffer-local, so it
|
||||
is possible to visit multiple files in Forms mode simultaneously, even
|
||||
if they have different properties.
|
||||
|
||||
@findex forms-mode
|
||||
If you have visited the control file in normal fashion with
|
||||
@code{find-file} or a like command, you can switch to Forms mode with
|
||||
the command @code{M-x forms-mode}. If you put @samp{-*- forms -*-} in
|
||||
the first line of the control file, then visiting it enables Forms mode
|
||||
automatically. But this makes it hard to edit the control file itself,
|
||||
so you'd better think twice before using this.
|
||||
|
||||
The default format for the data file, using @code{"\t"} to separate
|
||||
fields and @code{"\^k"} to separate lines within a field, matches the
|
||||
file format of some popular database programs, e.g. FileMaker. So
|
||||
@code{forms-mode} can decrease the need to use proprietary software.
|
||||
|
||||
@node Error Messages
|
||||
@chapter Error Messages
|
||||
|
||||
This section describes all error messages which can be generated by
|
||||
forms mode. Error messages that result from parsing the control file
|
||||
all start with the text @samp{Forms control file error}. Messages
|
||||
generated while analyzing the definition of @code{forms-format-list}
|
||||
start with @samp{Forms format error}.
|
||||
|
||||
@table @code
|
||||
@item Forms control file error: `forms-file' has not been set
|
||||
The variable @code{forms-file} was not set by the control file.
|
||||
|
||||
@item Forms control file error: `forms-number-of-fields' has not been set
|
||||
The variable @code{forms-number-of-fields} was not set by the control
|
||||
file.
|
||||
|
||||
@item Forms control file error: `forms-number-of-fields' must be a number > 0
|
||||
The variable @code{forms-number-of-fields} did not contain a positive
|
||||
number.
|
||||
|
||||
@item Forms control file error: `forms-field-sep' is not a string
|
||||
@itemx Forms control file error: `forms-multi-line' must be nil or a one-character string
|
||||
The variable @code{forms-multi-line} was set to something other than
|
||||
@code{nil} or a single-character string.
|
||||
|
||||
@item Forms control file error: `forms-multi-line' is equal to 'forms-field-sep'
|
||||
The variable @code{forms-multi-line} may not be equal to
|
||||
@code{forms-field-sep} for this would make it impossible to distinguish
|
||||
fields and the lines in the fields.
|
||||
|
||||
@item Forms control file error: `forms-new-record-filter' is not a function
|
||||
@itemx Forms control file error: `forms-modified-record-filter' is not a function
|
||||
The variable has been set to something else than a function.
|
||||
|
||||
@item Forms control file error: `forms-format-list' is not a list
|
||||
The variable @code{forms-format-list} was not set to a Lisp list
|
||||
by the control file.
|
||||
|
||||
@item Forms format error: field number @var{xx} out of range 1..@var{nn}
|
||||
A field number was supplied in @code{forms-format-list} with a value of
|
||||
@var{xx}, which was not greater than zero and smaller than or equal to
|
||||
the number of fields in the forms, @var{nn}.
|
||||
|
||||
@item Forms format error: @var{fun} is not a function
|
||||
The first element of a list which is an element of
|
||||
@code{forms-format-list} was not a valid Lisp function.
|
||||
|
||||
@item Forms format error: invalid element @var{xx}
|
||||
A list element was supplied in @code{forms-format-list} which was not a
|
||||
string, number or list.
|
||||
|
||||
@ignore
|
||||
@c This applies to Emacs 18 only.
|
||||
@c Error messages generated while a modified form is being analyzed.
|
||||
|
||||
@item Parse error: not looking at `...'
|
||||
When re-parsing the contents of a forms, the text shown could not
|
||||
be found.
|
||||
|
||||
@item Parse error: cannot find `...'
|
||||
When re-parsing the contents of a forms, the text shown, which
|
||||
separates two fields, could not be found.
|
||||
|
||||
@item Parse error: cannot parse adjacent fields @var{xx} and @var{yy}
|
||||
Fields @var{xx} and @var{yy} were not separated by text, so could not be
|
||||
parsed again.
|
||||
@end ignore
|
||||
|
||||
@item Warning: this record has @var{xx} fields instead of @var{yy}
|
||||
The number of fields in this record in the data file did not match
|
||||
@code{forms-number-of-fields}. Missing fields will be made empty.
|
||||
|
||||
@item Multi-line fields in this record - update refused!
|
||||
The current record contains newline characters, hence can not be written
|
||||
back to the data file, for it would corrupt it. Probably you inserted a
|
||||
newline in a field, while @code{forms-multi-line} was @code{nil}.
|
||||
|
||||
@item Field separator occurs in record - update refused!
|
||||
The current record contains the field separator string inside one of the
|
||||
fields. It can not be written back to the data file, for it would
|
||||
corrupt it. Probably you inserted the field separator string in a field.
|
||||
|
||||
@item Record number @var{xx} out of range 1..@var{yy}
|
||||
A jump was made to non-existing record @var{xx}. @var{yy} denotes the
|
||||
number of records in the file.
|
||||
|
||||
@item Stuck at record @var{xx}
|
||||
An internal error prevented a specific record from being retrieved.
|
||||
|
||||
@item No write access to @code{"}@var{file}@code{"}
|
||||
An attempt was made to enable edit mode on a file that has been write
|
||||
protected.
|
||||
|
||||
@item Search failed: @var{regexp}
|
||||
The @var{regexp} could not be found in the data file. Forward searching
|
||||
is done from the current location until the end of the file, then
|
||||
retrying from the beginning of the file until the current location.
|
||||
Backward searching is done from the current location until the beginning
|
||||
of the file, then retrying from the end of the file until the current
|
||||
location.
|
||||
|
||||
@item Wrapped
|
||||
A search completed successfully after wrapping around.
|
||||
|
||||
@item Warning: number of records changed to @var{nn}
|
||||
Forms mode's idea of the number of records has been adjusted to the
|
||||
number of records actually present in the data file.
|
||||
|
||||
@item Problem saving buffers?
|
||||
An error occurred while saving the data file buffer. Most likely, Emacs
|
||||
did ask to confirm deleting the buffer because it had been modified, and
|
||||
you said `no'.
|
||||
@end table
|
||||
|
||||
@node Long Example
|
||||
@chapter Long Example
|
||||
|
||||
The following example exploits most of the features of Forms mode.
|
||||
This example is included in the distribution as file @file{forms-d2.el}.
|
||||
|
||||
@example
|
||||
;; demo2 -- demo forms-mode -*- emacs-lisp -*-
|
||||
|
||||
;; @r{This sample forms exploit most of the features of forms mode.}
|
||||
|
||||
;; @r{Set the name of the data file.}
|
||||
(setq forms-file "forms-d2.dat")
|
||||
|
||||
;; @r{Use @code{forms-enumerate} to set field names and number thereof.}
|
||||
(setq forms-number-of-fields
|
||||
(forms-enumerate
|
||||
'(arch-newsgroup ; 1
|
||||
arch-volume ; 2
|
||||
arch-issue ; and ...
|
||||
arch-article ; ... so
|
||||
arch-shortname ; ... ... on
|
||||
arch-parts
|
||||
arch-from
|
||||
arch-longname
|
||||
arch-keywords
|
||||
arch-date
|
||||
arch-remarks)))
|
||||
|
||||
;; @r{The following functions are used by this form for layout purposes.}
|
||||
;;
|
||||
(defun arch-tocol (target &optional fill)
|
||||
"Produces a string to skip to column TARGET.
|
||||
Prepends newline if needed.
|
||||
The optional FILL should be a character, used to fill to the column."
|
||||
(if (null fill)
|
||||
(setq fill ? ))
|
||||
(if (< target (current-column))
|
||||
(concat "\n" (make-string target fill))
|
||||
(make-string (- target (current-column)) fill)))
|
||||
;;
|
||||
(defun arch-rj (target field &optional fill)
|
||||
"Produces a string to skip to column TARGET\
|
||||
minus the width of field FIELD.
|
||||
Prepends newline if needed.
|
||||
The optional FILL should be a character,
|
||||
used to fill to the column."
|
||||
(arch-tocol (- target (length (nth field forms-fields))) fill))
|
||||
|
||||
;; @r{Record filters.}
|
||||
;;
|
||||
(defun new-record-filter (the-record)
|
||||
"Form a new record with some defaults."
|
||||
(aset the-record arch-from (user-full-name))
|
||||
(aset the-record arch-date (current-time-string))
|
||||
the-record) ; return it
|
||||
(setq forms-new-record-filter 'new-record-filter)
|
||||
|
||||
;; @r{The format list.}
|
||||
(setq forms-format-list
|
||||
(list
|
||||
"====== Public Domain Software Archive ======\n\n"
|
||||
arch-shortname
|
||||
" - " arch-longname
|
||||
"\n\n"
|
||||
"Article: " arch-newsgroup
|
||||
"/" arch-article
|
||||
" "
|
||||
'(arch-tocol 40)
|
||||
"Issue: " arch-issue
|
||||
" "
|
||||
'(arch-rj 73 10)
|
||||
"Date: " arch-date
|
||||
"\n\n"
|
||||
"Submitted by: " arch-from
|
||||
"\n"
|
||||
'(arch-tocol 79 ?-)
|
||||
"\n"
|
||||
"Keywords: " arch-keywords
|
||||
"\n\n"
|
||||
"Parts: " arch-parts
|
||||
"\n\n====== Remarks ======\n\n"
|
||||
arch-remarks
|
||||
))
|
||||
|
||||
;; @r{That's all, folks!}
|
||||
@end example
|
||||
|
||||
@node Credits
|
||||
@chapter Credits
|
||||
|
||||
Bug fixes and other useful suggestions were supplied by
|
||||
Harald Hanche-Olsen (@code{hanche@@imf.unit.no}),
|
||||
@code{cwitty@@portia.stanford.edu},
|
||||
Jonathan I. Kamens,
|
||||
Per Cederqvist (@code{ceder@@signum.se}),
|
||||
Michael Lipka (@code{lipka@@lip.hanse.de}),
|
||||
Andy Piper (@code{ajp@@eng.cam.ac.uk}),
|
||||
Frederic Pierresteguy (@code{F.Pierresteguy@@frcl.bull.fr}),
|
||||
Ignatios Souvatzis
|
||||
and Richard Stallman (@code{rms@@gnu.org}).
|
||||
|
||||
This documentation was slightly inspired by the documentation of ``rolo
|
||||
mode'' by Paul Davis at Schlumberger Cambridge Research
|
||||
(@code{davis%scrsu1%sdr.slb.com@@relay.cs.net}).
|
||||
|
||||
None of this would have been possible without GNU Emacs of the Free
|
||||
Software Foundation. Thanks, Richard!
|
||||
|
||||
@node Index
|
||||
@unnumbered Index
|
||||
@printindex cp
|
||||
|
||||
@contents
|
||||
@bye
|
1076
man/frames.texi
Normal file
1076
man/frames.texi
Normal file
File diff suppressed because it is too large
Load diff
1009
man/glossary.texi
Normal file
1009
man/glossary.texi
Normal file
File diff suppressed because it is too large
Load diff
535
man/gnu.texi
Normal file
535
man/gnu.texi
Normal file
|
@ -0,0 +1,535 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 1986, 1987, 1993, 1995 Free Software Foundation, Inc.
|
||||
@ifclear justgnu
|
||||
@node Manifesto,, MS-DOS, Top
|
||||
@unnumbered The GNU Manifesto
|
||||
@end ifclear
|
||||
@ifset justgnu
|
||||
Copyright (C) 1985, 1993 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to anyone to make or distribute verbatim copies
|
||||
of this document, in any medium, provided that the
|
||||
copyright notice and permission notice are preserved,
|
||||
and that the distributor grants the recipient permission
|
||||
for further redistribution as permitted by this notice.
|
||||
|
||||
Modified versions may not be made.
|
||||
|
||||
@node Top
|
||||
@top The GNU Manifesto
|
||||
@end ifset
|
||||
|
||||
@quotation
|
||||
The GNU Manifesto which appears below was written by Richard Stallman at
|
||||
the beginning of the GNU project, to ask for participation and support.
|
||||
For the first few years, it was updated in minor ways to account for
|
||||
developments, but now it seems best to leave it unchanged as most people
|
||||
have seen it.
|
||||
|
||||
Since that time, we have learned about certain common misunderstandings
|
||||
that different wording could help avoid. Footnotes added in 1993 help
|
||||
clarify these points.
|
||||
|
||||
For up-to-date information about the available GNU software, please see
|
||||
the latest issue of the GNU's Bulletin. The list is much too long to
|
||||
include here.
|
||||
@end quotation
|
||||
|
||||
@unnumberedsec What's GNU? Gnu's Not Unix!
|
||||
|
||||
GNU, which stands for Gnu's Not Unix, is the name for the complete
|
||||
Unix-compatible software system which I am writing so that I can give it
|
||||
away free to everyone who can use it.@footnote{The wording here was
|
||||
careless. The intention was that nobody would have to pay for
|
||||
@emph{permission} to use the GNU system. But the words don't make this
|
||||
clear, and people often interpret them as saying that copies of GNU
|
||||
should always be distributed at little or no charge. That was never the
|
||||
intent; later on, the manifesto mentions the possibility of companies
|
||||
providing the service of distribution for a profit. Subsequently I have
|
||||
learned to distinguish carefully between ``free'' in the sense of
|
||||
freedom and ``free'' in the sense of price. Free software is software
|
||||
that users have the freedom to distribute and change. Some users may
|
||||
obtain copies at no charge, while others pay to obtain copies---and if
|
||||
the funds help support improving the software, so much the better. The
|
||||
important thing is that everyone who has a copy has the freedom to
|
||||
cooperate with others in using it.} Several other volunteers are helping
|
||||
me. Contributions of time, money, programs and equipment are greatly
|
||||
needed.
|
||||
|
||||
So far we have an Emacs text editor with Lisp for writing editor commands,
|
||||
a source level debugger, a yacc-compatible parser generator, a linker, and
|
||||
around 35 utilities. A shell (command interpreter) is nearly completed. A
|
||||
new portable optimizing C compiler has compiled itself and may be released
|
||||
this year. An initial kernel exists but many more features are needed to
|
||||
emulate Unix. When the kernel and compiler are finished, it will be
|
||||
possible to distribute a GNU system suitable for program development. We
|
||||
will use @TeX{} as our text formatter, but an nroff is being worked on. We
|
||||
will use the free, portable X window system as well. After this we will
|
||||
add a portable Common Lisp, an Empire game, a spreadsheet, and hundreds of
|
||||
other things, plus on-line documentation. We hope to supply, eventually,
|
||||
everything useful that normally comes with a Unix system, and more.
|
||||
|
||||
GNU will be able to run Unix programs, but will not be identical to Unix.
|
||||
We will make all improvements that are convenient, based on our experience
|
||||
with other operating systems. In particular, we plan to have longer
|
||||
file names, file version numbers, a crashproof file system, file name
|
||||
completion perhaps, terminal-independent display support, and perhaps
|
||||
eventually a Lisp-based window system through which several Lisp programs
|
||||
and ordinary Unix programs can share a screen. Both C and Lisp will be
|
||||
available as system programming languages. We will try to support UUCP,
|
||||
MIT Chaosnet, and Internet protocols for communication.
|
||||
|
||||
GNU is aimed initially at machines in the 68000/16000 class with virtual
|
||||
memory, because they are the easiest machines to make it run on. The extra
|
||||
effort to make it run on smaller machines will be left to someone who wants
|
||||
to use it on them.
|
||||
|
||||
To avoid horrible confusion, please pronounce the `G' in the word `GNU'
|
||||
when it is the name of this project.
|
||||
|
||||
@unnumberedsec Why I Must Write GNU
|
||||
|
||||
I consider that the golden rule requires that if I like a program I must
|
||||
share it with other people who like it. Software sellers want to divide
|
||||
the users and conquer them, making each user agree not to share with
|
||||
others. I refuse to break solidarity with other users in this way. I
|
||||
cannot in good conscience sign a nondisclosure agreement or a software
|
||||
license agreement. For years I worked within the Artificial Intelligence
|
||||
Lab to resist such tendencies and other inhospitalities, but eventually
|
||||
they had gone too far: I could not remain in an institution where such
|
||||
things are done for me against my will.
|
||||
|
||||
So that I can continue to use computers without dishonor, I have decided to
|
||||
put together a sufficient body of free software so that I will be able to
|
||||
get along without any software that is not free. I have resigned from the
|
||||
AI lab to deny MIT any legal excuse to prevent me from giving GNU away.
|
||||
|
||||
@unnumberedsec Why GNU Will Be Compatible with Unix
|
||||
|
||||
Unix is not my ideal system, but it is not too bad. The essential features
|
||||
of Unix seem to be good ones, and I think I can fill in what Unix lacks
|
||||
without spoiling them. And a system compatible with Unix would be
|
||||
convenient for many other people to adopt.
|
||||
|
||||
@unnumberedsec How GNU Will Be Available
|
||||
|
||||
GNU is not in the public domain. Everyone will be permitted to modify and
|
||||
redistribute GNU, but no distributor will be allowed to restrict its
|
||||
further redistribution. That is to say, proprietary modifications will not
|
||||
be allowed. I want to make sure that all versions of GNU remain free.
|
||||
|
||||
@unnumberedsec Why Many Other Programmers Want to Help
|
||||
|
||||
I have found many other programmers who are excited about GNU and want to
|
||||
help.
|
||||
|
||||
Many programmers are unhappy about the commercialization of system
|
||||
software. It may enable them to make more money, but it requires them to
|
||||
feel in conflict with other programmers in general rather than feel as
|
||||
comrades. The fundamental act of friendship among programmers is the
|
||||
sharing of programs; marketing arrangements now typically used essentially
|
||||
forbid programmers to treat others as friends. The purchaser of software
|
||||
must choose between friendship and obeying the law. Naturally, many decide
|
||||
that friendship is more important. But those who believe in law often do
|
||||
not feel at ease with either choice. They become cynical and think that
|
||||
programming is just a way of making money.
|
||||
|
||||
By working on and using GNU rather than proprietary programs, we can be
|
||||
hospitable to everyone and obey the law. In addition, GNU serves as an
|
||||
example to inspire and a banner to rally others to join us in sharing.
|
||||
This can give us a feeling of harmony which is impossible if we use
|
||||
software that is not free. For about half the programmers I talk to, this
|
||||
is an important happiness that money cannot replace.
|
||||
|
||||
@unnumberedsec How You Can Contribute
|
||||
|
||||
I am asking computer manufacturers for donations of machines and money.
|
||||
I'm asking individuals for donations of programs and work.
|
||||
|
||||
One consequence you can expect if you donate machines is that GNU will run
|
||||
on them at an early date. The machines should be complete, ready to use
|
||||
systems, approved for use in a residential area, and not in need of
|
||||
sophisticated cooling or power.
|
||||
|
||||
I have found very many programmers eager to contribute part-time work for
|
||||
GNU. For most projects, such part-time distributed work would be very hard
|
||||
to coordinate; the independently-written parts would not work together.
|
||||
But for the particular task of replacing Unix, this problem is absent. A
|
||||
complete Unix system contains hundreds of utility programs, each of which
|
||||
is documented separately. Most interface specifications are fixed by Unix
|
||||
compatibility. If each contributor can write a compatible replacement for
|
||||
a single Unix utility, and make it work properly in place of the original
|
||||
on a Unix system, then these utilities will work right when put together.
|
||||
Even allowing for Murphy to create a few unexpected problems, assembling
|
||||
these components will be a feasible task. (The kernel will require closer
|
||||
communication and will be worked on by a small, tight group.)
|
||||
|
||||
If I get donations of money, I may be able to hire a few people full or
|
||||
part time. The salary won't be high by programmers' standards, but I'm
|
||||
looking for people for whom building community spirit is as important as
|
||||
making money. I view this as a way of enabling dedicated people to devote
|
||||
their full energies to working on GNU by sparing them the need to make a
|
||||
living in another way.
|
||||
|
||||
@unnumberedsec Why All Computer Users Will Benefit
|
||||
|
||||
Once GNU is written, everyone will be able to obtain good system
|
||||
software free, just like air.@footnote{This is another place I failed to
|
||||
distinguish carefully between the two different meanings of ``free''.
|
||||
The statement as it stands is not false---you can get copies of GNU
|
||||
software at no charge, from your friends or over the net. But it does
|
||||
suggest the wrong idea.}
|
||||
|
||||
This means much more than just saving everyone the price of a Unix license.
|
||||
It means that much wasteful duplication of system programming effort will
|
||||
be avoided. This effort can go instead into advancing the state of the
|
||||
art.
|
||||
|
||||
Complete system sources will be available to everyone. As a result, a user
|
||||
who needs changes in the system will always be free to make them himself,
|
||||
or hire any available programmer or company to make them for him. Users
|
||||
will no longer be at the mercy of one programmer or company which owns the
|
||||
sources and is in sole position to make changes.
|
||||
|
||||
Schools will be able to provide a much more educational environment by
|
||||
encouraging all students to study and improve the system code. Harvard's
|
||||
computer lab used to have the policy that no program could be installed on
|
||||
the system if its sources were not on public display, and upheld it by
|
||||
actually refusing to install certain programs. I was very much inspired by
|
||||
this.
|
||||
|
||||
Finally, the overhead of considering who owns the system software and what
|
||||
one is or is not entitled to do with it will be lifted.
|
||||
|
||||
Arrangements to make people pay for using a program, including licensing of
|
||||
copies, always incur a tremendous cost to society through the cumbersome
|
||||
mechanisms necessary to figure out how much (that is, which programs) a
|
||||
person must pay for. And only a police state can force everyone to obey
|
||||
them. Consider a space station where air must be manufactured at great
|
||||
cost: charging each breather per liter of air may be fair, but wearing the
|
||||
metered gas mask all day and all night is intolerable even if everyone can
|
||||
afford to pay the air bill. And the TV cameras everywhere to see if you
|
||||
ever take the mask off are outrageous. It's better to support the air
|
||||
plant with a head tax and chuck the masks.
|
||||
|
||||
Copying all or parts of a program is as natural to a programmer as
|
||||
breathing, and as productive. It ought to be as free.
|
||||
|
||||
@unnumberedsec Some Easily Rebutted Objections to GNU's Goals
|
||||
|
||||
@quotation
|
||||
``Nobody will use it if it is free, because that means they can't rely
|
||||
on any support.''
|
||||
|
||||
``You have to charge for the program to pay for providing the
|
||||
support.''
|
||||
@end quotation
|
||||
|
||||
If people would rather pay for GNU plus service than get GNU free without
|
||||
service, a company to provide just service to people who have obtained GNU
|
||||
free ought to be profitable.@footnote{Several such companies now exist.}
|
||||
|
||||
We must distinguish between support in the form of real programming work
|
||||
and mere handholding. The former is something one cannot rely on from a
|
||||
software vendor. If your problem is not shared by enough people, the
|
||||
vendor will tell you to get lost.
|
||||
|
||||
If your business needs to be able to rely on support, the only way is to
|
||||
have all the necessary sources and tools. Then you can hire any available
|
||||
person to fix your problem; you are not at the mercy of any individual.
|
||||
With Unix, the price of sources puts this out of consideration for most
|
||||
businesses. With GNU this will be easy. It is still possible for there to
|
||||
be no available competent person, but this problem cannot be blamed on
|
||||
distribution arrangements. GNU does not eliminate all the world's problems,
|
||||
only some of them.
|
||||
|
||||
Meanwhile, the users who know nothing about computers need handholding:
|
||||
doing things for them which they could easily do themselves but don't know
|
||||
how.
|
||||
|
||||
Such services could be provided by companies that sell just hand-holding
|
||||
and repair service. If it is true that users would rather spend money and
|
||||
get a product with service, they will also be willing to buy the service
|
||||
having got the product free. The service companies will compete in quality
|
||||
and price; users will not be tied to any particular one. Meanwhile, those
|
||||
of us who don't need the service should be able to use the program without
|
||||
paying for the service.
|
||||
|
||||
@quotation
|
||||
``You cannot reach many people without advertising,
|
||||
and you must charge for the program to support that.''
|
||||
|
||||
``It's no use advertising a program people can get free.''
|
||||
@end quotation
|
||||
|
||||
There are various forms of free or very cheap publicity that can be used to
|
||||
inform numbers of computer users about something like GNU. But it may be
|
||||
true that one can reach more microcomputer users with advertising. If this
|
||||
is really so, a business which advertises the service of copying and
|
||||
mailing GNU for a fee ought to be successful enough to pay for its
|
||||
advertising and more. This way, only the users who benefit from the
|
||||
advertising pay for it.
|
||||
|
||||
On the other hand, if many people get GNU from their friends, and such
|
||||
companies don't succeed, this will show that advertising was not really
|
||||
necessary to spread GNU. Why is it that free market advocates don't
|
||||
want to let the free market decide this?@footnote{The Free Software
|
||||
Foundation raises most of its funds from a distribution service,
|
||||
although it is a charity rather than a company. If @emph{no one}
|
||||
chooses to obtain copies by ordering from the FSF, it will be unable
|
||||
to do its work. But this does not mean that proprietary restrictions
|
||||
are justified to force every user to pay. If a small fraction of all
|
||||
the users order copies from the FSF, that is sufficient to keep the FSF
|
||||
afloat. So we ask users to choose to support us in this way. Have you
|
||||
done your part?}
|
||||
|
||||
@quotation
|
||||
``My company needs a proprietary operating system
|
||||
to get a competitive edge.''
|
||||
@end quotation
|
||||
|
||||
GNU will remove operating system software from the realm of competition.
|
||||
You will not be able to get an edge in this area, but neither will your
|
||||
competitors be able to get an edge over you. You and they will compete in
|
||||
other areas, while benefiting mutually in this one. If your business is
|
||||
selling an operating system, you will not like GNU, but that's tough on
|
||||
you. If your business is something else, GNU can save you from being
|
||||
pushed into the expensive business of selling operating systems.
|
||||
|
||||
I would like to see GNU development supported by gifts from many
|
||||
manufacturers and users, reducing the cost to each.@footnote{A group of
|
||||
computer companies recently pooled funds to support maintenance of the
|
||||
GNU C Compiler.}
|
||||
|
||||
@quotation
|
||||
``Don't programmers deserve a reward for their creativity?''
|
||||
@end quotation
|
||||
|
||||
If anything deserves a reward, it is social contribution. Creativity can
|
||||
be a social contribution, but only in so far as society is free to use the
|
||||
results. If programmers deserve to be rewarded for creating innovative
|
||||
programs, by the same token they deserve to be punished if they restrict
|
||||
the use of these programs.
|
||||
|
||||
@quotation
|
||||
``Shouldn't a programmer be able to ask for a reward for his creativity?''
|
||||
@end quotation
|
||||
|
||||
There is nothing wrong with wanting pay for work, or seeking to maximize
|
||||
one's income, as long as one does not use means that are destructive. But
|
||||
the means customary in the field of software today are based on
|
||||
destruction.
|
||||
|
||||
Extracting money from users of a program by restricting their use of it is
|
||||
destructive because the restrictions reduce the amount and the ways that
|
||||
the program can be used. This reduces the amount of wealth that humanity
|
||||
derives from the program. When there is a deliberate choice to restrict,
|
||||
the harmful consequences are deliberate destruction.
|
||||
|
||||
The reason a good citizen does not use such destructive means to become
|
||||
wealthier is that, if everyone did so, we would all become poorer from the
|
||||
mutual destructiveness. This is Kantian ethics; or, the Golden Rule.
|
||||
Since I do not like the consequences that result if everyone hoards
|
||||
information, I am required to consider it wrong for one to do so.
|
||||
Specifically, the desire to be rewarded for one's creativity does not
|
||||
justify depriving the world in general of all or part of that creativity.
|
||||
|
||||
@quotation
|
||||
``Won't programmers starve?''
|
||||
@end quotation
|
||||
|
||||
I could answer that nobody is forced to be a programmer. Most of us cannot
|
||||
manage to get any money for standing on the street and making faces. But
|
||||
we are not, as a result, condemned to spend our lives standing on the
|
||||
street making faces, and starving. We do something else.
|
||||
|
||||
But that is the wrong answer because it accepts the questioner's implicit
|
||||
assumption: that without ownership of software, programmers cannot possibly
|
||||
be paid a cent. Supposedly it is all or nothing.
|
||||
|
||||
The real reason programmers will not starve is that it will still be
|
||||
possible for them to get paid for programming; just not paid as much as
|
||||
now.
|
||||
|
||||
Restricting copying is not the only basis for business in software. It is
|
||||
the most common basis because it brings in the most money. If it were
|
||||
prohibited, or rejected by the customer, software business would move to
|
||||
other bases of organization which are now used less often. There are
|
||||
always numerous ways to organize any kind of business.
|
||||
|
||||
Probably programming will not be as lucrative on the new basis as it is
|
||||
now. But that is not an argument against the change. It is not considered
|
||||
an injustice that sales clerks make the salaries that they now do. If
|
||||
programmers made the same, that would not be an injustice either. (In
|
||||
practice they would still make considerably more than that.)
|
||||
|
||||
@quotation
|
||||
``Don't people have a right to control how their creativity is used?''
|
||||
@end quotation
|
||||
|
||||
``Control over the use of one's ideas'' really constitutes control over
|
||||
other people's lives; and it is usually used to make their lives more
|
||||
difficult.
|
||||
|
||||
People who have studied the issue of intellectual property rights carefully
|
||||
(such as lawyers) say that there is no intrinsic right to intellectual
|
||||
property. The kinds of supposed intellectual property rights that the
|
||||
government recognizes were created by specific acts of legislation for
|
||||
specific purposes.
|
||||
|
||||
For example, the patent system was established to encourage inventors to
|
||||
disclose the details of their inventions. Its purpose was to help society
|
||||
rather than to help inventors. At the time, the life span of 17 years for
|
||||
a patent was short compared with the rate of advance of the state of the
|
||||
art. Since patents are an issue only among manufacturers, for whom the
|
||||
cost and effort of a license agreement are small compared with setting up
|
||||
production, the patents often do not do much harm. They do not obstruct
|
||||
most individuals who use patented products.
|
||||
|
||||
The idea of copyright did not exist in ancient times, when authors
|
||||
frequently copied other authors at length in works of non-fiction. This
|
||||
practice was useful, and is the only way many authors' works have survived
|
||||
even in part. The copyright system was created expressly for the purpose
|
||||
of encouraging authorship. In the domain for which it was
|
||||
invented---books, which could be copied economically only on a printing
|
||||
press---it did little harm, and did not obstruct most of the individuals
|
||||
who read the books.
|
||||
|
||||
All intellectual property rights are just licenses granted by society
|
||||
because it was thought, rightly or wrongly, that society as a whole would
|
||||
benefit by granting them. But in any particular situation, we have to ask:
|
||||
are we really better off granting such license? What kind of act are we
|
||||
licensing a person to do?
|
||||
|
||||
The case of programs today is very different from that of books a hundred
|
||||
years ago. The fact that the easiest way to copy a program is from one
|
||||
neighbor to another, the fact that a program has both source code and
|
||||
object code which are distinct, and the fact that a program is used rather
|
||||
than read and enjoyed, combine to create a situation in which a person who
|
||||
enforces a copyright is harming society as a whole both materially and
|
||||
spiritually; in which a person should not do so regardless of whether the
|
||||
law enables him to.
|
||||
|
||||
@quotation
|
||||
``Competition makes things get done better.''
|
||||
@end quotation
|
||||
|
||||
The paradigm of competition is a race: by rewarding the winner, we
|
||||
encourage everyone to run faster. When capitalism really works this way,
|
||||
it does a good job; but its defenders are wrong in assuming it always works
|
||||
this way. If the runners forget why the reward is offered and become
|
||||
intent on winning, no matter how, they may find other strategies---such as,
|
||||
attacking other runners. If the runners get into a fist fight, they will
|
||||
all finish late.
|
||||
|
||||
Proprietary and secret software is the moral equivalent of runners in a
|
||||
fist fight. Sad to say, the only referee we've got does not seem to
|
||||
object to fights; he just regulates them (``For every ten yards you run,
|
||||
you can fire one shot''). He really ought to break them up, and penalize
|
||||
runners for even trying to fight.
|
||||
|
||||
@quotation
|
||||
``Won't everyone stop programming without a monetary incentive?''
|
||||
@end quotation
|
||||
|
||||
Actually, many people will program with absolutely no monetary incentive.
|
||||
Programming has an irresistible fascination for some people, usually the
|
||||
people who are best at it. There is no shortage of professional musicians
|
||||
who keep at it even though they have no hope of making a living that way.
|
||||
|
||||
But really this question, though commonly asked, is not appropriate to the
|
||||
situation. Pay for programmers will not disappear, only become less. So
|
||||
the right question is, will anyone program with a reduced monetary
|
||||
incentive? My experience shows that they will.
|
||||
|
||||
For more than ten years, many of the world's best programmers worked at the
|
||||
Artificial Intelligence Lab for far less money than they could have had
|
||||
anywhere else. They got many kinds of non-monetary rewards: fame and
|
||||
appreciation, for example. And creativity is also fun, a reward in itself.
|
||||
|
||||
Then most of them left when offered a chance to do the same interesting
|
||||
work for a lot of money.
|
||||
|
||||
What the facts show is that people will program for reasons other than
|
||||
riches; but if given a chance to make a lot of money as well, they will
|
||||
come to expect and demand it. Low-paying organizations do poorly in
|
||||
competition with high-paying ones, but they do not have to do badly if the
|
||||
high-paying ones are banned.
|
||||
|
||||
@quotation
|
||||
``We need the programmers desperately. If they demand that we
|
||||
stop helping our neighbors, we have to obey.''
|
||||
@end quotation
|
||||
|
||||
You're never so desperate that you have to obey this sort of demand.
|
||||
Remember: millions for defense, but not a cent for tribute!
|
||||
|
||||
@quotation
|
||||
``Programmers need to make a living somehow.''
|
||||
@end quotation
|
||||
|
||||
In the short run, this is true. However, there are plenty of ways that
|
||||
programmers could make a living without selling the right to use a program.
|
||||
This way is customary now because it brings programmers and businessmen the
|
||||
most money, not because it is the only way to make a living. It is easy to
|
||||
find other ways if you want to find them. Here are a number of examples.
|
||||
|
||||
A manufacturer introducing a new computer will pay for the porting of
|
||||
operating systems onto the new hardware.
|
||||
|
||||
The sale of teaching, hand-holding and maintenance services could also
|
||||
employ programmers.
|
||||
|
||||
People with new ideas could distribute programs as freeware, asking for
|
||||
donations from satisfied users, or selling hand-holding services. I have
|
||||
met people who are already working this way successfully.
|
||||
|
||||
Users with related needs can form users' groups, and pay dues. A group
|
||||
would contract with programming companies to write programs that the
|
||||
group's members would like to use.
|
||||
|
||||
All sorts of development can be funded with a Software Tax:
|
||||
|
||||
@quotation
|
||||
Suppose everyone who buys a computer has to pay x percent of
|
||||
the price as a software tax. The government gives this to
|
||||
an agency like the NSF to spend on software development.
|
||||
|
||||
But if the computer buyer makes a donation to software development
|
||||
himself, he can take a credit against the tax. He can donate to
|
||||
the project of his own choosing---often, chosen because he hopes to
|
||||
use the results when it is done. He can take a credit for any amount
|
||||
of donation up to the total tax he had to pay.
|
||||
|
||||
The total tax rate could be decided by a vote of the payers of
|
||||
the tax, weighted according to the amount they will be taxed on.
|
||||
|
||||
The consequences:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
The computer-using community supports software development.
|
||||
@item
|
||||
This community decides what level of support is needed.
|
||||
@item
|
||||
Users who care which projects their share is spent on
|
||||
can choose this for themselves.
|
||||
@end itemize
|
||||
@end quotation
|
||||
|
||||
In the long run, making programs free is a step toward the post-scarcity
|
||||
world, where nobody will have to work very hard just to make a living.
|
||||
People will be free to devote themselves to activities that are fun, such
|
||||
as programming, after spending the necessary ten hours a week on required
|
||||
tasks such as legislation, family counseling, robot repair and asteroid
|
||||
prospecting. There will be no need to be able to make a living from
|
||||
programming.
|
||||
|
||||
We have already greatly reduced the amount of work that the whole society
|
||||
must do for its actual productivity, but only a little of this has
|
||||
translated itself into leisure for workers because much nonproductive
|
||||
activity is required to accompany productive activity. The main causes of
|
||||
this are bureaucracy and isometric struggles against competition. Free
|
||||
software will greatly reduce these drains in the area of software
|
||||
production. We must do this, in order for technical gains in productivity
|
||||
to translate into less work for us.
|
659
man/gnus-faq.texi
Normal file
659
man/gnus-faq.texi
Normal file
|
@ -0,0 +1,659 @@
|
|||
\input texinfo
|
||||
@c -*-texinfo-*-
|
||||
@c Copyright (C) 1995 Free Software Foundation, Inc.
|
||||
@setfilename gnus-faq.info
|
||||
|
||||
@node Frequently Asked Questions
|
||||
@section Frequently Asked Questions
|
||||
|
||||
This is the Gnus Frequently Asked Questions list.
|
||||
If you have a Web browser, the official hypertext version is at
|
||||
@file{http://www.miranova.com/~steve/gnus-faq.html>}, and has
|
||||
probably been updated since you got this manual.
|
||||
|
||||
@menu
|
||||
* Installation FAQ:: Installation of Gnus.
|
||||
* Customization FAQ:: Customizing Gnus.
|
||||
* Reading News FAQ:: News Reading Questions.
|
||||
* Reading Mail FAQ:: Mail Reading Questions.
|
||||
@end menu
|
||||
|
||||
|
||||
@node Installation FAQ
|
||||
@subsection Installation
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Q1.1 What is the latest version of Gnus?
|
||||
|
||||
The latest (and greatest) version is 5.0.10. You might also run
|
||||
across something called @emph{September Gnus}. September Gnus
|
||||
is the alpha version of the next major release of Gnus. It is currently
|
||||
not stable enough to run unless you are prepared to debug lisp.
|
||||
|
||||
@item
|
||||
Q1.2 Where do I get Gnus?
|
||||
|
||||
Any of the following locations:
|
||||
|
||||
@itemize @minus
|
||||
@item
|
||||
@file{ftp://ftp.ifi.uio.no/pub/emacs/gnus/gnus.tar.gz}
|
||||
|
||||
@item
|
||||
@file{ftp://ftp.pilgrim.umass.edu/pub/misc/ding/}
|
||||
|
||||
@item
|
||||
@file{gopher://gopher.pilgrim.umass.edu/11/pub/misc/ding/}
|
||||
|
||||
@item
|
||||
@file{ftp://aphrodite.nectar.cs.cmu.edu/pub/ding-gnus/}
|
||||
|
||||
@item
|
||||
@file{ftp://ftp.solace.mh.se:/pub/gnu/elisp/}
|
||||
|
||||
@end itemize
|
||||
|
||||
@item
|
||||
Q1.3 Which version of Emacs do I need?
|
||||
|
||||
At least GNU Emacs 19.28, or XEmacs 19.12 is recommended. GNU Emacs
|
||||
19.25 has been reported to work under certain circumstances, but it
|
||||
doesn't @emph{officially} work on it. 19.27 has also been reported to
|
||||
work. Gnus has been reported to work under OS/2 as well as Unix.
|
||||
|
||||
|
||||
@item
|
||||
Q1.4 Where is timezone.el?
|
||||
|
||||
Upgrade to XEmacs 19.13. In earlier versions of XEmacs this file was
|
||||
placed with Gnus 4.1.3, but that has been corrected.
|
||||
|
||||
|
||||
@item
|
||||
Q1.5 When I run Gnus on XEmacs 19.13 I get weird error messages.
|
||||
|
||||
You're running an old version of Gnus. Upgrade to at least version
|
||||
5.0.4.
|
||||
|
||||
|
||||
@item
|
||||
Q1.6 How do I unsubscribe from the Mailing List?
|
||||
|
||||
Send an e-mail message to @file{ding-request@@ifi.uio.no} with the magic word
|
||||
@emph{unsubscribe} somewhere in it, and you will be removed.
|
||||
|
||||
If you are reading the digest version of the list, send an e-mail message
|
||||
to @*
|
||||
@file{ding-rn-digests-d-request@@moe.shore.net}
|
||||
with @emph{unsubscribe} as the subject and you will be removed.
|
||||
|
||||
|
||||
@item
|
||||
Q1.7 How do I run Gnus on both Emacs and XEmacs?
|
||||
|
||||
The basic answer is to byte-compile under XEmacs, and then you can
|
||||
run under either Emacsen. There is, however, a potential version
|
||||
problem with easymenu.el with Gnu Emacs prior to 19.29.
|
||||
|
||||
Per Abrahamsen <abraham@@dina.kvl.dk> writes :@*
|
||||
The internal easymenu.el interface changed between 19.28 and 19.29 in
|
||||
order to make it possible to create byte compiled files that can be
|
||||
shared between Gnu Emacs and XEmacs. The change is upward
|
||||
compatible, but not downward compatible.
|
||||
This gives the following compatibility table:
|
||||
|
||||
@example
|
||||
Compiled with: | Can be used with:
|
||||
----------------+--------------------------------------
|
||||
19.28 | 19.28 19.29
|
||||
19.29 | 19.29 XEmacs
|
||||
XEmacs | 19.29 XEmacs
|
||||
@end example
|
||||
|
||||
If you have Gnu Emacs 19.28 or earlier, or XEmacs 19.12 or earlier, get
|
||||
a recent version of auc-menu.el from
|
||||
@file{ftp://ftp.iesd.auc.dk/pub/emacs-lisp/auc-menu.el}, and install it
|
||||
under the name easymenu.el somewhere early in your load path.
|
||||
|
||||
|
||||
@item
|
||||
Q1.8 What resources are available?
|
||||
|
||||
There is the newsgroup Gnu.emacs.gnus. Discussion of Gnus 5.x is now
|
||||
taking place there. There is also a mailing list, send mail to
|
||||
@file{ding-request@@ifi.uio.no} with the magic word @emph{subscribe}
|
||||
somewhere in it.
|
||||
|
||||
@emph{NOTE:} the traffic on this list is heavy so you may not want to be
|
||||
on it (unless you use Gnus as your mailer reader, that is). The mailing
|
||||
list is mainly for developers and testers.
|
||||
|
||||
Gnus has a home World Wide Web page at@*
|
||||
@file{http://www.ifi.uio.no/~larsi/ding.html}.
|
||||
|
||||
Gnus has a write up in the X Windows Applications FAQ at@*
|
||||
@file{http://www.ee.ryerson.ca:8080/~elf/xapps/Q-III.html}.
|
||||
|
||||
The Gnus manual is also available on the World Wide Web. The canonical
|
||||
source is in Norway at@*
|
||||
@file{http://www.ifi.uio.no/~larsi/ding-manual/gnus_toc.html}.
|
||||
|
||||
There are three mirrors in the United States:
|
||||
@enumerate
|
||||
@item
|
||||
@file{http://www.miranova.com/gnus-man/}
|
||||
|
||||
@item
|
||||
@file{http://www.pilgrim.umass.edu/pub/misc/ding/manual/gnus_toc.html}
|
||||
|
||||
@item
|
||||
@file{http://www.rtd.com/~woo/gnus/}
|
||||
|
||||
@end enumerate
|
||||
|
||||
PostScript copies of the Gnus Reference card are available from@*
|
||||
@file{ftp://ftp.cs.ualberta.ca/pub/oolog/gnus/}. They are mirrored at@*
|
||||
@file{ftp://ftp.pilgrim.umass.edu/pub/misc/ding/refcard/} in the
|
||||
United States. And@*
|
||||
@file{ftp://marvin.fkphy.uni-duesseldorf.de/pub/gnus/}
|
||||
in Germany.
|
||||
|
||||
An online version of the Gnus FAQ is available at@*
|
||||
@file{http://www.miranova.com/~steve/gnus-faq.html}. Off-line formats
|
||||
are also available:@*
|
||||
ASCII: @file{ftp://ftp.miranova.com/pub/gnus/gnus-faq}@*
|
||||
PostScript: @file{ftp://ftp.miranova.com/pub/gnus/gnus-faq.ps}.
|
||||
|
||||
|
||||
@item
|
||||
Q1.9 Gnus hangs on connecting to NNTP server
|
||||
|
||||
I am running XEmacs on SunOS and Gnus prints a message about Connecting
|
||||
to NNTP server and then just hangs.
|
||||
|
||||
Ben Wing <wing@@netcom.com> writes :@*
|
||||
I wonder if you're hitting the infamous @emph{libresolv} problem.
|
||||
The basic problem is that under SunOS you can compile either
|
||||
with DNS or NIS name lookup libraries but not both. Try
|
||||
substituting the IP address and see if that works; if so, you
|
||||
need to download the sources and recompile.
|
||||
|
||||
|
||||
@item
|
||||
Q1.10 Mailcrypt 3.4 doesn't work
|
||||
|
||||
This problem is verified to still exist in Gnus 5.0.9 and MailCrypt 3.4.
|
||||
The answer comes from Peter Arius
|
||||
<arius@@immd2.informatik.uni-erlangen.de>.
|
||||
|
||||
I found out that mailcrypt uses
|
||||
@code{gnus-eval-in-buffer-window}, which is a macro.
|
||||
It seems as if you have
|
||||
compiled mailcrypt with plain old GNUS in load path, and the XEmacs byte
|
||||
compiler has inserted that macro definition into
|
||||
@file{mc-toplev.elc}.
|
||||
The solution is to recompile @file{mc-toplev.el} with Gnus 5 in
|
||||
load-path, and it works fine.
|
||||
|
||||
Steve Baur <steve@@miranova.com> adds :@*
|
||||
The problem also manifests itself if neither GNUS 4 nor Gnus 5 is in the
|
||||
load-path.
|
||||
|
||||
|
||||
@item
|
||||
Q1.11 What other packages work with Gnus?
|
||||
|
||||
@itemize @minus
|
||||
@item
|
||||
Mailcrypt.
|
||||
|
||||
Mailcrypt is an Emacs interface to PGP. It works, it installs
|
||||
without hassle, and integrates very easily. Mailcrypt can be
|
||||
obtained from@*
|
||||
@file{ftp://cag.lcs.mit.edu/pub/patl/mailcrypt-3.4.tar.gz}.
|
||||
|
||||
@item
|
||||
Tiny Mime.
|
||||
|
||||
Tiny Mime is an Emacs MUA interface to MIME. Installation is
|
||||
a two-step process unlike most other packages, so you should
|
||||
be prepared to move the byte-compiled code somewhere. There
|
||||
are currently two versions of this package available. It can
|
||||
be obtained from@*
|
||||
@file{ftp://ftp.jaist.ac.jp/pub/GNU/elisp/}.
|
||||
Be sure to apply the supplied patch. It works with Gnus through
|
||||
version 5.0.9. In order for all dependencies to work correctly
|
||||
the load sequence is as follows:
|
||||
@lisp
|
||||
(load "tm-setup")
|
||||
(load "gnus")
|
||||
(load "mime-compose")
|
||||
@end lisp
|
||||
|
||||
@emph{NOTE:} Loading the package disables citation highlighting by
|
||||
default. To get the old behavior back, use the @kbd{M-t} command.
|
||||
|
||||
@end itemize
|
||||
|
||||
@end itemize
|
||||
|
||||
|
||||
@node Customization FAQ
|
||||
@subsection Customization
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Q2.1 Custom Edit does not work under XEmacs
|
||||
|
||||
The custom package has not been ported to XEmacs.
|
||||
|
||||
|
||||
@item
|
||||
Q2.2 How do I quote messages?
|
||||
|
||||
I see lots of messages with quoted material in them. I am wondering
|
||||
how to have Gnus do it for me.
|
||||
|
||||
This is Gnus, so there are a number of ways of doing this. You can use
|
||||
the built-in commands to do this. There are the @kbd{F} and @kbd{R}
|
||||
keys from the summary buffer which automatically include the article
|
||||
being responded to. These commands are also selectable as @i{Followup
|
||||
and Yank} and @i{Reply and Yank} in the Post menu.
|
||||
|
||||
@kbd{C-c C-y} grabs the previous message and prefixes each line with
|
||||
@code{ail-indentation-spaces} spaces or @code{mail-yank-prefix} if that is
|
||||
non-nil, unless you have set your own @code{mail-citation-hook}, which will
|
||||
be called to to do the job.
|
||||
|
||||
You might also consider the Supercite package, which allows for pretty
|
||||
arbitrarily complex quoting styles. Some people love it, some people
|
||||
hate it.
|
||||
|
||||
|
||||
@item
|
||||
Q2.3 How can I keep my nnvirtual:* groups sorted?
|
||||
|
||||
How can I most efficiently arrange matters so as to keep my nnvirtual:*
|
||||
(etc) groups at the top of my group selection buffer, whilst keeping
|
||||
everything sorted in alphabetical order.
|
||||
|
||||
If you don't subscribe often to new groups then the easiest way is to
|
||||
first sort the groups and then manually kill and yank the virtuals
|
||||
wherever you want them.
|
||||
|
||||
|
||||
@item
|
||||
Q2.4 Any good suggestions on stuff for an all.SCORE file?
|
||||
|
||||
Here is a collection of suggestions from the Gnus mailing list.
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
From ``Dave Disser'' <disser@@sdd.hp.com>@*
|
||||
I like blasting anything without lowercase letters. Weeds out most of
|
||||
the make $$ fast, as well as the lame titles like ``IBM'' and ``HP-UX''
|
||||
with no further description.
|
||||
@lisp
|
||||
(("Subject"
|
||||
("^\\(Re: \\)?[^a-z]*$" -200 nil R)))
|
||||
@end lisp
|
||||
|
||||
@item
|
||||
From ``Peter Arius'' <arius@@immd2.informatik.uni-erlangen.de>@*
|
||||
The most vital entries in my (still young) all.SCORE:
|
||||
@lisp
|
||||
(("xref"
|
||||
("alt.fan.oj-simpson" -1000 nil s))
|
||||
("subject"
|
||||
("\\<\\(make\\|fast\\|big\\)\\s-*\\(money\\|cash\\|bucks?\\)\\>" -1000 nil r)
|
||||
("$$$$" -1000 nil s)))
|
||||
@end lisp
|
||||
|
||||
@item
|
||||
From ``Per Abrahamsen'' <abraham@@dina.kvl.dk>@*
|
||||
@lisp
|
||||
(("subject"
|
||||
;; CAPS OF THE WORLD, UNITE
|
||||
("^..[^a-z]+$" -1 nil R)
|
||||
;; $$$ Make Money $$$ (Try work)
|
||||
("$" -1 nil s)
|
||||
;; I'm important! And I have exclamation marks to prove it!
|
||||
("!" -1 nil s)))
|
||||
@end lisp
|
||||
|
||||
@item
|
||||
From ``heddy boubaker'' <boubaker@@cenatls.cena.dgac.fr>@*
|
||||
I would like to contribute with mine.
|
||||
@lisp
|
||||
(
|
||||
(read-only t)
|
||||
("subject"
|
||||
;; ALL CAPS SUBJECTS
|
||||
("^\\([Rr][Ee]: +\\)?[^a-z]+$" -1 nil R)
|
||||
;; $$$ Make Money $$$
|
||||
("$$" -10 nil s)
|
||||
;; Empty subjects are worthless!
|
||||
("^ *\\([(<]none[>)]\\|(no subject\\( given\\)?)\\)? *$" -10 nil r)
|
||||
;; Sometimes interesting announces occur!
|
||||
("ANN?OU?NC\\(E\\|ING\\)" +10 nil r)
|
||||
;; Some people think they're on mailing lists
|
||||
("\\(un\\)?sub?scribe" -100 nil r)
|
||||
;; Stop Micro$oft NOW!!
|
||||
("\\(m\\(icro\\)?[s$]\\(oft\\|lot\\)?-?\\)?wind?\\(ows\\|aube\\|oze\\)?[- ]*\\('?95\\|NT\\|3[.]1\\|32\\)" -1001 nil r)
|
||||
;; I've nothing to buy
|
||||
("\\(for\\|4\\)[- ]*sale" -100 nil r)
|
||||
;; SELF-DISCIPLINED people
|
||||
("\\[[^a-z0-9 \t\n][^a-z0-9 \t\n]\\]" +100 nil r)
|
||||
)
|
||||
("from"
|
||||
;; To keep track of posters from my site
|
||||
(".dgac.fr" +1000 nil s))
|
||||
("followup"
|
||||
;; Keep track of answers to my posts
|
||||
("boubaker" +1000 nil s))
|
||||
("lines"
|
||||
;; Some people have really nothing to say!!
|
||||
(1 -10 nil <=))
|
||||
(mark -100)
|
||||
(expunge -1000)
|
||||
)
|
||||
@end lisp
|
||||
|
||||
@item
|
||||
From ``Christopher Jones'' <cjones@@au.oracle.com>@*
|
||||
The sample @file{all.SCORE} files from Per and boubaker could be
|
||||
augmented with:
|
||||
@lisp
|
||||
(("subject"
|
||||
;; No junk mail please!
|
||||
("please ignore" -500 nil s)
|
||||
("test" -500 nil e))
|
||||
)
|
||||
@end lisp
|
||||
|
||||
@item
|
||||
From ``Brian Edmonds'' <edmonds@@cs.ubc.ca>@*
|
||||
Augment any of the above with a fast method of scoring down
|
||||
excessively cross posted articles.
|
||||
@lisp
|
||||
("xref"
|
||||
;; the more cross posting, the exponentially worse the article
|
||||
("^xref: \\S-+ \\S-+ \\S-+ \\S-+" -1 nil r)
|
||||
("^xref: \\S-+ \\S-+ \\S-+ \\S-+ \\S-+" -2 nil r)
|
||||
("^xref: \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+" -4 nil r)
|
||||
("^xref: \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+" -8 nil r)
|
||||
("^xref: \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+" -16 nil r)
|
||||
("^xref: \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+" -32 nil r)
|
||||
("^xref: \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+" -64 nil r)
|
||||
("^xref: \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+" -128 nil r)
|
||||
("^xref: \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+" -256 nil r)
|
||||
("^xref: \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+ \\S-+" -512 nil r))
|
||||
@end lisp
|
||||
|
||||
@end enumerate
|
||||
|
||||
|
||||
@item
|
||||
Q2.5 What do I use to yank-through when replying?
|
||||
|
||||
You should probably reply and followup with @kbd{R} and @kbd{F}, instead
|
||||
of @kbd{r} and @kbd{f}, which solves your problem. But you could try
|
||||
something like:
|
||||
|
||||
@example
|
||||
(defconst mail-yank-ignored-headers
|
||||
"^.*:"
|
||||
"Delete these headers from old message when it's inserted in a reply.")
|
||||
@end example
|
||||
|
||||
|
||||
@item
|
||||
Q2.6 I don't like the default WWW browser
|
||||
|
||||
Now when choosing an URL Gnus starts up a W3 buffer, I would like it
|
||||
to always use Netscape (I don't browse in text-mode ;-).
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
Activate `Customize...' from the `Help' menu.
|
||||
|
||||
@item
|
||||
Scroll down to the `WWW Browser' field.
|
||||
|
||||
@item
|
||||
Click `mouse-2' on `WWW Browser'.
|
||||
|
||||
@item
|
||||
Select `Netscape' from the pop up menu.
|
||||
|
||||
@item
|
||||
Press `C-c C-c'
|
||||
|
||||
@end enumerate
|
||||
|
||||
If you are using XEmacs then to specify Netscape do
|
||||
@lisp
|
||||
(setq gnus-button-url 'gnus-netscape-open-url)
|
||||
@end lisp
|
||||
|
||||
|
||||
@item
|
||||
Q2.7 What, if any, relation is between ``ask-server'' and ``(setq
|
||||
gnus-read-active-file 'some)''?
|
||||
|
||||
In order for Gnus to show you the complete list of newsgroups, it will
|
||||
either have to either store the list locally, or ask the server to
|
||||
transmit the list. You enable the first with
|
||||
|
||||
@lisp
|
||||
(setq gnus-save-killed-list t)
|
||||
@end lisp
|
||||
|
||||
and the second with
|
||||
|
||||
@lisp
|
||||
(setq gnus-read-active-file t)
|
||||
@end lisp
|
||||
|
||||
If both are disabled, Gnus will not know what newsgroups exists. There
|
||||
is no option to get the list by casting a spell.
|
||||
|
||||
|
||||
@item
|
||||
Q2.8 Moving between groups is slow.
|
||||
|
||||
Per Abrahamsen <abraham@@dina.kvl.dk> writes:@*
|
||||
|
||||
Do you call @code{define-key} or something like that in one of the
|
||||
summary mode hooks? This would force Emacs to recalculate the keyboard
|
||||
shortcuts. Removing the call should speed up @kbd{M-x gnus-summary-mode
|
||||
RET} by a couple of orders of magnitude. You can use
|
||||
|
||||
@lisp
|
||||
(define-key gnus-summary-mode-map KEY COMMAND)
|
||||
@end lisp
|
||||
|
||||
in your @file{.gnus} instead.
|
||||
|
||||
@end itemize
|
||||
|
||||
|
||||
@node Reading News FAQ
|
||||
@subsection Reading News
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Q3.1 How do I convert my kill files to score files?
|
||||
|
||||
A kill-to-score translator was written by Ethan Bradford
|
||||
<ethanb@@ptolemy.astro.washington.edu>. It is available from@*
|
||||
@file{http://baugi.ifi.uio.no/~larsi/ding-various/gnus-kill-to-score.el}.
|
||||
|
||||
|
||||
@item
|
||||
Q3.2 My news server has a lot of groups, and killing groups is painfully
|
||||
slow.
|
||||
|
||||
Don't do that then. The best way to get rid of groups that should be
|
||||
dead is to edit your newsrc directly. This problem will be addressed
|
||||
in the near future.
|
||||
|
||||
|
||||
@item
|
||||
Q3.3 How do I use an NNTP server with authentication?
|
||||
|
||||
Put the following into your .gnus:
|
||||
@lisp
|
||||
(add-hook 'nntp-server-opened-hook 'nntp-send-authinfo)
|
||||
@end lisp
|
||||
|
||||
|
||||
@item
|
||||
Q3.4 Not reading the first article.
|
||||
|
||||
How do I avoid reading the first article when a group is selected?
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
Use @kbd{RET} to select the group instead of @kbd{SPC}.
|
||||
|
||||
@item
|
||||
@code{(setq gnus-auto-select first nil)}
|
||||
|
||||
@item
|
||||
Luis Fernandes <elf@@mailhost.ee.ryerson.ca>writes:@*
|
||||
This is what I use...customize as necessary...
|
||||
|
||||
@lisp
|
||||
;;; Don't auto-select first article if reading sources, or archives or
|
||||
;;; jobs postings, etc. and just display the summary buffer
|
||||
(add-hook 'gnus-select-group-hook
|
||||
(function
|
||||
(lambda ()
|
||||
(cond ((string-match "sources" gnus-newsgroup-name)
|
||||
(setq gnus-auto-select-first nil))
|
||||
((string-match "jobs" gnus-newsgroup-name)
|
||||
(setq gnus-auto-select-first nil))
|
||||
((string-match "comp\\.archives" gnus-newsgroup-name)
|
||||
(setq gnus-auto-select-first nil))
|
||||
((string-match "reviews" gnus-newsgroup-name)
|
||||
(setq gnus-auto-select-first nil))
|
||||
((string-match "announce" gnus-newsgroup-name)
|
||||
(setq gnus-auto-select-first nil))
|
||||
((string-match "binaries" gnus-newsgroup-name)
|
||||
(setq gnus-auto-select-first nil))
|
||||
(t
|
||||
(setq gnus-auto-select-first t))))))
|
||||
@end lisp
|
||||
|
||||
@item
|
||||
Per Abrahamsen <abraham@@dina.kvl.dk> writes:@*
|
||||
Another possibility is to create an @file{all.binaries.all.SCORE} file
|
||||
like this:
|
||||
|
||||
@lisp
|
||||
((local
|
||||
(gnus-auto-select-first nil)))
|
||||
@end lisp
|
||||
|
||||
and insert
|
||||
@lisp
|
||||
(setq gnus-auto-select-first t)
|
||||
@end lisp
|
||||
|
||||
in your @file{.gnus}.
|
||||
|
||||
@end enumerate
|
||||
|
||||
@item
|
||||
Q3.5 Why aren't BBDB known posters marked in the summary buffer?
|
||||
|
||||
Brian Edmonds <edmonds@@cs.ubc.ca> writes:@*
|
||||
Due to changes in Gnus 5.0, @file{bbdb-gnus.el} no longer marks known
|
||||
posters in the summary buffer. An updated version, @file{gnus-bbdb.el}
|
||||
is available at the locations listed below. This package also supports
|
||||
autofiling of incoming mail to folders specified in the BBDB. Extensive
|
||||
instructions are included as comments in the file.
|
||||
|
||||
Send mail to @file{majordomo@@edmonds.home.cs.ubc.ca} with the following
|
||||
line in the body of the message: @emph{get misc gnus-bbdb.el}.
|
||||
|
||||
Or get it from the World Wide Web:@*
|
||||
@file{http://www.cs.ubc.ca/spider/edmonds/gnus-bbdb.el}.
|
||||
|
||||
@end itemize
|
||||
|
||||
|
||||
@node Reading Mail FAQ
|
||||
@subsection Reading Mail
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Q4.1 What does the message ``Buffer has changed on disk'' mean in a mail
|
||||
group?
|
||||
|
||||
Your filter program should not deliver mail directly to your folders,
|
||||
instead it should put the mail into spool files. Gnus will then move
|
||||
the mail safely from the spool files into the folders. This will
|
||||
eliminate the problem. Look it up in the manual, in the section
|
||||
entitled ``Mail & Procmail''.
|
||||
|
||||
|
||||
@item
|
||||
Q4.2 How do you make articles un-expirable?
|
||||
|
||||
I am using nnml to read news and have used
|
||||
@code{gnus-auto-expirable-newsgroups} to automagically expire articles
|
||||
in some groups (Gnus being one of them). Sometimes there are
|
||||
interesting articles in these groups that I want to keep. Is there any
|
||||
way of explicitly marking an article as un-expirable - that is mark it
|
||||
as read but not expirable?
|
||||
|
||||
Use @kbd{u}, @kbd{!}, @kbd{d} or @kbd{M-u} in the summary buffer. You
|
||||
just remove the @kbd{E} mark by setting some other mark. It's not
|
||||
necessary to tick the articles.
|
||||
|
||||
|
||||
@item
|
||||
Q4.3 How do I delete bogus nnml: groups?
|
||||
|
||||
My problem is that I have various mail (nnml) groups generated while
|
||||
experimenting with Gnus. How do I remove them now? Setting the level to
|
||||
9 does not help. Also @code{gnus-group-check-bogus-groups} does not
|
||||
recognize them.
|
||||
|
||||
Removing mail groups is tricky at the moment. (It's on the to-do list,
|
||||
though.) You basically have to kill the groups in Gnus, shut down Gnus,
|
||||
edit the active file to exclude these groups, and probably remove the
|
||||
nnml directories that contained these groups as well. Then start Gnus
|
||||
back up again.
|
||||
|
||||
|
||||
@item
|
||||
Q4.4 What happened to my new mail groups?
|
||||
|
||||
I got new mail, but I have
|
||||
never seen the groups they should have been placed in.
|
||||
|
||||
They are probably there, but as zombies. Press @kbd{A z} to list
|
||||
zombie groups, and then subscribe to the groups you want with @kbd{u}.
|
||||
This is all documented quite nicely in the user's manual.
|
||||
|
||||
|
||||
@item
|
||||
Q4.5 Not scoring mail groups
|
||||
|
||||
How do you @emph{totally} turn off scoring in mail groups?
|
||||
|
||||
Use an nnbabyl:all.SCORE (or nnmh, or nnml, or whatever) file containing:
|
||||
|
||||
@example
|
||||
((adapt ignore)
|
||||
(local (gnus-use-scoring nil))
|
||||
(exclude-files "all.SCORE"))
|
||||
@end example
|
||||
|
||||
@end itemize
|
||||
|
||||
|
19430
man/gnus.texi
Normal file
19430
man/gnus.texi
Normal file
File diff suppressed because it is too large
Load diff
479
man/help.texi
Normal file
479
man/help.texi
Normal file
|
@ -0,0 +1,479 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Help, Mark, M-x, Top
|
||||
@chapter Help
|
||||
@kindex Help
|
||||
@cindex help
|
||||
@cindex self-documentation
|
||||
@findex help-command
|
||||
@kindex C-h
|
||||
@kindex F1
|
||||
|
||||
Emacs provides extensive help features accessible through a single
|
||||
character, @kbd{C-h}. @kbd{C-h} is a prefix key that is used only for
|
||||
documentation-printing commands. The characters that you can type after
|
||||
@kbd{C-h} are called @dfn{help options}. One help option is @kbd{C-h};
|
||||
that is how you ask for help about using @kbd{C-h}. To cancel, type
|
||||
@kbd{C-g}. The function key @key{F1} is equivalent to @kbd{C-h}.
|
||||
|
||||
@kindex C-h C-h
|
||||
@findex help-for-help
|
||||
@kbd{C-h C-h} (@code{help-for-help}) displays a list of the possible
|
||||
help options, each with a brief description. Before you type a help
|
||||
option, you can use @key{SPC} or @key{DEL} to scroll through the list.
|
||||
|
||||
@kbd{C-h} or @key{F1} means ``help'' in various other contexts as
|
||||
well. For example, in the middle of @code{query-replace}, it describes
|
||||
the options available for how to operate on the current match. After a
|
||||
prefix key, it displays a list of the alternatives that can follow the
|
||||
prefix key. (A few prefix keys don't support @kbd{C-h}, because they
|
||||
define other meanings for it, but they all support @key{F1}.)
|
||||
|
||||
Most help buffers use a special major mode, Help mode, which lets you
|
||||
scroll conveniently with @key{SPC} and @key{DEL}.
|
||||
|
||||
@menu
|
||||
* Help Summary:: Brief list of all Help commands.
|
||||
* Key Help:: Asking what a key does in Emacs.
|
||||
* Name Help:: Asking about a command, variable or function name.
|
||||
* Apropos:: Asking what pertains to a given topic.
|
||||
* Library Keywords:: Finding Lisp libraries by keywords (topics).
|
||||
* Language Help:: Help relating to international language support.
|
||||
* Help Mode:: Special features of Help mode and Help buffers.
|
||||
* Misc Help:: Other help commands.
|
||||
@end menu
|
||||
|
||||
@iftex
|
||||
@node Help Summary
|
||||
@end iftex
|
||||
@ifinfo
|
||||
@node Help Summary
|
||||
@section Help Summary
|
||||
@end ifinfo
|
||||
|
||||
Here is a summary of the defined help commands.
|
||||
|
||||
@table @kbd
|
||||
@item C-h a @var{regexp} @key{RET}
|
||||
Display a list of commands whose names match @var{regexp}
|
||||
(@code{apropos-command}).
|
||||
@item C-h b
|
||||
Display a table of all key bindings in effect now, in this order: minor
|
||||
mode bindings, major mode bindings, and global bindings
|
||||
(@code{describe-bindings}).
|
||||
@item C-h c @var{key}
|
||||
Print the name of the command that @var{key} runs
|
||||
(@code{describe-key-briefly}). Here @kbd{c} stands for `character'. For more
|
||||
extensive information on @var{key}, use @kbd{C-h k}.
|
||||
@item C-h f @var{function} @key{RET}
|
||||
Display documentation on the Lisp function named @var{function}
|
||||
(@code{describe-function}). Since commands are Lisp functions,
|
||||
a command name may be used.
|
||||
@item C-h h
|
||||
Display the @file{hello} file, which shows examples of various character
|
||||
sets.
|
||||
@item C-h i
|
||||
Run Info, the program for browsing documentation files (@code{info}).
|
||||
The complete Emacs manual is available on-line in Info.
|
||||
@item C-h k @var{key}
|
||||
Display the name and documentation of the command that @var{key} runs
|
||||
(@code{describe-key}).
|
||||
@item C-h l
|
||||
Display a description of the last 100 characters you typed
|
||||
(@code{view-lossage}).
|
||||
@item C-h m
|
||||
Display documentation of the current major mode (@code{describe-mode}).
|
||||
@item C-h n
|
||||
Display documentation of Emacs changes, most recent first
|
||||
(@code{view-emacs-news}).
|
||||
@item C-h p
|
||||
Find packages by topic keyword (@code{finder-by-keyword}).
|
||||
@item C-h s
|
||||
Display current contents of the syntax table, plus an explanation of
|
||||
what they mean (@code{describe-syntax}). @xref{Syntax}.
|
||||
@item C-h t
|
||||
Enter the Emacs interactive tutorial (@code{help-with-tutorial}).
|
||||
@item C-h v @var{var} @key{RET}
|
||||
Display the documentation of the Lisp variable @var{var}
|
||||
(@code{describe-variable}).
|
||||
@item C-h w @var{command} @key{RET}
|
||||
Print which keys run the command named @var{command} (@code{where-is}).
|
||||
@item C-h C @var{coding} @key{RET}
|
||||
Describe coding system @var{coding}
|
||||
(@code{describe-coding-system}).
|
||||
@item C-h C @key{RET}
|
||||
Describe the coding systems currently in use.
|
||||
@item C-h I @var{method} @key{RET}
|
||||
Describe an input method (@code{describe-input-method}).
|
||||
@item C-h L @var{language-env} @key{RET}
|
||||
Describe information on the character sets, coding systems and input
|
||||
methods used for language environment @var{language-env}
|
||||
(@code{describe-language-environment}).
|
||||
@item C-h C-c
|
||||
Display the copying conditions for GNU Emacs.
|
||||
@item C-h C-d
|
||||
Display information about getting new versions of GNU Emacs.
|
||||
@item C-h C-f @var{function} @key{RET}
|
||||
Enter Info and go to the node documenting the Emacs function @var{function}
|
||||
(@code{Info-goto-emacs-command-node}).
|
||||
@item C-h C-k @var{key}
|
||||
Enter Info and go to the node where the key sequence @var{key} is
|
||||
documented (@code{Info-goto-emacs-key-command-node}).
|
||||
@item C-h C-p
|
||||
Display information about the GNU Project.
|
||||
@item C-h @key{TAB} @var{symbol} @key{RET}
|
||||
Display the Info documentation on symbol @var{symbol} according to the
|
||||
programming language you are editing (@code{info-lookup-symbol}).
|
||||
@end table
|
||||
|
||||
@node Key Help
|
||||
@section Documentation for a Key
|
||||
|
||||
@kindex C-h c
|
||||
@findex describe-key-briefly
|
||||
The most basic @kbd{C-h} options are @kbd{C-h c}
|
||||
(@code{describe-key-briefly}) and @w{@kbd{C-h k}} (@code{describe-key}).
|
||||
@kbd{C-h c @var{key}} prints in the echo area the name of the command
|
||||
that @var{key} is bound to. For example, @kbd{C-h c C-f} prints
|
||||
@samp{forward-char}. Since command names are chosen to describe what
|
||||
the commands do, this is a good way to get a very brief description of
|
||||
what @var{key} does.
|
||||
|
||||
@kindex C-h k
|
||||
@findex describe-key
|
||||
@kbd{C-h k @var{key}} is similar but gives more information: it
|
||||
displays the documentation string of the command as well as its name.
|
||||
This is too big for the echo area, so a window is used for the display.
|
||||
|
||||
@kbd{C-h c} and @kbd{C-h k} work for any sort of key sequences,
|
||||
including function keys and mouse events.
|
||||
|
||||
@node Name Help
|
||||
@section Help by Command or Variable Name
|
||||
|
||||
@kindex C-h f
|
||||
@findex describe-function
|
||||
@kbd{C-h f} (@code{describe-function}) reads the name of a Lisp function
|
||||
using the minibuffer, then displays that function's documentation string
|
||||
in a window. Since commands are Lisp functions, you can use this to get
|
||||
the documentation of a command that you know by name. For example,
|
||||
|
||||
@example
|
||||
C-h f auto-fill-mode @key{RET}
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
displays the documentation of @code{auto-fill-mode}. This is the only
|
||||
way to get the documentation of a command that is not bound to any key
|
||||
(one which you would normally run using @kbd{M-x}).
|
||||
|
||||
@kbd{C-h f} is also useful for Lisp functions that you are planning to
|
||||
use in a Lisp program. For example, if you have just written the
|
||||
expression @code{(make-vector len)} and want to check that you are using
|
||||
@code{make-vector} properly, type @kbd{C-h f make-vector @key{RET}}.
|
||||
Because @kbd{C-h f} allows all function names, not just command names,
|
||||
you may find that some of your favorite abbreviations that work in
|
||||
@kbd{M-x} don't work in @kbd{C-h f}. An abbreviation may be unique
|
||||
among command names yet fail to be unique when other function names are
|
||||
allowed.
|
||||
|
||||
The function name for @kbd{C-h f} to describe has a default which is
|
||||
used if you type @key{RET} leaving the minibuffer empty. The default is
|
||||
the function called by the innermost Lisp expression in the buffer around
|
||||
point, @emph{provided} that is a valid, defined Lisp function name. For
|
||||
example, if point is located following the text @samp{(make-vector (car
|
||||
x)}, the innermost list containing point is the one that starts with
|
||||
@samp{(make-vector}, so the default is to describe the function
|
||||
@code{make-vector}.
|
||||
|
||||
@kbd{C-h f} is often useful just to verify that you have the right
|
||||
spelling for the function name. If @kbd{C-h f} mentions a name from the
|
||||
buffer as the default, that name must be defined as a Lisp function. If
|
||||
that is all you want to know, just type @kbd{C-g} to cancel the @kbd{C-h
|
||||
f} command, then go on editing.
|
||||
|
||||
@kindex C-h w
|
||||
@findex where-is
|
||||
@kbd{C-h w @var{command} @key{RET}} tells you what keys are bound to
|
||||
@var{command}. It prints a list of the keys in the echo area. If it
|
||||
says the command is not on any key, you must use @kbd{M-x} to run it.
|
||||
@kbd{C-h w} runs the command @code{where-is}.
|
||||
|
||||
@kbd{C-h v} (@code{describe-variable}) is like @kbd{C-h f} but describes
|
||||
Lisp variables instead of Lisp functions. Its default is the Lisp symbol
|
||||
around or before point, but only if that is the name of a known Lisp
|
||||
variable. @xref{Variables}.@refill
|
||||
|
||||
@node Apropos
|
||||
@section Apropos
|
||||
|
||||
@kindex C-h a
|
||||
@findex apropos-command
|
||||
@cindex apropos
|
||||
A more sophisticated sort of question to ask is, ``What are the
|
||||
commands for working with files?'' To ask this question, type @kbd{C-h
|
||||
a file @key{RET}}, which displays a list of all command names that
|
||||
contain @samp{file}, including @code{copy-file}, @code{find-file}, and
|
||||
so on. With each command name appears a brief description of how to use
|
||||
the command, and what keys you can currently invoke it with. For
|
||||
example, it would say that you can invoke @code{find-file} by typing
|
||||
@kbd{C-x C-f}. The @kbd{a} in @kbd{C-h a} stands for `Apropos';
|
||||
@kbd{C-h a} runs the command @code{apropos-command}. This command
|
||||
normally checks only commands (interactive functions); if you specify a
|
||||
prefix argument, it checks noninteractive functions as well.
|
||||
|
||||
Because @kbd{C-h a} looks only for functions whose names contain the
|
||||
string you specify, you must use ingenuity in choosing the
|
||||
string. If you are looking for commands for killing backwards and
|
||||
@kbd{C-h a kill-backwards @key{RET}} doesn't reveal any, don't give up.
|
||||
Try just @kbd{kill}, or just @kbd{backwards}, or just @kbd{back}. Be
|
||||
persistent. Also note that you can use a regular expression as the
|
||||
argument, for more flexibility (@pxref{Regexps}).
|
||||
|
||||
Here is a set of arguments to give to @kbd{C-h a} that covers many
|
||||
classes of Emacs commands, since there are strong conventions for naming
|
||||
the standard Emacs commands. By giving you a feel for the naming
|
||||
conventions, this set should also serve to aid you in developing a
|
||||
technique for picking @code{apropos} strings.
|
||||
|
||||
@quotation
|
||||
char, line, word, sentence, paragraph, region, page, sexp, list, defun,
|
||||
rect, buffer, frame, window, face, file, dir, register, mode, beginning, end,
|
||||
forward, backward, next, previous, up, down, search, goto, kill, delete,
|
||||
mark, insert, yank, fill, indent, case, change, set, what, list, find,
|
||||
view, describe, default.
|
||||
@end quotation
|
||||
|
||||
@findex apropos-variable
|
||||
To list all user variables that match a regexp, use the command
|
||||
@kbd{M-x apropos-variable}. This command shows only user variables and
|
||||
customization options by default; if you specify a prefix argument, it
|
||||
checks all variables.
|
||||
|
||||
@findex apropos
|
||||
To list all Lisp symbols that contain a match for a regexp, not just
|
||||
the ones that are defined as commands, use the command @kbd{M-x apropos}
|
||||
instead of @kbd{C-h a}. This command does not check key bindings by
|
||||
default; specify a numeric argument if you want it to check them.
|
||||
|
||||
@findex apropos-documentation
|
||||
The @code{apropos-documentation} command is like @code{apropos} except
|
||||
that it searches documentation strings as well as symbol names for
|
||||
matches for the specified regular expression.
|
||||
|
||||
@findex apropos-value
|
||||
The @code{apropos-value} command is like @code{apropos} except that it
|
||||
searches symbols' values for matches for the specified regular
|
||||
expression. This command does not check function definitions or
|
||||
property lists by default; specify a numeric argument if you want it to
|
||||
check them.
|
||||
|
||||
@vindex apropos-do-all
|
||||
If the variable @code{apropos-do-all} is non-@code{nil}, the commands
|
||||
above all behave as if they had been given a prefix argument.
|
||||
|
||||
If you want more information about a function definition, variable or
|
||||
symbol property listed in the Apropos buffer, you can click on it with
|
||||
@kbd{Mouse-2} or move there and type @key{RET}.
|
||||
|
||||
@node Library Keywords
|
||||
@section Keyword Search for Lisp Libraries
|
||||
|
||||
@kindex C-h p
|
||||
@findex finder-by-keyword
|
||||
The @kbd{C-h p} command lets you search the standard Emacs Lisp
|
||||
libraries by topic keywords. Here is a partial list of keywords you can
|
||||
use:
|
||||
|
||||
@display
|
||||
abbrev --- abbreviation handling, typing shortcuts, macros.
|
||||
bib --- support for the bibliography processor @code{bib}.
|
||||
c --- C and C++ language support.
|
||||
calendar --- calendar and time management support.
|
||||
comm --- communications, networking, remote access to files.
|
||||
data --- support for editing files of data.
|
||||
docs --- support for Emacs documentation.
|
||||
emulations --- emulations of other editors.
|
||||
extensions --- Emacs Lisp language extensions.
|
||||
faces --- support for using faces (fonts and colors; @pxref{Faces}).
|
||||
frames --- support for Emacs frames and window systems.
|
||||
games --- games, jokes and amusements.
|
||||
hardware --- support for interfacing with exotic hardware.
|
||||
help --- support for on-line help systems.
|
||||
hypermedia --- support for links within text, or other media types.
|
||||
i18n --- internationalization and alternate character-set support.
|
||||
internal --- code for Emacs internals, build process, defaults.
|
||||
languages --- specialized modes for editing programming languages.
|
||||
lisp --- support for using Lisp (including Emacs Lisp).
|
||||
local --- libraries local to your site.
|
||||
maint --- maintenance aids for the Emacs development group.
|
||||
mail --- modes for electronic-mail handling.
|
||||
matching --- searching and matching.
|
||||
news --- support for netnews reading and posting.
|
||||
non-text --- support for editing files that are not ordinary text.
|
||||
oop --- support for object-oriented programming.
|
||||
outlines --- hierarchical outlining.
|
||||
processes --- process, subshell, compilation, and job control support.
|
||||
terminals --- support for terminal types.
|
||||
tex --- support for the @TeX{} formatter.
|
||||
tools --- programming tools.
|
||||
unix --- front-ends/assistants for, or emulators of, Unix features.
|
||||
vms --- support code for VMS.
|
||||
wp --- word processing.
|
||||
@end display
|
||||
|
||||
@node Language Help
|
||||
@section Help for International Language Support
|
||||
|
||||
You can use the command @kbd{C-h L}
|
||||
(@code{describe-language-environment}) to find out the support for a
|
||||
specific language environment. @xref{Language Environments}. This
|
||||
tells you which languages this language environment is useful for, and
|
||||
lists the character sets, coding systems, and input methods that go with
|
||||
it. It also shows some sample text to illustrate scripts.
|
||||
|
||||
The command @kbd{C-h h} (@code{view-hello-file}) displays the file
|
||||
@file{etc/HELLO}, which shows how to say ``hello'' in many languages.
|
||||
|
||||
The command @kbd{C-h I} (@code{describe-input-method}) describes
|
||||
information about input methods---either a specified input method, or by
|
||||
default the input method in use. @xref{Input Methods}.
|
||||
|
||||
The command @kbd{C-h C} (@code{describe-coding-system}) describes
|
||||
information about coding systems---either a specified coding system, or
|
||||
the ones currently in use. @xref{Coding Systems}.
|
||||
|
||||
@node Help Mode
|
||||
@section Help Mode Commands
|
||||
|
||||
Help buffers provide the commands of View mode (@pxref{Misc File
|
||||
Ops}), plus a few special commands of their own.
|
||||
|
||||
@table @kbd
|
||||
@item @key{SPC}
|
||||
Scroll forward.
|
||||
@item @key{DEL}
|
||||
Scroll backward.
|
||||
@item @key{RET}
|
||||
Follow a cross reference at point.
|
||||
@item @key{TAB}
|
||||
Move point forward to the next cross reference.
|
||||
@item S-@key{TAB}
|
||||
Move point back to the previous cross reference.
|
||||
@item Mouse-2
|
||||
Follow a cross reference that you click on.
|
||||
@end table
|
||||
|
||||
When a command name (@pxref{M-x,, Running Commands by Name}) or
|
||||
variable name (@pxref{Variables}) appears in the documentation, it
|
||||
normally appears inside paired single-quotes. You can click on the name
|
||||
with @kbd{Mouse-2}, or move point there and type @key{RET}, to view the
|
||||
documentation of that command or variable. Use @kbd{C-c C-b} to retrace
|
||||
your steps.
|
||||
|
||||
@kindex @key{TAB} @r{(Help mode)}
|
||||
@findex help-next-ref
|
||||
@kindex S-@key{TAB} @r{(Help mode)}
|
||||
@findex help-previous-ref
|
||||
There are convenient commands for moving point to cross references in
|
||||
the help text. @key{TAB} (@code{help-next-ref}) moves point down to the
|
||||
next cross reference. Use @kbd{S-@key{TAB}} to move point up to the
|
||||
previous cross reference (@code{help-previous-ref}).
|
||||
|
||||
@node Misc Help
|
||||
@section Other Help Commands
|
||||
|
||||
@kindex C-h i
|
||||
@findex info
|
||||
@cindex Info
|
||||
@cindex manuals, on-line
|
||||
@cindex on-line manuals
|
||||
@kbd{C-h i} (@code{info}) runs the Info program, which is used for
|
||||
browsing through structured documentation files. The entire Emacs manual
|
||||
is available within Info. Eventually all the documentation of the GNU
|
||||
system will be available. Type @kbd{h} after entering Info to run
|
||||
a tutorial on using Info.
|
||||
|
||||
If you specify a numeric argument, @kbd{C-h i} prompts for the name of
|
||||
a documentation file. This way, you can browse a file which doesn't
|
||||
have an entry in the top-level Info menu. It is also handy when you
|
||||
need to get to the documentation quickly, and you know the exact name of
|
||||
the file.
|
||||
|
||||
@kindex C-h C-f
|
||||
@kindex C-h C-k
|
||||
@findex Info-goto-emacs-key-command-node
|
||||
@findex Info-goto-emacs-command-node
|
||||
There are two special help commands for accessing Emacs documentation
|
||||
through Info. @kbd{C-h C-f @var{function} @key{RET}} enters Info and
|
||||
goes straight to the documentation of the Emacs function
|
||||
@var{function}. @kbd{C-h C-k @var{key}} enters Info and goes straight
|
||||
to the documentation of the key @var{key}. These two keys run the
|
||||
commands @code{Info-goto-emacs-command-node} and
|
||||
@code{Info-goto-emacs-key-command-node}.
|
||||
|
||||
When editing a program, if you have an Info version of the manual for
|
||||
the programming language, you can use the command @kbd{C-h C-i} to refer
|
||||
to the manual documentation for a symbol (keyword, function or
|
||||
variable). The details of how this command works depend on the major
|
||||
mode.
|
||||
|
||||
@kindex C-h l
|
||||
@findex view-lossage
|
||||
If something surprising happens, and you are not sure what commands you
|
||||
typed, use @kbd{C-h l} (@code{view-lossage}). @kbd{C-h l} prints the last
|
||||
100 command characters you typed in. If you see commands that you don't
|
||||
know, you can use @kbd{C-h c} to find out what they do.
|
||||
|
||||
@kindex C-h m
|
||||
@findex describe-mode
|
||||
Emacs has numerous major modes, each of which redefines a few keys and
|
||||
makes a few other changes in how editing works. @kbd{C-h m}
|
||||
(@code{describe-mode}) prints documentation on the current major mode,
|
||||
which normally describes all the commands that are changed in this
|
||||
mode.
|
||||
|
||||
@kindex C-h b
|
||||
@findex describe-bindings
|
||||
@kbd{C-h b} (@code{describe-bindings}) and @kbd{C-h s}
|
||||
(@code{describe-syntax}) present other information about the current
|
||||
Emacs mode. @kbd{C-h b} displays a list of all the key bindings now in
|
||||
effect; the local bindings defined by the current minor modes first,
|
||||
then the local bindings defined by the current major mode, and finally
|
||||
the global bindings (@pxref{Key Bindings}). @kbd{C-h s} displays the
|
||||
contents of the syntax table, with explanations of each character's
|
||||
syntax (@pxref{Syntax}).
|
||||
|
||||
You can get a similar list for a particular prefix key by typing
|
||||
@kbd{C-h} after the prefix key. (There are a few prefix keys for which
|
||||
this does not work---those that provide their own bindings for
|
||||
@kbd{C-h}. One of these is @key{ESC}, because @kbd{@key{ESC} C-h} is
|
||||
actually @kbd{C-M-h}, which marks a defun.)
|
||||
|
||||
@kindex C-h F
|
||||
@findex view-emacs-FAQ
|
||||
@kindex C-h n
|
||||
@findex view-emacs-news
|
||||
@kindex C-h C-c
|
||||
@findex describe-copying
|
||||
@kindex C-h C-d
|
||||
@findex describe-distribution
|
||||
@kindex C-h C-w
|
||||
@findex describe-no-warranty
|
||||
@kindex C-h C-p
|
||||
@findex describe-project
|
||||
The other @kbd{C-h} options display various files of useful
|
||||
information. @kbd{C-h C-w} displays the full details on the complete
|
||||
absence of warranty for GNU Emacs. @kbd{C-h n} (@code{view-emacs-news})
|
||||
displays the file @file{emacs/etc/NEWS}, which contains documentation on
|
||||
Emacs changes arranged chronologically. @kbd{C-h F}
|
||||
(@code{view-emacs-FAQ}) displays the Emacs frequently-answered-questions
|
||||
list. @kbd{C-h t} (@code{help-with-tutorial}) displays the
|
||||
learn-by-doing Emacs tutorial. @kbd{C-h C-c} (@code{describe-copying})
|
||||
displays the file @file{emacs/etc/COPYING}, which tells you the
|
||||
conditions you must obey in distributing copies of Emacs. @kbd{C-h C-d}
|
||||
(@code{describe-distribution}) displays the file
|
||||
@file{emacs/etc/DISTRIB}, which tells you how you can order a copy of
|
||||
the latest version of Emacs. @kbd{C-h C-p} (@code{describe-project})
|
||||
displays general information about the GNU Project.
|
205
man/indent.texi
Normal file
205
man/indent.texi
Normal file
|
@ -0,0 +1,205 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Indentation, Text, Major Modes, Top
|
||||
@chapter Indentation
|
||||
@cindex indentation
|
||||
@cindex columns (indentation)
|
||||
|
||||
This chapter describes the Emacs commands that add, remove, or
|
||||
adjust indentation.
|
||||
|
||||
@c WideCommands
|
||||
@table @kbd
|
||||
@item @key{TAB}
|
||||
Indent current line ``appropriately'' in a mode-dependent fashion.
|
||||
@item @kbd{C-j}
|
||||
Perform @key{RET} followed by @key{TAB} (@code{newline-and-indent}).
|
||||
@item M-^
|
||||
Merge two lines (@code{delete-indentation}). This would cancel out
|
||||
the effect of @kbd{C-j}.
|
||||
@item C-M-o
|
||||
Split line at point; text on the line after point becomes a new line
|
||||
indented to the same column that it now starts in (@code{split-line}).
|
||||
@item M-m
|
||||
Move (forward or back) to the first nonblank character on the current
|
||||
line (@code{back-to-indentation}).
|
||||
@item C-M-\
|
||||
Indent several lines to same column (@code{indent-region}).
|
||||
@item C-x @key{TAB}
|
||||
Shift block of lines rigidly right or left (@code{indent-rigidly}).
|
||||
@item M-i
|
||||
Indent from point to the next prespecified tab stop column
|
||||
(@code{tab-to-tab-stop}).
|
||||
@item M-x indent-relative
|
||||
Indent from point to under an indentation point in the previous line.
|
||||
@end table
|
||||
|
||||
Most programming languages have some indentation convention. For Lisp
|
||||
code, lines are indented according to their nesting in parentheses. The
|
||||
same general idea is used for C code, though many details are different.
|
||||
|
||||
@kindex TAB
|
||||
Whatever the language, to indent a line, use the @key{TAB} command. Each
|
||||
major mode defines this command to perform the sort of indentation
|
||||
appropriate for the particular language. In Lisp mode, @key{TAB} aligns
|
||||
the line according to its depth in parentheses. No matter where in the
|
||||
line you are when you type @key{TAB}, it aligns the line as a whole. In C
|
||||
mode, @key{TAB} implements a subtle and sophisticated indentation style that
|
||||
knows about many aspects of C syntax.
|
||||
|
||||
In Text mode, @key{TAB} runs the command @code{tab-to-tab-stop}, which
|
||||
indents to the next tab stop column. You can set the tab stops with
|
||||
@kbd{M-x edit-tab-stops}.
|
||||
|
||||
@menu
|
||||
* Indentation Commands:: Various commands and techniques for indentation.
|
||||
* Tab Stops:: You can set arbitrary "tab stops" and then
|
||||
indent to the next tab stop when you want to.
|
||||
* Just Spaces:: You can request indentation using just spaces.
|
||||
@end menu
|
||||
|
||||
@node Indentation Commands, Tab Stops, Indentation, Indentation
|
||||
@section Indentation Commands and Techniques
|
||||
|
||||
@kindex M-m
|
||||
@findex back-to-indentation
|
||||
To move over the indentation on a line, do @kbd{M-m}
|
||||
(@code{back-to-indentation}). This command, given anywhere on a line,
|
||||
positions point at the first nonblank character on the line.
|
||||
|
||||
To insert an indented line before the current line, do @kbd{C-a C-o
|
||||
@key{TAB}}. To make an indented line after the current line, use
|
||||
@kbd{C-e C-j}.
|
||||
|
||||
If you just want to insert a tab character in the buffer, you can type
|
||||
@kbd{C-q @key{TAB}}.
|
||||
|
||||
@kindex C-M-o
|
||||
@findex split-line
|
||||
@kbd{C-M-o} (@code{split-line}) moves the text from point to the end of
|
||||
the line vertically down, so that the current line becomes two lines.
|
||||
@kbd{C-M-o} first moves point forward over any spaces and tabs. Then it
|
||||
inserts after point a newline and enough indentation to reach the same
|
||||
column point is on. Point remains before the inserted newline; in this
|
||||
regard, @kbd{C-M-o} resembles @kbd{C-o}.
|
||||
|
||||
@kindex M-^
|
||||
@findex delete-indentation
|
||||
To join two lines cleanly, use the @kbd{M-^}
|
||||
(@code{delete-indentation}) command. It deletes the indentation at the
|
||||
front of the current line, and the line boundary as well, replacing them
|
||||
with a single space. As a special case (useful for Lisp code) the
|
||||
single space is omitted if the characters to be joined are consecutive
|
||||
open parentheses or closing parentheses, or if the junction follows
|
||||
another newline. To delete just the indentation of a line, go to the
|
||||
beginning of the line and use @kbd{M-\}
|
||||
(@code{delete-horizontal-space}), which deletes all spaces and tabs
|
||||
around the cursor.
|
||||
|
||||
If you have a fill prefix, @kbd{M-^} deletes the fill prefix if it
|
||||
appears after the newline that is deleted. @xref{Fill Prefix}.
|
||||
|
||||
@kindex C-M-\
|
||||
@kindex C-x TAB
|
||||
@findex indent-region
|
||||
@findex indent-rigidly
|
||||
There are also commands for changing the indentation of several lines
|
||||
at once. @kbd{C-M-\} (@code{indent-region}) applies to all the lines
|
||||
that begin in the region; it indents each line in the ``usual'' way, as
|
||||
if you had typed @key{TAB} at the beginning of the line. A numeric
|
||||
argument specifies the column to indent to, and each line is shifted
|
||||
left or right so that its first nonblank character appears in that
|
||||
column. @kbd{C-x @key{TAB}} (@code{indent-rigidly}) moves all of the
|
||||
lines in the region right by its argument (left, for negative
|
||||
arguments). The whole group of lines moves rigidly sideways, which is
|
||||
how the command gets its name.@refill
|
||||
|
||||
@findex indent-relative
|
||||
@kbd{M-x indent-relative} indents at point based on the previous line
|
||||
(actually, the last nonempty line). It inserts whitespace at point, moving
|
||||
point, until it is underneath an indentation point in the previous line.
|
||||
An indentation point is the end of a sequence of whitespace or the end of
|
||||
the line. If point is farther right than any indentation point in the
|
||||
previous line, the whitespace before point is deleted and the first
|
||||
indentation point then applicable is used. If no indentation point is
|
||||
applicable even then, @code{indent-relative} runs @code{tab-to-tab-stop}
|
||||
@ifinfo
|
||||
(@pxref{Tab Stops}).
|
||||
@end ifinfo
|
||||
@iftex
|
||||
(see next section).
|
||||
@end iftex
|
||||
|
||||
@code{indent-relative} is the definition of @key{TAB} in Indented Text
|
||||
mode. @xref{Text}.
|
||||
|
||||
@xref{Format Indentation}, for another way of specifying the
|
||||
indentation for part of your text.
|
||||
|
||||
@node Tab Stops, Just Spaces, Indentation Commands, Indentation
|
||||
@section Tab Stops
|
||||
|
||||
@cindex tab stops
|
||||
@cindex using tab stops in making tables
|
||||
@cindex tables, indentation for
|
||||
@kindex M-i
|
||||
@findex tab-to-tab-stop
|
||||
For typing in tables, you can use Text mode's definition of @key{TAB},
|
||||
@code{tab-to-tab-stop}. This command inserts indentation before point,
|
||||
enough to reach the next tab stop column. If you are not in Text mode,
|
||||
this command can be found on the key @kbd{M-i}.
|
||||
|
||||
@findex edit-tab-stops
|
||||
@findex edit-tab-stops-note-changes
|
||||
@kindex C-c C-c @r{(Edit Tab Stops)}
|
||||
@vindex tab-stop-list
|
||||
You can specify the tab stops used by @kbd{M-i}. They are stored in a
|
||||
variable called @code{tab-stop-list}, as a list of column-numbers in
|
||||
increasing order.
|
||||
|
||||
The convenient way to set the tab stops is with @kbd{M-x
|
||||
edit-tab-stops}, which creates and selects a buffer containing a
|
||||
description of the tab stop settings. You can edit this buffer to
|
||||
specify different tab stops, and then type @kbd{C-c C-c} to make those
|
||||
new tab stops take effect. @code{edit-tab-stops} records which buffer
|
||||
was current when you invoked it, and stores the tab stops back in that
|
||||
buffer; normally all buffers share the same tab stops and changing them
|
||||
in one buffer affects all, but if you happen to make
|
||||
@code{tab-stop-list} local in one buffer then @code{edit-tab-stops} in
|
||||
that buffer will edit the local settings.
|
||||
|
||||
Here is what the text representing the tab stops looks like for ordinary
|
||||
tab stops every eight columns.
|
||||
|
||||
@example
|
||||
: : : : : :
|
||||
0 1 2 3 4
|
||||
0123456789012345678901234567890123456789012345678
|
||||
To install changes, type C-c C-c
|
||||
@end example
|
||||
|
||||
The first line contains a colon at each tab stop. The remaining lines
|
||||
are present just to help you see where the colons are and know what to do.
|
||||
|
||||
Note that the tab stops that control @code{tab-to-tab-stop} have nothing
|
||||
to do with displaying tab characters in the buffer. @xref{Display Vars},
|
||||
for more information on that.
|
||||
|
||||
@node Just Spaces,, Tab Stops, Indentation
|
||||
@section Tabs vs. Spaces
|
||||
|
||||
@vindex indent-tabs-mode
|
||||
Emacs normally uses both tabs and spaces to indent lines. If you prefer,
|
||||
all indentation can be made from spaces only. To request this, set
|
||||
@code{indent-tabs-mode} to @code{nil}. This is a per-buffer variable;
|
||||
altering the variable affects only the current buffer, but there is a
|
||||
default value which you can change as well. @xref{Locals}.
|
||||
|
||||
@findex tabify
|
||||
@findex untabify
|
||||
There are also commands to convert tabs to spaces or vice versa, always
|
||||
preserving the columns of all nonblank text. @kbd{M-x tabify} scans the
|
||||
region for sequences of spaces, and converts sequences of at least three
|
||||
spaces to tabs if that can be done without changing indentation. @kbd{M-x
|
||||
untabify} changes all tabs in the region to appropriate numbers of spaces.
|
548
man/killing.texi
Normal file
548
man/killing.texi
Normal file
|
@ -0,0 +1,548 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@iftex
|
||||
@chapter Killing and Moving Text
|
||||
|
||||
@dfn{Killing} means erasing text and copying it into the @dfn{kill
|
||||
ring}, from which it can be retrieved by @dfn{yanking} it. Some systems
|
||||
use the terms ``cutting'' and ``pasting'' for these operations.
|
||||
|
||||
The commonest way of moving or copying text within Emacs is to kill it
|
||||
and later yank it elsewhere in one or more places. This is very safe
|
||||
because Emacs remembers several recent kills, not just the last one. It
|
||||
is versatile, because the many commands for killing syntactic units can
|
||||
also be used for moving those units. But there are other ways of
|
||||
copying text for special purposes.
|
||||
|
||||
Emacs has only one kill ring for all buffers, so you can kill text in
|
||||
one buffer and yank it in another buffer.
|
||||
|
||||
@end iftex
|
||||
|
||||
@node Killing, Yanking, Mark, Top
|
||||
@section Deletion and Killing
|
||||
|
||||
@cindex killing text
|
||||
@cindex cutting text
|
||||
@cindex deletion
|
||||
Most commands which erase text from the buffer save it in the kill
|
||||
ring so that you can move or copy it to other parts of the buffer.
|
||||
These commands are known as @dfn{kill} commands. The rest of the
|
||||
commands that erase text do not save it in the kill ring; they are known
|
||||
as @dfn{delete} commands. (This distinction is made only for erasure of
|
||||
text in the buffer.) If you do a kill or delete command by mistake, you
|
||||
can use the @kbd{C-x u} (@code{undo}) command to undo it
|
||||
(@pxref{Undo}).
|
||||
|
||||
The delete commands include @kbd{C-d} (@code{delete-char}) and
|
||||
@key{DEL} (@code{delete-backward-char}), which delete only one character at
|
||||
a time, and those commands that delete only spaces or newlines. Commands
|
||||
that can destroy significant amounts of nontrivial data generally kill.
|
||||
The commands' names and individual descriptions use the words @samp{kill}
|
||||
and @samp{delete} to say which they do.
|
||||
|
||||
@menu
|
||||
* Deletion:: Commands for deleting small amounts of text and
|
||||
blank areas.
|
||||
* Killing by Lines:: How to kill entire lines of text at one time.
|
||||
* Other Kill Commands:: Commands to kill large regions of text and
|
||||
syntactic units such as words and sentences.
|
||||
@end menu
|
||||
|
||||
@node Deletion
|
||||
@subsection Deletion
|
||||
@c ??? Should be backward-delete-char
|
||||
@findex delete-backward-char
|
||||
@findex delete-char
|
||||
@kindex DEL
|
||||
@kindex C-d
|
||||
|
||||
@table @kbd
|
||||
@item C-d
|
||||
Delete next character (@code{delete-char}).
|
||||
@item @key{DEL}
|
||||
Delete previous character (@code{delete-backward-char}).
|
||||
@item M-\
|
||||
Delete spaces and tabs around point (@code{delete-horizontal-space}).
|
||||
@item M-@key{SPC}
|
||||
Delete spaces and tabs around point, leaving one space
|
||||
(@code{just-one-space}).
|
||||
@item C-x C-o
|
||||
Delete blank lines around the current line (@code{delete-blank-lines}).
|
||||
@item M-^
|
||||
Join two lines by deleting the intervening newline, along with any
|
||||
indentation following it (@code{delete-indentation}).
|
||||
@end table
|
||||
|
||||
The most basic delete commands are @kbd{C-d} (@code{delete-char}) and
|
||||
@key{DEL} (@code{delete-backward-char}). @kbd{C-d} deletes the
|
||||
character after point, the one the cursor is ``on top of.'' This
|
||||
doesn't move point. @key{DEL} deletes the character before the cursor,
|
||||
and moves point back. You can delete newlines like any other characters
|
||||
in the buffer; deleting a newline joins two lines. Actually, @kbd{C-d}
|
||||
and @key{DEL} aren't always delete commands; when given arguments, they
|
||||
kill instead, since they can erase more than one character this way.
|
||||
|
||||
@kindex M-\
|
||||
@findex delete-horizontal-space
|
||||
@kindex M-SPC
|
||||
@findex just-one-space
|
||||
The other delete commands are those which delete only whitespace
|
||||
characters: spaces, tabs and newlines. @kbd{M-\}
|
||||
(@code{delete-horizontal-space}) deletes all the spaces and tab
|
||||
characters before and after point. @kbd{M-@key{SPC}}
|
||||
(@code{just-one-space}) does likewise but leaves a single space after
|
||||
point, regardless of the number of spaces that existed previously (even
|
||||
zero).
|
||||
|
||||
@kbd{C-x C-o} (@code{delete-blank-lines}) deletes all blank lines
|
||||
after the current line. If the current line is blank, it deletes all
|
||||
blank lines preceding the current line as well (leaving one blank line,
|
||||
the current line).
|
||||
|
||||
@kbd{M-^} (@code{delete-indentation}) joins the current line and the
|
||||
previous line, by deleting a newline and all surrounding spaces, usually
|
||||
leaving a single space. @xref{Indentation,M-^}.
|
||||
|
||||
@node Killing by Lines
|
||||
@subsection Killing by Lines
|
||||
|
||||
@table @kbd
|
||||
@item C-k
|
||||
Kill rest of line or one or more lines (@code{kill-line}).
|
||||
@end table
|
||||
|
||||
@kindex C-k
|
||||
@findex kill-line
|
||||
The simplest kill command is @kbd{C-k}. If given at the beginning of
|
||||
a line, it kills all the text on the line, leaving it blank. When used
|
||||
on a blank line, it kills the whole line including its newline. To kill
|
||||
an entire non-blank line, go to the beginning and type @kbd{C-k} twice.
|
||||
|
||||
More generally, @kbd{C-k} kills from point up to the end of the line,
|
||||
unless it is at the end of a line. In that case it kills the newline
|
||||
following point, thus merging the next line into the current one.
|
||||
Spaces and tabs that you can't see at the end of the line are ignored
|
||||
when deciding which case applies, so if point appears to be at the end
|
||||
of the line, you can be sure @kbd{C-k} will kill the newline.
|
||||
|
||||
When @kbd{C-k} is given a positive argument, it kills that many lines
|
||||
and the newlines that follow them (however, text on the current line
|
||||
before point is spared). With a negative argument @minus{}@var{n}, it
|
||||
kills @var{n} lines preceding the current line (together with the text
|
||||
on the current line before point). Thus, @kbd{C-u - 2 C-k} at the front
|
||||
of a line kills the two previous lines.
|
||||
|
||||
@kbd{C-k} with an argument of zero kills the text before point on the
|
||||
current line.
|
||||
|
||||
@vindex kill-whole-line
|
||||
If the variable @code{kill-whole-line} is non-@code{nil}, @kbd{C-k} at
|
||||
the very beginning of a line kills the entire line including the
|
||||
following newline. This variable is normally @code{nil}.
|
||||
|
||||
@node Other Kill Commands
|
||||
@subsection Other Kill Commands
|
||||
@findex kill-region
|
||||
@kindex C-w
|
||||
|
||||
@c DoubleWideCommands
|
||||
@table @kbd
|
||||
@item C-w
|
||||
Kill region (from point to the mark) (@code{kill-region}).
|
||||
@item M-d
|
||||
Kill word (@code{kill-word}). @xref{Words}.
|
||||
@item M-@key{DEL}
|
||||
Kill word backwards (@code{backward-kill-word}).
|
||||
@item C-x @key{DEL}
|
||||
Kill back to beginning of sentence (@code{backward-kill-sentence}).
|
||||
@xref{Sentences}.
|
||||
@item M-k
|
||||
Kill to end of sentence (@code{kill-sentence}).
|
||||
@item C-M-k
|
||||
Kill sexp (@code{kill-sexp}). @xref{Lists}.
|
||||
@item M-z @var{char}
|
||||
Kill through the next occurrence of @var{char} (@code{zap-to-char}).
|
||||
@end table
|
||||
|
||||
A kill command which is very general is @kbd{C-w}
|
||||
(@code{kill-region}), which kills everything between point and the
|
||||
mark. With this command, you can kill any contiguous sequence of
|
||||
characters, if you first set the region around them.
|
||||
|
||||
@kindex M-z
|
||||
@findex zap-to-char
|
||||
A convenient way of killing is combined with searching: @kbd{M-z}
|
||||
(@code{zap-to-char}) reads a character and kills from point up to (and
|
||||
including) the next occurrence of that character in the buffer. A
|
||||
numeric argument acts as a repeat count. A negative argument means to
|
||||
search backward and kill text before point.
|
||||
|
||||
Other syntactic units can be killed: words, with @kbd{M-@key{DEL}} and
|
||||
@kbd{M-d} (@pxref{Words}); sexps, with @kbd{C-M-k} (@pxref{Lists}); and
|
||||
sentences, with @kbd{C-x @key{DEL}} and @kbd{M-k}
|
||||
(@pxref{Sentences}).@refill
|
||||
|
||||
You can use kill commands in read-only buffers. They don't actually
|
||||
change the buffer, and they beep to warn you of that, but they do copy
|
||||
the text you tried to kill into the kill ring, so you can yank it into
|
||||
other buffers. Most of the kill commands move point across the text
|
||||
they copy in this way, so that successive kill commands build up a
|
||||
single kill ring entry as usual.
|
||||
|
||||
@node Yanking, Accumulating Text, Killing, Top
|
||||
@section Yanking
|
||||
@cindex moving text
|
||||
@cindex copying text
|
||||
@cindex kill ring
|
||||
@cindex yanking
|
||||
@cindex pasting
|
||||
|
||||
@dfn{Yanking} means reinserting text previously killed. This is what
|
||||
some systems call ``pasting.'' The usual way to move or copy text is to
|
||||
kill it and then yank it elsewhere one or more times.
|
||||
|
||||
@table @kbd
|
||||
@item C-y
|
||||
Yank last killed text (@code{yank}).
|
||||
@item M-y
|
||||
Replace text just yanked with an earlier batch of killed text
|
||||
(@code{yank-pop}).
|
||||
@item M-w
|
||||
Save region as last killed text without actually killing it
|
||||
(@code{kill-ring-save}).
|
||||
@item C-M-w
|
||||
Append next kill to last batch of killed text (@code{append-next-kill}).
|
||||
@end table
|
||||
|
||||
@menu
|
||||
* Kill Ring:: Where killed text is stored. Basic yanking.
|
||||
* Appending Kills:: Several kills in a row all yank together.
|
||||
* Earlier Kills:: Yanking something killed some time ago.
|
||||
@end menu
|
||||
|
||||
@node Kill Ring
|
||||
@subsection The Kill Ring
|
||||
|
||||
All killed text is recorded in the @dfn{kill ring}, a list of blocks of
|
||||
text that have been killed. There is only one kill ring, shared by all
|
||||
buffers, so you can kill text in one buffer and yank it in another buffer.
|
||||
This is the usual way to move text from one file to another.
|
||||
(@xref{Accumulating Text}, for some other ways.)
|
||||
|
||||
@kindex C-y
|
||||
@findex yank
|
||||
The command @kbd{C-y} (@code{yank}) reinserts the text of the most recent
|
||||
kill. It leaves the cursor at the end of the text. It sets the mark at
|
||||
the beginning of the text. @xref{Mark}.
|
||||
|
||||
@kbd{C-u C-y} leaves the cursor in front of the text, and sets the
|
||||
mark after it. This happens only if the argument is specified with just
|
||||
a @kbd{C-u}, precisely. Any other sort of argument, including @kbd{C-u}
|
||||
and digits, specifies an earlier kill to yank (@pxref{Earlier Kills}).
|
||||
|
||||
@kindex M-w
|
||||
@findex kill-ring-save
|
||||
To copy a block of text, you can use @kbd{M-w}
|
||||
(@code{kill-ring-save}), which copies the region into the kill ring
|
||||
without removing it from the buffer. This is approximately equivalent
|
||||
to @kbd{C-w} followed by @kbd{C-x u}, except that @kbd{M-w} does not
|
||||
alter the undo history and does not temporarily change the screen.
|
||||
|
||||
@node Appending Kills
|
||||
@subsection Appending Kills
|
||||
|
||||
@cindex appending kills in the ring
|
||||
@cindex television
|
||||
Normally, each kill command pushes a new entry onto the kill ring.
|
||||
However, two or more kill commands in a row combine their text into a
|
||||
single entry, so that a single @kbd{C-y} yanks all the text as a unit,
|
||||
just as it was before it was killed.
|
||||
|
||||
Thus, if you want to yank text as a unit, you need not kill all of it
|
||||
with one command; you can keep killing line after line, or word after
|
||||
word, until you have killed it all, and you can still get it all back at
|
||||
once.
|
||||
|
||||
Commands that kill forward from point add onto the end of the previous
|
||||
killed text. Commands that kill backward from point add text onto the
|
||||
beginning. This way, any sequence of mixed forward and backward kill
|
||||
commands puts all the killed text into one entry without rearrangement.
|
||||
Numeric arguments do not break the sequence of appending kills. For
|
||||
example, suppose the buffer contains this text:
|
||||
|
||||
@example
|
||||
This is a line @point{}of sample text.
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
with point shown by @point{}. If you type @kbd{M-d M-@key{DEL} M-d
|
||||
M-@key{DEL}}, killing alternately forward and backward, you end up with
|
||||
@samp{a line of sample} as one entry in the kill ring, and @samp{This
|
||||
is@ @ text.} in the buffer. (Note the double space, which you can clean
|
||||
up with @kbd{M-@key{SPC}} or @kbd{M-q}.)
|
||||
|
||||
Another way to kill the same text is to move back two words with
|
||||
@kbd{M-b M-b}, then kill all four words forward with @kbd{C-u M-d}.
|
||||
This produces exactly the same results in the buffer and in the kill
|
||||
ring. @kbd{M-f M-f C-u M-@key{DEL}} kills the same text, all going
|
||||
backward; once again, the result is the same. The text in the kill ring
|
||||
entry always has the same order that it had in the buffer before you
|
||||
killed it.
|
||||
|
||||
@kindex C-M-w
|
||||
@findex append-next-kill
|
||||
If a kill command is separated from the last kill command by other
|
||||
commands (not just numeric arguments), it starts a new entry on the kill
|
||||
ring. But you can force it to append by first typing the command
|
||||
@kbd{C-M-w} (@code{append-next-kill}) right before it. The @kbd{C-M-w}
|
||||
tells the following command, if it is a kill command, to append the text
|
||||
it kills to the last killed text, instead of starting a new entry. With
|
||||
@kbd{C-M-w}, you can kill several separated pieces of text and
|
||||
accumulate them to be yanked back in one place.@refill
|
||||
|
||||
A kill command following @kbd{M-w} does not append to the text that
|
||||
@kbd{M-w} copied into the kill ring.
|
||||
|
||||
@node Earlier Kills
|
||||
@subsection Yanking Earlier Kills
|
||||
|
||||
@cindex yanking previous kills
|
||||
@kindex M-y
|
||||
@findex yank-pop
|
||||
To recover killed text that is no longer the most recent kill, use the
|
||||
@kbd{M-y} command (@code{yank-pop}). It takes the text previously
|
||||
yanked and replaces it with the text from an earlier kill. So, to
|
||||
recover the text of the next-to-the-last kill, first use @kbd{C-y} to
|
||||
yank the last kill, and then use @kbd{M-y} to replace it with the
|
||||
previous kill. @kbd{M-y} is allowed only after a @kbd{C-y} or another
|
||||
@kbd{M-y}.
|
||||
|
||||
You can understand @kbd{M-y} in terms of a ``last yank'' pointer which
|
||||
points at an entry in the kill ring. Each time you kill, the ``last
|
||||
yank'' pointer moves to the newly made entry at the front of the ring.
|
||||
@kbd{C-y} yanks the entry which the ``last yank'' pointer points to.
|
||||
@kbd{M-y} moves the ``last yank'' pointer to a different entry, and the
|
||||
text in the buffer changes to match. Enough @kbd{M-y} commands can move
|
||||
the pointer to any entry in the ring, so you can get any entry into the
|
||||
buffer. Eventually the pointer reaches the end of the ring; the next
|
||||
@kbd{M-y} moves it to the first entry again.
|
||||
|
||||
@kbd{M-y} moves the ``last yank'' pointer around the ring, but it does
|
||||
not change the order of the entries in the ring, which always runs from
|
||||
the most recent kill at the front to the oldest one still remembered.
|
||||
|
||||
@kbd{M-y} can take a numeric argument, which tells it how many entries
|
||||
to advance the ``last yank'' pointer by. A negative argument moves the
|
||||
pointer toward the front of the ring; from the front of the ring, it
|
||||
moves ``around'' to the last entry and continues forward from there.
|
||||
|
||||
Once the text you are looking for is brought into the buffer, you can
|
||||
stop doing @kbd{M-y} commands and it will stay there. It's just a copy
|
||||
of the kill ring entry, so editing it in the buffer does not change
|
||||
what's in the ring. As long as no new killing is done, the ``last
|
||||
yank'' pointer remains at the same place in the kill ring, so repeating
|
||||
@kbd{C-y} will yank another copy of the same previous kill.
|
||||
|
||||
If you know how many @kbd{M-y} commands it would take to find the text
|
||||
you want, you can yank that text in one step using @kbd{C-y} with a
|
||||
numeric argument. @kbd{C-y} with an argument restores the text the
|
||||
specified number of entries back in the kill ring. Thus, @kbd{C-u 2
|
||||
C-y} gets the next-to-the-last block of killed text. It is equivalent
|
||||
to @kbd{C-y M-y}. @kbd{C-y} with a numeric argument starts counting
|
||||
from the ``last yank'' pointer, and sets the ``last yank'' pointer to
|
||||
the entry that it yanks.
|
||||
|
||||
@vindex kill-ring-max
|
||||
The length of the kill ring is controlled by the variable
|
||||
@code{kill-ring-max}; no more than that many blocks of killed text are
|
||||
saved.
|
||||
|
||||
@vindex kill-ring
|
||||
The actual contents of the kill ring are stored in a variable named
|
||||
@code{kill-ring}; you can view the entire contents of the kill ring with
|
||||
the command @kbd{C-h v kill-ring}.
|
||||
|
||||
@node Accumulating Text, Rectangles, Yanking, Top
|
||||
@section Accumulating Text
|
||||
@findex append-to-buffer
|
||||
@findex prepend-to-buffer
|
||||
@findex copy-to-buffer
|
||||
@findex append-to-file
|
||||
|
||||
@cindex accumulating scattered text
|
||||
Usually we copy or move text by killing it and yanking it, but there
|
||||
are other methods convenient for copying one block of text in many
|
||||
places, or for copying many scattered blocks of text into one place. To
|
||||
copy one block to many places, store it in a register
|
||||
(@pxref{Registers}). Here we describe the commands to accumulate
|
||||
scattered pieces of text into a buffer or into a file.
|
||||
|
||||
@table @kbd
|
||||
@item M-x append-to-buffer
|
||||
Append region to contents of specified buffer.
|
||||
@item M-x prepend-to-buffer
|
||||
Prepend region to contents of specified buffer.
|
||||
@item M-x copy-to-buffer
|
||||
Copy region into specified buffer, deleting that buffer's old contents.
|
||||
@item M-x insert-buffer
|
||||
Insert contents of specified buffer into current buffer at point.
|
||||
@item M-x append-to-file
|
||||
Append region to contents of specified file, at the end.
|
||||
@end table
|
||||
|
||||
To accumulate text into a buffer, use @kbd{M-x append-to-buffer}.
|
||||
This reads a buffer name, then inserts a copy of the region into the
|
||||
buffer specified. If you specify a nonexistent buffer,
|
||||
@code{append-to-buffer} creates the buffer. The text is inserted
|
||||
wherever point is in that buffer. If you have been using the buffer for
|
||||
editing, the copied text goes into the middle of the text of the buffer,
|
||||
wherever point happens to be in it.
|
||||
|
||||
Point in that buffer is left at the end of the copied text, so
|
||||
successive uses of @code{append-to-buffer} accumulate the text in the
|
||||
specified buffer in the same order as they were copied. Strictly
|
||||
speaking, @code{append-to-buffer} does not always append to the text
|
||||
already in the buffer---it appends only if point in that buffer is at the end.
|
||||
However, if @code{append-to-buffer} is the only command you use to alter
|
||||
a buffer, then point is always at the end.
|
||||
|
||||
@kbd{M-x prepend-to-buffer} is just like @code{append-to-buffer}
|
||||
except that point in the other buffer is left before the copied text, so
|
||||
successive prependings add text in reverse order. @kbd{M-x
|
||||
copy-to-buffer} is similar except that any existing text in the other
|
||||
buffer is deleted, so the buffer is left containing just the text newly
|
||||
copied into it.
|
||||
|
||||
To retrieve the accumulated text from another buffer, use the command
|
||||
@kbd{M-x insert-buffer}; this too takes @var{buffername} as an argument.
|
||||
It inserts a copy of the text in buffer @var{buffername} into the
|
||||
selected buffer. You can alternatively select the other buffer for
|
||||
editing, then optionally move text from it by killing. @xref{Buffers},
|
||||
for background information on buffers.
|
||||
|
||||
Instead of accumulating text within Emacs, in a buffer, you can append
|
||||
text directly into a file with @kbd{M-x append-to-file}, which takes
|
||||
@var{filename} as an argument. It adds the text of the region to the end
|
||||
of the specified file. The file is changed immediately on disk.
|
||||
|
||||
You should use @code{append-to-file} only with files that are
|
||||
@emph{not} being visited in Emacs. Using it on a file that you are
|
||||
editing in Emacs would change the file behind Emacs's back, which
|
||||
can lead to losing some of your editing.
|
||||
|
||||
@node Rectangles, Registers, Accumulating Text, Top
|
||||
@section Rectangles
|
||||
@cindex rectangle
|
||||
@cindex columns (and rectangles)
|
||||
@cindex killing rectangular areas of text
|
||||
|
||||
The rectangle commands operate on rectangular areas of the text: all
|
||||
the characters between a certain pair of columns, in a certain range of
|
||||
lines. Commands are provided to kill rectangles, yank killed rectangles,
|
||||
clear them out, fill them with blanks or text, or delete them. Rectangle
|
||||
commands are useful with text in multicolumn formats, and for changing
|
||||
text into or out of such formats.
|
||||
|
||||
When you must specify a rectangle for a command to work on, you do it
|
||||
by putting the mark at one corner and point at the opposite corner. The
|
||||
rectangle thus specified is called the @dfn{region-rectangle} because
|
||||
you control it in about the same way the region is controlled. But
|
||||
remember that a given combination of point and mark values can be
|
||||
interpreted either as a region or as a rectangle, depending on the
|
||||
command that uses them.
|
||||
|
||||
If point and the mark are in the same column, the rectangle they
|
||||
delimit is empty. If they are in the same line, the rectangle is one
|
||||
line high. This asymmetry between lines and columns comes about
|
||||
because point (and likewise the mark) is between two columns, but within
|
||||
a line.
|
||||
|
||||
@table @kbd
|
||||
@item C-x r k
|
||||
Kill the text of the region-rectangle, saving its contents as the
|
||||
``last killed rectangle'' (@code{kill-rectangle}).
|
||||
@item C-x r d
|
||||
Delete the text of the region-rectangle (@code{delete-rectangle}).
|
||||
@item C-x r y
|
||||
Yank the last killed rectangle with its upper left corner at point
|
||||
(@code{yank-rectangle}).
|
||||
@item C-x r o
|
||||
Insert blank space to fill the space of the region-rectangle
|
||||
(@code{open-rectangle}). This pushes the previous contents of the
|
||||
region-rectangle rightward.
|
||||
@item M-x clear-rectangle
|
||||
Clear the region-rectangle by replacing its contents with spaces.
|
||||
@item M-x delete-whitespace-rectangle
|
||||
Delete whitespace in each of the lines on the specified rectangle,
|
||||
starting from the left edge column of the rectangle.
|
||||
@item C-x r t @key{RET} @var{string} @key{RET}
|
||||
Insert @var{string} on each line of the region-rectangle
|
||||
(@code{string-rectangle}).
|
||||
@end table
|
||||
|
||||
The rectangle operations fall into two classes: commands deleting and
|
||||
inserting rectangles, and commands for blank rectangles.
|
||||
|
||||
@kindex C-x r k
|
||||
@kindex C-x r d
|
||||
@findex kill-rectangle
|
||||
@findex delete-rectangle
|
||||
There are two ways to get rid of the text in a rectangle: you can
|
||||
discard the text (delete it) or save it as the ``last killed''
|
||||
rectangle. The commands for these two ways are @kbd{C-x r d}
|
||||
(@code{delete-rectangle}) and @kbd{C-x r k} (@code{kill-rectangle}). In
|
||||
either case, the portion of each line that falls inside the rectangle's
|
||||
boundaries is deleted, causing following text (if any) on the line to
|
||||
move left into the gap.
|
||||
|
||||
Note that ``killing'' a rectangle is not killing in the usual sense; the
|
||||
rectangle is not stored in the kill ring, but in a special place that
|
||||
can only record the most recent rectangle killed. This is because yanking
|
||||
a rectangle is so different from yanking linear text that different yank
|
||||
commands have to be used and yank-popping is hard to make sense of.
|
||||
|
||||
@kindex C-x r y
|
||||
@findex yank-rectangle
|
||||
To yank the last killed rectangle, type @kbd{C-x r y}
|
||||
(@code{yank-rectangle}). Yanking a rectangle is the opposite of killing
|
||||
one. Point specifies where to put the rectangle's upper left corner.
|
||||
The rectangle's first line is inserted there, the rectangle's second
|
||||
line is inserted at a position one line vertically down, and so on. The
|
||||
number of lines affected is determined by the height of the saved
|
||||
rectangle.
|
||||
|
||||
You can convert single-column lists into double-column lists using
|
||||
rectangle killing and yanking; kill the second half of the list as a
|
||||
rectangle and then yank it beside the first line of the list.
|
||||
@xref{Two-Column}, for another way to edit multi-column text.
|
||||
|
||||
You can also copy rectangles into and out of registers with @kbd{C-x r
|
||||
r @var{r}} and @kbd{C-x r i @var{r}}. @xref{RegRect,,Rectangle
|
||||
Registers}.
|
||||
|
||||
@kindex C-x r o
|
||||
@findex open-rectangle
|
||||
@findex clear-rectangle
|
||||
There are two commands you can use for making blank rectangles:
|
||||
@kbd{M-x clear-rectangle} which blanks out existing text, and @kbd{C-x r
|
||||
o} (@code{open-rectangle}) which inserts a blank rectangle. Clearing a
|
||||
rectangle is equivalent to deleting it and then inserting a blank
|
||||
rectangle of the same size.
|
||||
|
||||
@findex delete-whitespace-rectangle
|
||||
The command @kbd{M-x delete-whitespace-rectangle} deletes horizontal
|
||||
whitespace starting from a particular column. This applies to each of
|
||||
the lines in the rectangle, and the column is specified by the left
|
||||
edge of the rectangle. The right edge of the rectangle does not make
|
||||
any difference to this command.
|
||||
|
||||
@kindex C-x r t
|
||||
@findex string-rectangle
|
||||
The command @kbd{C-x r t} (@code{M-x string-rectangle}) replaces the
|
||||
rectangle with a specified string (inserted once on each line). The
|
||||
string's width need not be the same as the width of the rectangle. If
|
||||
the string's width is less, the text after the rectangle shifts left; if
|
||||
the string is wider than the rectangle, the text after the rectangle
|
||||
shifts right.
|
72
man/m-x.texi
Normal file
72
man/m-x.texi
Normal file
|
@ -0,0 +1,72 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node M-x, Help, Minibuffer, Top
|
||||
@chapter Running Commands by Name
|
||||
|
||||
The Emacs commands that are used often or that must be quick to type are
|
||||
bound to keys---short sequences of characters---for convenient use. Other
|
||||
Emacs commands that do not need to be brief are not bound to keys; to run
|
||||
them, you must refer to them by name.
|
||||
|
||||
A command name is, by convention, made up of one or more words,
|
||||
separated by hyphens; for example, @code{auto-fill-mode} or
|
||||
@code{manual-entry}. The use of English words makes the command name
|
||||
easier to remember than a key made up of obscure characters, even though
|
||||
it is more characters to type.
|
||||
|
||||
@kindex M-x
|
||||
The way to run a command by name is to start with @kbd{M-x}, type the
|
||||
command name, and finish it with @key{RET}. @kbd{M-x} uses the
|
||||
minibuffer to read the command name. @key{RET} exits the minibuffer and
|
||||
runs the command. The string @samp{M-x} appears at the beginning of the
|
||||
minibuffer as a @dfn{prompt} to remind you to enter the name of a
|
||||
command to be run. @xref{Minibuffer}, for full information on the
|
||||
features of the minibuffer.
|
||||
|
||||
You can use completion to enter the command name. For example, the
|
||||
command @code{forward-char} can be invoked by name by typing
|
||||
|
||||
@example
|
||||
M-x forward-char @key{RET}
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
or
|
||||
|
||||
@example
|
||||
M-x forw @key{TAB} c @key{RET}
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
Note that @code{forward-char} is the same command that you invoke with
|
||||
the key @kbd{C-f}. You can run any Emacs command by name using
|
||||
@kbd{M-x}, whether or not any keys are bound to it.
|
||||
|
||||
If you type @kbd{C-g} while the command name is being read, you cancel
|
||||
the @kbd{M-x} command and get out of the minibuffer, ending up at top level.
|
||||
|
||||
To pass a numeric argument to the command you are invoking with
|
||||
@kbd{M-x}, specify the numeric argument before the @kbd{M-x}. @kbd{M-x}
|
||||
passes the argument along to the command it runs. The argument value
|
||||
appears in the prompt while the command name is being read.
|
||||
|
||||
@vindex suggest-key-bindings
|
||||
If the command you type has a key binding of its own, Emacs mentions
|
||||
this in the echo area, two seconds after the command finishes (if you
|
||||
don't type anything else first). For example, if you type @kbd{M-x
|
||||
forward-word}, the message says that you can run the same command more
|
||||
easily by typing @kbd{M-f}. You can turn off these messages by setting
|
||||
@code{suggest-key-bindings} to @code{nil}.
|
||||
|
||||
Normally, when describing in this manual a command that is run by
|
||||
name, we omit the @key{RET} that is needed to terminate the name. Thus
|
||||
we might speak of @kbd{M-x auto-fill-mode} rather than @kbd{M-x
|
||||
auto-fill-mode @key{RET}}. We mention the @key{RET} only when there is
|
||||
a need to emphasize its presence, such as when we show the command
|
||||
together with following arguments.
|
||||
|
||||
@findex execute-extended-command
|
||||
@kbd{M-x} works by running the command
|
||||
@code{execute-extended-command}, which is responsible for reading the
|
||||
name of another command and invoking it.
|
169
man/major.texi
Normal file
169
man/major.texi
Normal file
|
@ -0,0 +1,169 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Major Modes, Indentation, International, Top
|
||||
@chapter Major Modes
|
||||
@cindex major modes
|
||||
@cindex mode, major
|
||||
@kindex TAB @r{(and major modes)}
|
||||
@kindex DEL @r{(and major modes)}
|
||||
@kindex C-j @r{(and major modes)}
|
||||
|
||||
Emacs provides many alternative @dfn{major modes}, each of which
|
||||
customizes Emacs for editing text of a particular sort. The major modes
|
||||
are mutually exclusive, and each buffer has one major mode at any time.
|
||||
The mode line normally shows the name of the current major mode, in
|
||||
parentheses (@pxref{Mode Line}).
|
||||
|
||||
The least specialized major mode is called @dfn{Fundamental mode}.
|
||||
This mode has no mode-specific redefinitions or variable settings, so
|
||||
that each Emacs command behaves in its most general manner, and each
|
||||
option is in its default state. For editing text of a specific type
|
||||
that Emacs knows about, such as Lisp code or English text, you should
|
||||
switch to the appropriate major mode, such as Lisp mode or Text mode.
|
||||
|
||||
Selecting a major mode changes the meanings of a few keys to become
|
||||
more specifically adapted to the language being edited. The ones that
|
||||
are changed frequently are @key{TAB}, @key{DEL}, and @kbd{C-j}. The
|
||||
prefix key @kbd{C-c} normally contains mode-specific commands. In
|
||||
addition, the commands which handle comments use the mode to determine
|
||||
how comments are to be delimited. Many major modes redefine the
|
||||
syntactical properties of characters appearing in the buffer.
|
||||
@xref{Syntax}.
|
||||
|
||||
The major modes fall into three major groups. Lisp mode (which has
|
||||
several variants), C mode, Fortran mode and others are for specific
|
||||
programming languages. Text mode, Nroff mode, @TeX{} mode and Outline
|
||||
mode are for editing English text. The remaining major modes are not
|
||||
intended for use on users' files; they are used in buffers created for
|
||||
specific purposes by Emacs, such as Dired mode for buffers made by Dired
|
||||
(@pxref{Dired}), Mail mode for buffers made by @kbd{C-x m}
|
||||
(@pxref{Sending Mail}), and Shell mode for buffers used for
|
||||
communicating with an inferior shell process (@pxref{Interactive
|
||||
Shell}).
|
||||
|
||||
Most programming-language major modes specify that only blank lines
|
||||
separate paragraphs. This is to make the paragraph commands useful.
|
||||
(@xref{Paragraphs}.) They also cause Auto Fill mode to use the
|
||||
definition of @key{TAB} to indent the new lines it creates. This is
|
||||
because most lines in a program are usually indented.
|
||||
(@xref{Indentation}.)
|
||||
|
||||
@menu
|
||||
* Choosing Modes:: How major modes are specified or chosen.
|
||||
@end menu
|
||||
|
||||
@node Choosing Modes,,Major Modes,Major Modes
|
||||
@section How Major Modes are Chosen
|
||||
|
||||
@cindex choosing a major mode
|
||||
You can select a major mode explicitly for the current buffer, but
|
||||
most of the time Emacs determines which mode to use based on the file
|
||||
name or on special text in the file.
|
||||
|
||||
Explicit selection of a new major mode is done with a @kbd{M-x} command.
|
||||
From the name of a major mode, add @code{-mode} to get the name of a
|
||||
command to select that mode. Thus, you can enter Lisp mode by executing
|
||||
@kbd{M-x lisp-mode}.
|
||||
|
||||
@vindex auto-mode-alist
|
||||
When you visit a file, Emacs usually chooses the right major mode based
|
||||
on the file's name. For example, files whose names end in @samp{.c} are
|
||||
edited in C mode. The correspondence between file names and major modes is
|
||||
controlled by the variable @code{auto-mode-alist}. Its value is a list in
|
||||
which each element has this form,
|
||||
|
||||
@example
|
||||
(@var{regexp} . @var{mode-function})
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
or this form,
|
||||
|
||||
@example
|
||||
(@var{regexp} @var{mode-function} @var{flag})
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
For example, one element normally found in the list has the form
|
||||
@code{(@t{"\\.c\\'"} . c-mode)}, and it is responsible for selecting C
|
||||
mode for files whose names end in @file{.c}. (Note that @samp{\\} is
|
||||
needed in Lisp syntax to include a @samp{\} in the string, which is
|
||||
needed to suppress the special meaning of @samp{.} in regexps.) If the
|
||||
element has the form @code{(@var{regexp} @var{mode-function}
|
||||
@var{flag})} and @var{flag} is non-@code{nil}, then after calling
|
||||
@var{function}, the suffix that matched @var{regexp} is discarded and
|
||||
the list is searched again for another match.
|
||||
|
||||
You can specify which major mode should be used for editing a certain
|
||||
file by a special sort of text in the first nonblank line of the file. The
|
||||
mode name should appear in this line both preceded and followed by
|
||||
@samp{-*-}. Other text may appear on the line as well. For example,
|
||||
|
||||
@example
|
||||
;-*-Lisp-*-
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
tells Emacs to use Lisp mode. Such an explicit specification overrides
|
||||
any defaulting based on the file name. Note how the semicolon is used
|
||||
to make Lisp treat this line as a comment.
|
||||
|
||||
Another format of mode specification is
|
||||
|
||||
@example
|
||||
-*- mode: @var{modename};-*-
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
which allows you to specify local variables as well, like this:
|
||||
|
||||
@example
|
||||
-*- mode: @var{modename}; @var{var}: @var{value}; @dots{} -*-
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
@xref{File Variables}, for more information about this.
|
||||
|
||||
@vindex interpreter-mode-alist
|
||||
When a file's contents begin with @samp{#!}, it can serve as an
|
||||
executable shell command, which works by running an interpreter named on
|
||||
the file's first line. The rest of the file is used as input to the
|
||||
interpreter.
|
||||
|
||||
When you visit such a file in Emacs, if the file's name does not
|
||||
specify a major mode, Emacs uses the interpreter name on the first line
|
||||
to choose a mode. If the first line is the name of a recognized
|
||||
interpreter program, such as @samp{perl} or @samp{tcl}, Emacs uses a
|
||||
mode appropriate for programs for that interpreter. The variable
|
||||
@code{interpreter-mode-alist} specifies the correspondence between
|
||||
interpreter program names and major modes.
|
||||
|
||||
When the first line starts with @samp{#!}, you cannot (on many
|
||||
systems) use the @samp{-*-} feature on the first line, because the
|
||||
system would get confused when running the interpreter. So Emacs looks
|
||||
for @samp{-*-} on the second line in such files as well as on the
|
||||
first line.
|
||||
|
||||
@vindex default-major-mode
|
||||
When you visit a file that does not specify a major mode to use, or
|
||||
when you create a new buffer with @kbd{C-x b}, the variable
|
||||
@code{default-major-mode} specifies which major mode to use. Normally
|
||||
its value is the symbol @code{fundamental-mode}, which specifies
|
||||
Fundamental mode. If @code{default-major-mode} is @code{nil}, the major
|
||||
mode is taken from the previously selected buffer.
|
||||
|
||||
@findex normal-mode
|
||||
If you change the major mode of a buffer, you can go back to the major
|
||||
mode Emacs would choose automatically: use the command @kbd{M-x
|
||||
normal-mode} to do this. This is the same function that
|
||||
@code{find-file} calls to choose the major mode. It also processes
|
||||
the file's local variables list if any.
|
||||
|
||||
@vindex change-major-mode-with-file-name
|
||||
The commands @kbd{C-x C-w} and @code{set-visited-file-name} change to
|
||||
a new major mode if the new file name implies a mode (@pxref{Saving}).
|
||||
However, this does not happen if the buffer contents specify a major
|
||||
mode, and certain ``special'' major modes do not allow the mode to
|
||||
change. You can turn off this mode-changing feature by setting
|
||||
@code{change-major-mode-with-file-name} to @code{nil}.
|
351
man/mark.texi
Normal file
351
man/mark.texi
Normal file
|
@ -0,0 +1,351 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Mark, Killing, Help, Top
|
||||
@chapter The Mark and the Region
|
||||
@cindex mark
|
||||
@cindex setting a mark
|
||||
@cindex region
|
||||
|
||||
Many Emacs commands operate on an arbitrary contiguous part of the
|
||||
current buffer. To specify the text for such a command to operate on,
|
||||
you set @dfn{the mark} at one end of it, and move point to the other
|
||||
end. The text between point and the mark is called @dfn{the region}.
|
||||
Emacs highlights the region whenever there is one, if you enable
|
||||
Transient Mark mode (@pxref{Transient Mark}).
|
||||
|
||||
You can move point or the mark to adjust the boundaries of the region.
|
||||
It doesn't matter which one is set first chronologically, or which one
|
||||
comes earlier in the text. Once the mark has been set, it remains where
|
||||
you put it until you set it again at another place. Each Emacs buffer
|
||||
has its own mark, so that when you return to a buffer that had been
|
||||
selected previously, it has the same mark it had before.
|
||||
|
||||
Many commands that insert text, such as @kbd{C-y} (@code{yank}) and
|
||||
@kbd{M-x insert-buffer}, position point and the mark at opposite ends of
|
||||
the inserted text, so that the region contains the text just inserted.
|
||||
|
||||
Aside from delimiting the region, the mark is also useful for
|
||||
remembering a spot that you may want to go back to. To make this
|
||||
feature more useful, each buffer remembers 16 previous locations of the
|
||||
mark in the @dfn{mark ring}.
|
||||
|
||||
@menu
|
||||
* Setting Mark:: Commands to set the mark.
|
||||
* Transient Mark:: How to make Emacs highlight the region--
|
||||
when there is one.
|
||||
* Using Region:: Summary of ways to operate on contents of the region.
|
||||
* Marking Objects:: Commands to put region around textual units.
|
||||
* Mark Ring:: Previous mark positions saved so you can go back there.
|
||||
* Global Mark Ring:: Previous mark positions in various buffers.
|
||||
@end menu
|
||||
|
||||
@node Setting Mark
|
||||
@section Setting the Mark
|
||||
|
||||
Here are some commands for setting the mark:
|
||||
|
||||
@c WideCommands
|
||||
@table @kbd
|
||||
@item C-@key{SPC}
|
||||
Set the mark where point is (@code{set-mark-command}).
|
||||
@item C-@@
|
||||
The same.
|
||||
@item C-x C-x
|
||||
Interchange mark and point (@code{exchange-point-and-mark}).
|
||||
@item Drag-Mouse-1
|
||||
Set point and the mark around the text you drag across.
|
||||
@item Mouse-3
|
||||
Set the mark where point is, then move point to where you click
|
||||
(@code{mouse-save-then-kill}).
|
||||
@end table
|
||||
|
||||
For example, suppose you wish to convert part of the buffer to
|
||||
upper case, using the @kbd{C-x C-u} (@code{upcase-region}) command,
|
||||
which operates on the text in the region. You can first go to the
|
||||
beginning of the text to be capitalized, type @kbd{C-@key{SPC}} to put
|
||||
the mark there, move to the end, and then type @kbd{C-x C-u}. Or, you
|
||||
can set the mark at the end of the text, move to the beginning, and then
|
||||
type @kbd{C-x C-u}.
|
||||
|
||||
@kindex C-SPC
|
||||
@findex set-mark-command
|
||||
The most common way to set the mark is with the @kbd{C-@key{SPC}} command
|
||||
(@code{set-mark-command}). This sets the mark where point is. Then you
|
||||
can move point away, leaving the mark behind.
|
||||
|
||||
There are two ways to set the mark with the mouse. You can drag mouse
|
||||
button one across a range of text; that puts point where you release the
|
||||
mouse button, and sets the mark at the other end of that range. Or you
|
||||
can click mouse button three, which sets the mark at point (like
|
||||
@kbd{C-@key{SPC}}) and then moves point (like @kbd{Mouse-1}). Both of
|
||||
these methods copy the region into the kill ring in addition to setting
|
||||
the mark; that gives behavior consistent with other window-driven
|
||||
applications, but if you don't want to modify the kill ring, you must
|
||||
use keyboard commands to set the mark. @xref{Mouse Commands}.
|
||||
|
||||
@kindex C-x C-x
|
||||
@findex exchange-point-and-mark
|
||||
Ordinary terminals have only one cursor, so there is no way for Emacs
|
||||
to show you where the mark is located. You have to remember. The usual
|
||||
solution to this problem is to set the mark and then use it soon, before
|
||||
you forget where it is. Alternatively, you can see where the mark is
|
||||
with the command @kbd{C-x C-x} (@code{exchange-point-and-mark}) which
|
||||
puts the mark where point was and point where the mark was. The extent
|
||||
of the region is unchanged, but the cursor and point are now at the
|
||||
previous position of the mark. In Transient Mark mode, this command
|
||||
reactivates the mark.
|
||||
|
||||
@kbd{C-x C-x} is also useful when you are satisfied with the position
|
||||
of point but want to move the other end of the region (where the mark
|
||||
is); do @kbd{C-x C-x} to put point at that end of the region, and then
|
||||
move it. A second use of @kbd{C-x C-x}, if necessary, puts the mark at
|
||||
the new position with point back at its original position.
|
||||
|
||||
@kindex C-@@
|
||||
There is no such character as @kbd{C-@key{SPC}} in ASCII; when you
|
||||
type @key{SPC} while holding down @key{CTRL}, what you get on most
|
||||
ordinary terminals is the character @kbd{C-@@}. This key is actually
|
||||
bound to @code{set-mark-command}. But unless you are unlucky enough to
|
||||
have a terminal where typing @kbd{C-@key{SPC}} does not produce
|
||||
@kbd{C-@@}, you might as well think of this character as
|
||||
@kbd{C-@key{SPC}}. Under X, @kbd{C-@key{SPC}} is actually a distinct
|
||||
character, but its binding is still @code{set-mark-command}.
|
||||
|
||||
@node Transient Mark
|
||||
@section Transient Mark Mode
|
||||
@cindex mode, Transient Mark
|
||||
@cindex Transient Mark mode
|
||||
@cindex highlighting region
|
||||
@cindex region highlighting
|
||||
|
||||
Emacs can highlight the current region, using X Windows. But normally
|
||||
it does not. Why not?
|
||||
|
||||
Highlighting the region doesn't work well ordinarily in Emacs, because
|
||||
once you have set a mark, there is @emph{always} a region (in that
|
||||
buffer). And highlighting the region all the time would be a nuisance.
|
||||
|
||||
You can turn on region highlighting by enabling Transient Mark mode.
|
||||
This is a more rigid mode of operation in which the region ``lasts''
|
||||
only temporarily, so you must set up a region for each command that uses
|
||||
one. In Transient Mark mode, most of the time there is no region;
|
||||
therefore, highlighting the region when it exists is convenient.
|
||||
|
||||
@findex transient-mark-mode
|
||||
To enable Transient Mark mode, type @kbd{M-x transient-mark-mode}.
|
||||
This command toggles the mode, so you can repeat the command to turn off
|
||||
the mode.
|
||||
|
||||
Here are the details of Transient Mark mode:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
To set the mark, type @kbd{C-@key{SPC}} (@code{set-mark-command}).
|
||||
This makes the mark active; as you move point, you will see the region
|
||||
highlighting grow and shrink.
|
||||
|
||||
@item
|
||||
The mouse commands for specifying the mark also make it active. So do
|
||||
keyboard commands whose purpose is to specify a region, including
|
||||
@kbd{M-@@}, @kbd{C-M-@@}, @kbd{M-h}, @kbd{C-M-h}, @kbd{C-x C-p}, and
|
||||
@kbd{C-x h}.
|
||||
|
||||
@item
|
||||
When the mark is active, you can execute commands that operate on the
|
||||
region, such as killing, indenting, or writing to a file.
|
||||
|
||||
@item
|
||||
Any change to the buffer, such as inserting or deleting a character,
|
||||
deactivates the mark. This means any subsequent command that operates
|
||||
on a region will get an error and refuse to operate. You can make the
|
||||
region active again by typing @kbd{C-x C-x}.
|
||||
|
||||
@item
|
||||
Commands like @kbd{M->} and @kbd{C-s} that ``leave the mark behind'' in
|
||||
addition to some other primary purpose do not activate the new mark.
|
||||
You can activate the new region by executing @kbd{C-x C-x}
|
||||
(@code{exchange-point-and-mark}).
|
||||
|
||||
@item
|
||||
@kbd{C-s} when the mark is active does not alter the mark.
|
||||
|
||||
@item
|
||||
Quitting with @kbd{C-g} deactivates the mark.
|
||||
@end itemize
|
||||
|
||||
Highlighting of the region uses the @code{region} face; you can
|
||||
customize how the region is highlighted by changing this face.
|
||||
@xref{Face Customization}.
|
||||
|
||||
@vindex highlight-nonselected-windows
|
||||
When multiple windows show the same buffer, they can have different
|
||||
regions, because they can have different values of point (though they
|
||||
all share one common mark position). Ordinarily, only the selected
|
||||
window highlights its region (@pxref{Windows}). However, if the
|
||||
variable @code{highlight-nonselected-windows} is non-@code{nil}, then
|
||||
each window highlights its own region (provided that Transient Mark mode
|
||||
is enabled and the window's buffer's mark is active).
|
||||
|
||||
When Transient Mark mode is not enabled, every command that sets the
|
||||
mark also activates it, and nothing ever deactivates it.
|
||||
|
||||
@vindex mark-even-if-inactive
|
||||
If the variable @code{mark-even-if-inactive} is non-@code{nil} in
|
||||
Transient Mark mode, then commands can use the mark and the region
|
||||
even when it is inactive. Region highlighting appears and disappears
|
||||
just as it normally does in Transient Mark mode, but the mark doesn't
|
||||
really go away when the highlighting disappears.
|
||||
|
||||
@cindex Zmacs mode
|
||||
Transient Mark mode is also sometimes known as ``Zmacs mode''
|
||||
because the Zmacs editor on the MIT Lisp Machine handled the mark in a
|
||||
similar way.
|
||||
|
||||
@node Using Region
|
||||
@section Operating on the Region
|
||||
|
||||
@cindex operations on a marked region
|
||||
Once you have a region and the mark is active, here are some of the
|
||||
ways you can operate on the region:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Kill it with @kbd{C-w} (@pxref{Killing}).
|
||||
@item
|
||||
Save it in a register with @kbd{C-x r s} (@pxref{Registers}).
|
||||
@item
|
||||
Save it in a buffer or a file (@pxref{Accumulating Text}).
|
||||
@item
|
||||
Convert case with @kbd{C-x C-l} or @kbd{C-x C-u} (@pxref{Case}).
|
||||
@item
|
||||
Indent it with @kbd{C-x @key{TAB}} or @kbd{C-M-\} (@pxref{Indentation}).
|
||||
@item
|
||||
Fill it as text with @kbd{M-x fill-region} (@pxref{Filling}).
|
||||
@item
|
||||
Print hardcopy with @kbd{M-x print-region} (@pxref{Hardcopy}).
|
||||
@item
|
||||
Evaluate it as Lisp code with @kbd{M-x eval-region} (@pxref{Lisp Eval}).
|
||||
@end itemize
|
||||
|
||||
Most commands that operate on the text in the
|
||||
region have the word @code{region} in their names.
|
||||
|
||||
@node Marking Objects
|
||||
@section Commands to Mark Textual Objects
|
||||
|
||||
@cindex marking sections of text
|
||||
Here are the commands for placing point and the mark around a textual
|
||||
object such as a word, list, paragraph or page.
|
||||
|
||||
@table @kbd
|
||||
@item M-@@
|
||||
Set mark after end of next word (@code{mark-word}). This command and
|
||||
the following one do not move point.
|
||||
@item C-M-@@
|
||||
Set mark after end of next Lisp expression (@code{mark-sexp}).
|
||||
@item M-h
|
||||
Put region around current paragraph (@code{mark-paragraph}).
|
||||
@item C-M-h
|
||||
Put region around current Lisp defun (@code{mark-defun}).
|
||||
@item C-x h
|
||||
Put region around entire buffer (@code{mark-whole-buffer}).
|
||||
@item C-x C-p
|
||||
Put region around current page (@code{mark-page}).
|
||||
@end table
|
||||
|
||||
@kbd{M-@@} (@code{mark-word}) puts the mark at the end of the next word,
|
||||
while @kbd{C-M-@@} (@code{mark-sexp}) puts it at the end of the next Lisp
|
||||
expression. These commands handle arguments just like @kbd{M-f} and
|
||||
@kbd{C-M-f}.
|
||||
|
||||
@kindex C-x h
|
||||
@findex mark-whole-buffer
|
||||
Other commands set both point and mark, to delimit an object in the
|
||||
buffer. For example, @kbd{M-h} (@code{mark-paragraph}) moves point to
|
||||
the beginning of the paragraph that surrounds or follows point, and puts
|
||||
the mark at the end of that paragraph (@pxref{Paragraphs}). It prepares
|
||||
the region so you can indent, case-convert, or kill a whole paragraph.
|
||||
|
||||
@kbd{C-M-h} (@code{mark-defun}) similarly puts point before and the
|
||||
mark after the current or following defun (@pxref{Defuns}). @kbd{C-x
|
||||
C-p} (@code{mark-page}) puts point before the current page, and mark at
|
||||
the end (@pxref{Pages}). The mark goes after the terminating page
|
||||
delimiter (to include it), while point goes after the preceding page
|
||||
delimiter (to exclude it). A numeric argument specifies a later page
|
||||
(if positive) or an earlier page (if negative) instead of the current
|
||||
page.
|
||||
|
||||
Finally, @kbd{C-x h} (@code{mark-whole-buffer}) sets up the entire
|
||||
buffer as the region, by putting point at the beginning and the mark at
|
||||
the end.
|
||||
|
||||
In Transient Mark mode, all of these commands activate the mark.
|
||||
|
||||
@node Mark Ring
|
||||
@section The Mark Ring
|
||||
|
||||
@kindex C-u C-SPC
|
||||
@cindex mark ring
|
||||
@kindex C-u C-@@
|
||||
Aside from delimiting the region, the mark is also useful for
|
||||
remembering a spot that you may want to go back to. To make this
|
||||
feature more useful, each buffer remembers 16 previous locations of the
|
||||
mark, in the @dfn{mark ring}. Commands that set the mark also push the
|
||||
old mark onto this ring. To return to a marked location, use @kbd{C-u
|
||||
C-@key{SPC}} (or @kbd{C-u C-@@}); this is the command
|
||||
@code{set-mark-command} given a numeric argument. It moves point to
|
||||
where the mark was, and restores the mark from the ring of former
|
||||
marks. Thus, repeated use of this command moves point to all of the old
|
||||
marks on the ring, one by one. The mark positions you move through in
|
||||
this way are not lost; they go to the end of the ring.
|
||||
|
||||
Each buffer has its own mark ring. All editing commands use the current
|
||||
buffer's mark ring. In particular, @kbd{C-u C-@key{SPC}} always stays in
|
||||
the same buffer.
|
||||
|
||||
Many commands that can move long distances, such as @kbd{M-<}
|
||||
(@code{beginning-of-buffer}), start by setting the mark and saving the
|
||||
old mark on the mark ring. This is to make it easier for you to move
|
||||
back later. Searches set the mark if they move point. You can tell
|
||||
when a command sets the mark because it displays @samp{Mark Set} in the
|
||||
echo area.
|
||||
|
||||
If you want to move back to the same place over and over, the mark
|
||||
ring may not be convenient enough. If so, you can record the position
|
||||
in a register for later retrieval (@pxref{RegPos}).
|
||||
|
||||
@vindex mark-ring-max
|
||||
The variable @code{mark-ring-max} specifies the maximum number of
|
||||
entries to keep in the mark ring. If that many entries exist and
|
||||
another one is pushed, the last one in the list is discarded. Repeating
|
||||
@kbd{C-u C-@key{SPC}} cycles through the positions currently in the
|
||||
ring.
|
||||
|
||||
@vindex mark-ring
|
||||
The variable @code{mark-ring} holds the mark ring itself, as a list of
|
||||
marker objects, with the most recent first. This variable is local in
|
||||
every buffer.
|
||||
|
||||
@node Global Mark Ring
|
||||
@section The Global Mark Ring
|
||||
@cindex global mark ring
|
||||
|
||||
In addition to the ordinary mark ring that belongs to each buffer,
|
||||
Emacs has a single @dfn{global mark ring}. It records a sequence of
|
||||
buffers in which you have recently set the mark, so you can go back
|
||||
to those buffers.
|
||||
|
||||
Setting the mark always makes an entry on the current buffer's mark
|
||||
ring. If you have switched buffers since the previous mark setting, the
|
||||
new mark position makes an entry on the global mark ring also. The
|
||||
result is that the global mark ring records a sequence of buffers that
|
||||
you have been in, and, for each buffer, a place where you set the mark.
|
||||
|
||||
@kindex C-x C-@key{SPC}
|
||||
@findex pop-global-mark
|
||||
The command @kbd{C-x C-@key{SPC}} (@code{pop-global-mark}) jumps to
|
||||
the buffer and position of the latest entry in the global ring. It also
|
||||
rotates the ring, so that successive uses of @kbd{C-x C-@key{SPC}} take
|
||||
you to earlier and earlier buffers.
|
||||
|
1325
man/message.texi
Normal file
1325
man/message.texi
Normal file
File diff suppressed because it is too large
Load diff
4096
man/mh-e.texi
Normal file
4096
man/mh-e.texi
Normal file
File diff suppressed because it is too large
Load diff
534
man/mini.texi
Normal file
534
man/mini.texi
Normal file
|
@ -0,0 +1,534 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Minibuffer, M-x, Basic, Top
|
||||
@chapter The Minibuffer
|
||||
@cindex minibuffer
|
||||
|
||||
The @dfn{minibuffer} is the facility used by Emacs commands to read
|
||||
arguments more complicated than a single number. Minibuffer arguments
|
||||
can be file names, buffer names, Lisp function names, Emacs command
|
||||
names, Lisp expressions, and many other things, depending on the command
|
||||
reading the argument. You can use the usual Emacs editing commands in
|
||||
the minibuffer to edit the argument text.
|
||||
|
||||
@cindex prompt
|
||||
When the minibuffer is in use, it appears in the echo area, and the
|
||||
terminal's cursor moves there. The beginning of the minibuffer line
|
||||
displays a @dfn{prompt} which says what kind of input you should supply and
|
||||
how it will be used. Often this prompt is derived from the name of the
|
||||
command that the argument is for. The prompt normally ends with a colon.
|
||||
|
||||
@cindex default argument
|
||||
Sometimes a @dfn{default argument} appears in parentheses after the
|
||||
colon; it too is part of the prompt. The default will be used as the
|
||||
argument value if you enter an empty argument (for example, just type
|
||||
@key{RET}). For example, commands that read buffer names always show a
|
||||
default, which is the name of the buffer that will be used if you type
|
||||
just @key{RET}.
|
||||
|
||||
The simplest way to enter a minibuffer argument is to type the text
|
||||
you want, terminated by @key{RET} which exits the minibuffer. You can
|
||||
cancel the command that wants the argument, and get out of the
|
||||
minibuffer, by typing @kbd{C-g}.
|
||||
|
||||
Since the minibuffer uses the screen space of the echo area, it can
|
||||
conflict with other ways Emacs customarily uses the echo area. Here is how
|
||||
Emacs handles such conflicts:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
If a command gets an error while you are in the minibuffer, this does
|
||||
not cancel the minibuffer. However, the echo area is needed for the
|
||||
error message and therefore the minibuffer itself is hidden for a
|
||||
while. It comes back after a few seconds, or as soon as you type
|
||||
anything.
|
||||
|
||||
@item
|
||||
If in the minibuffer you use a command whose purpose is to print a
|
||||
message in the echo area, such as @kbd{C-x =}, the message is printed
|
||||
normally, and the minibuffer is hidden for a while. It comes back
|
||||
after a few seconds, or as soon as you type anything.
|
||||
|
||||
@item
|
||||
Echoing of keystrokes does not take place while the minibuffer is in
|
||||
use.
|
||||
@end itemize
|
||||
|
||||
@menu
|
||||
* File: Minibuffer File. Entering file names with the minibuffer.
|
||||
* Edit: Minibuffer Edit. How to edit in the minibuffer.
|
||||
* Completion:: An abbreviation facility for minibuffer input.
|
||||
* Minibuffer History:: Reusing recent minibuffer arguments.
|
||||
* Repetition:: Re-executing commands that used the minibuffer.
|
||||
@end menu
|
||||
|
||||
@node Minibuffer File
|
||||
@section Minibuffers for File Names
|
||||
|
||||
Sometimes the minibuffer starts out with text in it. For example, when
|
||||
you are supposed to give a file name, the minibuffer starts out containing
|
||||
the @dfn{default directory}, which ends with a slash. This is to inform
|
||||
you which directory the file will be found in if you do not specify a
|
||||
directory.
|
||||
|
||||
@c Separate paragraph to clean up ugly pagebreak--rms
|
||||
@need 1500
|
||||
For example, the minibuffer might start out with these contents:
|
||||
|
||||
@example
|
||||
Find File: /u2/emacs/src/
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
where @samp{Find File:@: } is the prompt. Typing @kbd{buffer.c}
|
||||
specifies the file @file{/u2/emacs/src/buffer.c}. To find files in
|
||||
nearby directories, use @kbd{..}; thus, if you type
|
||||
@kbd{../lisp/simple.el}, you will get the file named
|
||||
@file{/u2/emacs/lisp/simple.el}. Alternatively, you can kill with
|
||||
@kbd{M-@key{DEL}} the directory names you don't want (@pxref{Words}).
|
||||
|
||||
If you don't want any of the default, you can kill it with @kbd{C-a
|
||||
C-k}. But you don't need to kill the default; you can simply ignore it.
|
||||
Insert an absolute file name, one starting with a slash or a tilde,
|
||||
after the default directory. For example, to specify the file
|
||||
@file{/etc/termcap}, just insert that name, giving these minibuffer
|
||||
contents:
|
||||
|
||||
@example
|
||||
Find File: /u2/emacs/src//etc/termcap
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
@cindex // in file name
|
||||
@cindex double slash in file name
|
||||
@cindex slashes repeated in file name
|
||||
GNU Emacs gives a special meaning to a double slash (which is not
|
||||
normally a useful thing to write): it means, ``ignore everything before
|
||||
the second slash in the pair.'' Thus, @samp{/u2/emacs/src/} is ignored
|
||||
in the example above, and you get the file @file{/etc/termcap}.
|
||||
|
||||
If you set @code{insert-default-directory} to @code{nil}, the default
|
||||
directory is not inserted in the minibuffer. This way, the minibuffer
|
||||
starts out empty. But the name you type, if relative, is still
|
||||
interpreted with respect to the same default directory.
|
||||
|
||||
@node Minibuffer Edit
|
||||
@section Editing in the Minibuffer
|
||||
|
||||
The minibuffer is an Emacs buffer (albeit a peculiar one), and the usual
|
||||
Emacs commands are available for editing the text of an argument you are
|
||||
entering.
|
||||
|
||||
Since @key{RET} in the minibuffer is defined to exit the minibuffer,
|
||||
you can't use it to insert a newline in the minibuffer. To do that,
|
||||
type @kbd{C-o} or @kbd{C-q C-j}. (Recall that a newline is really the
|
||||
character control-J.)
|
||||
|
||||
The minibuffer has its own window which always has space on the screen
|
||||
but acts as if it were not there when the minibuffer is not in use. When
|
||||
the minibuffer is in use, its window is just like the others; you can
|
||||
switch to another window with @kbd{C-x o}, edit text in other windows and
|
||||
perhaps even visit more files, before returning to the minibuffer to submit
|
||||
the argument. You can kill text in another window, return to the
|
||||
minibuffer window, and then yank the text to use it in the argument.
|
||||
@xref{Windows}.
|
||||
|
||||
@findex resize-minibuffer-mode
|
||||
@cindex Resize-Minibuffer mode
|
||||
@cindex mode, Resize-Minibuffer
|
||||
@cindex height of minibuffer
|
||||
@cindex size of minibuffer
|
||||
@cindex growing minibuffer
|
||||
There are some restrictions on the use of the minibuffer window,
|
||||
however. You cannot switch buffers in it---the minibuffer and its
|
||||
window are permanently attached. Also, you cannot split or kill the
|
||||
minibuffer window. But you can make it taller in the normal fashion
|
||||
with @kbd{C-x ^}. If you enable Resize-Minibuffer mode, then the
|
||||
minibuffer window expands vertically as necessary to hold the text that
|
||||
you put in the minibuffer. Use @kbd{M-x resize-minibuffer-mode} to
|
||||
enable or disable this minor mode (@pxref{Minor Modes}).
|
||||
|
||||
@vindex minibuffer-scroll-overlap
|
||||
Scrolling works specially in the minibuffer window. When the
|
||||
minibuffer is just one line high, and it contains a long line of text
|
||||
that won't fit on the screen, scrolling automatically maintains an
|
||||
overlap of a certain number of characters from one continuation line to
|
||||
the next. The variable @code{minibuffer-scroll-overlap} specifies how
|
||||
many characters of overlap; the default is 20.
|
||||
|
||||
If while in the minibuffer you issue a command that displays help text
|
||||
of any sort in another window, you can use the @kbd{C-M-v} command while
|
||||
in the minibuffer to scroll the help text. This lasts until you exit
|
||||
the minibuffer. This feature is especially useful if a completing
|
||||
minibuffer gives you a list of possible completions. @xref{Other Window}.
|
||||
|
||||
@vindex enable-recursive-minibuffers
|
||||
Emacs normally disallows most commands that use the minibuffer while
|
||||
the minibuffer is active. This rule is to prevent recursive minibuffers
|
||||
from confusing novice users. If you want to be able to use such
|
||||
commands in the minibuffer, set the variable
|
||||
@code{enable-recursive-minibuffers} to a non-@code{nil} value.
|
||||
|
||||
@node Completion
|
||||
@section Completion
|
||||
@cindex completion
|
||||
|
||||
For certain kinds of arguments, you can use @dfn{completion} to enter
|
||||
the argument value. Completion means that you type part of the
|
||||
argument, then Emacs visibly fills in the rest, or as much as
|
||||
can be determined from the part you have typed.
|
||||
|
||||
When completion is available, certain keys---@key{TAB}, @key{RET}, and
|
||||
@key{SPC}---are rebound to complete the text present in the minibuffer
|
||||
into a longer string that it stands for, by matching it against a set of
|
||||
@dfn{completion alternatives} provided by the command reading the
|
||||
argument. @kbd{?} is defined to display a list of possible completions
|
||||
of what you have inserted.
|
||||
|
||||
For example, when @kbd{M-x} uses the minibuffer to read the name of a
|
||||
command, it provides a list of all available Emacs command names to
|
||||
complete against. The completion keys match the text in the minibuffer
|
||||
against all the command names, find any additional name characters
|
||||
implied by the ones already present in the minibuffer, and add those
|
||||
characters to the ones you have given. This is what makes it possible
|
||||
to type @kbd{M-x ins @key{SPC} b @key{RET}} instead of @kbd{M-x
|
||||
insert-buffer @key{RET}} (for example).
|
||||
|
||||
Case is normally significant in completion, because it is significant
|
||||
in most of the names that you can complete (buffer names, file names and
|
||||
command names). Thus, @samp{fo} does not complete to @samp{Foo}.
|
||||
Completion does ignore case distinctions for certain arguments in which
|
||||
case does not matter.
|
||||
|
||||
@menu
|
||||
* Example: Completion Example.
|
||||
* Commands: Completion Commands.
|
||||
* Strict Completion::
|
||||
* Options: Completion Options.
|
||||
@end menu
|
||||
|
||||
@node Completion Example
|
||||
@subsection Completion Example
|
||||
|
||||
@kindex TAB @r{(completion)}
|
||||
@findex minibuffer-complete
|
||||
A concrete example may help here. If you type @kbd{M-x au @key{TAB}},
|
||||
the @key{TAB} looks for alternatives (in this case, command names) that
|
||||
start with @samp{au}. There are several, including
|
||||
@code{auto-fill-mode} and @code{auto-save-mode}---but they are all the
|
||||
same as far as @code{auto-}, so the @samp{au} in the minibuffer changes
|
||||
to @samp{auto-}.@refill
|
||||
|
||||
If you type @key{TAB} again immediately, there are multiple
|
||||
possibilities for the very next character---it could be any of
|
||||
@samp{cfilrs}---so no more characters are added; instead, @key{TAB}
|
||||
displays a list of all possible completions in another window.
|
||||
|
||||
If you go on to type @kbd{f @key{TAB}}, this @key{TAB} sees
|
||||
@samp{auto-f}. The only command name starting this way is
|
||||
@code{auto-fill-mode}, so completion fills in the rest of that. You now
|
||||
have @samp{auto-fill-mode} in the minibuffer after typing just @kbd{au
|
||||
@key{TAB} f @key{TAB}}. Note that @key{TAB} has this effect because in
|
||||
the minibuffer it is bound to the command @code{minibuffer-complete}
|
||||
when completion is available.
|
||||
|
||||
@node Completion Commands
|
||||
@subsection Completion Commands
|
||||
|
||||
Here is a list of the completion commands defined in the minibuffer
|
||||
when completion is available.
|
||||
|
||||
@table @kbd
|
||||
@item @key{TAB}
|
||||
Complete the text in the minibuffer as much as possible
|
||||
(@code{minibuffer-complete}).
|
||||
@item @key{SPC}
|
||||
Complete the minibuffer text, but don't go beyond one word
|
||||
(@code{minibuffer-complete-word}).
|
||||
@item @key{RET}
|
||||
Submit the text in the minibuffer as the argument, possibly completing
|
||||
first as described below (@code{minibuffer-complete-and-exit}).
|
||||
@item ?
|
||||
Print a list of all possible completions of the text in the minibuffer
|
||||
(@code{minibuffer-list-completions}).
|
||||
@end table
|
||||
|
||||
@kindex SPC
|
||||
@findex minibuffer-complete-word
|
||||
@key{SPC} completes much like @key{TAB}, but never goes beyond the
|
||||
next hyphen or space. If you have @samp{auto-f} in the minibuffer and
|
||||
type @key{SPC}, it finds that the completion is @samp{auto-fill-mode},
|
||||
but it stops completing after @samp{fill-}. This gives
|
||||
@samp{auto-fill-}. Another @key{SPC} at this point completes all the
|
||||
way to @samp{auto-fill-mode}. @key{SPC} in the minibuffer when
|
||||
completion is available runs the command
|
||||
@code{minibuffer-complete-word}.
|
||||
|
||||
Here are some commands you can use to choose a completion from a
|
||||
window that displays a list of completions:
|
||||
|
||||
@table @kbd
|
||||
@findex mouse-choose-completion
|
||||
@item Mouse-2
|
||||
Clicking mouse button 2 on a completion in the list of possible
|
||||
completions chooses that completion (@code{mouse-choose-completion}).
|
||||
You normally use this command while point is in the minibuffer; but you
|
||||
must click in the list of completions, not in the minibuffer itself.
|
||||
|
||||
@findex switch-to-completions
|
||||
@item @key{PRIOR}
|
||||
@itemx M-v
|
||||
Typing @key{PRIOR} or @key{PAGE-UP}, or @kbd{M-v}, while in the
|
||||
minibuffer, selects the window showing the completion list buffer
|
||||
(@code{switch-to-completions}). This paves the way for using the
|
||||
commands below. (Selecting that window in the usual ways has the same
|
||||
effect, but this way is more convenient.)
|
||||
|
||||
@findex choose-completion
|
||||
@item @key{RET}
|
||||
Typing @key{RET} @emph{in the completion list buffer} chooses the
|
||||
completion that point is in or next to (@code{choose-completion}). To
|
||||
use this command, you must first switch windows to the window that shows
|
||||
the list of completions.
|
||||
|
||||
@findex next-completion
|
||||
@item @key{RIGHT}
|
||||
Typing the right-arrow key @key{RIGHT} @emph{in the completion list
|
||||
buffer} moves point to the following completion (@code{next-completion}).
|
||||
|
||||
@findex previous-completion
|
||||
@item @key{LEFT}
|
||||
Typing the left-arrow key @key{LEFT} @emph{in the completion list
|
||||
buffer} moves point toward the beginning of the buffer, to the previous
|
||||
completion (@code{previous-completion}).
|
||||
@end table
|
||||
|
||||
@node Strict Completion
|
||||
@subsection Strict Completion
|
||||
|
||||
There are three different ways that @key{RET} can work in completing
|
||||
minibuffers, depending on how the argument will be used.
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
@dfn{Strict} completion is used when it is meaningless to give any
|
||||
argument except one of the known alternatives. For example, when
|
||||
@kbd{C-x k} reads the name of a buffer to kill, it is meaningless to
|
||||
give anything but the name of an existing buffer. In strict
|
||||
completion, @key{RET} refuses to exit if the text in the minibuffer
|
||||
does not complete to an exact match.
|
||||
|
||||
@item
|
||||
@dfn{Cautious} completion is similar to strict completion, except that
|
||||
@key{RET} exits only if the text was an exact match already, not
|
||||
needing completion. If the text is not an exact match, @key{RET} does
|
||||
not exit, but it does complete the text. If it completes to an exact
|
||||
match, a second @key{RET} will exit.
|
||||
|
||||
Cautious completion is used for reading file names for files that must
|
||||
already exist.
|
||||
|
||||
@item
|
||||
@dfn{Permissive} completion is used when any string whatever is
|
||||
meaningful, and the list of completion alternatives is just a guide.
|
||||
For example, when @kbd{C-x C-f} reads the name of a file to visit, any
|
||||
file name is allowed, in case you want to create a file. In
|
||||
permissive completion, @key{RET} takes the text in the minibuffer
|
||||
exactly as given, without completing it.
|
||||
@end itemize
|
||||
|
||||
The completion commands display a list of all possible completions in
|
||||
a window whenever there is more than one possibility for the very next
|
||||
character. Also, typing @kbd{?} explicitly requests such a list. If
|
||||
the list of completions is long, you can scroll it with @kbd{C-M-v}
|
||||
(@pxref{Other Window}).
|
||||
|
||||
@node Completion Options
|
||||
@subsection Completion Options
|
||||
|
||||
@vindex completion-ignored-extensions
|
||||
When completion is done on file names, certain file names are usually
|
||||
ignored. The variable @code{completion-ignored-extensions} contains a
|
||||
list of strings; a file whose name ends in any of those strings is
|
||||
ignored as a possible completion. The standard value of this variable
|
||||
has several elements including @code{".o"}, @code{".elc"}, @code{".dvi"}
|
||||
and @code{"~"}. The effect is that, for example, @samp{foo} can
|
||||
complete to @samp{foo.c} even though @samp{foo.o} exists as well.
|
||||
However, if @emph{all} the possible completions end in ``ignored''
|
||||
strings, then they are not ignored. Ignored extensions do not apply to
|
||||
lists of completions---those always mention all possible completions.
|
||||
|
||||
@vindex completion-auto-help
|
||||
Normally, a completion command that finds the next character is undetermined
|
||||
automatically displays a list of all possible completions. If the variable
|
||||
@code{completion-auto-help} is set to @code{nil}, this does not happen,
|
||||
and you must type @kbd{?} to display the possible completions.
|
||||
|
||||
@pindex complete
|
||||
The @code{complete} library implements a more powerful kind of
|
||||
completion that can complete multiple words at a time. For example, it
|
||||
can complete the command name abbreviation @code{p-b} into
|
||||
@code{print-buffer}, because no other command starts with two words
|
||||
whose initials are @samp{p} and @samp{b}. To use this library, put
|
||||
@code{(load "complete")} in your @file{~/.emacs} file (@pxref{Init
|
||||
File}).
|
||||
|
||||
@cindex Icomplete mode
|
||||
Icomplete mode presents a constantly-updated display that tells you
|
||||
what completions are available for the text you've entered so far. The
|
||||
command to enable or disable this minor mode is @kbd{M-x
|
||||
icomplete-mode}.
|
||||
|
||||
@node Minibuffer History
|
||||
@section Minibuffer History
|
||||
@cindex minibuffer history
|
||||
@cindex history of minibuffer input
|
||||
|
||||
Every argument that you enter with the minibuffer is saved on a
|
||||
@dfn{minibuffer history list} so that you can use it again later in
|
||||
another argument. Special commands load the text of an earlier argument
|
||||
in the minibuffer. They discard the old minibuffer contents, so you can
|
||||
think of them as moving through the history of previous arguments.
|
||||
|
||||
@table @kbd
|
||||
@item @key{UP}
|
||||
@itemx M-p
|
||||
Move to the next earlier argument string saved in the minibuffer history
|
||||
(@code{previous-history-element}).
|
||||
@item @key{DOWN}
|
||||
@itemx M-n
|
||||
Move to the next later argument string saved in the minibuffer history
|
||||
(@code{next-history-element}).
|
||||
@item M-r @var{regexp} @key{RET}
|
||||
Move to an earlier saved argument in the minibuffer history that has a
|
||||
match for @var{regexp} (@code{previous-matching-history-element}).
|
||||
@item M-s @var{regexp} @key{RET}
|
||||
Move to a later saved argument in the minibuffer history that has a
|
||||
match for @var{regexp} (@code{next-matching-history-element}).
|
||||
@end table
|
||||
|
||||
@kindex M-p @r{(minibuffer history)}
|
||||
@kindex M-n @r{(minibuffer history)}
|
||||
@findex next-history-element
|
||||
@findex previous-history-element
|
||||
The simplest way to reuse the saved arguments in the history list is
|
||||
to move through the history list one element at a time. While in the
|
||||
minibuffer, use @kbd{M-p} or up-arrow (@code{previous-history-element})
|
||||
to ``move to'' the next earlier minibuffer input, and use @kbd{M-n} or
|
||||
down-arrow (@code{next-history-element}) to ``move to'' the next later
|
||||
input.
|
||||
|
||||
The previous input that you fetch from the history entirely replaces
|
||||
the contents of the minibuffer. To use it as the argument, exit the
|
||||
minibuffer as usual with @key{RET}. You can also edit the text before
|
||||
you reuse it; this does not change the history element that you
|
||||
``moved'' to, but your new argument does go at the end of the history
|
||||
list in its own right.
|
||||
|
||||
For many minibuffer arguments there is a ``default'' value. In some
|
||||
cases, the minibuffer history commands know the default value. Then you
|
||||
can insert the default value into the minibuffer as text by using
|
||||
@kbd{M-n} to move ``into the future'' in the history. Eventually we
|
||||
hope to make this feature available whenever the minibuffer has a
|
||||
default value.
|
||||
|
||||
@findex previous-matching-history-element
|
||||
@findex next-matching-history-element
|
||||
@kindex M-r @r{(minibuffer history)}
|
||||
@kindex M-s @r{(minibuffer history)}
|
||||
There are also commands to search forward or backward through the
|
||||
history; they search for history elements that match a regular
|
||||
expression that you specify with the minibuffer. @kbd{M-r}
|
||||
(@code{previous-matching-history-element}) searches older elements in
|
||||
the history, while @kbd{M-s} (@code{next-matching-history-element})
|
||||
searches newer elements. By special dispensation, these commands can
|
||||
use the minibuffer to read their arguments even though you are already
|
||||
in the minibuffer when you issue them. As with incremental searching,
|
||||
an uppercase letter in the regular expression makes the search
|
||||
case-sensitive (@pxref{Search Case}).
|
||||
|
||||
@ignore
|
||||
We may change the precise way these commands read their arguments.
|
||||
Perhaps they will search for a match for the string given so far in the
|
||||
minibuffer; perhaps they will search for a literal match rather than a
|
||||
regular expression match; perhaps they will only accept matches at the
|
||||
beginning of a history element; perhaps they will read the string to
|
||||
search for incrementally like @kbd{C-s}. To find out what interface is
|
||||
actually available, type @kbd{C-h f previous-matching-history-element}.
|
||||
@end ignore
|
||||
|
||||
All uses of the minibuffer record your input on a history list, but
|
||||
there are separate history lists for different kinds of arguments. For
|
||||
example, there is a list for file names, used by all the commands that
|
||||
read file names. (As a special feature, this history list records
|
||||
the absolute file name, no more and no less, even if that is not how
|
||||
you entered the file name.)
|
||||
|
||||
There are several other very specific history lists, including one for
|
||||
command names read by @kbd{M-x}, one for buffer names, one for arguments
|
||||
of commands like @code{query-replace}, and one for compilation commands
|
||||
read by @code{compile}. Finally, there is one ``miscellaneous'' history
|
||||
list that most minibuffer arguments use.
|
||||
|
||||
@vindex history-length
|
||||
The variable @code{history-length} specifies the maximum length of a
|
||||
minibuffer history list; once a list gets that long, the oldest element
|
||||
is deleted each time an element is added. If the value of
|
||||
@code{history-length} is @code{t}, though, there is no maximum length
|
||||
and elements are never deleted.
|
||||
|
||||
@node Repetition
|
||||
@section Repeating Minibuffer Commands
|
||||
@cindex command history
|
||||
@cindex history of commands
|
||||
|
||||
Every command that uses the minibuffer at least once is recorded on a
|
||||
special history list, together with the values of its arguments, so that
|
||||
you can repeat the entire command. In particular, every use of
|
||||
@kbd{M-x} is recorded there, since @kbd{M-x} uses the minibuffer to read
|
||||
the command name.
|
||||
|
||||
@findex list-command-history
|
||||
@c widecommands
|
||||
@table @kbd
|
||||
@item C-x @key{ESC} @key{ESC}
|
||||
Re-execute a recent minibuffer command (@code{repeat-complex-command}).
|
||||
@item M-x list-command-history
|
||||
Display the entire command history, showing all the commands
|
||||
@kbd{C-x @key{ESC} @key{ESC}} can repeat, most recent first.
|
||||
@end table
|
||||
|
||||
@kindex C-x ESC ESC
|
||||
@findex repeat-complex-command
|
||||
@kbd{C-x @key{ESC} @key{ESC}} is used to re-execute a recent
|
||||
minibuffer-using command. With no argument, it repeats the last such
|
||||
command. A numeric argument specifies which command to repeat; one
|
||||
means the last one, and larger numbers specify earlier ones.
|
||||
|
||||
@kbd{C-x @key{ESC} @key{ESC}} works by turning the previous command
|
||||
into a Lisp expression and then entering a minibuffer initialized with
|
||||
the text for that expression. If you type just @key{RET}, the command
|
||||
is repeated as before. You can also change the command by editing the
|
||||
Lisp expression. Whatever expression you finally submit is what will be
|
||||
executed. The repeated command is added to the front of the command
|
||||
history unless it is identical to the most recently executed command
|
||||
already there.
|
||||
|
||||
Even if you don't understand Lisp syntax, it will probably be obvious
|
||||
which command is displayed for repetition. If you do not change the
|
||||
text, it will repeat exactly as before.
|
||||
|
||||
Once inside the minibuffer for @kbd{C-x @key{ESC} @key{ESC}}, you can
|
||||
use the minibuffer history commands (@kbd{M-p}, @kbd{M-n}, @kbd{M-r},
|
||||
@kbd{M-s}; @pxref{Minibuffer History}) to move through the history list
|
||||
of saved entire commands. After finding the desired previous command,
|
||||
you can edit its expression as usual and then resubmit it by typing
|
||||
@key{RET} as usual.
|
||||
|
||||
@vindex command-history
|
||||
The list of previous minibuffer-using commands is stored as a Lisp
|
||||
list in the variable @code{command-history}. Each element is a Lisp
|
||||
expression which describes one command and its arguments. Lisp programs
|
||||
can re-execute a command by calling @code{eval} with the
|
||||
@code{command-history} element.
|
1834
man/misc.texi
Normal file
1834
man/misc.texi
Normal file
File diff suppressed because it is too large
Load diff
1004
man/mule.texi
Normal file
1004
man/mule.texi
Normal file
File diff suppressed because it is too large
Load diff
263
man/picture.texi
Normal file
263
man/picture.texi
Normal file
|
@ -0,0 +1,263 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Picture, Sending Mail, Abbrevs, Top
|
||||
@chapter Editing Pictures
|
||||
@cindex pictures
|
||||
@cindex making pictures out of text characters
|
||||
@findex edit-picture
|
||||
|
||||
To edit a picture made out of text characters (for example, a picture
|
||||
of the division of a register into fields, as a comment in a program),
|
||||
use the command @kbd{M-x edit-picture} to enter Picture mode.
|
||||
|
||||
In Picture mode, editing is based on the @dfn{quarter-plane} model of
|
||||
text, according to which the text characters lie studded on an area that
|
||||
stretches infinitely far to the right and downward. The concept of the end
|
||||
of a line does not exist in this model; the most you can say is where the
|
||||
last nonblank character on the line is found.
|
||||
|
||||
Of course, Emacs really always considers text as a sequence of
|
||||
characters, and lines really do have ends. But Picture mode replaces
|
||||
the most frequently-used commands with variants that simulate the
|
||||
quarter-plane model of text. They do this by inserting spaces or by
|
||||
converting tabs to spaces.
|
||||
|
||||
Most of the basic editing commands of Emacs are redefined by Picture mode
|
||||
to do essentially the same thing but in a quarter-plane way. In addition,
|
||||
Picture mode defines various keys starting with the @kbd{C-c} prefix to
|
||||
run special picture editing commands.
|
||||
|
||||
One of these keys, @kbd{C-c C-c}, is pretty important. Often a
|
||||
picture is part of a larger file that is usually edited in some other
|
||||
major mode. @kbd{M-x edit-picture} records the name of the previous
|
||||
major mode so you can use the @kbd{C-c C-c} command
|
||||
(@code{picture-mode-exit}) later to go back to that mode. @kbd{C-c C-c}
|
||||
also deletes spaces from the ends of lines, unless given a numeric
|
||||
argument.
|
||||
|
||||
The special commands of Picture mode all work in other modes (provided
|
||||
the @file{picture} library is loaded), but are not bound to keys except
|
||||
in Picture mode. The descriptions below talk of moving ``one column''
|
||||
and so on, but all the picture mode commands handle numeric arguments as
|
||||
their normal equivalents do.
|
||||
|
||||
@vindex picture-mode-hook
|
||||
Turning on Picture mode runs the hook @code{picture-mode-hook}
|
||||
(@pxref{Hooks}).
|
||||
|
||||
@menu
|
||||
* Basic Picture:: Basic concepts and simple commands of Picture Mode.
|
||||
* Insert in Picture:: Controlling direction of cursor motion
|
||||
after "self-inserting" characters.
|
||||
* Tabs in Picture:: Various features for tab stops and indentation.
|
||||
* Rectangles in Picture:: Clearing and superimposing rectangles.
|
||||
@end menu
|
||||
|
||||
@node Basic Picture, Insert in Picture, Picture, Picture
|
||||
@section Basic Editing in Picture Mode
|
||||
|
||||
@findex picture-forward-column
|
||||
@findex picture-backward-column
|
||||
@findex picture-move-down
|
||||
@findex picture-move-up
|
||||
@cindex editing in Picture mode
|
||||
|
||||
Most keys do the same thing in Picture mode that they usually do, but
|
||||
do it in a quarter-plane style. For example, @kbd{C-f} is rebound to
|
||||
run @code{picture-forward-column}, a command which moves point one
|
||||
column to the right, inserting a space if necessary so that the actual
|
||||
end of the line makes no difference. @kbd{C-b} is rebound to run
|
||||
@code{picture-backward-column}, which always moves point left one
|
||||
column, converting a tab to multiple spaces if necessary. @kbd{C-n} and
|
||||
@kbd{C-p} are rebound to run @code{picture-move-down} and
|
||||
@code{picture-move-up}, which can either insert spaces or convert tabs
|
||||
as necessary to make sure that point stays in exactly the same column.
|
||||
@kbd{C-e} runs @code{picture-end-of-line}, which moves to after the last
|
||||
nonblank character on the line. There is no need to change @kbd{C-a},
|
||||
as the choice of screen model does not affect beginnings of
|
||||
lines.
|
||||
|
||||
@findex picture-newline
|
||||
Insertion of text is adapted to the quarter-plane screen model through
|
||||
the use of Overwrite mode (@pxref{Minor Modes}). Self-inserting characters
|
||||
replace existing text, column by column, rather than pushing existing text
|
||||
to the right. @key{RET} runs @code{picture-newline}, which just moves to
|
||||
the beginning of the following line so that new text will replace that
|
||||
line.
|
||||
|
||||
@findex picture-backward-clear-column
|
||||
@findex picture-clear-column
|
||||
@findex picture-clear-line
|
||||
Picture mode provides erasure instead of deletion and killing of
|
||||
text. @key{DEL} (@code{picture-backward-clear-column}) replaces the
|
||||
preceding character with a space rather than removing it; this moves
|
||||
point backwards. @kbd{C-d} (@code{picture-clear-column}) replaces the
|
||||
next character or characters with spaces, but does not move point. (If
|
||||
you want to clear characters to spaces and move forward over them, use
|
||||
@key{SPC}.) @kbd{C-k} (@code{picture-clear-line}) really kills the
|
||||
contents of lines, but does not delete the newlines from the
|
||||
buffer.
|
||||
|
||||
@findex picture-open-line
|
||||
To do actual insertion, you must use special commands. @kbd{C-o}
|
||||
(@code{picture-open-line}) creates a blank line after the current line;
|
||||
it never splits a line. @kbd{C-M-o} (@code{split-line}) makes sense in
|
||||
Picture mode, so it is not changed. @kbd{C-j}
|
||||
(@code{picture-duplicate-line}) inserts below the current line another
|
||||
line with the same contents.@refill
|
||||
|
||||
@kindex C-c C-d @r{(Picture mode)}
|
||||
To do actual deletion in Picture mode, use @kbd{C-w}, @kbd{C-c C-d}
|
||||
(which is defined as @code{delete-char}, as @kbd{C-d} is in other
|
||||
modes), or one of the picture rectangle commands (@pxref{Rectangles in
|
||||
Picture}).
|
||||
|
||||
@node Insert in Picture, Tabs in Picture, Basic Picture, Picture
|
||||
@section Controlling Motion after Insert
|
||||
|
||||
@findex picture-movement-up
|
||||
@findex picture-movement-down
|
||||
@findex picture-movement-left
|
||||
@findex picture-movement-right
|
||||
@findex picture-movement-nw
|
||||
@findex picture-movement-ne
|
||||
@findex picture-movement-sw
|
||||
@findex picture-movement-se
|
||||
@kindex C-c < @r{(Picture mode)}
|
||||
@kindex C-c > @r{(Picture mode)}
|
||||
@kindex C-c ^ @r{(Picture mode)}
|
||||
@kindex C-c . @r{(Picture mode)}
|
||||
@kindex C-c ` @r{(Picture mode)}
|
||||
@kindex C-c ' @r{(Picture mode)}
|
||||
@kindex C-c / @r{(Picture mode)}
|
||||
@kindex C-c \ @r{(Picture mode)}
|
||||
Since ``self-inserting'' characters in Picture mode overwrite and move
|
||||
point, there is no essential restriction on how point should be moved.
|
||||
Normally point moves right, but you can specify any of the eight
|
||||
orthogonal or diagonal directions for motion after a ``self-inserting''
|
||||
character. This is useful for drawing lines in the buffer.
|
||||
|
||||
@table @kbd
|
||||
@item C-c <
|
||||
Move left after insertion (@code{picture-movement-left}).
|
||||
@item C-c >
|
||||
Move right after insertion (@code{picture-movement-right}).
|
||||
@item C-c ^
|
||||
Move up after insertion (@code{picture-movement-up}).
|
||||
@item C-c .
|
||||
Move down after insertion (@code{picture-movement-down}).
|
||||
@item C-c `
|
||||
Move up and left (``northwest'') after insertion (@code{picture-movement-nw}).
|
||||
@item C-c '
|
||||
Move up and right (``northeast'') after insertion
|
||||
(@code{picture-movement-ne}).
|
||||
@item C-c /
|
||||
Move down and left (``southwest'') after insertion
|
||||
@*(@code{picture-movement-sw}).
|
||||
@item C-c \
|
||||
Move down and right (``southeast'') after insertion
|
||||
@*(@code{picture-movement-se}).
|
||||
@end table
|
||||
|
||||
@kindex C-c C-f @r{(Picture mode)}
|
||||
@kindex C-c C-b @r{(Picture mode)}
|
||||
@findex picture-motion
|
||||
@findex picture-motion-reverse
|
||||
Two motion commands move based on the current Picture insertion
|
||||
direction. The command @kbd{C-c C-f} (@code{picture-motion}) moves in the
|
||||
same direction as motion after ``insertion'' currently does, while @kbd{C-c
|
||||
C-b} (@code{picture-motion-reverse}) moves in the opposite direction.
|
||||
|
||||
@node Tabs in Picture, Rectangles in Picture, Insert in Picture, Picture
|
||||
@section Picture Mode Tabs
|
||||
|
||||
@kindex M-TAB @r{(Picture mode)}
|
||||
@findex picture-tab-search
|
||||
@vindex picture-tab-chars
|
||||
Two kinds of tab-like action are provided in Picture mode. Use
|
||||
@kbd{M-@key{TAB}} (@code{picture-tab-search}) for context-based tabbing.
|
||||
With no argument, it moves to a point underneath the next
|
||||
``interesting'' character that follows whitespace in the previous
|
||||
nonblank line. ``Next'' here means ``appearing at a horizontal position
|
||||
greater than the one point starts out at.'' With an argument, as in
|
||||
@kbd{C-u M-@key{TAB}}, this command moves to the next such interesting
|
||||
character in the current line. @kbd{M-@key{TAB}} does not change the
|
||||
text; it only moves point. ``Interesting'' characters are defined by
|
||||
the variable @code{picture-tab-chars}, which should define a set of
|
||||
characters. The syntax for this variable is like the syntax used inside
|
||||
of @samp{[@dots{}]} in a regular expression---but without the @samp{[}
|
||||
and the @samp{]}. Its default value is @code{"!-~"}.
|
||||
|
||||
@findex picture-tab
|
||||
@key{TAB} itself runs @code{picture-tab}, which operates based on the
|
||||
current tab stop settings; it is the Picture mode equivalent of
|
||||
@code{tab-to-tab-stop}. Normally it just moves point, but with a numeric
|
||||
argument it clears the text that it moves over.
|
||||
|
||||
@kindex C-c TAB @r{(Picture mode)}
|
||||
@findex picture-set-tab-stops
|
||||
The context-based and tab-stop-based forms of tabbing are brought
|
||||
together by the command @kbd{C-c @key{TAB}} (@code{picture-set-tab-stops}).
|
||||
This command sets the tab stops to the positions which @kbd{M-@key{TAB}}
|
||||
would consider significant in the current line. The use of this command,
|
||||
together with @key{TAB}, can get the effect of context-based tabbing. But
|
||||
@kbd{M-@key{TAB}} is more convenient in the cases where it is sufficient.
|
||||
|
||||
It may be convenient to prevent use of actual tab characters in
|
||||
pictures. For example, this prevents @kbd{C-x @key{TAB}} from messing
|
||||
up the picture. You can do this by setting the variable
|
||||
@code{indent-tabs-mode} to @code{nil}. @xref{Just Spaces}.
|
||||
|
||||
@node Rectangles in Picture,, Tabs in Picture, Picture
|
||||
@section Picture Mode Rectangle Commands
|
||||
@cindex rectangles and Picture mode
|
||||
@cindex Picture mode and rectangles
|
||||
|
||||
Picture mode defines commands for working on rectangular pieces of the
|
||||
text in ways that fit with the quarter-plane model. The standard rectangle
|
||||
commands may also be useful (@pxref{Rectangles}).
|
||||
|
||||
@table @kbd
|
||||
@item C-c C-k
|
||||
Clear out the region-rectangle with spaces
|
||||
(@code{picture-clear-rectangle}). With argument, delete the text.
|
||||
@item C-c C-w @var{r}
|
||||
Similar but save rectangle contents in register @var{r} first
|
||||
(@code{picture-clear-rectangle-to-register}).
|
||||
@item C-c C-y
|
||||
Copy last killed rectangle into the buffer by overwriting, with upper
|
||||
left corner at point (@code{picture-yank-rectangle}). With argument,
|
||||
insert instead.
|
||||
@item C-c C-x @var{r}
|
||||
Similar, but use the rectangle in register @var{r}
|
||||
(@code{picture-yank-rectangle-from-register}).
|
||||
@end table
|
||||
|
||||
@kindex C-c C-k @r{(Picture mode)}
|
||||
@kindex C-c C-w @r{(Picture mode)}
|
||||
@findex picture-clear-rectangle
|
||||
@findex picture-clear-rectangle-to-register
|
||||
The picture rectangle commands @kbd{C-c C-k}
|
||||
(@code{picture-clear-rectangle}) and @kbd{C-c C-w}
|
||||
(@code{picture-clear-rectangle-to-register}) differ from the standard
|
||||
rectangle commands in that they normally clear the rectangle instead of
|
||||
deleting it; this is analogous with the way @kbd{C-d} is changed in Picture
|
||||
mode.
|
||||
|
||||
However, deletion of rectangles can be useful in Picture mode, so
|
||||
these commands delete the rectangle if given a numeric argument.
|
||||
@kbd{C-c C-k} either with or without a numeric argument saves the
|
||||
rectangle for @kbd{C-c C-y}.
|
||||
|
||||
@kindex C-c C-y @r{(Picture mode)}
|
||||
@kindex C-c C-x @r{(Picture mode)}
|
||||
@findex picture-yank-rectangle
|
||||
@findex picture-yank-rectangle-from-register
|
||||
The Picture mode commands for yanking rectangles differ from the
|
||||
standard ones in overwriting instead of inserting. This is the same way
|
||||
that Picture mode insertion of other text differs from other modes.
|
||||
@kbd{C-c C-y} (@code{picture-yank-rectangle}) inserts (by overwriting)
|
||||
the rectangle that was most recently killed, while @kbd{C-c C-x}
|
||||
(@code{picture-yank-rectangle-from-register}) does likewise for the
|
||||
rectangle found in a specified register.
|
3341
man/programs.texi
Normal file
3341
man/programs.texi
Normal file
File diff suppressed because it is too large
Load diff
4992
man/reftex.texi
Normal file
4992
man/reftex.texi
Normal file
File diff suppressed because it is too large
Load diff
296
man/regs.texi
Normal file
296
man/regs.texi
Normal file
|
@ -0,0 +1,296 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Registers, Display, Rectangles, Top
|
||||
@chapter Registers
|
||||
@cindex registers
|
||||
|
||||
Emacs @dfn{registers} are places you can save text or positions for
|
||||
later use. Once you save text or a rectangle in a register, you can
|
||||
copy it into the buffer once or many times; you can move point to a
|
||||
position saved in a register once or many times.
|
||||
|
||||
@findex view-register
|
||||
Each register has a name which is a single character. A register can
|
||||
store a piece of text, a rectangle, a position, a window configuration,
|
||||
or a file name, but only one thing at any given time. Whatever you
|
||||
store in a register remains there until you store something else in that
|
||||
register. To see what a register @var{r} contains, use @kbd{M-x
|
||||
view-register}.
|
||||
|
||||
@table @kbd
|
||||
@item M-x view-register @key{RET} @var{r}
|
||||
Display a description of what register @var{r} contains.
|
||||
@end table
|
||||
|
||||
@menu
|
||||
* Position: RegPos. Saving positions in registers.
|
||||
* Text: RegText. Saving text in registers.
|
||||
* Rectangle: RegRect. Saving rectangles in registers.
|
||||
* Configurations: RegConfig. Saving window configurations in registers.
|
||||
* Files: RegFiles. File names in registers.
|
||||
* Numbers: RegNumbers. Numbers in registers.
|
||||
* Bookmarks:: Bookmarks are like registers, but persistent.
|
||||
@end menu
|
||||
|
||||
@node RegPos
|
||||
@section Saving Positions in Registers
|
||||
|
||||
Saving a position records a place in a buffer so that you can move
|
||||
back there later. Moving to a saved position switches to that buffer
|
||||
and moves point to that place in it.
|
||||
|
||||
@table @kbd
|
||||
@item C-x r @key{SPC} @var{r}
|
||||
Save position of point in register @var{r} (@code{point-to-register}).
|
||||
@item C-x r j @var{r}
|
||||
Jump to the position saved in register @var{r} (@code{jump-to-register}).
|
||||
@end table
|
||||
|
||||
@kindex C-x r SPC
|
||||
@findex point-to-register
|
||||
To save the current position of point in a register, choose a name
|
||||
@var{r} and type @kbd{C-x r @key{SPC} @var{r}}. The register @var{r}
|
||||
retains the position thus saved until you store something else in that
|
||||
register.
|
||||
|
||||
@kindex C-x r j
|
||||
@findex jump-to-register
|
||||
The command @kbd{C-x r j @var{r}} moves point to the position recorded
|
||||
in register @var{r}. The register is not affected; it continues to
|
||||
record the same position. You can jump to the saved position any number
|
||||
of times.
|
||||
|
||||
If you use @kbd{C-x r j} to go to a saved position, but the buffer it
|
||||
was saved from has been killed, @kbd{C-x r j} tries to create the buffer
|
||||
again by visiting the same file. Of course, this works only for buffers
|
||||
that were visiting files.
|
||||
|
||||
@node RegText
|
||||
@section Saving Text in Registers
|
||||
|
||||
When you want to insert a copy of the same piece of text several
|
||||
times, it may be inconvenient to yank it from the kill ring, since each
|
||||
subsequent kill moves that entry further down the ring. An alternative
|
||||
is to store the text in a register and later retrieve it.
|
||||
|
||||
@table @kbd
|
||||
@item C-x r s @var{r}
|
||||
Copy region into register @var{r} (@code{copy-to-register}).
|
||||
@item C-x r i @var{r}
|
||||
Insert text from register @var{r} (@code{insert-register}).
|
||||
@end table
|
||||
|
||||
@kindex C-x r s
|
||||
@kindex C-x r i
|
||||
@findex copy-to-register
|
||||
@findex insert-register
|
||||
@kbd{C-x r s @var{r}} stores a copy of the text of the region into the
|
||||
register named @var{r}. Given a numeric argument, @kbd{C-x r s @var{r}}
|
||||
deletes the text from the buffer as well.
|
||||
|
||||
@kbd{C-x r i @var{r}} inserts in the buffer the text from register
|
||||
@var{r}. Normally it leaves point before the text and places the mark
|
||||
after, but with a numeric argument (@kbd{C-u}) it puts point after the
|
||||
text and the mark before.
|
||||
|
||||
@node RegRect
|
||||
@section Saving Rectangles in Registers
|
||||
|
||||
A register can contain a rectangle instead of linear text. The
|
||||
rectangle is represented as a list of strings. @xref{Rectangles}, for
|
||||
basic information on how to specify a rectangle in the buffer.
|
||||
|
||||
@table @kbd
|
||||
@findex copy-rectangle-to-register
|
||||
@kindex C-x r r
|
||||
@item C-x r r @var{r}
|
||||
Copy the region-rectangle into register @var{r}
|
||||
(@code{copy-rectangle-to-register}). With numeric argument, delete it as
|
||||
well.
|
||||
@item C-x r i @var{r}
|
||||
Insert the rectangle stored in register @var{r} (if it contains a
|
||||
rectangle) (@code{insert-register}).
|
||||
@end table
|
||||
|
||||
The @kbd{C-x r i @var{r}} command inserts a text string if the
|
||||
register contains one, and inserts a rectangle if the register contains
|
||||
one.
|
||||
|
||||
See also the command @code{sort-columns}, which you can think of
|
||||
as sorting a rectangle. @xref{Sorting}.
|
||||
|
||||
@node RegConfig
|
||||
@section Saving Window Configurations in Registers
|
||||
|
||||
@findex window-configuration-to-register
|
||||
@findex frame-configuration-to-register
|
||||
@kindex C-x r w
|
||||
@kindex C-x r f
|
||||
You can save the window configuration of the selected frame in a
|
||||
register, or even the configuration of all windows in all frames, and
|
||||
restore the configuration later.
|
||||
|
||||
@table @kbd
|
||||
@item C-x r w @var{r}
|
||||
Save the state of the selected frame's windows in register @var{r}
|
||||
(@code{window-configuration-to-register}).
|
||||
@item C-x r f @var{r}
|
||||
Save the state of all frames, including all their windows, in register
|
||||
@var{r} (@code{frame-configuration-to-register}).
|
||||
@end table
|
||||
|
||||
Use @kbd{C-x r j @var{r}} to restore a window or frame configuration.
|
||||
This is the same command used to restore a cursor position. When you
|
||||
restore a frame configuration, any existing frames not included in the
|
||||
configuration become invisible. If you wish to delete these frames
|
||||
instead, use @kbd{C-u C-x r j @var{r}}.
|
||||
|
||||
@node RegNumbers
|
||||
@section Keeping Numbers in Registers
|
||||
|
||||
There are commands to store a number in a register, to insert
|
||||
the number in the buffer in decimal, and to increment it. These commands
|
||||
can be useful in keyboard macros (@pxref{Keyboard Macros}).
|
||||
|
||||
@table @kbd
|
||||
@item C-u @var{number} C-x r n @var{reg}
|
||||
@kindex C-x r n
|
||||
@findex number-to-register
|
||||
Store @var{number} into register @var{reg} (@code{number-to-register}).
|
||||
@item C-u @var{number} C-x r + @var{reg}
|
||||
@kindex C-x r +
|
||||
@findex increment-register
|
||||
Increment the number in register @var{reg} by @var{number}
|
||||
(@code{increment-register}).
|
||||
@item C-x r g @var{reg}
|
||||
Insert the number from register @var{reg} into the buffer.
|
||||
@end table
|
||||
|
||||
@kbd{C-x r g} is the same command used to insert any other
|
||||
sort of register contents into the buffer.
|
||||
|
||||
@node RegFiles
|
||||
@section Keeping File Names in Registers
|
||||
|
||||
If you visit certain file names frequently, you can visit them more
|
||||
conveniently if you put their names in registers. Here's the Lisp code
|
||||
used to put a file name in a register:
|
||||
|
||||
@smallexample
|
||||
(set-register ?@var{r} '(file . @var{name}))
|
||||
@end smallexample
|
||||
|
||||
@need 3000
|
||||
@noindent
|
||||
For example,
|
||||
|
||||
@smallexample
|
||||
(set-register ?z '(file . "/gd/gnu/emacs/19.0/src/ChangeLog"))
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
puts the file name shown in register @samp{z}.
|
||||
|
||||
To visit the file whose name is in register @var{r}, type @kbd{C-x r j
|
||||
@var{r}}. (This is the same command used to jump to a position or
|
||||
restore a frame configuration.)
|
||||
|
||||
@node Bookmarks
|
||||
@section Bookmarks
|
||||
@cindex bookmarks
|
||||
|
||||
@dfn{Bookmarks} are somewhat like registers in that they record
|
||||
positions you can jump to. Unlike registers, they have long names, and
|
||||
they persist automatically from one Emacs session to the next. The
|
||||
prototypical use of bookmarks is to record ``where you were reading'' in
|
||||
various files.
|
||||
|
||||
@table @kbd
|
||||
@item C-x r m @key{RET}
|
||||
Set the bookmark for the visited file, at point.
|
||||
|
||||
@item C-x r m @var{bookmark} @key{RET}
|
||||
@findex bookmark-set
|
||||
Set the bookmark named @var{bookmark} at point (@code{bookmark-set}).
|
||||
|
||||
@item C-x r b @var{bookmark} @key{RET}
|
||||
@findex bookmark-jump
|
||||
Jump to the bookmark named @var{bookmark} (@code{bookmark-jump}).
|
||||
|
||||
@item C-x r l
|
||||
@findex list-bookmarks
|
||||
List all bookmarks (@code{list-bookmarks}).
|
||||
|
||||
@item M-x bookmark-save
|
||||
@findex bookmark-save
|
||||
Save all the current bookmark values in the default bookmark file.
|
||||
@end table
|
||||
|
||||
@kindex C-x r m
|
||||
@findex bookmark-set
|
||||
@kindex C-x r b
|
||||
@findex bookmark-jump
|
||||
The prototypical use for bookmarks is to record one current position
|
||||
in each of several files. So the command @kbd{C-x r m}, which sets a
|
||||
bookmark, uses the visited file name as the default for the bookmark
|
||||
name. If you name each bookmark after the file it points to, then you
|
||||
can conveniently revisit any of those files with @kbd{C-x r b}, and move
|
||||
to the position of the bookmark at the same time.
|
||||
|
||||
@kindex C-x r l
|
||||
To display a list of all your bookmarks in a separate buffer, type
|
||||
@kbd{C-x r l} (@code{list-bookmarks}). If you switch to that buffer,
|
||||
you can use it to edit your bookmark definitions or annotate the
|
||||
bookmarks. Type @kbd{C-h m} in that buffer for more information about
|
||||
its special editing commands.
|
||||
|
||||
When you kill Emacs, Emacs offers to save your bookmark values in your
|
||||
default bookmark file, @file{~/.emacs.bmk}, if you have changed any
|
||||
bookmark values. You can also save the bookmarks at any time with the
|
||||
@kbd{M-x bookmark-save} command. The bookmark commands load your
|
||||
default bookmark file automatically. This saving and loading is how
|
||||
bookmarks persist from one Emacs session to the next.
|
||||
|
||||
@vindex bookmark-save-flag
|
||||
If you set the variable @code{bookmark-save-flag} to 1, then each
|
||||
command that sets a bookmark will also save your bookmarks; this way,
|
||||
you don't lose any bookmark values even if Emacs crashes. (The value,
|
||||
if a number, says how many bookmark modifications should go by between
|
||||
saving.)
|
||||
|
||||
@vindex bookmark-search-size
|
||||
Bookmark position values are saved with surrounding context, so that
|
||||
@code{bookmark-jump} can find the proper position even if the file is
|
||||
modified slightly. The variable @code{bookmark-search-size} says how
|
||||
many characters of context to record, on each side of the bookmark's
|
||||
position.
|
||||
|
||||
Here are some additional commands for working with bookmarks:
|
||||
|
||||
@table @kbd
|
||||
@item M-x bookmark-load @key{RET} @var{filename} @key{RET}
|
||||
@findex bookmark-load
|
||||
Load a file named @var{filename} that contains a list of bookmark
|
||||
values. You can use this command, as well as @code{bookmark-write}, to
|
||||
work with other files of bookmark values in addition to your default
|
||||
bookmark file.
|
||||
|
||||
@item M-x bookmark-write @key{RET} @var{filename} @key{RET}
|
||||
@findex bookmark-write
|
||||
Save all the current bookmark values in the file @var{filename}.
|
||||
|
||||
@item M-x bookmark-delete @key{RET} @var{bookmark} @key{RET}
|
||||
@findex bookmark-delete
|
||||
Delete the bookmark named @var{bookmark}.
|
||||
|
||||
@item M-x bookmark-insert-location @key{RET} @var{bookmark} @key{RET}
|
||||
@findex bookmark-insert-location
|
||||
Insert in the buffer the name of the file that bookmark @var{bookmark}
|
||||
points to.
|
||||
|
||||
@item M-x bookmark-insert @key{RET} @var{bookmark} @key{RET}
|
||||
@findex bookmark-insert
|
||||
Insert in the buffer the @emph{contents} of the file that bookmark
|
||||
@var{bookmark} points to.
|
||||
@end table
|
1154
man/rmail.texi
Normal file
1154
man/rmail.texi
Normal file
File diff suppressed because it is too large
Load diff
2535
man/sc.texi
Normal file
2535
man/sc.texi
Normal file
File diff suppressed because it is too large
Load diff
330
man/screen.texi
Normal file
330
man/screen.texi
Normal file
|
@ -0,0 +1,330 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Screen, User Input, Acknowledgments, Top
|
||||
@chapter The Organization of the Screen
|
||||
@cindex screen
|
||||
@cindex parts of the screen
|
||||
@c
|
||||
|
||||
On a text-only terminal, the Emacs display occupies the whole screen.
|
||||
On the X Window System, Emacs creates its own X windows to use. We use
|
||||
the term @dfn{frame} to mean an entire text-only screen or an entire X
|
||||
window used by Emacs. Emacs uses both kinds of frames in the same way
|
||||
to display your editing. Emacs normally starts out with just one frame,
|
||||
but you can create additional frames if you wish. @xref{Frames}.
|
||||
|
||||
When you start Emacs, the entire frame except for the first and last
|
||||
lines is devoted to the text you are editing. This area is called the
|
||||
@dfn{window}. The first line is a @dfn{menu bar}, and the last line is
|
||||
a special @dfn{echo area} or @dfn{minibuffer window} where prompts
|
||||
appear and where you can enter responses. See below for more
|
||||
information about these special lines.
|
||||
|
||||
You can subdivide the large text window horizontally or vertically
|
||||
into multiple text windows, each of which can be used for a different
|
||||
file (@pxref{Windows}). In this manual, the word ``window'' always
|
||||
refers to the subdivisions of a frame within Emacs.
|
||||
|
||||
The window that the cursor is in is the @dfn{selected window}, in
|
||||
which editing takes place. Most Emacs commands implicitly apply to the
|
||||
text in the selected window (though mouse commands generally operate on
|
||||
whatever window you click them in, whether selected or not). The other
|
||||
windows display text for reference only, unless/until you select them.
|
||||
If you use multiple frames under the X Window System, then giving the
|
||||
input focus to a particular frame selects a window in that frame.
|
||||
|
||||
Each window's last line is a @dfn{mode line}, which describes what is
|
||||
going on in that window. It appears in inverse video, if the terminal
|
||||
supports that, and its contents begin with @w{@samp{--:-- @ *scratch*}}
|
||||
when Emacs starts. The mode line displays status information such as
|
||||
what buffer is being displayed above it in the window, what major and
|
||||
minor modes are in use, and whether the buffer contains unsaved changes.
|
||||
|
||||
@menu
|
||||
* Point:: The place in the text where editing commands operate.
|
||||
* Echo Area:: Short messages appear at the bottom of the screen.
|
||||
* Mode Line:: Interpreting the mode line.
|
||||
* Menu Bar:: How to use the menu bar.
|
||||
@end menu
|
||||
|
||||
@node Point
|
||||
@section Point
|
||||
@cindex point
|
||||
@cindex cursor
|
||||
|
||||
Within Emacs, the terminal's cursor shows the location at which
|
||||
editing commands will take effect. This location is called @dfn{point}.
|
||||
Many Emacs commands move point through the text, so that you can edit at
|
||||
different places in it. You can also place point by clicking mouse
|
||||
button 1.
|
||||
|
||||
While the cursor appears to point @emph{at} a character, you should
|
||||
think of point as @emph{between} two characters; it points @emph{before}
|
||||
the character that appears under the cursor. For example, if your text
|
||||
looks like @samp{frob} with the cursor over the @samp{b}, then point is
|
||||
between the @samp{o} and the @samp{b}. If you insert the character
|
||||
@samp{!} at that position, the result is @samp{fro!b}, with point
|
||||
between the @samp{!} and the @samp{b}. Thus, the cursor remains over
|
||||
the @samp{b}, as before.
|
||||
|
||||
Sometimes people speak of ``the cursor'' when they mean ``point,'' or
|
||||
speak of commands that move point as ``cursor motion'' commands.
|
||||
|
||||
Terminals have only one cursor, and when output is in progress it must
|
||||
appear where the typing is being done. This does not mean that point is
|
||||
moving. It is only that Emacs has no way to show you the location of point
|
||||
except when the terminal is idle.
|
||||
|
||||
If you are editing several files in Emacs, each in its own buffer,
|
||||
each buffer has its own point location. A buffer that is not currently
|
||||
displayed remembers where point is in case you display it again later.
|
||||
|
||||
When there are multiple windows in a frame, each window has its own
|
||||
point location. The cursor shows the location of point in the selected
|
||||
window. This also is how you can tell which window is selected. If the
|
||||
same buffer appears in more than one window, each window has its own
|
||||
position for point in that buffer.
|
||||
|
||||
When there are multiple frames, each frame can display one cursor.
|
||||
The cursor in the selected frame is solid; the cursor in other frames is
|
||||
a hollow box, and appears in the window that would be selected if you
|
||||
give the input focus to that frame.
|
||||
|
||||
The term `point' comes from the character @samp{.}, which was the
|
||||
command in TECO (the language in which the original Emacs was written)
|
||||
for accessing the value now called `point'.
|
||||
|
||||
@node Echo Area
|
||||
@section The Echo Area
|
||||
@cindex echo area
|
||||
@c
|
||||
|
||||
The line at the bottom of the frame (below the mode line) is the
|
||||
@dfn{echo area}. It is used to display small amounts of text for
|
||||
several purposes.
|
||||
|
||||
@dfn{Echoing} means displaying the characters that you type. Outside
|
||||
Emacs, the operating system normally echoes all your input. Emacs
|
||||
handles echoing differently.
|
||||
|
||||
Single-character commands do not echo in Emacs, and multi-character
|
||||
commands echo only if you pause while typing them. As soon as you pause
|
||||
for more than a second in the middle of a command, Emacs echoes all the
|
||||
characters of the command so far. This is to @dfn{prompt} you for the
|
||||
rest of the command. Once echoing has started, the rest of the command
|
||||
echoes immediately as you type it. This behavior is designed to give
|
||||
confident users fast response, while giving hesitant users maximum
|
||||
feedback. You can change this behavior by setting a variable
|
||||
(@pxref{Display Vars}).
|
||||
|
||||
@cindex error message in the echo area
|
||||
If a command cannot be executed, it may print an @dfn{error message} in
|
||||
the echo area. Error messages are accompanied by a beep or by flashing the
|
||||
screen. Also, any input you have typed ahead is thrown away when an error
|
||||
happens.
|
||||
|
||||
Some commands print informative messages in the echo area. These
|
||||
messages look much like error messages, but they are not announced with
|
||||
a beep and do not throw away input. Sometimes the message tells you
|
||||
what the command has done, when this is not obvious from looking at the
|
||||
text being edited. Sometimes the sole purpose of a command is to print
|
||||
a message giving you specific information---for example, @kbd{C-x =}
|
||||
prints a message describing the character position of point in the text
|
||||
and its current column in the window. Commands that take a long time
|
||||
often display messages ending in @samp{...} while they are working, and
|
||||
add @samp{done} at the end when they are finished.
|
||||
|
||||
@cindex @samp{*Messages*} buffer
|
||||
@cindex saved echo area messages
|
||||
@cindex messages saved from echo area
|
||||
Echo-area informative messages are saved in an editor buffer named
|
||||
@samp{*Messages*}. (We have not explained buffers yet; see
|
||||
@ref{Buffers}, for more information about them.) If you miss a message
|
||||
that appears briefly on the screen, you can switch to the
|
||||
@samp{*Messages*} buffer to see it again. (Successive progress messages
|
||||
are often collapsed into one in that buffer.)
|
||||
|
||||
@vindex message-log-max
|
||||
The size of @samp{*Messages*} is limited to a certain number of lines.
|
||||
The variable @code{message-log-max} specifies how many lines. Once the
|
||||
buffer has that many lines, each line added at the end deletes one line
|
||||
from the beginning. @xref{Variables}, for how to set variables such as
|
||||
@code{message-log-max}.
|
||||
|
||||
The echo area is also used to display the @dfn{minibuffer}, a window that
|
||||
is used for reading arguments to commands, such as the name of a file to be
|
||||
edited. When the minibuffer is in use, the echo area begins with a prompt
|
||||
string that usually ends with a colon; also, the cursor appears in that line
|
||||
because it is the selected window. You can always get out of the
|
||||
minibuffer by typing @kbd{C-g}. @xref{Minibuffer}.
|
||||
|
||||
@node Mode Line
|
||||
@section The Mode Line
|
||||
@cindex mode line
|
||||
@cindex top level
|
||||
@c
|
||||
|
||||
Each text window's last line is a @dfn{mode line}, which describes what
|
||||
is going on in that window. When there is only one text window, the
|
||||
mode line appears right above the echo area; it is the next-to-last line
|
||||
on the frame. The mode line is in inverse video if the terminal
|
||||
supports that, and it starts and ends with dashes.
|
||||
|
||||
Normally, the mode line looks like this:
|
||||
|
||||
@example
|
||||
-@var{cs}:@var{ch} @var{buf} (@var{major} @var{minor})--@var{line}--@var{pos}------
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
This gives information about the buffer being displayed in the window: the
|
||||
buffer's name, what major and minor modes are in use, whether the buffer's
|
||||
text has been changed, and how far down the buffer you are currently
|
||||
looking.
|
||||
|
||||
@var{ch} contains two stars @samp{**} if the text in the buffer has
|
||||
been edited (the buffer is ``modified''), or @samp{--} if the buffer has
|
||||
not been edited. For a read-only buffer, it is @samp{%*} if the buffer
|
||||
is modified, and @samp{%%} otherwise.
|
||||
|
||||
@var{buf} is the name of the window's @dfn{buffer}. In most cases
|
||||
this is the same as the name of a file you are editing. @xref{Buffers}.
|
||||
|
||||
The buffer displayed in the selected window (the window that the
|
||||
cursor is in) is also Emacs's selected buffer, the one that editing
|
||||
takes place in. When we speak of what some command does to ``the
|
||||
buffer,'' we are talking about the currently selected buffer.
|
||||
|
||||
@var{line} is @samp{L} followed by the current line number of point.
|
||||
This is present when Line Number mode is enabled (which it normally is).
|
||||
You can optionally display the current column number too, by turning on
|
||||
Column Number mode (which is not enabled by default because it is
|
||||
somewhat slower). @xref{Optional Mode Line}.
|
||||
|
||||
@var{pos} tells you whether there is additional text above the top of
|
||||
the window, or below the bottom. If your buffer is small and it is all
|
||||
visible in the window, @var{pos} is @samp{All}. Otherwise, it is
|
||||
@samp{Top} if you are looking at the beginning of the buffer, @samp{Bot}
|
||||
if you are looking at the end of the buffer, or @samp{@var{nn}%}, where
|
||||
@var{nn} is the percentage of the buffer above the top of the
|
||||
window.@refill
|
||||
|
||||
@var{major} is the name of the @dfn{major mode} in effect in the
|
||||
buffer. At any time, each buffer is in one and only one of the possible
|
||||
major modes. The major modes available include Fundamental mode (the
|
||||
least specialized), Text mode, Lisp mode, C mode, Texinfo mode, and many
|
||||
others. @xref{Major Modes}, for details of how the modes differ and how
|
||||
to select one.@refill
|
||||
|
||||
Some major modes display additional information after the major mode
|
||||
name. For example, Rmail buffers display the current message number and
|
||||
the total number of messages. Compilation buffers and Shell buffers
|
||||
display the status of the subprocess.
|
||||
|
||||
@var{minor} is a list of some of the @dfn{minor modes} that are turned
|
||||
on at the moment in the window's chosen buffer. For example,
|
||||
@samp{Fill} means that Auto Fill mode is on. @samp{Abbrev} means that
|
||||
Word Abbrev mode is on. @samp{Ovwrt} means that Overwrite mode is on.
|
||||
@xref{Minor Modes}, for more information. @samp{Narrow} means that the
|
||||
buffer being displayed has editing restricted to only a portion of its
|
||||
text. This is not really a minor mode, but is like one.
|
||||
@xref{Narrowing}. @samp{Def} means that a keyboard macro is being
|
||||
defined. @xref{Keyboard Macros}.
|
||||
|
||||
In addition, if Emacs is currently inside a recursive editing level,
|
||||
square brackets (@samp{[@dots{}]}) appear around the parentheses that
|
||||
surround the modes. If Emacs is in one recursive editing level within
|
||||
another, double square brackets appear, and so on. Since recursive
|
||||
editing levels affect Emacs globally, not just one buffer, the square
|
||||
brackets appear in every window's mode line or not in any of them.
|
||||
@xref{Recursive Edit}.@refill
|
||||
|
||||
Non-windowing terminals can only show a single Emacs frame at a time
|
||||
(@pxref{Frames}). On such terminals, the mode line displays the name of
|
||||
the selected frame, after @var{ch}. The initial frame's name is
|
||||
@samp{F1}.
|
||||
|
||||
@var{cs} states the coding system used for the file you are editing.
|
||||
A dash indicates the default state of affairs: no code conversion,
|
||||
except for end-of-line translation if the file contents call for that.
|
||||
@samp{=} means no conversion whatsoever. Nontrivial code conversions
|
||||
are represented by various letters---for example, @samp{1} refers to ISO
|
||||
Latin-1. @xref{Coding Systems}, for more information. If you are using
|
||||
an input method, a string of the form @samp{@var{i}>} is added to the
|
||||
beginning of @var{cs}; @var{i} identifies the input method. (Some input
|
||||
methods show @samp{+} or @samp{@@} instead of @samp{>}.) @xref{Input
|
||||
Methods}.
|
||||
|
||||
When you are using a character-only terminal (not a window system),
|
||||
@var{cs} uses three characters to describe, respectively, the coding
|
||||
system for keyboard input, the coding system for terminal output, and
|
||||
the coding system used for the file you are editing.
|
||||
|
||||
When multibyte characters are not enabled, @var{cs} does not appear at
|
||||
all. @xref{Enabling Multibyte}.
|
||||
|
||||
@cindex end-of-line conversion, mode-line indication
|
||||
The colon after @var{cs} can change to another string in certain
|
||||
circumstances. Emacs uses newline to separate lines in the buffer.
|
||||
Some files use different conventions for separating lines: either
|
||||
carriage-return linefeed (the MS-DOS convention) or just carriage-return
|
||||
(the Macintosh convention). If the buffer's file uses carriage-return
|
||||
linefeed, the colon changes to either a backslash (@samp{\}) or
|
||||
@samp{(DOS)}, depending on the operating system. If the file uses just
|
||||
carriage-return, the colon indicator changes to either a forward slash
|
||||
(@samp{/}) or @samp{(Mac)}. On some systems, Emacs displays
|
||||
@samp{(Unix)} instead of the colon even for files that use newline to
|
||||
separate lines.
|
||||
|
||||
@vindex eol-mnemonic-unix
|
||||
@vindex eol-mnemonic-dos
|
||||
@vindex eol-mnemonic-mac
|
||||
@vindex eol-mnemonic-undecided
|
||||
You can customize the mode line display for each of the end-of-line
|
||||
formats by setting each of the variables @code{eol-mnemonic-unix},
|
||||
@code{eol-mnemonic-dos}, @code{eol-mnemonic-mac}, and
|
||||
@code{eol-mnemonic-undecided} to any string you find appropriate.
|
||||
@xref{Variables}, for an explanation how to set variables.
|
||||
|
||||
@xref{Optional Mode Line}, for features that add other handy
|
||||
information to the mode line, such as the current column number of
|
||||
point, the current time, and whether new mail for you has arrived.
|
||||
|
||||
@node Menu Bar
|
||||
@section The Menu Bar
|
||||
@cindex menu bar
|
||||
|
||||
Each Emacs frame normally has a @dfn{menu bar} at the top which you
|
||||
can use to perform certain common operations. There's no need to list
|
||||
them here, as you can more easily see for yourself.
|
||||
|
||||
@kindex M-`
|
||||
@kindex F10
|
||||
@findex tmm-menubar
|
||||
When you are using a window system, you can use the mouse to choose a
|
||||
command from the menu bar. An arrow pointing right, after the menu
|
||||
item, indicates that the item leads to a subsidiary menu; @samp{...} at
|
||||
the end means that the command will read arguments from the keyboard
|
||||
before it actually does anything.
|
||||
|
||||
To view the full command name and documentation for a menu item, type
|
||||
@kbd{C-h k}, and then select the menu bar with the mouse in the usual
|
||||
way (@pxref{Key Help}).
|
||||
|
||||
On text-only terminals with no mouse, you can use the menu bar by
|
||||
typing @kbd{M-`} or @key{F10} (these run the command
|
||||
@code{tmm-menubar}). This command enters a mode in which you can select
|
||||
a menu item from the keyboard. A provisional choice appears in the echo
|
||||
area. You can use the left and right arrow keys to move through the
|
||||
menu to different choices. When you have found the choice you want,
|
||||
type @key{RET} to select it.
|
||||
|
||||
Each menu item also has an assigned letter or digit which designates
|
||||
that item; it is usually the initial of some word in the item's name.
|
||||
This letter or digit is separated from the item name by @samp{=>}. You
|
||||
can type the item's letter or digit to select the item.
|
||||
|
||||
Some of the commands in the menu bar have ordinary key bindings as
|
||||
well; if so, the menu lists one equivalent key binding in parentheses
|
||||
after the item itself.
|
948
man/search.texi
Normal file
948
man/search.texi
Normal file
|
@ -0,0 +1,948 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Search, Fixit, Display, Top
|
||||
@chapter Searching and Replacement
|
||||
@cindex searching
|
||||
@cindex finding strings within text
|
||||
|
||||
Like other editors, Emacs has commands for searching for occurrences of
|
||||
a string. The principal search command is unusual in that it is
|
||||
@dfn{incremental}; it begins to search before you have finished typing the
|
||||
search string. There are also nonincremental search commands more like
|
||||
those of other editors.
|
||||
|
||||
Besides the usual @code{replace-string} command that finds all
|
||||
occurrences of one string and replaces them with another, Emacs has a fancy
|
||||
replacement command called @code{query-replace} which asks interactively
|
||||
which occurrences to replace.
|
||||
|
||||
@menu
|
||||
* Incremental Search:: Search happens as you type the string.
|
||||
* Nonincremental Search:: Specify entire string and then search.
|
||||
* Word Search:: Search for sequence of words.
|
||||
* Regexp Search:: Search for match for a regexp.
|
||||
* Regexps:: Syntax of regular expressions.
|
||||
* Search Case:: To ignore case while searching, or not.
|
||||
* Replace:: Search, and replace some or all matches.
|
||||
* Other Repeating Search:: Operating on all matches for some regexp.
|
||||
@end menu
|
||||
|
||||
@node Incremental Search, Nonincremental Search, Search, Search
|
||||
@section Incremental Search
|
||||
|
||||
@cindex incremental search
|
||||
An incremental search begins searching as soon as you type the first
|
||||
character of the search string. As you type in the search string, Emacs
|
||||
shows you where the string (as you have typed it so far) would be
|
||||
found. When you have typed enough characters to identify the place you
|
||||
want, you can stop. Depending on what you plan to do next, you may or
|
||||
may not need to terminate the search explicitly with @key{RET}.
|
||||
|
||||
@c WideCommands
|
||||
@table @kbd
|
||||
@item C-s
|
||||
Incremental search forward (@code{isearch-forward}).
|
||||
@item C-r
|
||||
Incremental search backward (@code{isearch-backward}).
|
||||
@end table
|
||||
|
||||
@kindex C-s
|
||||
@findex isearch-forward
|
||||
@kbd{C-s} starts an incremental search. @kbd{C-s} reads characters from
|
||||
the keyboard and positions the cursor at the first occurrence of the
|
||||
characters that you have typed. If you type @kbd{C-s} and then @kbd{F},
|
||||
the cursor moves right after the first @samp{F}. Type an @kbd{O}, and see
|
||||
the cursor move to after the first @samp{FO}. After another @kbd{O}, the
|
||||
cursor is after the first @samp{FOO} after the place where you started the
|
||||
search. At each step, the buffer text that matches the search string is
|
||||
highlighted, if the terminal can do that; at each step, the current search
|
||||
string is updated in the echo area.
|
||||
|
||||
If you make a mistake in typing the search string, you can cancel
|
||||
characters with @key{DEL}. Each @key{DEL} cancels the last character of
|
||||
search string. This does not happen until Emacs is ready to read another
|
||||
input character; first it must either find, or fail to find, the character
|
||||
you want to erase. If you do not want to wait for this to happen, use
|
||||
@kbd{C-g} as described below.
|
||||
|
||||
When you are satisfied with the place you have reached, you can type
|
||||
@key{RET}, which stops searching, leaving the cursor where the search
|
||||
brought it. Also, any command not specially meaningful in searches
|
||||
stops the searching and is then executed. Thus, typing @kbd{C-a} would
|
||||
exit the search and then move to the beginning of the line. @key{RET}
|
||||
is necessary only if the next command you want to type is a printing
|
||||
character, @key{DEL}, @key{RET}, or another control character that is
|
||||
special within searches (@kbd{C-q}, @kbd{C-w}, @kbd{C-r}, @kbd{C-s},
|
||||
@kbd{C-y}, @kbd{M-y}, @kbd{M-r}, or @kbd{M-s}).
|
||||
|
||||
Sometimes you search for @samp{FOO} and find it, but not the one you
|
||||
expected to find. There was a second @samp{FOO} that you forgot about,
|
||||
before the one you were aiming for. In this event, type another @kbd{C-s}
|
||||
to move to the next occurrence of the search string. This can be done any
|
||||
number of times. If you overshoot, you can cancel some @kbd{C-s}
|
||||
characters with @key{DEL}.
|
||||
|
||||
After you exit a search, you can search for the same string again by
|
||||
typing just @kbd{C-s C-s}: the first @kbd{C-s} is the key that invokes
|
||||
incremental search, and the second @kbd{C-s} means ``search again.''
|
||||
|
||||
To reuse earlier search strings, use the @dfn{search ring}. The
|
||||
commands @kbd{M-p} and @kbd{M-n} move through the ring to pick a search
|
||||
string to reuse. These commands leave the selected search ring element
|
||||
in the minibuffer, where you can edit it. Type @kbd{C-s} or @kbd{C-r}
|
||||
to terminate editing the string and search for it.
|
||||
|
||||
If your string is not found at all, the echo area says @samp{Failing
|
||||
I-Search}. The cursor is after the place where Emacs found as much of your
|
||||
string as it could. Thus, if you search for @samp{FOOT}, and there is no
|
||||
@samp{FOOT}, you might see the cursor after the @samp{FOO} in @samp{FOOL}.
|
||||
At this point there are several things you can do. If your string was
|
||||
mistyped, you can rub some of it out and correct it. If you like the place
|
||||
you have found, you can type @key{RET} or some other Emacs command to
|
||||
``accept what the search offered.'' Or you can type @kbd{C-g}, which
|
||||
removes from the search string the characters that could not be found (the
|
||||
@samp{T} in @samp{FOOT}), leaving those that were found (the @samp{FOO} in
|
||||
@samp{FOOT}). A second @kbd{C-g} at that point cancels the search
|
||||
entirely, returning point to where it was when the search started.
|
||||
|
||||
An upper-case letter in the search string makes the search
|
||||
case-sensitive. If you delete the upper-case character from the search
|
||||
string, it ceases to have this effect. @xref{Search Case}.
|
||||
|
||||
If a search is failing and you ask to repeat it by typing another
|
||||
@kbd{C-s}, it starts again from the beginning of the buffer. Repeating
|
||||
a failing reverse search with @kbd{C-r} starts again from the end. This
|
||||
is called @dfn{wrapping around}. @samp{Wrapped} appears in the search
|
||||
prompt once this has happened. If you keep on going past the original
|
||||
starting point of the search, it changes to @samp{Overwrapped}, which
|
||||
means that you are revisiting matches that you have already seen.
|
||||
|
||||
@cindex quitting (in search)
|
||||
The @kbd{C-g} ``quit'' character does special things during searches;
|
||||
just what it does depends on the status of the search. If the search has
|
||||
found what you specified and is waiting for input, @kbd{C-g} cancels the
|
||||
entire search. The cursor moves back to where you started the search. If
|
||||
@kbd{C-g} is typed when there are characters in the search string that have
|
||||
not been found---because Emacs is still searching for them, or because it
|
||||
has failed to find them---then the search string characters which have not
|
||||
been found are discarded from the search string. With them gone, the
|
||||
search is now successful and waiting for more input, so a second @kbd{C-g}
|
||||
will cancel the entire search.
|
||||
|
||||
To search for a newline, type @kbd{C-j}. To search for another
|
||||
control character, such as control-S or carriage return, you must quote
|
||||
it by typing @kbd{C-q} first. This function of @kbd{C-q} is analogous
|
||||
to its use for insertion (@pxref{Inserting Text}): it causes the
|
||||
following character to be treated the way any ``ordinary'' character is
|
||||
treated in the same context. You can also specify a character by its
|
||||
octal code: enter @kbd{C-q} followed by a sequence of octal digits.
|
||||
|
||||
You can change to searching backwards with @kbd{C-r}. If a search fails
|
||||
because the place you started was too late in the file, you should do this.
|
||||
Repeated @kbd{C-r} keeps looking for more occurrences backwards. A
|
||||
@kbd{C-s} starts going forwards again. @kbd{C-r} in a search can be canceled
|
||||
with @key{DEL}.
|
||||
|
||||
@kindex C-r
|
||||
@findex isearch-backward
|
||||
If you know initially that you want to search backwards, you can use
|
||||
@kbd{C-r} instead of @kbd{C-s} to start the search, because @kbd{C-r} as
|
||||
a key runs a command (@code{isearch-backward}) to search backward. A
|
||||
backward search finds matches that are entirely before the starting
|
||||
point, just as a forward search finds matches that begin after it.
|
||||
|
||||
The characters @kbd{C-y} and @kbd{C-w} can be used in incremental
|
||||
search to grab text from the buffer into the search string. This makes
|
||||
it convenient to search for another occurrence of text at point.
|
||||
@kbd{C-w} copies the word after point as part of the search string,
|
||||
advancing point over that word. Another @kbd{C-s} to repeat the search
|
||||
will then search for a string including that word. @kbd{C-y} is similar
|
||||
to @kbd{C-w} but copies all the rest of the current line into the search
|
||||
string. Both @kbd{C-y} and @kbd{C-w} convert the text they copy to
|
||||
lower case if the search is currently not case-sensitive; this is so the
|
||||
search remains case-insensitive.
|
||||
|
||||
The character @kbd{M-y} copies text from the kill ring into the search
|
||||
string. It uses the same text that @kbd{C-y} as a command would yank.
|
||||
@xref{Yanking}.
|
||||
|
||||
When you exit the incremental search, it sets the mark to where point
|
||||
@emph{was}, before the search. That is convenient for moving back
|
||||
there. In Transient Mark mode, incremental search sets the mark without
|
||||
activating it, and does so only if the mark is not already active.
|
||||
|
||||
@vindex isearch-mode-map
|
||||
To customize the special characters that incremental search understands,
|
||||
alter their bindings in the keymap @code{isearch-mode-map}. For a list
|
||||
of bindings, look at the documentation of @code{isearch-mode} with
|
||||
@kbd{C-h f isearch-mode @key{RET}}.
|
||||
|
||||
@subsection Slow Terminal Incremental Search
|
||||
|
||||
Incremental search on a slow terminal uses a modified style of display
|
||||
that is designed to take less time. Instead of redisplaying the buffer at
|
||||
each place the search gets to, it creates a new single-line window and uses
|
||||
that to display the line that the search has found. The single-line window
|
||||
comes into play as soon as point gets outside of the text that is already
|
||||
on the screen.
|
||||
|
||||
When you terminate the search, the single-line window is removed.
|
||||
Then Emacs redisplays the window in which the search was done, to show
|
||||
its new position of point.
|
||||
|
||||
@ignore
|
||||
The three dots at the end of the search string, normally used to indicate
|
||||
that searching is going on, are not displayed in slow style display.
|
||||
@end ignore
|
||||
|
||||
@vindex search-slow-speed
|
||||
The slow terminal style of display is used when the terminal baud rate is
|
||||
less than or equal to the value of the variable @code{search-slow-speed},
|
||||
initially 1200.
|
||||
|
||||
@vindex search-slow-window-lines
|
||||
The number of lines to use in slow terminal search display is controlled
|
||||
by the variable @code{search-slow-window-lines}. Its normal value is 1.
|
||||
|
||||
@node Nonincremental Search, Word Search, Incremental Search, Search
|
||||
@section Nonincremental Search
|
||||
@cindex nonincremental search
|
||||
|
||||
Emacs also has conventional nonincremental search commands, which require
|
||||
you to type the entire search string before searching begins.
|
||||
|
||||
@table @kbd
|
||||
@item C-s @key{RET} @var{string} @key{RET}
|
||||
Search for @var{string}.
|
||||
@item C-r @key{RET} @var{string} @key{RET}
|
||||
Search backward for @var{string}.
|
||||
@end table
|
||||
|
||||
To do a nonincremental search, first type @kbd{C-s @key{RET}}. This
|
||||
enters the minibuffer to read the search string; terminate the string
|
||||
with @key{RET}, and then the search takes place. If the string is not
|
||||
found, the search command gets an error.
|
||||
|
||||
The way @kbd{C-s @key{RET}} works is that the @kbd{C-s} invokes
|
||||
incremental search, which is specially programmed to invoke nonincremental
|
||||
search if the argument you give it is empty. (Such an empty argument would
|
||||
otherwise be useless.) @kbd{C-r @key{RET}} also works this way.
|
||||
|
||||
However, nonincremental searches performed using @kbd{C-s @key{RET}} do
|
||||
not call @code{search-forward} right away. The first thing done is to see
|
||||
if the next character is @kbd{C-w}, which requests a word search.
|
||||
@ifinfo
|
||||
@xref{Word Search}.
|
||||
@end ifinfo
|
||||
|
||||
@findex search-forward
|
||||
@findex search-backward
|
||||
Forward and backward nonincremental searches are implemented by the
|
||||
commands @code{search-forward} and @code{search-backward}. These
|
||||
commands may be bound to keys in the usual manner. The feature that you
|
||||
can get to them via the incremental search commands exists for
|
||||
historical reasons, and to avoid the need to find suitable key sequences
|
||||
for them.
|
||||
|
||||
@node Word Search, Regexp Search, Nonincremental Search, Search
|
||||
@section Word Search
|
||||
@cindex word search
|
||||
|
||||
Word search searches for a sequence of words without regard to how the
|
||||
words are separated. More precisely, you type a string of many words,
|
||||
using single spaces to separate them, and the string can be found even if
|
||||
there are multiple spaces, newlines or other punctuation between the words.
|
||||
|
||||
Word search is useful for editing a printed document made with a text
|
||||
formatter. If you edit while looking at the printed, formatted version,
|
||||
you can't tell where the line breaks are in the source file. With word
|
||||
search, you can search without having to know them.
|
||||
|
||||
@table @kbd
|
||||
@item C-s @key{RET} C-w @var{words} @key{RET}
|
||||
Search for @var{words}, ignoring details of punctuation.
|
||||
@item C-r @key{RET} C-w @var{words} @key{RET}
|
||||
Search backward for @var{words}, ignoring details of punctuation.
|
||||
@end table
|
||||
|
||||
Word search is a special case of nonincremental search and is invoked
|
||||
with @kbd{C-s @key{RET} C-w}. This is followed by the search string,
|
||||
which must always be terminated with @key{RET}. Being nonincremental,
|
||||
this search does not start until the argument is terminated. It works
|
||||
by constructing a regular expression and searching for that; see
|
||||
@ref{Regexp Search}.
|
||||
|
||||
Use @kbd{C-r @key{RET} C-w} to do backward word search.
|
||||
|
||||
@findex word-search-forward
|
||||
@findex word-search-backward
|
||||
Forward and backward word searches are implemented by the commands
|
||||
@code{word-search-forward} and @code{word-search-backward}. These
|
||||
commands may be bound to keys in the usual manner. The feature that you
|
||||
can get to them via the incremental search commands exists for historical
|
||||
reasons, and to avoid the need to find suitable key sequences for them.
|
||||
|
||||
@node Regexp Search, Regexps, Word Search, Search
|
||||
@section Regular Expression Search
|
||||
@cindex regular expression
|
||||
@cindex regexp
|
||||
|
||||
A @dfn{regular expression} (@dfn{regexp}, for short) is a pattern that
|
||||
denotes a class of alternative strings to match, possibly infinitely
|
||||
many. In GNU Emacs, you can search for the next match for a regexp
|
||||
either incrementally or not.
|
||||
|
||||
@kindex C-M-s
|
||||
@findex isearch-forward-regexp
|
||||
@kindex C-M-r
|
||||
@findex isearch-backward-regexp
|
||||
Incremental search for a regexp is done by typing @kbd{C-M-s}
|
||||
(@code{isearch-forward-regexp}). This command reads a search string
|
||||
incrementally just like @kbd{C-s}, but it treats the search string as a
|
||||
regexp rather than looking for an exact match against the text in the
|
||||
buffer. Each time you add text to the search string, you make the
|
||||
regexp longer, and the new regexp is searched for. Invoking @kbd{C-s}
|
||||
with a prefix argument (its value does not matter) is another way to do
|
||||
a forward incremental regexp search. To search backward for a regexp,
|
||||
use @kbd{C-M-r} (@code{isearch-backward-regexp}), or @kbd{C-r} with a
|
||||
prefix argument.
|
||||
|
||||
All of the control characters that do special things within an
|
||||
ordinary incremental search have the same function in incremental regexp
|
||||
search. Typing @kbd{C-s} or @kbd{C-r} immediately after starting the
|
||||
search retrieves the last incremental search regexp used; that is to
|
||||
say, incremental regexp and non-regexp searches have independent
|
||||
defaults. They also have separate search rings that you can access with
|
||||
@kbd{M-p} and @kbd{M-n}.
|
||||
|
||||
If you type @key{SPC} in incremental regexp search, it matches any
|
||||
sequence of whitespace characters, including newlines. If you want
|
||||
to match just a space, type @kbd{C-q @key{SPC}}.
|
||||
|
||||
Note that adding characters to the regexp in an incremental regexp
|
||||
search can make the cursor move back and start again. For example, if
|
||||
you have searched for @samp{foo} and you add @samp{\|bar}, the cursor
|
||||
backs up in case the first @samp{bar} precedes the first @samp{foo}.
|
||||
|
||||
@findex re-search-forward
|
||||
@findex re-search-backward
|
||||
Nonincremental search for a regexp is done by the functions
|
||||
@code{re-search-forward} and @code{re-search-backward}. You can invoke
|
||||
these with @kbd{M-x}, or bind them to keys, or invoke them by way of
|
||||
incremental regexp search with @kbd{C-M-s @key{RET}} and @kbd{C-M-r
|
||||
@key{RET}}.
|
||||
|
||||
If you use the incremental regexp search commands with a prefix
|
||||
argument, they perform ordinary string search, like
|
||||
@code{isearch-forward} and @code{isearch-backward}. @xref{Incremental
|
||||
Search}.
|
||||
|
||||
@node Regexps, Search Case, Regexp Search, Search
|
||||
@section Syntax of Regular Expressions
|
||||
@cindex regexp syntax
|
||||
|
||||
Regular expressions have a syntax in which a few characters are
|
||||
special constructs and the rest are @dfn{ordinary}. An ordinary
|
||||
character is a simple regular expression which matches that same
|
||||
character and nothing else. The special characters are @samp{$},
|
||||
@samp{^}, @samp{.}, @samp{*}, @samp{+}, @samp{?}, @samp{[}, @samp{]} and
|
||||
@samp{\}. Any other character appearing in a regular expression is
|
||||
ordinary, unless a @samp{\} precedes it.
|
||||
|
||||
For example, @samp{f} is not a special character, so it is ordinary, and
|
||||
therefore @samp{f} is a regular expression that matches the string
|
||||
@samp{f} and no other string. (It does @emph{not} match the string
|
||||
@samp{ff}.) Likewise, @samp{o} is a regular expression that matches
|
||||
only @samp{o}. (When case distinctions are being ignored, these regexps
|
||||
also match @samp{F} and @samp{O}, but we consider this a generalization
|
||||
of ``the same string,'' rather than an exception.)
|
||||
|
||||
Any two regular expressions @var{a} and @var{b} can be concatenated. The
|
||||
result is a regular expression which matches a string if @var{a} matches
|
||||
some amount of the beginning of that string and @var{b} matches the rest of
|
||||
the string.@refill
|
||||
|
||||
As a simple example, we can concatenate the regular expressions @samp{f}
|
||||
and @samp{o} to get the regular expression @samp{fo}, which matches only
|
||||
the string @samp{fo}. Still trivial. To do something nontrivial, you
|
||||
need to use one of the special characters. Here is a list of them.
|
||||
|
||||
@table @kbd
|
||||
@item .@: @r{(Period)}
|
||||
is a special character that matches any single character except a newline.
|
||||
Using concatenation, we can make regular expressions like @samp{a.b}, which
|
||||
matches any three-character string that begins with @samp{a} and ends with
|
||||
@samp{b}.@refill
|
||||
|
||||
@item *
|
||||
is not a construct by itself; it is a postfix operator that means to
|
||||
match the preceding regular expression repetitively as many times as
|
||||
possible. Thus, @samp{o*} matches any number of @samp{o}s (including no
|
||||
@samp{o}s).
|
||||
|
||||
@samp{*} always applies to the @emph{smallest} possible preceding
|
||||
expression. Thus, @samp{fo*} has a repeating @samp{o}, not a repeating
|
||||
@samp{fo}. It matches @samp{f}, @samp{fo}, @samp{foo}, and so on.
|
||||
|
||||
The matcher processes a @samp{*} construct by matching, immediately,
|
||||
as many repetitions as can be found. Then it continues with the rest
|
||||
of the pattern. If that fails, backtracking occurs, discarding some
|
||||
of the matches of the @samp{*}-modified construct in case that makes
|
||||
it possible to match the rest of the pattern. For example, in matching
|
||||
@samp{ca*ar} against the string @samp{caaar}, the @samp{a*} first
|
||||
tries to match all three @samp{a}s; but the rest of the pattern is
|
||||
@samp{ar} and there is only @samp{r} left to match, so this try fails.
|
||||
The next alternative is for @samp{a*} to match only two @samp{a}s.
|
||||
With this choice, the rest of the regexp matches successfully.@refill
|
||||
|
||||
@item +
|
||||
is a postfix operator, similar to @samp{*} except that it must match
|
||||
the preceding expression at least once. So, for example, @samp{ca+r}
|
||||
matches the strings @samp{car} and @samp{caaaar} but not the string
|
||||
@samp{cr}, whereas @samp{ca*r} matches all three strings.
|
||||
|
||||
@item ?
|
||||
is a postfix operator, similar to @samp{*} except that it can match the
|
||||
preceding expression either once or not at all. For example,
|
||||
@samp{ca?r} matches @samp{car} or @samp{cr}; nothing else.
|
||||
|
||||
@item [ @dots{} ]
|
||||
is a @dfn{character set}, which begins with @samp{[} and is terminated
|
||||
by @samp{]}. In the simplest case, the characters between the two
|
||||
brackets are what this set can match.
|
||||
|
||||
Thus, @samp{[ad]} matches either one @samp{a} or one @samp{d}, and
|
||||
@samp{[ad]*} matches any string composed of just @samp{a}s and @samp{d}s
|
||||
(including the empty string), from which it follows that @samp{c[ad]*r}
|
||||
matches @samp{cr}, @samp{car}, @samp{cdr}, @samp{caddaar}, etc.
|
||||
|
||||
You can also include character ranges in a character set, by writing the
|
||||
starting and ending characters with a @samp{-} between them. Thus,
|
||||
@samp{[a-z]} matches any lower-case ASCII letter. Ranges may be
|
||||
intermixed freely with individual characters, as in @samp{[a-z$%.]},
|
||||
which matches any lower-case ASCII letter or @samp{$}, @samp{%} or
|
||||
period.
|
||||
|
||||
Note that the usual regexp special characters are not special inside a
|
||||
character set. A completely different set of special characters exists
|
||||
inside character sets: @samp{]}, @samp{-} and @samp{^}.
|
||||
|
||||
To include a @samp{]} in a character set, you must make it the first
|
||||
character. For example, @samp{[]a]} matches @samp{]} or @samp{a}. To
|
||||
include a @samp{-}, write @samp{-} as the first or last character of the
|
||||
set, or put it after a range. Thus, @samp{[]-]} matches both @samp{]}
|
||||
and @samp{-}.
|
||||
|
||||
To include @samp{^} in a set, put it anywhere but at the beginning of
|
||||
the set.
|
||||
|
||||
When you use a range in case-insensitive search, you should write both
|
||||
ends of the range in upper case, or both in lower case, or both should
|
||||
be non-letters. The behavior of a mixed-case range such as @samp{A-z}
|
||||
is somewhat ill-defined, and it may change in future Emacs versions.
|
||||
|
||||
@item [^ @dots{} ]
|
||||
@samp{[^} begins a @dfn{complemented character set}, which matches any
|
||||
character except the ones specified. Thus, @samp{[^a-z0-9A-Z]} matches
|
||||
all characters @emph{except} letters and digits.
|
||||
|
||||
@samp{^} is not special in a character set unless it is the first
|
||||
character. The character following the @samp{^} is treated as if it
|
||||
were first (in other words, @samp{-} and @samp{]} are not special there).
|
||||
|
||||
A complemented character set can match a newline, unless newline is
|
||||
mentioned as one of the characters not to match. This is in contrast to
|
||||
the handling of regexps in programs such as @code{grep}.
|
||||
|
||||
@item ^
|
||||
is a special character that matches the empty string, but only at the
|
||||
beginning of a line in the text being matched. Otherwise it fails to
|
||||
match anything. Thus, @samp{^foo} matches a @samp{foo} that occurs at
|
||||
the beginning of a line.
|
||||
|
||||
@item $
|
||||
is similar to @samp{^} but matches only at the end of a line. Thus,
|
||||
@samp{x+$} matches a string of one @samp{x} or more at the end of a line.
|
||||
|
||||
@item \
|
||||
has two functions: it quotes the special characters (including
|
||||
@samp{\}), and it introduces additional special constructs.
|
||||
|
||||
Because @samp{\} quotes special characters, @samp{\$} is a regular
|
||||
expression that matches only @samp{$}, and @samp{\[} is a regular
|
||||
expression that matches only @samp{[}, and so on.
|
||||
@end table
|
||||
|
||||
Note: for historical compatibility, special characters are treated as
|
||||
ordinary ones if they are in contexts where their special meanings make no
|
||||
sense. For example, @samp{*foo} treats @samp{*} as ordinary since there is
|
||||
no preceding expression on which the @samp{*} can act. It is poor practice
|
||||
to depend on this behavior; it is better to quote the special character anyway,
|
||||
regardless of where it appears.@refill
|
||||
|
||||
For the most part, @samp{\} followed by any character matches only that
|
||||
character. However, there are several exceptions: two-character
|
||||
sequences starting with @samp{\} that have special meanings. The second
|
||||
character in the sequence is always an ordinary character when used on
|
||||
its own. Here is a table of @samp{\} constructs.
|
||||
|
||||
@table @kbd
|
||||
@item \|
|
||||
specifies an alternative. Two regular expressions @var{a} and @var{b}
|
||||
with @samp{\|} in between form an expression that matches some text if
|
||||
either @var{a} matches it or @var{b} matches it. It works by trying to
|
||||
match @var{a}, and if that fails, by trying to match @var{b}.
|
||||
|
||||
Thus, @samp{foo\|bar} matches either @samp{foo} or @samp{bar}
|
||||
but no other string.@refill
|
||||
|
||||
@samp{\|} applies to the largest possible surrounding expressions. Only a
|
||||
surrounding @samp{\( @dots{} \)} grouping can limit the grouping power of
|
||||
@samp{\|}.@refill
|
||||
|
||||
Full backtracking capability exists to handle multiple uses of @samp{\|}.
|
||||
|
||||
@item \( @dots{} \)
|
||||
is a grouping construct that serves three purposes:
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
To enclose a set of @samp{\|} alternatives for other operations.
|
||||
Thus, @samp{\(foo\|bar\)x} matches either @samp{foox} or @samp{barx}.
|
||||
|
||||
@item
|
||||
To enclose a complicated expression for the postfix operators @samp{*},
|
||||
@samp{+} and @samp{?} to operate on. Thus, @samp{ba\(na\)*} matches
|
||||
@samp{bananana}, etc., with any (zero or more) number of @samp{na}
|
||||
strings.@refill
|
||||
|
||||
@item
|
||||
To record a matched substring for future reference.
|
||||
@end enumerate
|
||||
|
||||
This last application is not a consequence of the idea of a
|
||||
parenthetical grouping; it is a separate feature that is assigned as a
|
||||
second meaning to the same @samp{\( @dots{} \)} construct. In practice
|
||||
there is no conflict between the two meanings.
|
||||
|
||||
@item \@var{d}
|
||||
matches the same text that matched the @var{d}th occurrence of a
|
||||
@samp{\( @dots{} \)} construct.
|
||||
|
||||
After the end of a @samp{\( @dots{} \)} construct, the matcher remembers
|
||||
the beginning and end of the text matched by that construct. Then,
|
||||
later on in the regular expression, you can use @samp{\} followed by the
|
||||
digit @var{d} to mean ``match the same text matched the @var{d}th time
|
||||
by the @samp{\( @dots{} \)} construct.''
|
||||
|
||||
The strings matching the first nine @samp{\( @dots{} \)} constructs
|
||||
appearing in a regular expression are assigned numbers 1 through 9 in
|
||||
the order that the open-parentheses appear in the regular expression.
|
||||
So you can use @samp{\1} through @samp{\9} to refer to the text matched
|
||||
by the corresponding @samp{\( @dots{} \)} constructs.
|
||||
|
||||
For example, @samp{\(.*\)\1} matches any newline-free string that is
|
||||
composed of two identical halves. The @samp{\(.*\)} matches the first
|
||||
half, which may be anything, but the @samp{\1} that follows must match
|
||||
the same exact text.
|
||||
|
||||
If a particular @samp{\( @dots{} \)} construct matches more than once
|
||||
(which can easily happen if it is followed by @samp{*}), only the last
|
||||
match is recorded.
|
||||
|
||||
@item \`
|
||||
matches the empty string, but only at the beginning
|
||||
of the buffer or string being matched against.
|
||||
|
||||
@item \'
|
||||
matches the empty string, but only at the end of
|
||||
the buffer or string being matched against.
|
||||
|
||||
@item \=
|
||||
matches the empty string, but only at point.
|
||||
|
||||
@item \b
|
||||
matches the empty string, but only at the beginning or
|
||||
end of a word. Thus, @samp{\bfoo\b} matches any occurrence of
|
||||
@samp{foo} as a separate word. @samp{\bballs?\b} matches
|
||||
@samp{ball} or @samp{balls} as a separate word.@refill
|
||||
|
||||
@samp{\b} matches at the beginning or end of the buffer
|
||||
regardless of what text appears next to it.
|
||||
|
||||
@item \B
|
||||
matches the empty string, but @emph{not} at the beginning or
|
||||
end of a word.
|
||||
|
||||
@item \<
|
||||
matches the empty string, but only at the beginning of a word.
|
||||
@samp{\<} matches at the beginning of the buffer only if a
|
||||
word-constituent character follows.
|
||||
|
||||
@item \>
|
||||
matches the empty string, but only at the end of a word. @samp{\>}
|
||||
matches at the end of the buffer only if the contents end with a
|
||||
word-constituent character.
|
||||
|
||||
@item \w
|
||||
matches any word-constituent character. The syntax table
|
||||
determines which characters these are. @xref{Syntax}.
|
||||
|
||||
@item \W
|
||||
matches any character that is not a word-constituent.
|
||||
|
||||
@item \s@var{c}
|
||||
matches any character whose syntax is @var{c}. Here @var{c} is a
|
||||
character that represents a syntax code: thus, @samp{w} for word
|
||||
constituent, @samp{-} for whitespace, @samp{(} for open parenthesis,
|
||||
etc. Represent a character of whitespace (which can be a newline) by
|
||||
either @samp{-} or a space character.
|
||||
|
||||
@item \S@var{c}
|
||||
matches any character whose syntax is not @var{c}.
|
||||
@end table
|
||||
|
||||
The constructs that pertain to words and syntax are controlled by the
|
||||
setting of the syntax table (@pxref{Syntax}).
|
||||
|
||||
Here is a complicated regexp, used by Emacs to recognize the end of a
|
||||
sentence together with any whitespace that follows. It is given in Lisp
|
||||
syntax to enable you to distinguish the spaces from the tab characters. In
|
||||
Lisp syntax, the string constant begins and ends with a double-quote.
|
||||
@samp{\"} stands for a double-quote as part of the regexp, @samp{\\} for a
|
||||
backslash as part of the regexp, @samp{\t} for a tab and @samp{\n} for a
|
||||
newline.
|
||||
|
||||
@example
|
||||
"[.?!][]\"')]*\\($\\|\t\\| \\)[ \t\n]*"
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
This contains four parts in succession: a character set matching period,
|
||||
@samp{?}, or @samp{!}; a character set matching close-brackets, quotes,
|
||||
or parentheses, repeated any number of times; an alternative in
|
||||
backslash-parentheses that matches end-of-line, a tab, or two spaces;
|
||||
and a character set matching whitespace characters, repeated any number
|
||||
of times.
|
||||
|
||||
To enter the same regexp interactively, you would type @key{TAB} to
|
||||
enter a tab, and @kbd{C-j} to enter a newline. You would also type
|
||||
single backslashes as themselves, instead of doubling them for Lisp syntax.
|
||||
|
||||
@node Search Case, Replace, Regexps, Search
|
||||
@section Searching and Case
|
||||
|
||||
@vindex case-fold-search
|
||||
Incremental searches in Emacs normally ignore the case of the text
|
||||
they are searching through, if you specify the text in lower case.
|
||||
Thus, if you specify searching for @samp{foo}, then @samp{Foo} and
|
||||
@samp{foo} are also considered a match. Regexps, and in particular
|
||||
character sets, are included: @samp{[ab]} would match @samp{a} or
|
||||
@samp{A} or @samp{b} or @samp{B}.@refill
|
||||
|
||||
An upper-case letter anywhere in the incremental search string makes
|
||||
the search case-sensitive. Thus, searching for @samp{Foo} does not find
|
||||
@samp{foo} or @samp{FOO}. This applies to regular expression search as
|
||||
well as to string search. The effect ceases if you delete the
|
||||
upper-case letter from the search string.
|
||||
|
||||
If you set the variable @code{case-fold-search} to @code{nil}, then
|
||||
all letters must match exactly, including case. This is a per-buffer
|
||||
variable; altering the variable affects only the current buffer, but
|
||||
there is a default value which you can change as well. @xref{Locals}.
|
||||
This variable applies to nonincremental searches also, including those
|
||||
performed by the replace commands (@pxref{Replace}) and the minibuffer
|
||||
history matching commands (@pxref{Minibuffer History}).
|
||||
|
||||
@node Replace, Other Repeating Search, Search Case, Search
|
||||
@section Replacement Commands
|
||||
@cindex replacement
|
||||
@cindex search-and-replace commands
|
||||
@cindex string substitution
|
||||
@cindex global substitution
|
||||
|
||||
Global search-and-replace operations are not needed as often in Emacs
|
||||
as they are in other editors@footnote{In some editors,
|
||||
search-and-replace operations are the only convenient way to make a
|
||||
single change in the text.}, but they are available. In addition to the
|
||||
simple @kbd{M-x replace-string} command which is like that found in most
|
||||
editors, there is a @kbd{M-x query-replace} command which asks you, for
|
||||
each occurrence of the pattern, whether to replace it.
|
||||
|
||||
The replace commands normally operate on the text from point to the
|
||||
end of the buffer; however, in Transient Mark mode, when the mark is
|
||||
active, they operate on the region. The replace commands all replace
|
||||
one string (or regexp) with one replacement string. It is possible to
|
||||
perform several replacements in parallel using the command
|
||||
@code{expand-region-abbrevs} (@pxref{Expanding Abbrevs}).
|
||||
|
||||
@menu
|
||||
* Unconditional Replace:: Replacing all matches for a string.
|
||||
* Regexp Replace:: Replacing all matches for a regexp.
|
||||
* Replacement and Case:: How replacements preserve case of letters.
|
||||
* Query Replace:: How to use querying.
|
||||
@end menu
|
||||
|
||||
@node Unconditional Replace, Regexp Replace, Replace, Replace
|
||||
@subsection Unconditional Replacement
|
||||
@findex replace-string
|
||||
@findex replace-regexp
|
||||
|
||||
@table @kbd
|
||||
@item M-x replace-string @key{RET} @var{string} @key{RET} @var{newstring} @key{RET}
|
||||
Replace every occurrence of @var{string} with @var{newstring}.
|
||||
@item M-x replace-regexp @key{RET} @var{regexp} @key{RET} @var{newstring} @key{RET}
|
||||
Replace every match for @var{regexp} with @var{newstring}.
|
||||
@end table
|
||||
|
||||
To replace every instance of @samp{foo} after point with @samp{bar},
|
||||
use the command @kbd{M-x replace-string} with the two arguments
|
||||
@samp{foo} and @samp{bar}. Replacement happens only in the text after
|
||||
point, so if you want to cover the whole buffer you must go to the
|
||||
beginning first. All occurrences up to the end of the buffer are
|
||||
replaced; to limit replacement to part of the buffer, narrow to that
|
||||
part of the buffer before doing the replacement (@pxref{Narrowing}).
|
||||
In Transient Mark mode, when the region is active, replacement is
|
||||
limited to the region (@pxref{Transient Mark}).
|
||||
|
||||
When @code{replace-string} exits, it leaves point at the last
|
||||
occurrence replaced. It sets the mark to the prior position of point
|
||||
(where the @code{replace-string} command was issued); use @kbd{C-u
|
||||
C-@key{SPC}} to move back there.
|
||||
|
||||
A numeric argument restricts replacement to matches that are surrounded
|
||||
by word boundaries. The argument's value doesn't matter.
|
||||
|
||||
@node Regexp Replace, Replacement and Case, Unconditional Replace, Replace
|
||||
@subsection Regexp Replacement
|
||||
|
||||
The @kbd{M-x replace-string} command replaces exact matches for a
|
||||
single string. The similar command @kbd{M-x replace-regexp} replaces
|
||||
any match for a specified pattern.
|
||||
|
||||
In @code{replace-regexp}, the @var{newstring} need not be constant: it
|
||||
can refer to all or part of what is matched by the @var{regexp}.
|
||||
@samp{\&} in @var{newstring} stands for the entire match being replaced.
|
||||
@samp{\@var{d}} in @var{newstring}, where @var{d} is a digit, stands for
|
||||
whatever matched the @var{d}th parenthesized grouping in @var{regexp}.
|
||||
To include a @samp{\} in the text to replace with, you must enter
|
||||
@samp{\\}. For example,
|
||||
|
||||
@example
|
||||
M-x replace-regexp @key{RET} c[ad]+r @key{RET} \&-safe @key{RET}
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
replaces (for example) @samp{cadr} with @samp{cadr-safe} and @samp{cddr}
|
||||
with @samp{cddr-safe}.
|
||||
|
||||
@example
|
||||
M-x replace-regexp @key{RET} \(c[ad]+r\)-safe @key{RET} \1 @key{RET}
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
performs the inverse transformation.
|
||||
|
||||
@node Replacement and Case, Query Replace, Regexp Replace, Replace
|
||||
@subsection Replace Commands and Case
|
||||
|
||||
If the first argument of a replace command is all lower case, the
|
||||
commands ignores case while searching for occurrences to
|
||||
replace---provided @code{case-fold-search} is non-@code{nil}. If
|
||||
@code{case-fold-search} is set to @code{nil}, case is always significant
|
||||
in all searches.
|
||||
|
||||
@vindex case-replace
|
||||
In addition, when the @var{newstring} argument is all or partly lower
|
||||
case, replacement commands try to preserve the case pattern of each
|
||||
occurrence. Thus, the command
|
||||
|
||||
@example
|
||||
M-x replace-string @key{RET} foo @key{RET} bar @key{RET}
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
replaces a lower case @samp{foo} with a lower case @samp{bar}, an
|
||||
all-caps @samp{FOO} with @samp{BAR}, and a capitalized @samp{Foo} with
|
||||
@samp{Bar}. (These three alternatives---lower case, all caps, and
|
||||
capitalized, are the only ones that @code{replace-string} can
|
||||
distinguish.)
|
||||
|
||||
If upper-case letters are used in the replacement string, they remain
|
||||
upper case every time that text is inserted. If upper-case letters are
|
||||
used in the first argument, the second argument is always substituted
|
||||
exactly as given, with no case conversion. Likewise, if either
|
||||
@code{case-replace} or @code{case-fold-search} is set to @code{nil},
|
||||
replacement is done without case conversion.
|
||||
|
||||
@node Query Replace,, Replacement and Case, Replace
|
||||
@subsection Query Replace
|
||||
@cindex query replace
|
||||
|
||||
@table @kbd
|
||||
@item M-% @var{string} @key{RET} @var{newstring} @key{RET}
|
||||
@itemx M-x query-replace @key{RET} @var{string} @key{RET} @var{newstring} @key{RET}
|
||||
Replace some occurrences of @var{string} with @var{newstring}.
|
||||
@item C-M-% @var{regexp} @key{RET} @var{newstring} @key{RET}
|
||||
@itemx M-x query-replace-regexp @key{RET} @var{regexp} @key{RET} @var{newstring} @key{RET}
|
||||
Replace some matches for @var{regexp} with @var{newstring}.
|
||||
@end table
|
||||
|
||||
@kindex M-%
|
||||
@findex query-replace
|
||||
If you want to change only some of the occurrences of @samp{foo} to
|
||||
@samp{bar}, not all of them, then you cannot use an ordinary
|
||||
@code{replace-string}. Instead, use @kbd{M-%} (@code{query-replace}).
|
||||
This command finds occurrences of @samp{foo} one by one, displays each
|
||||
occurrence and asks you whether to replace it. A numeric argument to
|
||||
@code{query-replace} tells it to consider only occurrences that are
|
||||
bounded by word-delimiter characters. This preserves case, just like
|
||||
@code{replace-string}, provided @code{case-replace} is non-@code{nil},
|
||||
as it normally is.
|
||||
|
||||
@kindex C-M-%
|
||||
@findex query-replace-regexp
|
||||
Aside from querying, @code{query-replace} works just like
|
||||
@code{replace-string}, and @code{query-replace-regexp} works just like
|
||||
@code{replace-regexp}. This command is run by @kbd{C-M-%}.
|
||||
|
||||
The things you can type when you are shown an occurrence of @var{string}
|
||||
or a match for @var{regexp} are:
|
||||
|
||||
@ignore @c Not worth it.
|
||||
@kindex SPC @r{(query-replace)}
|
||||
@kindex DEL @r{(query-replace)}
|
||||
@kindex , @r{(query-replace)}
|
||||
@kindex RET @r{(query-replace)}
|
||||
@kindex . @r{(query-replace)}
|
||||
@kindex ! @r{(query-replace)}
|
||||
@kindex ^ @r{(query-replace)}
|
||||
@kindex C-r @r{(query-replace)}
|
||||
@kindex C-w @r{(query-replace)}
|
||||
@kindex C-l @r{(query-replace)}
|
||||
@end ignore
|
||||
|
||||
@c WideCommands
|
||||
@table @kbd
|
||||
@item @key{SPC}
|
||||
to replace the occurrence with @var{newstring}.
|
||||
|
||||
@item @key{DEL}
|
||||
to skip to the next occurrence without replacing this one.
|
||||
|
||||
@item , @r{(Comma)}
|
||||
to replace this occurrence and display the result. You are then asked
|
||||
for another input character to say what to do next. Since the
|
||||
replacement has already been made, @key{DEL} and @key{SPC} are
|
||||
equivalent in this situation; both move to the next occurrence.
|
||||
|
||||
You can type @kbd{C-r} at this point (see below) to alter the replaced
|
||||
text. You can also type @kbd{C-x u} to undo the replacement; this exits
|
||||
the @code{query-replace}, so if you want to do further replacement you
|
||||
must use @kbd{C-x @key{ESC} @key{ESC} @key{RET}} to restart
|
||||
(@pxref{Repetition}).
|
||||
|
||||
@item @key{RET}
|
||||
to exit without doing any more replacements.
|
||||
|
||||
@item .@: @r{(Period)}
|
||||
to replace this occurrence and then exit without searching for more
|
||||
occurrences.
|
||||
|
||||
@item !
|
||||
to replace all remaining occurrences without asking again.
|
||||
|
||||
@item ^
|
||||
to go back to the position of the previous occurrence (or what used to
|
||||
be an occurrence), in case you changed it by mistake. This works by
|
||||
popping the mark ring. Only one @kbd{^} in a row is meaningful, because
|
||||
only one previous replacement position is kept during @code{query-replace}.
|
||||
|
||||
@item C-r
|
||||
to enter a recursive editing level, in case the occurrence needs to be
|
||||
edited rather than just replaced with @var{newstring}. When you are
|
||||
done, exit the recursive editing level with @kbd{C-M-c} to proceed to
|
||||
the next occurrence. @xref{Recursive Edit}.
|
||||
|
||||
@item C-w
|
||||
to delete the occurrence, and then enter a recursive editing level as in
|
||||
@kbd{C-r}. Use the recursive edit to insert text to replace the deleted
|
||||
occurrence of @var{string}. When done, exit the recursive editing level
|
||||
with @kbd{C-M-c} to proceed to the next occurrence.
|
||||
|
||||
@item C-l
|
||||
to redisplay the screen. Then you must type another character to
|
||||
specify what to do with this occurrence.
|
||||
|
||||
@item C-h
|
||||
to display a message summarizing these options. Then you must type
|
||||
another character to specify what to do with this occurrence.
|
||||
@end table
|
||||
|
||||
Some other characters are aliases for the ones listed above: @kbd{y},
|
||||
@kbd{n} and @kbd{q} are equivalent to @key{SPC}, @key{DEL} and
|
||||
@key{RET}.
|
||||
|
||||
Aside from this, any other character exits the @code{query-replace},
|
||||
and is then reread as part of a key sequence. Thus, if you type
|
||||
@kbd{C-k}, it exits the @code{query-replace} and then kills to end of
|
||||
line.
|
||||
|
||||
To restart a @code{query-replace} once it is exited, use @kbd{C-x
|
||||
@key{ESC} @key{ESC}}, which repeats the @code{query-replace} because it
|
||||
used the minibuffer to read its arguments. @xref{Repetition, C-x ESC
|
||||
ESC}.
|
||||
|
||||
See also @ref{Transforming File Names}, for Dired commands to rename,
|
||||
copy, or link files by replacing regexp matches in file names.
|
||||
|
||||
@node Other Repeating Search,, Replace, Search
|
||||
@section Other Search-and-Loop Commands
|
||||
|
||||
Here are some other commands that find matches for a regular
|
||||
expression. They all operate from point to the end of the buffer, and
|
||||
all ignore case in matching, if the pattern contains no upper-case
|
||||
letters and @code{case-fold-search} is non-@code{nil}.
|
||||
|
||||
@findex list-matching-lines
|
||||
@findex occur
|
||||
@findex count-matches
|
||||
@findex delete-non-matching-lines
|
||||
@findex delete-matching-lines
|
||||
@findex flush-lines
|
||||
@findex keep-lines
|
||||
|
||||
@table @kbd
|
||||
@item M-x occur @key{RET} @var{regexp} @key{RET}
|
||||
Display a list showing each line in the buffer that contains a match for
|
||||
@var{regexp}. A numeric argument specifies the number of context lines
|
||||
to print before and after each matching line; the default is none.
|
||||
To limit the search to part of the buffer, narrow to that part
|
||||
(@pxref{Narrowing}).
|
||||
|
||||
@kindex RET @r{(Occur mode)}
|
||||
The buffer @samp{*Occur*} containing the output serves as a menu for
|
||||
finding the occurrences in their original context. Click @kbd{Mouse-2}
|
||||
on an occurrence listed in @samp{*Occur*}, or position point there and
|
||||
type @key{RET}; this switches to the buffer that was searched and
|
||||
moves point to the original of the chosen occurrence.
|
||||
|
||||
@item M-x list-matching-lines
|
||||
Synonym for @kbd{M-x occur}.
|
||||
|
||||
@item M-x count-matches @key{RET} @var{regexp} @key{RET}
|
||||
Print the number of matches for @var{regexp} after point.
|
||||
|
||||
@item M-x flush-lines @key{RET} @var{regexp} @key{RET}
|
||||
Delete each line that follows point and contains a match for
|
||||
@var{regexp}.
|
||||
|
||||
@item M-x keep-lines @key{RET} @var{regexp} @key{RET}
|
||||
Delete each line that follows point and @emph{does not} contain a match
|
||||
for @var{regexp}.
|
||||
@end table
|
||||
|
||||
In addition, you can use @code{grep} from Emacs to search a collection
|
||||
of files for matches for a regular expression, then visit the matches
|
||||
either sequentially or in arbitrary order. @xref{Grep Searching}.
|
643
man/sending.texi
Normal file
643
man/sending.texi
Normal file
|
@ -0,0 +1,643 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Sending Mail, Rmail, Picture, Top
|
||||
@chapter Sending Mail
|
||||
@cindex sending mail
|
||||
@cindex mail
|
||||
@cindex message
|
||||
|
||||
To send a message in Emacs, you start by typing a command (@kbd{C-x m})
|
||||
to select and initialize the @samp{*mail*} buffer. Then you edit the text
|
||||
and headers of the message in this buffer, and type another command
|
||||
(@kbd{C-c C-s} or @kbd{C-c C-c}) to send the message.
|
||||
|
||||
@table @kbd
|
||||
@item C-x m
|
||||
Begin composing a message to send (@code{compose-mail}).
|
||||
@item C-x 4 m
|
||||
Likewise, but display the message in another window
|
||||
(@code{compose-mail-other-window}).
|
||||
@item C-x 5 m
|
||||
Likewise, but make a new frame (@code{compose-mail-other-frame}).
|
||||
@item C-c C-s
|
||||
In Mail mode, send the message (@code{mail-send}).
|
||||
@item C-c C-c
|
||||
Send the message and bury the mail buffer (@code{mail-send-and-exit}).
|
||||
@end table
|
||||
|
||||
@kindex C-x m
|
||||
@findex compose-mail
|
||||
@kindex C-x 4 m
|
||||
@findex compose-mail-other-window
|
||||
@kindex C-x 5 m
|
||||
@findex compose-mail-other-frame
|
||||
The command @kbd{C-x m} (@code{compose-mail}) selects a buffer named
|
||||
@samp{*mail*} and initializes it with the skeleton of an outgoing
|
||||
message. @kbd{C-x 4 m} (@code{compose-mail-other-window}) selects the
|
||||
@samp{*mail*} buffer in a different window, leaving the previous current
|
||||
buffer visible. @kbd{C-x 5 m} (@code{compose-mail-other-frame}) creates
|
||||
a new frame to select the @samp{*mail*} buffer.
|
||||
|
||||
Because the mail-composition buffer is an ordinary Emacs buffer, you can
|
||||
switch to other buffers while in the middle of composing mail, and switch
|
||||
back later (or never). If you use the @kbd{C-x m} command again when you
|
||||
have been composing another message but have not sent it, you are asked to
|
||||
confirm before the old message is erased. If you answer @kbd{n}, the
|
||||
@samp{*mail*} buffer is left selected with its old contents, so you can
|
||||
finish the old message and send it. @kbd{C-u C-x m} is another way to do
|
||||
this. Sending the message marks the @samp{*mail*} buffer ``unmodified,''
|
||||
which avoids the need for confirmation when @kbd{C-x m} is next used.
|
||||
|
||||
If you are composing a message in the @samp{*mail*} buffer and want to
|
||||
send another message before finishing the first, rename the
|
||||
@samp{*mail*} buffer using @kbd{M-x rename-uniquely} (@pxref{Misc
|
||||
Buffer}). Then you can use @kbd{C-x m} or its variants described above
|
||||
to make a new @samp{*mail*} buffer. Once you've done that, you can work
|
||||
with each mail buffer independently.
|
||||
|
||||
@menu
|
||||
* Format: Mail Format. Format of the mail being composed.
|
||||
* Headers: Mail Headers. Details of permitted mail header fields.
|
||||
* Aliases: Mail Aliases. Abbreviating and grouping mail addresses.
|
||||
* Mode: Mail Mode. Special commands for editing mail being composed.
|
||||
* Spook: Distracting NSA. How to distract the NSA's attention.
|
||||
* Mail Methods:: Using alternative mail-composition methods.
|
||||
@end menu
|
||||
|
||||
@node Mail Format
|
||||
@section The Format of the Mail Buffer
|
||||
|
||||
In addition to the @dfn{text} or @dfn{body}, a message has @dfn{header
|
||||
fields} which say who sent it, when, to whom, why, and so on. Some
|
||||
header fields, such as @samp{Date} and @samp{Sender}, are created
|
||||
automatically when you send the message. Others, such as the recipient
|
||||
names, must be specified by you in order to send the message properly.
|
||||
|
||||
Mail mode provides a few commands to help you edit some header fields,
|
||||
and some are preinitialized in the buffer automatically at times. You can
|
||||
insert and edit header fields using ordinary editing commands.
|
||||
|
||||
The line in the buffer that says
|
||||
|
||||
@example
|
||||
--text follows this line--
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
is a special delimiter that separates the headers you have specified from
|
||||
the text. Whatever follows this line is the text of the message; the
|
||||
headers precede it. The delimiter line itself does not appear in the
|
||||
message actually sent. The text used for the delimiter line is controlled
|
||||
by the variable @code{mail-header-separator}.
|
||||
|
||||
Here is an example of what the headers and text in the mail buffer
|
||||
might look like.
|
||||
|
||||
@example
|
||||
To: gnu@@gnu.org
|
||||
CC: lungfish@@spam.org, byob@@spam.org
|
||||
Subject: The Emacs Manual
|
||||
--Text follows this line--
|
||||
Please ignore this message.
|
||||
@end example
|
||||
|
||||
@node Mail Headers
|
||||
@section Mail Header Fields
|
||||
@cindex headers (of mail message)
|
||||
|
||||
A header field in the mail buffer starts with a field name at the
|
||||
beginning of a line, terminated by a colon. Upper and lower case are
|
||||
equivalent in field names (and in mailing addresses also). After the
|
||||
colon and optional whitespace comes the contents of the field.
|
||||
|
||||
You can use any name you like for a header field, but normally people
|
||||
use only standard field names with accepted meanings. Here is a table
|
||||
of fields commonly used in outgoing messages.
|
||||
|
||||
@table @samp
|
||||
@item To
|
||||
This field contains the mailing addresses to which the message is
|
||||
addressed. If you list more than one address, use commas, not spaces,
|
||||
to separate them.
|
||||
|
||||
@item Subject
|
||||
The contents of the @samp{Subject} field should be a piece of text
|
||||
that says what the message is about. The reason @samp{Subject} fields
|
||||
are useful is that most mail-reading programs can provide a summary of
|
||||
messages, listing the subject of each message but not its text.
|
||||
|
||||
@item CC
|
||||
This field contains additional mailing addresses to send the message to,
|
||||
like @samp{To} except that these readers should not regard the message
|
||||
as directed at them.
|
||||
|
||||
@item BCC
|
||||
This field contains additional mailing addresses to send the message to,
|
||||
which should not appear in the header of the message actually sent.
|
||||
Copies sent this way are called @dfn{blind carbon copies}.
|
||||
|
||||
@vindex mail-self-blind
|
||||
To send a blind carbon copy of every outgoing message to yourself, set
|
||||
the variable @code{mail-self-blind} to @code{t}.
|
||||
|
||||
@item FCC
|
||||
This field contains the name of one file and directs Emacs to append a
|
||||
copy of the message to that file when you send the message. If the file
|
||||
is in Rmail format, Emacs writes the message in Rmail format; otherwise,
|
||||
Emacs writes the message in system mail file format.
|
||||
|
||||
@vindex mail-archive-file-name
|
||||
To put a fixed file name in the @samp{FCC} field each time you start
|
||||
editing an outgoing message, set the variable
|
||||
@code{mail-archive-file-name} to that file name. Unless you remove the
|
||||
@samp{FCC} field before sending, the message will be written into that
|
||||
file when it is sent.
|
||||
|
||||
@item From
|
||||
Use the @samp{From} field to say who you are, when the account you are
|
||||
using to send the mail is not your own. The contents of the @samp{From}
|
||||
field should be a valid mailing address, since replies will normally go
|
||||
there. If you don't specify the @samp{From} field yourself, Emacs uses
|
||||
the value of @code{user-mail-address} as the default.
|
||||
|
||||
@item Reply-to
|
||||
Use this field to direct replies to a different address. Most
|
||||
mail-reading programs (including Rmail) automatically send replies to
|
||||
the @samp{Reply-to} address in preference to the @samp{From} address.
|
||||
By adding a @samp{Reply-to} field to your header, you can work around
|
||||
any problems your @samp{From} address may cause for replies.
|
||||
|
||||
@cindex @code{REPLYTO} environment variable
|
||||
@vindex mail-default-reply-to
|
||||
To put a fixed @samp{Reply-to} address into every outgoing message, set
|
||||
the variable @code{mail-default-reply-to} to that address (as a string).
|
||||
Then @code{mail} initializes the message with a @samp{Reply-to} field as
|
||||
specified. You can delete or alter that header field before you send
|
||||
the message, if you wish. When Emacs starts up, if the environment
|
||||
variable @code{REPLYTO} is set, @code{mail-default-reply-to} is
|
||||
initialized from that environment variable.
|
||||
|
||||
@item In-reply-to
|
||||
This field contains a piece of text describing a message you are
|
||||
replying to. Some mail systems can use this information to correlate
|
||||
related pieces of mail. Normally this field is filled in by Rmail
|
||||
when you reply to a message in Rmail, and you never need to
|
||||
think about it (@pxref{Rmail}).
|
||||
|
||||
@item References
|
||||
This field lists the message IDs of related previous messages. Rmail
|
||||
sets up this field automatically when you reply to a message.
|
||||
@end table
|
||||
|
||||
The @samp{To}, @samp{CC}, @samp{BCC} and @samp{FCC} header fields can
|
||||
appear any number of times, and each such header field can contain
|
||||
multiple addresses, separated by commas. This way, you can specify any
|
||||
number of places to send the message. A @samp{To}, @samp{CC}, or
|
||||
@samp{BCC} field can also have continuation lines: one or more lines
|
||||
starting with whitespace, following the starting line of the field, are
|
||||
considered part of the field. Here's an example of a @samp{To} field
|
||||
with a continuation line:@refill
|
||||
|
||||
@example
|
||||
@group
|
||||
To: foo@@here.net, this@@there.net,
|
||||
me@@gnu.cambridge.mass.usa.earth.spiral3281
|
||||
@end group
|
||||
@end example
|
||||
|
||||
@vindex mail-from-style
|
||||
When you send the message, if you didn't write a @samp{From} field
|
||||
yourself, Emacs puts in one for you. The variable
|
||||
@code{mail-from-style} controls the format:
|
||||
|
||||
@table @code
|
||||
@item nil
|
||||
Use just the email address, as in @samp{king@@grassland.com}.
|
||||
@item parens
|
||||
Use both email address and full name, as in @samp{king@@grassland.com (Elvis
|
||||
Parsley)}.
|
||||
@item angles
|
||||
Use both email address and full name, as in @samp{Elvis Parsley
|
||||
<king@@grassland.com>}.
|
||||
@item system-default
|
||||
Allow the system to insert the @samp{From} field.
|
||||
@end table
|
||||
|
||||
@node Mail Aliases
|
||||
@section Mail Aliases
|
||||
@cindex mail aliases
|
||||
@cindex @file{.mailrc} file
|
||||
@cindex mailrc file
|
||||
|
||||
You can define @dfn{mail aliases} in a file named @file{~/.mailrc}.
|
||||
These are short mnemonic names which stand for mail addresses or groups of
|
||||
mail addresses. Like many other mail programs, Emacs expands aliases
|
||||
when they occur in the @samp{To}, @samp{From}, @samp{CC}, @samp{BCC}, and
|
||||
@samp{Reply-to} fields, plus their @samp{Resent-} variants.
|
||||
|
||||
To define an alias in @file{~/.mailrc}, write a line in the following
|
||||
format:
|
||||
|
||||
@example
|
||||
alias @var{shortaddress} @var{fulladdresses}
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
Here @var{fulladdresses} stands for one or more mail addresses for
|
||||
@var{shortaddress} to expand into. Separate multiple addresses with
|
||||
spaces; if an address contains a space, quote the whole address with a
|
||||
pair of double-quotes.
|
||||
|
||||
For instance, to make @code{maingnu} stand for
|
||||
@code{gnu@@gnu.org} plus a local address of your own, put in
|
||||
this line:@refill
|
||||
|
||||
@example
|
||||
alias maingnu gnu@@gnu.org local-gnu
|
||||
@end example
|
||||
|
||||
Emacs also recognizes include commands in @samp{.mailrc} files.
|
||||
They look like this:
|
||||
|
||||
@example
|
||||
source @var{filename}
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
The file @file{~/.mailrc} is used primarily by other mail-reading
|
||||
programs; it can contain various other commands. Emacs ignores
|
||||
everything in it except for alias definitions and include commands.
|
||||
|
||||
@findex define-mail-alias
|
||||
Another way to define a mail alias, within Emacs alone, is with the
|
||||
@code{define-mail-alias} command. It prompts for the alias and then the
|
||||
full address. You can use it to define aliases in your @file{.emacs}
|
||||
file, like this:
|
||||
|
||||
@example
|
||||
(define-mail-alias "maingnu" "gnu@@gnu.org")
|
||||
@end example
|
||||
|
||||
@vindex mail-aliases
|
||||
@code{define-mail-alias} records aliases by adding them to a
|
||||
variable named @code{mail-aliases}. If you are comfortable with
|
||||
manipulating Lisp lists, you can set @code{mail-aliases} directly. The
|
||||
initial value of @code{mail-aliases} is @code{t}, which means that
|
||||
Emacs should read @file{.mailrc} to get the proper value.
|
||||
|
||||
@vindex mail-personal-alias-file
|
||||
You can specify a different file name to use instead of
|
||||
@file{~/.mailrc} by setting the variable
|
||||
@code{mail-personal-alias-file}.
|
||||
|
||||
@findex expand-mail-aliases
|
||||
Normally, Emacs expands aliases when you send the message. You do not
|
||||
need to expand mail aliases before sending the message, but you can
|
||||
expand them if you want to see where the mail will actually go. To do
|
||||
this, use the command @kbd{M-x expand-mail-aliases}; it expands all mail
|
||||
aliases currently present in the mail headers that hold addresses.
|
||||
|
||||
If you like, you can have mail aliases expand as abbrevs, as soon as
|
||||
you type them in (@pxref{Abbrevs}). To enable this feature, execute the
|
||||
following:
|
||||
|
||||
@example
|
||||
(add-hook 'mail-setup-hook 'mail-abbrevs-setup)
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
@findex define-mail-abbrev
|
||||
@vindex mail-abbrevs
|
||||
This can go in your @file{.emacs} file. @xref{Hooks}. If you use this
|
||||
feature, you must use @code{define-mail-abbrev} instead of
|
||||
@code{define-mail-alias}; the latter does not work with this package.
|
||||
Note that the mail abbreviation package uses the variable
|
||||
@code{mail-abbrevs} instead of @code{mail-aliases}, and that all alias
|
||||
names are converted to lower case.
|
||||
|
||||
@kindex C-c C-a @r{(Mail mode)}
|
||||
@findex mail-interactive-insert-alias
|
||||
The mail abbreviation package also provides the @kbd{C-c C-a}
|
||||
(@code{mail-interactive-insert-alias}) command, which reads an alias
|
||||
name (with completion) and inserts its definition at point. This is
|
||||
useful when editing the message text itself or a header field such as
|
||||
@samp{Subject} in which Emacs does not normally expand aliases.
|
||||
|
||||
Note that abbrevs expand only if you insert a word-separator character
|
||||
afterward. However, you can rebind @kbd{C-n} and @kbd{M->} to cause
|
||||
expansion as well. Here's how to do that:
|
||||
|
||||
@smallexample
|
||||
(add-hook 'mail-setup-hook
|
||||
'(lambda ()
|
||||
(substitute-key-definition
|
||||
'next-line 'mail-abbrev-next-line
|
||||
mail-mode-map global-map)
|
||||
(substitute-key-definition
|
||||
'end-of-buffer 'mail-abbrev-end-of-buffer
|
||||
mail-mode-map global-map)))
|
||||
@end smallexample
|
||||
|
||||
@node Mail Mode
|
||||
@section Mail Mode
|
||||
@cindex Mail mode
|
||||
@cindex mode, Mail
|
||||
|
||||
The major mode used in the mail buffer is Mail mode, which is much
|
||||
like Text mode except that various special commands are provided on the
|
||||
@kbd{C-c} prefix. These commands all have to do specifically with
|
||||
editing or sending the message. In addition, Mail mode defines the
|
||||
character @samp{%} as a word separator; this is helpful for using the
|
||||
word commands to edit mail addresses.
|
||||
|
||||
Mail mode is normally used in buffers set up automatically by the
|
||||
@code{mail} command and related commands. However, you can also switch
|
||||
to Mail mode in a file-visiting buffer. That is a useful thing to do if
|
||||
you have saved draft message text in a file.
|
||||
|
||||
@menu
|
||||
* Mail Sending:: Commands to send the message.
|
||||
* Header Editing:: Commands to move to header fields and edit them.
|
||||
* Citing Mail:: Copying all or part of a message you are replying to.
|
||||
* Mail Mode Misc:: Spell checking, signatures, etc.
|
||||
@end menu
|
||||
|
||||
@node Mail Sending
|
||||
@subsection Mail Sending
|
||||
|
||||
Mail mode has two commands for sending the message you have been
|
||||
editing:
|
||||
|
||||
@table @kbd
|
||||
@item C-c C-s
|
||||
Send the message, and leave the mail buffer selected (@code{mail-send}).
|
||||
@item C-c C-c
|
||||
Send the message, and select some other buffer (@code{mail-send-and-exit}).
|
||||
@end table
|
||||
|
||||
@kindex C-c C-s @r{(Mail mode)}
|
||||
@kindex C-c C-c @r{(Mail mode)}
|
||||
@findex mail-send
|
||||
@findex mail-send-and-exit
|
||||
@kbd{C-c C-s} (@code{mail-send}) sends the message and marks the mail
|
||||
buffer unmodified, but leaves that buffer selected so that you can
|
||||
modify the message (perhaps with new recipients) and send it again.
|
||||
@kbd{C-c C-c} (@code{mail-send-and-exit}) sends and then deletes the
|
||||
window or switches to another buffer. It puts the mail buffer at the
|
||||
lowest priority for reselection by default, since you are finished with
|
||||
using it. This is the usual way to send the message.
|
||||
|
||||
In a file-visiting buffer, sending the message does not clear the
|
||||
modified flag, because only saving the file should do that. As a
|
||||
result, you don't get a warning if you try to send the same message
|
||||
twice.
|
||||
|
||||
@vindex sendmail-coding-system
|
||||
When you send a message that contains non-ASCII characters, they need
|
||||
to be encoded with a coding system (@pxref{Coding Systems}). Usually
|
||||
the coding system is specified automatically by your chosen language
|
||||
environment (@pxref{Language Environments}). You can explicitly specify
|
||||
the coding system for outgoing mail by setting the variable
|
||||
@code{sendmail-coding-system}.
|
||||
|
||||
If the coding system thus determined does not handle the characters in
|
||||
a particular message, Emacs asks you to select the coding system to use,
|
||||
showing a list of possible coding systems.
|
||||
|
||||
@node Header Editing
|
||||
@subsection Mail Header Editing
|
||||
|
||||
Mail mode provides special commands to move to particular header
|
||||
fields and to complete addresses in headers.
|
||||
|
||||
@table @kbd
|
||||
@item C-c C-f C-t
|
||||
Move to the @samp{To} header field, creating one if there is none
|
||||
(@code{mail-to}).
|
||||
@item C-c C-f C-s
|
||||
Move to the @samp{Subject} header field, creating one if there is
|
||||
none (@code{mail-subject}).
|
||||
@item C-c C-f C-c
|
||||
Move to the @samp{CC} header field, creating one if there is none
|
||||
(@code{mail-cc}).
|
||||
@item C-c C-f C-b
|
||||
Move to the @samp{BCC} header field, creating one if there is none
|
||||
(@code{mail-bcc}).
|
||||
@item C-c C-f C-f
|
||||
Move to the @samp{FCC} header field, creating one if there is none
|
||||
(@code{mail-fcc}).
|
||||
@item M-@key{TAB}
|
||||
Complete a mailing address (@code{mail-complete}).
|
||||
@end table
|
||||
|
||||
@kindex C-c C-f C-t @r{(Mail mode)}
|
||||
@findex mail-to
|
||||
@kindex C-c C-f C-s @r{(Mail mode)}
|
||||
@findex mail-subject
|
||||
@kindex C-c C-f C-c @r{(Mail mode)}
|
||||
@findex mail-cc
|
||||
@kindex C-c C-f C-b @r{(Mail mode)}
|
||||
@findex mail-bcc
|
||||
@kindex C-c C-f C-f @r{(Mail mode)}
|
||||
@findex mail-fcc
|
||||
There are five commands to move point to particular header fields, all
|
||||
based on the prefix @kbd{C-c C-f} (@samp{C-f} is for ``field''). They
|
||||
are listed in the table above. If the field in question does not exist,
|
||||
these commands create one. We provide special motion commands for these
|
||||
particular fields because they are the fields users most often want to
|
||||
edit.
|
||||
|
||||
@findex mail-complete
|
||||
@kindex M-TAB @r{(Mail mode)}
|
||||
While editing a header field that contains mailing addresses, such as
|
||||
@samp{To:}, @samp{CC:} and @samp{BCC:}, you can complete a mailing
|
||||
address by typing @kbd{M-@key{TAB}} (@code{mail-complete}). It inserts
|
||||
the full name corresponding to the address, if it can determine the full
|
||||
name. The variable @code{mail-complete-style} controls whether to insert
|
||||
the full name, and what style to use, as in @code{mail-from-style}
|
||||
(@pxref{Mail Headers}).
|
||||
|
||||
For completion purposes, the valid mailing addresses are taken to be
|
||||
the local users' names plus your personal mail aliases. You can specify
|
||||
additional sources of valid addresses; use the customization buffer
|
||||
to see the options for this.
|
||||
|
||||
If you type @kbd{M-@key{TAB}} in the body of the message, it invokes
|
||||
@code{ispell-complete-word}, as in Text mode.
|
||||
|
||||
@node Citing Mail
|
||||
@subsection Citing Mail
|
||||
@cindex citing mail
|
||||
|
||||
Mail mode also has commands for yanking or @dfn{citing} all or part of
|
||||
a message that you are replying to. These commands are active only when
|
||||
you started sending a message using an Rmail command.
|
||||
|
||||
@table @kbd
|
||||
@item C-c C-y
|
||||
Yank the selected message from Rmail (@code{mail-yank-original}).
|
||||
@item C-c C-r
|
||||
Yank the region from the Rmail buffer (@code{mail-yank-region}).
|
||||
@item C-c C-q
|
||||
Fill each paragraph cited from another message
|
||||
(@code{mail-fill-yanked-message}).
|
||||
@end table
|
||||
|
||||
@kindex C-c C-y @r{(Mail mode)}
|
||||
@findex mail-yank-original
|
||||
When mail sending is invoked from the Rmail mail reader using an Rmail
|
||||
command, @kbd{C-c C-y} can be used inside the mail buffer to insert
|
||||
the text of the message you are replying to. Normally it indents each line
|
||||
of that message three spaces and eliminates most header fields. A numeric
|
||||
argument specifies the number of spaces to indent. An argument of just
|
||||
@kbd{C-u} says not to indent at all and not to eliminate anything.
|
||||
@kbd{C-c C-y} always uses the current message from the Rmail buffer,
|
||||
so you can insert several old messages by selecting one in Rmail,
|
||||
switching to @samp{*mail*} and yanking it, then switching back to
|
||||
Rmail to select another.
|
||||
|
||||
@vindex mail-yank-prefix
|
||||
You can specify the text for @kbd{C-c C-y} to insert at the beginning
|
||||
of each line: set @code{mail-yank-prefix} to the desired string. (A
|
||||
value of @code{nil} means to use indentation; this is the default.)
|
||||
However, @kbd{C-u C-c C-y} never adds anything at the beginning of the
|
||||
inserted lines, regardless of the value of @code{mail-yank-prefix}.
|
||||
|
||||
@kindex C-c C-r @r{(Mail mode)}
|
||||
@findex mail-yank-region
|
||||
To yank just a part of an incoming message, set the region in Rmail to
|
||||
the part you want; then go to the @samp{*Mail*} message and type
|
||||
@kbd{C-c C-r} (@code{mail-yank-region}). Each line that is copied is
|
||||
indented or prefixed according to @code{mail-yank-prefix}.
|
||||
|
||||
@kindex C-c C-q @r{(Mail mode)}
|
||||
@findex mail-fill-yanked-message
|
||||
After using @kbd{C-c C-y} or @kbd{C-c C-r}, you can type @kbd{C-c C-q}
|
||||
(@code{mail-fill-yanked-message}) to fill the paragraphs of the yanked
|
||||
old message or messages. One use of @kbd{C-c C-q} fills all such
|
||||
paragraphs, each one individually. To fill a single paragraph of the
|
||||
quoted message, use @kbd{M-q}. If filling does not automatically
|
||||
handle the type of citation prefix you use, try setting the fill prefix
|
||||
explicitly. @xref{Filling}.
|
||||
|
||||
@node Mail Mode Misc
|
||||
@subsection Mail Mode Miscellany
|
||||
|
||||
@table @kbd
|
||||
@item C-c C-t
|
||||
Move to the beginning of the message body text (@code{mail-text}).
|
||||
@item C-c C-w
|
||||
Insert the file @file{~/.signature} at the end of the message text
|
||||
(@code{mail-signature}).
|
||||
@item C-c C-i @var{file} @key{RET}
|
||||
Insert the contents of @var{file} at the end of the outgoing message
|
||||
(@code{mail-attach-file}).
|
||||
@item M-x ispell-message
|
||||
Do spelling correction on the message text, but not on citations from
|
||||
other messages.
|
||||
@end table
|
||||
|
||||
@kindex C-c C-t @r{(Mail mode)}
|
||||
@findex mail-text
|
||||
@kbd{C-c C-t} (@code{mail-text}) moves point to just after the header
|
||||
separator line---that is, to the beginning of the message body text.
|
||||
|
||||
@kindex C-c C-w @r{(Mail mode)}
|
||||
@findex mail-signature
|
||||
@vindex mail-signature
|
||||
@kbd{C-c C-w} (@code{mail-signature}) adds a standard piece of text at
|
||||
the end of the message to say more about who you are. The text comes
|
||||
from the file @file{~/.signature} in your home directory. To insert
|
||||
your signature automatically, set the variable @code{mail-signature} to
|
||||
@code{t}; then starting a mail message automatically inserts the
|
||||
contents of your @file{~/.signature} file. If you want to omit your
|
||||
signature from a particular message, delete it from the buffer before
|
||||
you send the message.
|
||||
|
||||
You can also set @code{mail-signature} to a string; then that string
|
||||
is inserted automatically as your signature when you start editing a
|
||||
message to send. If you set it to some other Lisp expression, the
|
||||
expression is evaluated each time, and its value (which should be a
|
||||
string) specifies the signature.
|
||||
|
||||
@findex ispell-message
|
||||
You can do spelling correction on the message text you have written
|
||||
with the command @kbd{M-x ispell-message}. If you have yanked an
|
||||
incoming message into the outgoing draft, this command skips what was
|
||||
yanked, but it checks the text that you yourself inserted. (It looks
|
||||
for indentation or @code{mail-yank-prefix} to distinguish the cited
|
||||
lines from your input.) @xref{Spelling}.
|
||||
|
||||
@kindex C-c C-i @r{(Mail mode)}
|
||||
@findex mail-attach-file
|
||||
To include a file in the outgoing message, you can use @kbd{C-x i},
|
||||
the usual command to insert a file in the current buffer. But it is
|
||||
often more convenient to use a special command, @kbd{C-c C-i}
|
||||
(@code{mail-attach-file}). This command inserts the file contents at
|
||||
the end of the buffer, after your signature if any, with a delimiter
|
||||
line that includes the file name.
|
||||
|
||||
@vindex mail-mode-hook
|
||||
@vindex mail-setup-hook
|
||||
Turning on Mail mode (which @kbd{C-x m} does automatically) runs the
|
||||
normal hooks @code{text-mode-hook} and @code{mail-mode-hook}.
|
||||
Initializing a new outgoing message runs the normal hook
|
||||
@code{mail-setup-hook}; if you want to add special fields to your mail
|
||||
header or make other changes to the appearance of the mail buffer, use
|
||||
that hook. @xref{Hooks}.
|
||||
|
||||
The main difference between these hooks is just when they are
|
||||
invoked. Whenever you type @kbd{M-x mail}, @code{mail-mode-hook} runs
|
||||
as soon as the @samp{*mail*} buffer is created. Then the
|
||||
@code{mail-setup} function puts in the default contents of the buffer.
|
||||
After these default contents are inserted, @code{mail-setup-hook} runs.
|
||||
|
||||
@node Distracting NSA
|
||||
@section Distracting the NSA
|
||||
|
||||
@findex spook
|
||||
@cindex NSA
|
||||
@kbd{M-x spook} adds a line of randomly chosen keywords to an outgoing
|
||||
mail message. The keywords are chosen from a list of words that suggest
|
||||
you are discussing something subversive.
|
||||
|
||||
The idea behind this feature is the suspicion that the NSA snoops on
|
||||
all electronic mail messages that contain keywords suggesting they might
|
||||
find them interesting. (The NSA says they don't, but that's what they
|
||||
@emph{would} say.) The idea is that if lots of people add suspicious
|
||||
words to their messages, the NSA will get so busy with spurious input
|
||||
that they will have to give up reading it all.
|
||||
|
||||
Here's how to insert spook keywords automatically whenever you start
|
||||
entering an outgoing message:
|
||||
|
||||
@example
|
||||
(add-hook 'mail-setup-hook 'spook)
|
||||
@end example
|
||||
|
||||
Whether or not this confuses the NSA, it at least amuses people.
|
||||
|
||||
@node Mail Methods
|
||||
@section Mail-Composition Methods
|
||||
@cindex mail-composition methods
|
||||
|
||||
This chapter describes the usual Emacs mode for editing and sending
|
||||
mail---Mail mode. Emacs has alternative facilities for editing and
|
||||
sending mail, including MH-E and Message mode, not documented in this
|
||||
manual. You can choose any of them as your preferred method. The
|
||||
commands @code{C-x m}, @code{C-x 4 m} and @code{C-x 5 m} use whichever
|
||||
agent you have specified. So do various other Emacs commands and
|
||||
facilities that send mail.
|
||||
|
||||
@vindex mail-user-agent
|
||||
To specify your mail-composition method, set the variable
|
||||
@code{mail-user-agent}. Currently legitimate values include
|
||||
@code{sendmail-user-agent}, @code{mh-e-user-agent}, and
|
||||
@code{message-user-agent}.
|
||||
|
||||
If you select a different mail-composition method, the information in
|
||||
this chapter about the @samp{*mail*} buffer and Mail mode does not
|
||||
apply; other methods may use completely different commands with a
|
||||
different format in a differently named buffer.
|
||||
|
1965
man/text.texi
Normal file
1965
man/text.texi
Normal file
File diff suppressed because it is too large
Load diff
972
man/trouble.texi
Normal file
972
man/trouble.texi
Normal file
|
@ -0,0 +1,972 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@iftex
|
||||
@chapter Dealing with Common Problems
|
||||
|
||||
If you type an Emacs command you did not intend, the results are often
|
||||
mysterious. This chapter tells what you can do to cancel your mistake or
|
||||
recover from a mysterious situation. Emacs bugs and system crashes are
|
||||
also considered.
|
||||
@end iftex
|
||||
|
||||
@node Quitting, Lossage, Customization, Top
|
||||
@section Quitting and Aborting
|
||||
@cindex quitting
|
||||
|
||||
@table @kbd
|
||||
@item C-g
|
||||
@itemx C-@key{BREAK} (MS-DOS)
|
||||
Quit. Cancel running or partially typed command.
|
||||
@item C-]
|
||||
Abort innermost recursive editing level and cancel the command which
|
||||
invoked it (@code{abort-recursive-edit}).
|
||||
@item @key{ESC} @key{ESC} @key{ESC}
|
||||
Either quit or abort, whichever makes sense (@code{keyboard-escape-quit}).
|
||||
@item M-x top-level
|
||||
Abort all recursive editing levels that are currently executing.
|
||||
@item C-x u
|
||||
Cancel a previously made change in the buffer contents (@code{undo}).
|
||||
@end table
|
||||
|
||||
There are two ways of canceling commands which are not finished
|
||||
executing: @dfn{quitting} with @kbd{C-g}, and @dfn{aborting} with
|
||||
@kbd{C-]} or @kbd{M-x top-level}. Quitting cancels a partially typed
|
||||
command or one which is already running. Aborting exits a recursive
|
||||
editing level and cancels the command that invoked the recursive edit.
|
||||
(@xref{Recursive Edit}.)
|
||||
|
||||
@cindex quitting
|
||||
@kindex C-g
|
||||
Quitting with @kbd{C-g} is used for getting rid of a partially typed
|
||||
command, or a numeric argument that you don't want. It also stops a
|
||||
running command in the middle in a relatively safe way, so you can use
|
||||
it if you accidentally give a command which takes a long time. In
|
||||
particular, it is safe to quit out of killing; either your text will
|
||||
@emph{all} still be in the buffer, or it will @emph{all} be in the kill
|
||||
ring (or maybe both). Quitting an incremental search does special
|
||||
things documented under searching; in general, it may take two
|
||||
successive @kbd{C-g} characters to get out of a search
|
||||
(@pxref{Incremental Search}).
|
||||
|
||||
On MS-DOS, the character @kbd{C-@key{BREAK}} serves as a quit character
|
||||
like @kbd{C-g}. The reason is that it is not feasible, on MS-DOS, to
|
||||
recognize @kbd{C-g} while a command is running, between interactions
|
||||
with the user. By contrast, it @emph{is} feasible to recognize
|
||||
@kbd{C-@key{BREAK}} at all times. @xref{MS-DOS Input}.
|
||||
|
||||
@kbd{C-g} works by setting the variable @code{quit-flag} to @code{t}
|
||||
the instant @kbd{C-g} is typed; Emacs Lisp checks this variable
|
||||
frequently and quits if it is non-@code{nil}. @kbd{C-g} is only
|
||||
actually executed as a command if you type it while Emacs is waiting for
|
||||
input.
|
||||
|
||||
If you quit with @kbd{C-g} a second time before the first @kbd{C-g} is
|
||||
recognized, you activate the ``emergency escape'' feature and return to
|
||||
the shell. @xref{Emergency Escape}.
|
||||
|
||||
@cindex NFS and quitting
|
||||
There may be times when you cannot quit. When Emacs is waiting for
|
||||
the operating system to do something, quitting is impossible unless
|
||||
special pains are taken for the particular system call within Emacs
|
||||
where the waiting occurs. We have done this for the system calls that
|
||||
users are likely to want to quit from, but it's possible you will find
|
||||
another. In one very common case---waiting for file input or output
|
||||
using NFS---Emacs itself knows how to quit, but most NFS implementations
|
||||
simply do not allow user programs to stop waiting for NFS when the NFS
|
||||
server is hung.
|
||||
|
||||
@cindex aborting recursive edit
|
||||
@findex abort-recursive-edit
|
||||
@kindex C-]
|
||||
Aborting with @kbd{C-]} (@code{abort-recursive-edit}) is used to get
|
||||
out of a recursive editing level and cancel the command which invoked
|
||||
it. Quitting with @kbd{C-g} does not do this, and could not do this,
|
||||
because it is used to cancel a partially typed command @emph{within} the
|
||||
recursive editing level. Both operations are useful. For example, if
|
||||
you are in a recursive edit and type @kbd{C-u 8} to enter a numeric
|
||||
argument, you can cancel that argument with @kbd{C-g} and remain in the
|
||||
recursive edit.
|
||||
|
||||
@findex keyboard-escape-quit
|
||||
@kindex ESC ESC ESC
|
||||
The command @kbd{@key{ESC} @key{ESC} @key{ESC}}
|
||||
(@code{keyboard-escape-quit}) can either quit or abort. This key was
|
||||
defined because @key{ESC} is used to ``get out'' in many PC programs.
|
||||
It can cancel a prefix argument, clear a selected region, or get out of
|
||||
a Query Replace, like @kbd{C-g}. It can get out of the minibuffer or a
|
||||
recursive edit, like @kbd{C-]}. It can also get out of splitting the
|
||||
frame into multiple windows, like @kbd{C-x 1}. One thing it cannot do,
|
||||
however, is stop a command that is running. That's because it executes
|
||||
as an ordinary command, and Emacs doesn't notice it until it is ready
|
||||
for a command.
|
||||
|
||||
@findex top-level
|
||||
The command @kbd{M-x top-level} is equivalent to ``enough'' @kbd{C-]}
|
||||
commands to get you out of all the levels of recursive edits that you
|
||||
are in. @kbd{C-]} gets you out one level at a time, but @kbd{M-x
|
||||
top-level} goes out all levels at once. Both @kbd{C-]} and @kbd{M-x
|
||||
top-level} are like all other commands, and unlike @kbd{C-g}, in that
|
||||
they take effect only when Emacs is ready for a command. @kbd{C-]} is
|
||||
an ordinary key and has its meaning only because of its binding in the
|
||||
keymap. @xref{Recursive Edit}.
|
||||
|
||||
@kbd{C-x u} (@code{undo}) is not strictly speaking a way of canceling
|
||||
a command, but you can think of it as canceling a command that already
|
||||
finished executing. @xref{Undo}.
|
||||
|
||||
@node Lossage, Bugs, Quitting, Top
|
||||
@section Dealing with Emacs Trouble
|
||||
|
||||
This section describes various conditions in which Emacs fails to work
|
||||
normally, and how to recognize them and correct them.
|
||||
|
||||
@menu
|
||||
* DEL Gets Help:: What to do if @key{DEL} doesn't delete.
|
||||
* Stuck Recursive:: `[...]' in mode line around the parentheses.
|
||||
* Screen Garbled:: Garbage on the screen.
|
||||
* Text Garbled:: Garbage in the text.
|
||||
* Unasked-for Search:: Spontaneous entry to incremental search.
|
||||
* Memory Full:: How to cope when you run out of memory.
|
||||
* After a Crash:: Recovering editing in an Emacs session that crashed.
|
||||
* Emergency Escape:: Emergency escape---
|
||||
What to do if Emacs stops responding.
|
||||
* Total Frustration:: When you are at your wits' end.
|
||||
@end menu
|
||||
|
||||
@node DEL Gets Help
|
||||
@subsection If @key{DEL} Fails to Delete
|
||||
|
||||
If you find that @key{DEL} enters Help like @kbd{Control-h} instead of
|
||||
deleting a character, your terminal is sending the wrong code for
|
||||
@key{DEL}. You can work around this problem by changing the keyboard
|
||||
translation table (@pxref{Keyboard Translations}).
|
||||
|
||||
@node Stuck Recursive
|
||||
@subsection Recursive Editing Levels
|
||||
|
||||
Recursive editing levels are important and useful features of Emacs, but
|
||||
they can seem like malfunctions to the user who does not understand them.
|
||||
|
||||
If the mode line has square brackets @samp{[@dots{}]} around the parentheses
|
||||
that contain the names of the major and minor modes, you have entered a
|
||||
recursive editing level. If you did not do this on purpose, or if you
|
||||
don't understand what that means, you should just get out of the recursive
|
||||
editing level. To do so, type @kbd{M-x top-level}. This is called getting
|
||||
back to top level. @xref{Recursive Edit}.
|
||||
|
||||
@node Screen Garbled
|
||||
@subsection Garbage on the Screen
|
||||
|
||||
If the data on the screen looks wrong, the first thing to do is see
|
||||
whether the text is really wrong. Type @kbd{C-l}, to redisplay the
|
||||
entire screen. If the screen appears correct after this, the problem
|
||||
was entirely in the previous screen update. (Otherwise, see @ref{Text
|
||||
Garbled}.)
|
||||
|
||||
Display updating problems often result from an incorrect termcap entry
|
||||
for the terminal you are using. The file @file{etc/TERMS} in the Emacs
|
||||
distribution gives the fixes for known problems of this sort.
|
||||
@file{INSTALL} contains general advice for these problems in one of its
|
||||
sections. Very likely there is simply insufficient padding for certain
|
||||
display operations. To investigate the possibility that you have this sort
|
||||
of problem, try Emacs on another terminal made by a different manufacturer.
|
||||
If problems happen frequently on one kind of terminal but not another kind,
|
||||
it is likely to be a bad termcap entry, though it could also be due to a
|
||||
bug in Emacs that appears for terminals that have or that lack specific
|
||||
features.
|
||||
|
||||
@node Text Garbled
|
||||
@subsection Garbage in the Text
|
||||
|
||||
If @kbd{C-l} shows that the text is wrong, try undoing the changes to it
|
||||
using @kbd{C-x u} until it gets back to a state you consider correct. Also
|
||||
try @kbd{C-h l} to find out what command you typed to produce the observed
|
||||
results.
|
||||
|
||||
If a large portion of text appears to be missing at the beginning or
|
||||
end of the buffer, check for the word @samp{Narrow} in the mode line.
|
||||
If it appears, the text you don't see is probably still present, but
|
||||
temporarily off-limits. To make it accessible again, type @kbd{C-x n
|
||||
w}. @xref{Narrowing}.
|
||||
|
||||
@node Unasked-for Search
|
||||
@subsection Spontaneous Entry to Incremental Search
|
||||
|
||||
If Emacs spontaneously displays @samp{I-search:} at the bottom of the
|
||||
screen, it means that the terminal is sending @kbd{C-s} and @kbd{C-q}
|
||||
according to the poorly designed xon/xoff ``flow control'' protocol.
|
||||
|
||||
If this happens to you, your best recourse is to put the terminal in a
|
||||
mode where it will not use flow control, or give it so much padding that
|
||||
it will never send a @kbd{C-s}. (One way to increase the amount of
|
||||
padding is to set the variable @code{baud-rate} to a larger value. Its
|
||||
value is the terminal output speed, measured in the conventional units
|
||||
of baud.)
|
||||
|
||||
@cindex flow control
|
||||
@cindex xon-xoff
|
||||
@findex enable-flow-control
|
||||
If you don't succeed in turning off flow control, the next best thing
|
||||
is to tell Emacs to cope with it. To do this, call the function
|
||||
@code{enable-flow-control}.
|
||||
|
||||
@findex enable-flow-control-on
|
||||
Typically there are particular terminal types with which you must use
|
||||
flow control. You can conveniently ask for flow control on those
|
||||
terminal types only, using @code{enable-flow-control-on}. For example,
|
||||
if you find you must use flow control on VT-100 and H19 terminals, put
|
||||
the following in your @file{.emacs} file:
|
||||
|
||||
@example
|
||||
(enable-flow-control-on "vt100" "h19")
|
||||
@end example
|
||||
|
||||
When flow control is enabled, you must type @kbd{C-\} to get the
|
||||
effect of a @kbd{C-s}, and type @kbd{C-^} to get the effect of a
|
||||
@kbd{C-q}. (These aliases work by means of keyboard translations; see
|
||||
@ref{Keyboard Translations}.)
|
||||
|
||||
@node Memory Full
|
||||
@subsection Running out of Memory
|
||||
@cindex memory full
|
||||
@cindex out of memory
|
||||
|
||||
If you get the error message @samp{Virtual memory exceeded}, save your
|
||||
modified buffers with @kbd{C-x s}. This method of saving them has the
|
||||
smallest need for additional memory. Emacs keeps a reserve of memory
|
||||
which it makes available when this error happens; that should be enough
|
||||
to enable @kbd{C-x s} to complete its work.
|
||||
|
||||
Once you have saved your modified buffers, you can exit this Emacs job
|
||||
and start another, or you can use @kbd{M-x kill-some-buffers} to free
|
||||
space in the current Emacs job. If you kill buffers containing a
|
||||
substantial amount of text, you can safely go on editing. Emacs refills
|
||||
its memory reserve automatically when it sees sufficient free space
|
||||
available, in case you run out of memory another time.
|
||||
|
||||
Do not use @kbd{M-x buffer-menu} to save or kill buffers when you run
|
||||
out of memory, because the buffer menu needs a fair amount memory
|
||||
itself, and the reserve supply may not be enough.
|
||||
|
||||
@node After a Crash
|
||||
@subsection Recovery After a Crash
|
||||
|
||||
If Emacs or the computer crashes, you can recover the files you were
|
||||
editing at the time of the crash from their auto-save files. To do
|
||||
this, start Emacs again and type the command @kbd{M-x recover-session}.
|
||||
|
||||
This command initially displays a buffer which lists interrupted
|
||||
session files, each with its date. You must choose which session to
|
||||
recover from. Typically the one you want is the most recent one. Move
|
||||
point to the one you choose, and type @kbd{C-c C-c}.
|
||||
|
||||
Then @code{recover-session} asks about each of the files that you were
|
||||
editing during that session; it asks whether to recover that file. If
|
||||
you answer @kbd{y} for a file, it shows the dates of that file and its
|
||||
auto-save file, then asks once again whether to recover that file. For
|
||||
the second question, you must confirm with @kbd{yes}. If you do, Emacs
|
||||
visits the file but gets the text from the auto-save file.
|
||||
|
||||
When @code{recover-session} is done, the files you've chosen to
|
||||
recover are present in Emacs buffers. You should then save them. Only
|
||||
this---saving them---updates the files themselves.
|
||||
|
||||
@node Emergency Escape
|
||||
@subsection Emergency Escape
|
||||
|
||||
Because at times there have been bugs causing Emacs to loop without
|
||||
checking @code{quit-flag}, a special feature causes Emacs to be suspended
|
||||
immediately if you type a second @kbd{C-g} while the flag is already set,
|
||||
so you can always get out of GNU Emacs. Normally Emacs recognizes and
|
||||
clears @code{quit-flag} (and quits!) quickly enough to prevent this from
|
||||
happening. (On MS-DOS and compatible systems, type @kbd{C-@key{BREAK}}
|
||||
twice.)
|
||||
|
||||
When you resume Emacs after a suspension caused by multiple @kbd{C-g}, it
|
||||
asks two questions before going back to what it had been doing:
|
||||
|
||||
@example
|
||||
Auto-save? (y or n)
|
||||
Abort (and dump core)? (y or n)
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
Answer each one with @kbd{y} or @kbd{n} followed by @key{RET}.
|
||||
|
||||
Saying @kbd{y} to @samp{Auto-save?} causes immediate auto-saving of all
|
||||
modified buffers in which auto-saving is enabled.
|
||||
|
||||
Saying @kbd{y} to @samp{Abort (and dump core)?} causes an illegal instruction to be
|
||||
executed, dumping core. This is to enable a wizard to figure out why Emacs
|
||||
was failing to quit in the first place. Execution does not continue
|
||||
after a core dump. If you answer @kbd{n}, execution does continue. With
|
||||
luck, GNU Emacs will ultimately check @code{quit-flag} and quit normally.
|
||||
If not, and you type another @kbd{C-g}, it is suspended again.
|
||||
|
||||
If Emacs is not really hung, just slow, you may invoke the double
|
||||
@kbd{C-g} feature without really meaning to. Then just resume and answer
|
||||
@kbd{n} to both questions, and you will arrive at your former state.
|
||||
Presumably the quit you requested will happen soon.
|
||||
|
||||
The double-@kbd{C-g} feature is turned off when Emacs is running under
|
||||
the X Window System, since you can use the window manager to kill Emacs
|
||||
or to create another window and run another program.
|
||||
|
||||
On MS-DOS and compatible systems, the emergency escape feature is
|
||||
sometimes unavailable, even if you press @kbd{C-@key{BREAK}} twice, when
|
||||
some system call (MS-DOS or BIOS) hangs, or when Emacs is stuck in a
|
||||
very tight endless loop (in C code, @strong{not} in Lisp code).
|
||||
|
||||
@node Total Frustration
|
||||
@subsection Help for Total Frustration
|
||||
@cindex Eliza
|
||||
@cindex doctor
|
||||
|
||||
If using Emacs (or something else) becomes terribly frustrating and none
|
||||
of the techniques described above solve the problem, Emacs can still help
|
||||
you.
|
||||
|
||||
First, if the Emacs you are using is not responding to commands, type
|
||||
@kbd{C-g C-g} to get out of it and then start a new one.
|
||||
|
||||
@findex doctor
|
||||
Second, type @kbd{M-x doctor @key{RET}}.
|
||||
|
||||
The doctor will help you feel better. Each time you say something to
|
||||
the doctor, you must end it by typing @key{RET} @key{RET}. This lets
|
||||
the doctor know you are finished.
|
||||
|
||||
@node Bugs, Contributing, Lossage, Top
|
||||
@section Reporting Bugs
|
||||
|
||||
@cindex bugs
|
||||
Sometimes you will encounter a bug in Emacs. Although we cannot
|
||||
promise we can or will fix the bug, and we might not even agree that it
|
||||
is a bug, we want to hear about problems you encounter. Often we agree
|
||||
they are bugs and want to fix them.
|
||||
|
||||
To make it possible for us to fix a bug, you must report it. In order
|
||||
to do so effectively, you must know when and how to do it.
|
||||
|
||||
@menu
|
||||
* Criteria: Bug Criteria. Have you really found a bug?
|
||||
* Understanding Bug Reporting:: How to report a bug effectively.
|
||||
* Checklist:: Steps to follow for a good bug report.
|
||||
* Sending Patches:: How to send a patch for GNU Emacs.
|
||||
@end menu
|
||||
|
||||
@node Bug Criteria
|
||||
@subsection When Is There a Bug
|
||||
|
||||
If Emacs executes an illegal instruction, or dies with an operating
|
||||
system error message that indicates a problem in the program (as opposed to
|
||||
something like ``disk full''), then it is certainly a bug.
|
||||
|
||||
If Emacs updates the display in a way that does not correspond to what is
|
||||
in the buffer, then it is certainly a bug. If a command seems to do the
|
||||
wrong thing but the problem corrects itself if you type @kbd{C-l}, it is a
|
||||
case of incorrect display updating.
|
||||
|
||||
Taking forever to complete a command can be a bug, but you must make
|
||||
certain that it was really Emacs's fault. Some commands simply take a
|
||||
long time. Type @kbd{C-g} (@kbd{C-@key{BREAK}} on MS-DOS) and then @kbd{C-h l}
|
||||
to see whether the input Emacs received was what you intended to type;
|
||||
if the input was such that you @emph{know} it should have been processed
|
||||
quickly, report a bug. If you don't know whether the command should
|
||||
take a long time, find out by looking in the manual or by asking for
|
||||
assistance.
|
||||
|
||||
If a command you are familiar with causes an Emacs error message in a
|
||||
case where its usual definition ought to be reasonable, it is probably a
|
||||
bug.
|
||||
|
||||
If a command does the wrong thing, that is a bug. But be sure you know
|
||||
for certain what it ought to have done. If you aren't familiar with the
|
||||
command, or don't know for certain how the command is supposed to work,
|
||||
then it might actually be working right. Rather than jumping to
|
||||
conclusions, show the problem to someone who knows for certain.
|
||||
|
||||
Finally, a command's intended definition may not be best for editing
|
||||
with. This is a very important sort of problem, but it is also a matter of
|
||||
judgment. Also, it is easy to come to such a conclusion out of ignorance
|
||||
of some of the existing features. It is probably best not to complain
|
||||
about such a problem until you have checked the documentation in the usual
|
||||
ways, feel confident that you understand it, and know for certain that what
|
||||
you want is not available. If you are not sure what the command is
|
||||
supposed to do after a careful reading of the manual, check the index and
|
||||
glossary for any terms that may be unclear.
|
||||
|
||||
If after careful rereading of the manual you still do not understand
|
||||
what the command should do, that indicates a bug in the manual, which
|
||||
you should report. The manual's job is to make everything clear to
|
||||
people who are not Emacs experts---including you. It is just as
|
||||
important to report documentation bugs as program bugs.
|
||||
|
||||
If the on-line documentation string of a function or variable disagrees
|
||||
with the manual, one of them must be wrong; that is a bug.
|
||||
|
||||
@node Understanding Bug Reporting
|
||||
@subsection Understanding Bug Reporting
|
||||
|
||||
@findex emacs-version
|
||||
When you decide that there is a bug, it is important to report it and to
|
||||
report it in a way which is useful. What is most useful is an exact
|
||||
description of what commands you type, starting with the shell command to
|
||||
run Emacs, until the problem happens.
|
||||
|
||||
The most important principle in reporting a bug is to report
|
||||
@emph{facts}. Hypotheses and verbal descriptions are no substitute for
|
||||
the detailed raw data. Reporting the facts is straightforward, but many
|
||||
people strain to posit explanations and report them instead of the
|
||||
facts. If the explanations are based on guesses about how Emacs is
|
||||
implemented, they will be useless; meanwhile, lacking the facts, we will
|
||||
have no real information about the bug.
|
||||
|
||||
For example, suppose that you type @kbd{C-x C-f /glorp/baz.ugh
|
||||
@key{RET}}, visiting a file which (you know) happens to be rather large,
|
||||
and Emacs displayed @samp{I feel pretty today}. The best way to report
|
||||
the bug is with a sentence like the preceding one, because it gives all
|
||||
the facts.
|
||||
|
||||
A bad way would be to assume that the problem is due to the size of
|
||||
the file and say, ``I visited a large file, and Emacs displayed @samp{I
|
||||
feel pretty today}.'' This is what we mean by ``guessing
|
||||
explanations.'' The problem is just as likely to be due to the fact
|
||||
that there is a @samp{z} in the file name. If this is so, then when we
|
||||
got your report, we would try out the problem with some ``large file,''
|
||||
probably with no @samp{z} in its name, and not see any problem. There
|
||||
is no way in the world that we could guess that we should try visiting a
|
||||
file with a @samp{z} in its name.
|
||||
|
||||
Alternatively, the problem might be due to the fact that the file starts
|
||||
with exactly 25 spaces. For this reason, you should make sure that you
|
||||
inform us of the exact contents of any file that is needed to reproduce the
|
||||
bug. What if the problem only occurs when you have typed the @kbd{C-x C-a}
|
||||
command previously? This is why we ask you to give the exact sequence of
|
||||
characters you typed since starting the Emacs session.
|
||||
|
||||
You should not even say ``visit a file'' instead of @kbd{C-x C-f} unless
|
||||
you @emph{know} that it makes no difference which visiting command is used.
|
||||
Similarly, rather than saying ``if I have three characters on the line,''
|
||||
say ``after I type @kbd{@key{RET} A B C @key{RET} C-p},'' if that is
|
||||
the way you entered the text.@refill
|
||||
|
||||
So please don't guess any explanations when you report a bug. If you
|
||||
want to actually @emph{debug} the problem, and report explanations that
|
||||
are more than guesses, that is useful---but please include the facts as
|
||||
well.
|
||||
|
||||
@node Checklist
|
||||
@subsection Checklist for Bug Reports
|
||||
|
||||
@cindex reporting bugs
|
||||
The best way to send a bug report is to mail it electronically to the
|
||||
Emacs maintainers at @samp{bug-gnu-emacs@@gnu.org}. (If you
|
||||
want to suggest a change as an improvement, use the same address.)
|
||||
|
||||
If you'd like to read the bug reports, you can find them on the
|
||||
newsgroup @samp{gnu.emacs.bug}; keep in mind, however, that as a
|
||||
spectator you should not criticize anything about what you see there.
|
||||
The purpose of bug reports is to give information to the Emacs
|
||||
maintainers. Spectators are welcome only as long as they do not
|
||||
interfere with this. In particular, some bug reports contain large
|
||||
amounts of data; spectators should not complain about this.
|
||||
|
||||
Please do not post bug reports using netnews; mail is more reliable
|
||||
than netnews about reporting your correct address, which we may need in
|
||||
order to ask you for more information.
|
||||
|
||||
If you can't send electronic mail, then mail the bug report on paper
|
||||
or machine-readable media to this address:
|
||||
|
||||
@format
|
||||
GNU Emacs Bugs
|
||||
Free Software Foundation
|
||||
59 Temple Place, Suite 330
|
||||
Boston, MA 02111-1307 USA
|
||||
@end format
|
||||
|
||||
We do not promise to fix the bug; but if the bug is serious,
|
||||
or ugly, or easy to fix, chances are we will want to.
|
||||
|
||||
@findex report-emacs-bug
|
||||
A convenient way to send a bug report for Emacs is to use the command
|
||||
@kbd{M-x report-emacs-bug}. This sets up a mail buffer (@pxref{Sending
|
||||
Mail}) and automatically inserts @emph{some} of the essential
|
||||
information. However, it cannot supply all the necessary information;
|
||||
you should still read and follow the guidelines below, so you can enter
|
||||
the other crucial information by hand before you send the message.
|
||||
|
||||
To enable maintainers to investigate a bug, your report
|
||||
should include all these things:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
The version number of Emacs. Without this, we won't know whether there
|
||||
is any point in looking for the bug in the current version of GNU
|
||||
Emacs.
|
||||
|
||||
You can get the version number by typing @kbd{M-x emacs-version
|
||||
@key{RET}}. If that command does not work, you probably have something
|
||||
other than GNU Emacs, so you will have to report the bug somewhere
|
||||
else.
|
||||
|
||||
@item
|
||||
The type of machine you are using, and the operating system name and
|
||||
version number. @kbd{M-x emacs-version @key{RET}} provides this
|
||||
information too. Copy its output from the @samp{*Messages*} buffer, so
|
||||
that you get it all and get it accurately.
|
||||
|
||||
@item
|
||||
The operands given to the @code{configure} command when Emacs was
|
||||
installed.
|
||||
|
||||
@item
|
||||
A complete list of any modifications you have made to the Emacs source.
|
||||
(We may not have time to investigate the bug unless it happens in an
|
||||
unmodified Emacs. But if you've made modifications and you don't tell
|
||||
us, you are sending us on a wild goose chase.)
|
||||
|
||||
Be precise about these changes. A description in English is not
|
||||
enough---send a context diff for them.
|
||||
|
||||
Adding files of your own, or porting to another machine, is a
|
||||
modification of the source.
|
||||
|
||||
@item
|
||||
Details of any other deviations from the standard procedure for installing
|
||||
GNU Emacs.
|
||||
|
||||
@item
|
||||
The complete text of any files needed to reproduce the bug.
|
||||
|
||||
If you can tell us a way to cause the problem without visiting any files,
|
||||
please do so. This makes it much easier to debug. If you do need files,
|
||||
make sure you arrange for us to see their exact contents. For example, it
|
||||
can often matter whether there are spaces at the ends of lines, or a
|
||||
newline after the last line in the buffer (nothing ought to care whether
|
||||
the last line is terminated, but try telling the bugs that).
|
||||
|
||||
@item
|
||||
The precise commands we need to type to reproduce the bug.
|
||||
|
||||
@findex open-dribble-file
|
||||
@cindex dribble file
|
||||
The easy way to record the input to Emacs precisely is to write a
|
||||
dribble file. To start the file, execute the Lisp expression
|
||||
|
||||
@example
|
||||
(open-dribble-file "~/dribble")
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
using @kbd{M-:} or from the @samp{*scratch*} buffer just after
|
||||
starting Emacs. From then on, Emacs copies all your input to the
|
||||
specified dribble file until the Emacs process is killed.
|
||||
|
||||
@item
|
||||
@findex open-termscript
|
||||
@cindex termscript file
|
||||
@cindex @code{TERM} environment variable
|
||||
For possible display bugs, the terminal type (the value of environment
|
||||
variable @code{TERM}), the complete termcap entry for the terminal from
|
||||
@file{/etc/termcap} (since that file is not identical on all machines),
|
||||
and the output that Emacs actually sent to the terminal.
|
||||
|
||||
The way to collect the terminal output is to execute the Lisp expression
|
||||
|
||||
@example
|
||||
(open-termscript "~/termscript")
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
using @kbd{M-:} or from the @samp{*scratch*} buffer just after
|
||||
starting Emacs. From then on, Emacs copies all terminal output to the
|
||||
specified termscript file as well, until the Emacs process is killed.
|
||||
If the problem happens when Emacs starts up, put this expression into
|
||||
your @file{.emacs} file so that the termscript file will be open when
|
||||
Emacs displays the screen for the first time.
|
||||
|
||||
Be warned: it is often difficult, and sometimes impossible, to fix a
|
||||
terminal-dependent bug without access to a terminal of the type that
|
||||
stimulates the bug.@refill
|
||||
|
||||
@item
|
||||
A description of what behavior you observe that you believe is
|
||||
incorrect. For example, ``The Emacs process gets a fatal signal,'' or,
|
||||
``The resulting text is as follows, which I think is wrong.''
|
||||
|
||||
Of course, if the bug is that Emacs gets a fatal signal, then one can't
|
||||
miss it. But if the bug is incorrect text, the maintainer might fail to
|
||||
notice what is wrong. Why leave it to chance?
|
||||
|
||||
Even if the problem you experience is a fatal signal, you should still
|
||||
say so explicitly. Suppose something strange is going on, such as, your
|
||||
copy of the source is out of sync, or you have encountered a bug in the
|
||||
C library on your system. (This has happened!) Your copy might crash
|
||||
and the copy here might not. If you @emph{said} to expect a crash, then
|
||||
when Emacs here fails to crash, we would know that the bug was not
|
||||
happening. If you don't say to expect a crash, then we would not know
|
||||
whether the bug was happening---we would not be able to draw any
|
||||
conclusion from our observations.
|
||||
|
||||
@item
|
||||
If the manifestation of the bug is an Emacs error message, it is
|
||||
important to report the precise text of the error message, and a
|
||||
backtrace showing how the Lisp program in Emacs arrived at the error.
|
||||
|
||||
To get the error message text accurately, copy it from the
|
||||
@samp{*Messages*} buffer into the bug report. Copy all of it, not just
|
||||
part.
|
||||
|
||||
To make a backtrace for the error, evaluate the Lisp expression
|
||||
@code{(setq @w{debug-on-error t})} before the error happens (that is to
|
||||
say, you must execute that expression and then make the bug happen).
|
||||
This causes the error to run the Lisp debugger, which shows you a
|
||||
backtrace. Copy the text of the debugger's backtrace into the bug
|
||||
report.
|
||||
|
||||
This use of the debugger is possible only if you know how to make the
|
||||
bug happen again. If you can't make it happen again, at least copy
|
||||
the whole error message.
|
||||
|
||||
@item
|
||||
Check whether any programs you have loaded into the Lisp world,
|
||||
including your @file{.emacs} file, set any variables that may affect the
|
||||
functioning of Emacs. Also, see whether the problem happens in a
|
||||
freshly started Emacs without loading your @file{.emacs} file (start
|
||||
Emacs with the @code{-q} switch to prevent loading the init file). If
|
||||
the problem does @emph{not} occur then, you must report the precise
|
||||
contents of any programs that you must load into the Lisp world in order
|
||||
to cause the problem to occur.
|
||||
|
||||
@item
|
||||
If the problem does depend on an init file or other Lisp programs that
|
||||
are not part of the standard Emacs system, then you should make sure it
|
||||
is not a bug in those programs by complaining to their maintainers
|
||||
first. After they verify that they are using Emacs in a way that is
|
||||
supposed to work, they should report the bug.
|
||||
|
||||
@item
|
||||
If you wish to mention something in the GNU Emacs source, show the line
|
||||
of code with a few lines of context. Don't just give a line number.
|
||||
|
||||
The line numbers in the development sources don't match those in your
|
||||
sources. It would take extra work for the maintainers to determine what
|
||||
code is in your version at a given line number, and we could not be
|
||||
certain.
|
||||
|
||||
@item
|
||||
Additional information from a C debugger such as GDB might enable
|
||||
someone to find a problem on a machine which he does not have available.
|
||||
If you don't know how to use GDB, please read the GDB manual---it is not
|
||||
very long, and using GDB is easy. You can find the GDB distribution,
|
||||
including the GDB manual in online form, in most of the same places you
|
||||
can find the Emacs distribution. To run Emacs under GDB, you should
|
||||
switch to the @file{src} subdirectory in which Emacs was compiled, then
|
||||
do @samp{gdb emacs}. It is important for the directory @file{src} to be
|
||||
current so that GDB will read the @file{.gdbinit} file in this
|
||||
directory.
|
||||
|
||||
However, you need to think when you collect the additional information
|
||||
if you want it to show what causes the bug.
|
||||
|
||||
@cindex backtrace for bug reports
|
||||
For example, many people send just a backtrace, but that is not very
|
||||
useful by itself. A simple backtrace with arguments often conveys
|
||||
little about what is happening inside GNU Emacs, because most of the
|
||||
arguments listed in the backtrace are pointers to Lisp objects. The
|
||||
numeric values of these pointers have no significance whatever; all that
|
||||
matters is the contents of the objects they point to (and most of the
|
||||
contents are themselves pointers).
|
||||
|
||||
@findex debug_print
|
||||
To provide useful information, you need to show the values of Lisp
|
||||
objects in Lisp notation. Do this for each variable which is a Lisp
|
||||
object, in several stack frames near the bottom of the stack. Look at
|
||||
the source to see which variables are Lisp objects, because the debugger
|
||||
thinks of them as integers.
|
||||
|
||||
To show a variable's value in Lisp syntax, first print its value, then
|
||||
use the user-defined GDB command @code{pr} to print the Lisp object in
|
||||
Lisp syntax. (If you must use another debugger, call the function
|
||||
@code{debug_print} with the object as an argument.) The @code{pr}
|
||||
command is defined by the file @file{.gdbinit}, and it works only if you
|
||||
are debugging a running process (not with a core dump).
|
||||
|
||||
To make Lisp errors stop Emacs and return to GDB, put a breakpoint at
|
||||
@code{Fsignal}.
|
||||
|
||||
To find out which Lisp functions are running, using GDB, move up the
|
||||
stack, and each time you get to a frame for the function
|
||||
@code{Ffuncall}, type these GDB commands:
|
||||
|
||||
@example
|
||||
p *args
|
||||
pr
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
To print the first argument that the function received, use these
|
||||
commands:
|
||||
|
||||
@example
|
||||
p args[1]
|
||||
pr
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
You can print the other arguments likewise. The argument @code{nargs}
|
||||
of @code{Ffuncall} says how many arguments @code{Ffuncall} received;
|
||||
these include the Lisp function itself and the arguments for that
|
||||
function.
|
||||
|
||||
The file @file{.gdbinit} defines several other commands that are useful
|
||||
for examining the data types and contents of Lisp objects. Their names
|
||||
begin with @samp{x}. These commands work at a lower level than
|
||||
@code{pr}, and are less convenient, but they may work even when
|
||||
@code{pr} does not, such as when debugging a core dump or when Emacs has
|
||||
had a fatal signal.
|
||||
|
||||
@item
|
||||
If the symptom of the bug is that Emacs fails to respond, don't assume
|
||||
Emacs is ``hung''---it may instead be in an infinite loop. To find out
|
||||
which, make the problem happen under GDB and stop Emacs once it is not
|
||||
responding. (If Emacs is using X Windows directly, you can stop Emacs
|
||||
by typing @kbd{C-z} at the GDB job.) Then try stepping with
|
||||
@samp{step}. If Emacs is hung, the @samp{step} command won't return.
|
||||
If it is looping, @samp{step} will return.
|
||||
|
||||
If this shows Emacs is hung in a system call, stop it again and examine
|
||||
the arguments of the call. In your bug report, state exactly where in
|
||||
the source the system call is, and what the arguments are.
|
||||
|
||||
If Emacs is in an infinite loop, please determine where the loop starts
|
||||
and ends. The easiest way to do this is to use the GDB command
|
||||
@samp{finish}. Each time you use it, Emacs resumes execution until it
|
||||
exits one stack frame. Keep typing @samp{finish} until it doesn't
|
||||
return---that means the infinite loop is in the stack frame which you
|
||||
just tried to finish.
|
||||
|
||||
Stop Emacs again, and use @samp{finish} repeatedly again until you get
|
||||
@emph{back to} that frame. Then use @samp{next} to step through that
|
||||
frame. By stepping, you will see where the loop starts and ends. Also
|
||||
please examine the data being used in the loop and try to determine why
|
||||
the loop does not exit when it should. Include all of this information
|
||||
in your bug report.
|
||||
@end itemize
|
||||
|
||||
Here are some things that are not necessary in a bug report:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
A description of the envelope of the bug---this is not necessary for a
|
||||
reproducible bug.
|
||||
|
||||
Often people who encounter a bug spend a lot of time investigating
|
||||
which changes to the input file will make the bug go away and which
|
||||
changes will not affect it.
|
||||
|
||||
This is often time-consuming and not very useful, because the way we
|
||||
will find the bug is by running a single example under the debugger with
|
||||
breakpoints, not by pure deduction from a series of examples. You might
|
||||
as well save time by not searching for additional examples.
|
||||
|
||||
Of course, if you can find a simpler example to report @emph{instead} of
|
||||
the original one, that is a convenience. Errors in the output will be
|
||||
easier to spot, running under the debugger will take less time, etc.
|
||||
|
||||
However, simplification is not vital; if you can't do this or don't have
|
||||
time to try, please report the bug with your original test case.
|
||||
|
||||
@item
|
||||
A system-call trace of Emacs execution.
|
||||
|
||||
System-call traces are very useful for certain special kinds of
|
||||
debugging, but in most cases they give little useful information. It is
|
||||
therefore strange that many people seem to think that @emph{the} way to
|
||||
report information about a crash is to send a system-call trace. Perhaps
|
||||
this is a habit formed from experience debugging programs that don't
|
||||
have source code or debugging symbols.
|
||||
|
||||
In most programs, a backtrace is normally far, far more informative than
|
||||
a system-call trace. Even in Emacs, a simple backtrace is generally
|
||||
more informative, though to give full information you should supplement
|
||||
the backtrace by displaying variable values and printing them as Lisp
|
||||
objects with @code{pr} (see above).
|
||||
|
||||
@item
|
||||
A patch for the bug.
|
||||
|
||||
A patch for the bug is useful if it is a good one. But don't omit the
|
||||
other information that a bug report needs, such as the test case, on the
|
||||
assumption that a patch is sufficient. We might see problems with your
|
||||
patch and decide to fix the problem another way, or we might not
|
||||
understand it at all. And if we can't understand what bug you are
|
||||
trying to fix, or why your patch should be an improvement, we mustn't
|
||||
install it.
|
||||
|
||||
@ifinfo
|
||||
@xref{Sending Patches}, for guidelines on how to make it easy for us to
|
||||
understand and install your patches.
|
||||
@end ifinfo
|
||||
|
||||
@item
|
||||
A guess about what the bug is or what it depends on.
|
||||
|
||||
Such guesses are usually wrong. Even experts can't guess right about
|
||||
such things without first using the debugger to find the facts.
|
||||
@end itemize
|
||||
|
||||
@node Sending Patches
|
||||
@subsection Sending Patches for GNU Emacs
|
||||
|
||||
@cindex sending patches for GNU Emacs
|
||||
@cindex patches, sending
|
||||
If you would like to write bug fixes or improvements for GNU Emacs,
|
||||
that is very helpful. When you send your changes, please follow these
|
||||
guidelines to make it easy for the maintainers to use them. If you
|
||||
don't follow these guidelines, your information might still be useful,
|
||||
but using it will take extra work. Maintaining GNU Emacs is a lot of
|
||||
work in the best of circumstances, and we can't keep up unless you do
|
||||
your best to help.
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Send an explanation with your changes of what problem they fix or what
|
||||
improvement they bring about. For a bug fix, just include a copy of the
|
||||
bug report, and explain why the change fixes the bug.
|
||||
|
||||
(Referring to a bug report is not as good as including it, because then
|
||||
we will have to look it up, and we have probably already deleted it if
|
||||
we've already fixed the bug.)
|
||||
|
||||
@item
|
||||
Always include a proper bug report for the problem you think you have
|
||||
fixed. We need to convince ourselves that the change is right before
|
||||
installing it. Even if it is correct, we might have trouble
|
||||
understanding it if we don't have a way to reproduce the problem.
|
||||
|
||||
@item
|
||||
Include all the comments that are appropriate to help people reading the
|
||||
source in the future understand why this change was needed.
|
||||
|
||||
@item
|
||||
Don't mix together changes made for different reasons.
|
||||
Send them @emph{individually}.
|
||||
|
||||
If you make two changes for separate reasons, then we might not want to
|
||||
install them both. We might want to install just one. If you send them
|
||||
all jumbled together in a single set of diffs, we have to do extra work
|
||||
to disentangle them---to figure out which parts of the change serve
|
||||
which purpose. If we don't have time for this, we might have to ignore
|
||||
your changes entirely.
|
||||
|
||||
If you send each change as soon as you have written it, with its own
|
||||
explanation, then two changes never get tangled up, and we can consider
|
||||
each one properly without any extra work to disentangle them.
|
||||
|
||||
@item
|
||||
Send each change as soon as that change is finished. Sometimes people
|
||||
think they are helping us by accumulating many changes to send them all
|
||||
together. As explained above, this is absolutely the worst thing you
|
||||
could do.
|
||||
|
||||
Since you should send each change separately, you might as well send it
|
||||
right away. That gives us the option of installing it immediately if it
|
||||
is important.
|
||||
|
||||
@item
|
||||
Use @samp{diff -c} to make your diffs. Diffs without context are hard
|
||||
to install reliably. More than that, they are hard to study; we must
|
||||
always study a patch to decide whether we want to install it. Unidiff
|
||||
format is better than contextless diffs, but not as easy to read as
|
||||
@samp{-c} format.
|
||||
|
||||
If you have GNU diff, use @samp{diff -c -F'^[_a-zA-Z0-9$]+ *('} when
|
||||
making diffs of C code. This shows the name of the function that each
|
||||
change occurs in.
|
||||
|
||||
@item
|
||||
Avoid any ambiguity as to which is the old version and which is the new.
|
||||
Please make the old version the first argument to diff, and the new
|
||||
version the second argument. And please give one version or the other a
|
||||
name that indicates whether it is the old version or your new changed
|
||||
one.
|
||||
|
||||
@item
|
||||
Write the change log entries for your changes. This is both to save us
|
||||
the extra work of writing them, and to help explain your changes so we
|
||||
can understand them.
|
||||
|
||||
The purpose of the change log is to show people where to find what was
|
||||
changed. So you need to be specific about what functions you changed;
|
||||
in large functions, it's often helpful to indicate where within the
|
||||
function the change was.
|
||||
|
||||
On the other hand, once you have shown people where to find the change,
|
||||
you need not explain its purpose in the change log. Thus, if you add a
|
||||
new function, all you need to say about it is that it is new. If you
|
||||
feel that the purpose needs explaining, it probably does---but put the
|
||||
explanation in comments in the code. It will be more useful there.
|
||||
|
||||
Please read the @file{ChangeLog} files in the @file{src} and @file{lisp}
|
||||
directories to see what sorts of information to put in, and to learn the
|
||||
style that we use. If you would like your name to appear in the header
|
||||
line, showing who made the change, send us the header line.
|
||||
@xref{Change Log}.
|
||||
|
||||
@item
|
||||
When you write the fix, keep in mind that we can't install a change that
|
||||
would break other systems. Please think about what effect your change
|
||||
will have if compiled on another type of system.
|
||||
|
||||
Sometimes people send fixes that @emph{might} be an improvement in
|
||||
general---but it is hard to be sure of this. It's hard to install
|
||||
such changes because we have to study them very carefully. Of course,
|
||||
a good explanation of the reasoning by which you concluded the change
|
||||
was correct can help convince us.
|
||||
|
||||
The safest changes are changes to the configuration files for a
|
||||
particular machine. These are safe because they can't create new bugs
|
||||
on other machines.
|
||||
|
||||
Please help us keep up with the workload by designing the patch in a
|
||||
form that is clearly safe to install.
|
||||
@end itemize
|
||||
|
||||
@node Contributing, Service, Bugs, Top
|
||||
@section Contributing to Emacs Development
|
||||
|
||||
If you would like to help pretest Emacs releases to assure they work
|
||||
well, or if you would like to work on improving Emacs, please contact
|
||||
the maintainers at @code{bug-gnu-emacs@@gnu.org}. A pretester
|
||||
should be prepared to investigate bugs as well as report them. If you'd
|
||||
like to work on improving Emacs, please ask for suggested projects or
|
||||
suggest your own ideas.
|
||||
|
||||
If you have already written an improvement, please tell us about it. If
|
||||
you have not yet started work, it is useful to contact
|
||||
@code{bug-gnu-emacs@@gnu.org} before you start; it might be
|
||||
possible to suggest ways to make your extension fit in better with the
|
||||
rest of Emacs.
|
||||
|
||||
@node Service, Command Arguments, Contributing, Top
|
||||
@section How To Get Help with GNU Emacs
|
||||
|
||||
If you need help installing, using or changing GNU Emacs, there are two
|
||||
ways to find it:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Send a message to the mailing list
|
||||
@code{help-gnu-emacs@@gnu.org}, or post your request on
|
||||
newsgroup @code{gnu.emacs.help}. (This mailing list and newsgroup
|
||||
interconnect, so it does not matter which one you use.)
|
||||
|
||||
@item
|
||||
Look in the service directory for someone who might help you for a fee.
|
||||
The service directory is found in the file named @file{etc/SERVICE} in the
|
||||
Emacs distribution.
|
||||
@end itemize
|
1945
man/vip.texi
Normal file
1945
man/vip.texi
Normal file
File diff suppressed because it is too large
Load diff
4459
man/viper.texi
Normal file
4459
man/viper.texi
Normal file
File diff suppressed because it is too large
Load diff
1617
man/widget.texi
Normal file
1617
man/widget.texi
Normal file
File diff suppressed because it is too large
Load diff
354
man/windows.texi
Normal file
354
man/windows.texi
Normal file
|
@ -0,0 +1,354 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Windows, Frames, Buffers, Top
|
||||
@chapter Multiple Windows
|
||||
@cindex windows in Emacs
|
||||
@cindex multiple windows in Emacs
|
||||
|
||||
Emacs can split a frame into two or many windows. Multiple windows
|
||||
can display parts of different buffers, or different parts of one
|
||||
buffer. Multiple frames always imply multiple windows, because each
|
||||
frame has its own set of windows. Each window belongs to one and only
|
||||
one frame.
|
||||
|
||||
@menu
|
||||
* Basic Window:: Introduction to Emacs windows.
|
||||
* Split Window:: New windows are made by splitting existing windows.
|
||||
* Other Window:: Moving to another window or doing something to it.
|
||||
* Pop Up Window:: Finding a file or buffer in another window.
|
||||
* Force Same Window:: Forcing certain buffers to appear in the selected
|
||||
window rather than in another window.
|
||||
* Change Window:: Deleting windows and changing their sizes.
|
||||
@end menu
|
||||
|
||||
@node Basic Window
|
||||
@section Concepts of Emacs Windows
|
||||
|
||||
Each Emacs window displays one Emacs buffer at any time. A single
|
||||
buffer may appear in more than one window; if it does, any changes in
|
||||
its text are displayed in all the windows where it appears. But the
|
||||
windows showing the same buffer can show different parts of it, because
|
||||
each window has its own value of point.
|
||||
|
||||
@cindex selected window
|
||||
At any time, one of the windows is the @dfn{selected window}; the
|
||||
buffer this window is displaying is the current buffer. The terminal's
|
||||
cursor shows the location of point in this window. Each other window
|
||||
has a location of point as well, but since the terminal has only one
|
||||
cursor there is no way to show where those locations are. When multiple
|
||||
frames are visible in X Windows, each frame has a cursor which appears
|
||||
in the frame's selected window. The cursor in the selected frame is
|
||||
solid; the cursor in other frames is a hollow box.
|
||||
|
||||
Commands to move point affect the value of point for the selected Emacs
|
||||
window only. They do not change the value of point in any other Emacs
|
||||
window, even one showing the same buffer. The same is true for commands
|
||||
such as @kbd{C-x b} to change the selected buffer in the selected window;
|
||||
they do not affect other windows at all. However, there are other commands
|
||||
such as @kbd{C-x 4 b} that select a different window and switch buffers in
|
||||
it. Also, all commands that display information in a window, including
|
||||
(for example) @kbd{C-h f} (@code{describe-function}) and @kbd{C-x C-b}
|
||||
(@code{list-buffers}), work by switching buffers in a nonselected window
|
||||
without affecting the selected window.
|
||||
|
||||
When multiple windows show the same buffer, they can have different
|
||||
regions, because they can have different values of point. However,
|
||||
they all have the same value for the mark, because each buffer has
|
||||
only one mark position.
|
||||
|
||||
Each window has its own mode line, which displays the buffer name,
|
||||
modification status and major and minor modes of the buffer that is
|
||||
displayed in the window. @xref{Mode Line}, for full details on the mode
|
||||
line.
|
||||
|
||||
@iftex
|
||||
@break
|
||||
@end iftex
|
||||
|
||||
@node Split Window
|
||||
@section Splitting Windows
|
||||
|
||||
@table @kbd
|
||||
@item C-x 2
|
||||
Split the selected window into two windows, one above the other
|
||||
(@code{split-window-vertically}).
|
||||
@item C-x 3
|
||||
Split the selected window into two windows positioned side by side
|
||||
(@code{split-window-horizontally}).
|
||||
@item C-Mouse-2
|
||||
In the mode line or scroll bar of a window, split that window.
|
||||
@end table
|
||||
|
||||
@kindex C-x 2
|
||||
@findex split-window-vertically
|
||||
The command @kbd{C-x 2} (@code{split-window-vertically}) breaks the
|
||||
selected window into two windows, one above the other. Both windows start
|
||||
out displaying the same buffer, with the same value of point. By default
|
||||
the two windows each get half the height of the window that was split; a
|
||||
numeric argument specifies how many lines to give to the top window.
|
||||
|
||||
@kindex C-x 3
|
||||
@findex split-window-horizontally
|
||||
@kbd{C-x 3} (@code{split-window-horizontally}) breaks the selected
|
||||
window into two side-by-side windows. A numeric argument specifies how
|
||||
many columns to give the one on the left. A line of vertical bars
|
||||
separates the two windows. Windows that are not the full width of the
|
||||
screen have mode lines, but they are truncated. On terminals where
|
||||
Emacs does not support highlighting, truncated mode lines sometimes do
|
||||
not appear in inverse video.
|
||||
|
||||
@kindex C-Mouse-2 @r{(scroll bar)}
|
||||
You can split a window horizontally or vertically by clicking
|
||||
@kbd{C-Mouse-2} in the mode line or the scroll bar. The line of
|
||||
splitting goes through the place where you click: if you click on the
|
||||
mode line, the new scroll bar goes above the spot; if you click in the
|
||||
scroll bar, the mode line of the split window is side by side with your
|
||||
click.
|
||||
|
||||
@vindex truncate-partial-width-windows
|
||||
When a window is less than the full width, text lines too long to fit are
|
||||
frequent. Continuing all those lines might be confusing. The variable
|
||||
@code{truncate-partial-width-windows} can be set non-@code{nil} to force
|
||||
truncation in all windows less than the full width of the screen,
|
||||
independent of the buffer being displayed and its value for
|
||||
@code{truncate-lines}. @xref{Continuation Lines}.@refill
|
||||
|
||||
Horizontal scrolling is often used in side-by-side windows.
|
||||
@xref{Display}.
|
||||
|
||||
@vindex split-window-keep-point
|
||||
If @code{split-window-keep-point} is non-@code{nil}, the default, both
|
||||
of the windows resulting from @kbd{C-x 2} inherit the value of point
|
||||
from the window that was split. This means that scrolling is
|
||||
inevitable. If this variable is @code{nil}, then @kbd{C-x 2} tries to
|
||||
avoid shifting any text the screen, by putting point in each window at a
|
||||
position already visible in the window. It also selects whichever
|
||||
window contain the screen line that the cursor was previously on. Some
|
||||
users prefer the latter mode on slow terminals.
|
||||
|
||||
@node Other Window
|
||||
@section Using Other Windows
|
||||
|
||||
@table @kbd
|
||||
@item C-x o
|
||||
Select another window (@code{other-window}). That is @kbd{o}, not zero.
|
||||
@item C-M-v
|
||||
Scroll the next window (@code{scroll-other-window}).
|
||||
@item M-x compare-windows
|
||||
Find next place where the text in the selected window does not match
|
||||
the text in the next window.
|
||||
@item Mouse-1
|
||||
@kbd{Mouse-1}, in a window's mode line, selects that window
|
||||
but does not move point in it (@code{mouse-select-window}).
|
||||
@end table
|
||||
|
||||
@kindex C-x o
|
||||
@findex other-window
|
||||
To select a different window, click with @kbd{Mouse-1} on its mode
|
||||
line. With the keyboard, you can switch windows by typing @kbd{C-x o}
|
||||
(@code{other-window}). That is an @kbd{o}, for `other', not a zero.
|
||||
When there are more than two windows, this command moves through all the
|
||||
windows in a cyclic order, generally top to bottom and left to right.
|
||||
After the rightmost and bottommost window, it goes back to the one at
|
||||
the upper left corner. A numeric argument means to move several steps
|
||||
in the cyclic order of windows. A negative argument moves around the
|
||||
cycle in the opposite order. When the minibuffer is active, the
|
||||
minibuffer is the last window in the cycle; you can switch from the
|
||||
minibuffer window to one of the other windows, and later switch back and
|
||||
finish supplying the minibuffer argument that is requested.
|
||||
@xref{Minibuffer Edit}.
|
||||
|
||||
@kindex C-M-v
|
||||
@findex scroll-other-window
|
||||
The usual scrolling commands (@pxref{Display}) apply to the selected
|
||||
window only, but there is one command to scroll the next window.
|
||||
@kbd{C-M-v} (@code{scroll-other-window}) scrolls the window that
|
||||
@kbd{C-x o} would select. It takes arguments, positive and negative,
|
||||
like @kbd{C-v}. (In the minibuffer, @kbd{C-M-v} scrolls the window
|
||||
that contains the minibuffer help display, if any, rather than the
|
||||
next window in the standard cyclic order.)
|
||||
|
||||
The command @kbd{M-x compare-windows} lets you compare two files or
|
||||
buffers visible in two windows, by moving through them to the next
|
||||
mismatch. @xref{Comparing Files}, for details.
|
||||
|
||||
@node Pop Up Window
|
||||
@section Displaying in Another Window
|
||||
|
||||
@cindex selecting buffers in other windows
|
||||
@kindex C-x 4
|
||||
@kbd{C-x 4} is a prefix key for commands that select another window
|
||||
(splitting the window if there is only one) and select a buffer in that
|
||||
window. Different @kbd{C-x 4} commands have different ways of finding the
|
||||
buffer to select.
|
||||
|
||||
@table @kbd
|
||||
@item C-x 4 b @var{bufname} @key{RET}
|
||||
Select buffer @var{bufname} in another window. This runs
|
||||
@code{switch-to-buffer-other-window}.
|
||||
@item C-x 4 C-o @var{bufname} @key{RET}
|
||||
Display buffer @var{bufname} in another window, but
|
||||
don't select that buffer or that window. This runs
|
||||
@code{display-buffer}.
|
||||
@item C-x 4 f @var{filename} @key{RET}
|
||||
Visit file @var{filename} and select its buffer in another window. This
|
||||
runs @code{find-file-other-window}. @xref{Visiting}.
|
||||
@item C-x 4 d @var{directory} @key{RET}
|
||||
Select a Dired buffer for directory @var{directory} in another window.
|
||||
This runs @code{dired-other-window}. @xref{Dired}.
|
||||
@item C-x 4 m
|
||||
Start composing a mail message in another window. This runs
|
||||
@code{mail-other-window}; its same-window analogue is @kbd{C-x m}
|
||||
(@pxref{Sending Mail}).
|
||||
@item C-x 4 .
|
||||
Find a tag in the current tags table, in another window. This runs
|
||||
@code{find-tag-other-window}, the multiple-window variant of @kbd{M-.}
|
||||
(@pxref{Tags}).
|
||||
@item C-x 4 r @var{filename} @key{RET}
|
||||
Visit file @var{filename} read-only, and select its buffer in another
|
||||
window. This runs @code{find-file-read-only-other-window}.
|
||||
@xref{Visiting}.
|
||||
@end table
|
||||
|
||||
@node Force Same Window
|
||||
@section Forcing Display in the Same Window
|
||||
|
||||
Certain Emacs commands switch to a specific buffer with special
|
||||
contents. For example, @kbd{M-x shell} switches to a buffer named
|
||||
@samp{*Shell*}. By convention, all these commands are written to pop up
|
||||
the buffer in a separate window. But you can specify that certain of
|
||||
these buffers should appear in the selected window.
|
||||
|
||||
@vindex same-window-buffer-names
|
||||
If you add a buffer name to the list @code{same-window-buffer-names},
|
||||
the effect is that such commands display that particular buffer by
|
||||
switching to it in the selected window. For example, if you add the
|
||||
element @code{"*grep*"} to the list, the @code{grep} command will
|
||||
display its output buffer in the selected window.
|
||||
|
||||
The default value of @code{same-window-buffer-names} is not
|
||||
@code{nil}: it specifies buffer names @samp{*info*}, @samp{*mail*} and
|
||||
@samp{*shell*} (as well as others used by more obscure Emacs packages).
|
||||
This is why @kbd{M-x shell} normally switches to the @samp{*shell*}
|
||||
buffer in the selected window. If you delete this element from the
|
||||
value of @code{same-window-buffer-names}, the behavior of @kbd{M-x
|
||||
shell} will change---it will pop up the buffer in another window
|
||||
instead.
|
||||
|
||||
@vindex same-window-regexps
|
||||
You can specify these buffers more generally with the variable
|
||||
@code{same-window-regexps}. Set it to a list of regular expressions;
|
||||
then any buffer whose name matches one of those regular expressions is
|
||||
displayed by switching to it in the selected window. (Once again, this
|
||||
applies only to buffers that normally get displayed for you in a
|
||||
separate window.) The default value of this variable specifies Telnet
|
||||
and rlogin buffers.
|
||||
|
||||
An analogous feature lets you specify buffers which should be
|
||||
displayed in their own individual frames. @xref{Special Buffer Frames}.
|
||||
|
||||
@node Change Window
|
||||
@section Deleting and Rearranging Windows
|
||||
|
||||
@table @kbd
|
||||
@item C-x 0
|
||||
Delete the selected window (@code{delete-window}). The last character
|
||||
in this key sequence is a zero.
|
||||
@item C-x 1
|
||||
Delete all windows in the selected frame except the selected window
|
||||
(@code{delete-other-windows}).
|
||||
@item C-x 4 0
|
||||
Delete the selected window and kill the buffer that was showing in it
|
||||
(@code{kill-buffer-and-window}). The last character in this key
|
||||
sequence is a zero.
|
||||
@item C-x ^
|
||||
Make selected window taller (@code{enlarge-window}).
|
||||
@item C-x @}
|
||||
Make selected window wider (@code{enlarge-window-horizontally}).
|
||||
@item C-x @{
|
||||
Make selected window narrower (@code{shrink-window-horizontally}).
|
||||
@item C-x -
|
||||
Shrink this window if its buffer doesn't need so many lines
|
||||
(@code{shrink-window-if-larger-than-buffer}).
|
||||
@item C-x +
|
||||
Make all windows the same height (@code{balance-windows}).
|
||||
@item Drag-Mouse-1
|
||||
Dragging a window's mode line up or down with @kbd{Mouse-1} changes
|
||||
window heights.
|
||||
@item Mouse-2
|
||||
@kbd{Mouse-2} in a window's mode line deletes all other windows in the frame
|
||||
(@code{mouse-delete-other-windows}).
|
||||
@item Mouse-3
|
||||
@kbd{Mouse-3} in a window's mode line deletes that window
|
||||
(@code{mouse-delete-window}).
|
||||
@end table
|
||||
|
||||
@kindex C-x 0
|
||||
@findex delete-window
|
||||
To delete a window, type @kbd{C-x 0} (@code{delete-window}). (That is
|
||||
a zero.) The space occupied by the deleted window is given to an
|
||||
adjacent window (but not the minibuffer window, even if that is active
|
||||
at the time). Once a window is deleted, its attributes are forgotten;
|
||||
only restoring a window configuration can bring it back. Deleting the
|
||||
window has no effect on the buffer it used to display; the buffer
|
||||
continues to exist, and you can select it in any window with @kbd{C-x
|
||||
b}.
|
||||
|
||||
@findex kill-buffer-and-window
|
||||
@kindex C-x 4 0
|
||||
@kbd{C-x 4 0} (@code{kill-buffer-and-window}) is a stronger command
|
||||
than @kbd{C-x 0}; it kills the current buffer and then deletes the
|
||||
selected window.
|
||||
|
||||
@kindex C-x 1
|
||||
@findex delete-other-windows
|
||||
@kbd{C-x 1} (@code{delete-other-windows}) is more powerful in a
|
||||
different way; it deletes all the windows except the selected one (and
|
||||
the minibuffer); the selected window expands to use the whole frame
|
||||
except for the echo area.
|
||||
|
||||
You can also delete a window by clicking on its mode line with
|
||||
@kbd{Mouse-2}, and delete all the windows in a frame except one window
|
||||
by clicking on that window's mode line with @kbd{Mouse-3}.
|
||||
|
||||
The easiest way to adjust window heights is with a mouse. If you
|
||||
press @kbd{Mouse-1} on a mode line, you can drag that mode line up or
|
||||
down, changing the heights of the windows above and below it.
|
||||
|
||||
@kindex C-x ^
|
||||
@findex enlarge-window
|
||||
@kindex C-x @}
|
||||
@findex enlarge-window-horizontally
|
||||
@vindex window-min-height
|
||||
@vindex window-min-width
|
||||
To readjust the division of space among vertically adjacent windows,
|
||||
use @kbd{C-x ^} (@code{enlarge-window}). It makes the currently
|
||||
selected window get one line bigger, or as many lines as is specified
|
||||
with a numeric argument. With a negative argument, it makes the
|
||||
selected window smaller. @kbd{C-x @}}
|
||||
(@code{enlarge-window-horizontally}) makes the selected window wider by
|
||||
the specified number of columns. @kbd{C-x @{}
|
||||
(@code{shrink-window-horizontally}) makes the selected window narrower
|
||||
by the specified number of columns.
|
||||
|
||||
When you make a window bigger, the space comes from one of its
|
||||
neighbors. If this makes any window too small, it is deleted and its
|
||||
space is given to an adjacent window. The minimum size is specified by
|
||||
the variables @code{window-min-height} and @code{window-min-width}.
|
||||
|
||||
@kindex C-x -
|
||||
@findex shrink-window-if-larger-than-buffer
|
||||
The command @kbd{C-x -} (@code{shrink-window-if-larger-than-buffer})
|
||||
reduces the height of the selected window, if it is taller than
|
||||
necessary to show the whole text of the buffer it is displaying. It
|
||||
gives the extra lines to other windows in the frame.
|
||||
|
||||
@kindex C-x +
|
||||
@findex balance-windows
|
||||
You can also use @kbd{C-x +} (@code{balance-windows}) to even out the
|
||||
heights of all the windows in the selected frame.
|
||||
|
||||
@xref{Minibuffer Edit}, for information about the Resize-Minibuffer
|
||||
mode, which automatically changes the size of the minibuffer window to
|
||||
fit the text in the minibuffer.
|
Loading…
Add table
Reference in a new issue