Move to ../doc/emacs/, misc/
This commit is contained in:
parent
6336d8c3d7
commit
19e364e295
99 changed files with 0 additions and 220340 deletions
23
man/.gitignore
vendored
23
man/.gitignore
vendored
|
@ -1,23 +0,0 @@
|
|||
*.aux
|
||||
*.cp
|
||||
*.cps
|
||||
*.dvi
|
||||
*.fn
|
||||
*.fns
|
||||
*.ky
|
||||
*.kys
|
||||
*.log
|
||||
*.op
|
||||
*.ops
|
||||
*.pdf
|
||||
*.pg
|
||||
*.pgs
|
||||
*.ps
|
||||
*.tmp
|
||||
*.toc
|
||||
*.tp
|
||||
*.tps
|
||||
*.vr
|
||||
*.vrs
|
||||
Makefile
|
||||
makefile
|
8242
man/ChangeLog
8242
man/ChangeLog
File diff suppressed because it is too large
Load diff
368
man/Makefile.in
368
man/Makefile.in
|
@ -1,368 +0,0 @@
|
|||
#### Makefile for the Emacs Manual and other documentation.
|
||||
|
||||
# Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
|
||||
# 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This file is part of GNU Emacs.
|
||||
|
||||
# GNU Emacs is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# GNU Emacs is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with GNU Emacs; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
|
||||
# Where to find the source code. $(srcdir) will be the man
|
||||
# subdirectory of the source tree. This is
|
||||
# set by the configure script's `--srcdir' option.
|
||||
srcdir=@srcdir@
|
||||
top_srcdir=@top_srcdir@
|
||||
|
||||
# Tell make where to find source files; this is needed for the makefiles.
|
||||
VPATH=@srcdir@
|
||||
|
||||
|
||||
# The makeinfo program is part of the Texinfo distribution.
|
||||
# Use --force so that it generates output even if there are errors.
|
||||
MAKEINFO = makeinfo --force
|
||||
INFO_TARGETS = ../info/emacs ../info/ccmode ../info/cl \
|
||||
../info/dired-x ../info/ediff ../info/forms ../info/gnus \
|
||||
../info/message ../info/sieve ../info/pgg ../info/emacs-mime \
|
||||
../info/info ../info/mh-e ../info/reftex \
|
||||
../info/sc ../info/vip ../info/viper ../info/widget \
|
||||
../info/efaq ../info/ada-mode ../info/autotype ../info/calc \
|
||||
../info/idlwave ../info/eudc ../info/ebrowse ../info/pcl-cvs \
|
||||
../info/woman ../info/eshell ../info/org ../info/url \
|
||||
../info/speedbar ../info/tramp ../info/ses ../info/smtpmail \
|
||||
../info/flymake ../info/newsticker ../info/rcirc ../info/erc
|
||||
DVI_TARGETS = emacs.dvi calc.dvi cc-mode.dvi cl.dvi dired-x.dvi \
|
||||
ediff.dvi forms.dvi gnus.dvi message.dvi emacs-mime.dvi \
|
||||
gnus.dvi message.dvi sieve.dvi pgg.dvi mh-e.dvi \
|
||||
reftex.dvi sc.dvi vip.dvi viper.dvi widget.dvi faq.dvi \
|
||||
ada-mode.dvi autotype.dvi idlwave.dvi eudc.dvi ebrowse.dvi \
|
||||
pcl-cvs.dvi woman.dvi eshell.dvi org.dvi url.dvi \
|
||||
speedbar.dvi tramp.dvi ses.dvi smtpmail.dvi flymake.dvi \
|
||||
newsticker.dvi emacs-xtra.dvi rcirc.dvi erc.dvi
|
||||
INFOSOURCES = info.texi
|
||||
|
||||
# The following rule does not work with all versions of `make'.
|
||||
.SUFFIXES: .texi .dvi
|
||||
.texi.dvi:
|
||||
texi2dvi $<
|
||||
|
||||
TEXI2DVI = texi2dvi
|
||||
ENVADD = TEXINPUTS="$(srcdir):$(TEXINPUTS)" MAKEINFO="$(MAKEINFO) -I$(srcdir)"
|
||||
|
||||
EMACS_XTRA=\
|
||||
$(srcdir)/arevert-xtra.texi \
|
||||
$(srcdir)/cal-xtra.texi \
|
||||
$(srcdir)/dired-xtra.texi \
|
||||
$(srcdir)/picture-xtra.texi \
|
||||
$(srcdir)/emerge-xtra.texi \
|
||||
$(srcdir)/vc-xtra.texi \
|
||||
$(srcdir)/vc1-xtra.texi \
|
||||
$(srcdir)/vc2-xtra.texi \
|
||||
$(srcdir)/fortran-xtra.texi \
|
||||
$(srcdir)/msdog-xtra.texi
|
||||
|
||||
EMACSSOURCES= \
|
||||
${srcdir}/emacs.texi \
|
||||
${srcdir}/doclicense.texi \
|
||||
${srcdir}/gpl.texi \
|
||||
${srcdir}/screen.texi \
|
||||
${srcdir}/commands.texi \
|
||||
${srcdir}/entering.texi \
|
||||
${srcdir}/basic.texi \
|
||||
${srcdir}/mini.texi \
|
||||
${srcdir}/m-x.texi \
|
||||
${srcdir}/help.texi \
|
||||
${srcdir}/mark.texi \
|
||||
${srcdir}/killing.texi \
|
||||
${srcdir}/regs.texi \
|
||||
${srcdir}/display.texi \
|
||||
${srcdir}/search.texi \
|
||||
${srcdir}/fixit.texi \
|
||||
${srcdir}/files.texi \
|
||||
${srcdir}/buffers.texi \
|
||||
${srcdir}/windows.texi \
|
||||
${srcdir}/frames.texi \
|
||||
${srcdir}/mule.texi \
|
||||
${srcdir}/major.texi \
|
||||
${srcdir}/indent.texi \
|
||||
${srcdir}/text.texi \
|
||||
${srcdir}/programs.texi \
|
||||
${srcdir}/building.texi \
|
||||
${srcdir}/maintaining.texi \
|
||||
${srcdir}/abbrevs.texi \
|
||||
${srcdir}/sending.texi \
|
||||
${srcdir}/rmail.texi \
|
||||
${srcdir}/dired.texi \
|
||||
${srcdir}/calendar.texi \
|
||||
${srcdir}/misc.texi \
|
||||
${srcdir}/custom.texi \
|
||||
${srcdir}/trouble.texi \
|
||||
${srcdir}/cmdargs.texi \
|
||||
${srcdir}/xresources.texi \
|
||||
${srcdir}/anti.texi \
|
||||
${srcdir}/macos.texi \
|
||||
${srcdir}/msdog.texi \
|
||||
${srcdir}/gnu.texi \
|
||||
${srcdir}/glossary.texi \
|
||||
${srcdir}/ack.texi \
|
||||
${srcdir}/kmacro.texi \
|
||||
$(EMACS_XTRA)
|
||||
|
||||
info: $(top_srcdir)/info $(INFO_TARGETS)
|
||||
|
||||
$(top_srcdir)/info:
|
||||
mkdir $@
|
||||
|
||||
dvi: $(DVI_TARGETS)
|
||||
|
||||
# Note that all the Info targets build the Info files
|
||||
# in srcdir. There is no provision for Info files
|
||||
# to exist in the build directory.
|
||||
# In a distribution of Emacs, the Info files should be up to date.
|
||||
|
||||
# The following target uses an explicit -o switch to work around
|
||||
# the @setfilename directive in info.texi, which is required for
|
||||
# the Texinfo distribution.
|
||||
|
||||
../info/info: ${INFOSOURCES}
|
||||
cd $(srcdir); $(MAKEINFO) --no-split info.texi -o $@
|
||||
|
||||
info.dvi: ${INFOSOURCES}
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/info.texi
|
||||
|
||||
../info/emacs: ${EMACSSOURCES}
|
||||
cd $(srcdir); $(MAKEINFO) emacs.texi
|
||||
|
||||
emacs.dvi: ${EMACSSOURCES}
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/emacs.texi
|
||||
|
||||
# This target is here so you could easily get the list of the *.texi
|
||||
# files which belong to the Emacs manual (as opposed to the separate
|
||||
# manuals for CL, CC Mode, Ebrowse, etc.). With this target, you can
|
||||
# say things like "grep foo `make emacsman`".
|
||||
emacsman:
|
||||
@echo $(EMACSSOURCES)
|
||||
|
||||
../info/ccmode: cc-mode.texi
|
||||
cd $(srcdir); $(MAKEINFO) cc-mode.texi
|
||||
cc-mode.dvi: cc-mode.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/cc-mode.texi
|
||||
|
||||
../info/ada-mode: ada-mode.texi
|
||||
cd $(srcdir); $(MAKEINFO) ada-mode.texi
|
||||
ada-mode.dvi: ada-mode.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/ada-mode.texi
|
||||
|
||||
../info/pcl-cvs: pcl-cvs.texi
|
||||
cd $(srcdir); $(MAKEINFO) pcl-cvs.texi
|
||||
pcl-cvs.dvi: pcl-cvs.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/pcl-cvs.texi
|
||||
|
||||
../info/eshell: eshell.texi
|
||||
cd $(srcdir); $(MAKEINFO) eshell.texi
|
||||
eshell.dvi: eshell.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/eshell.texi
|
||||
|
||||
../info/cl: cl.texi
|
||||
cd $(srcdir); $(MAKEINFO) cl.texi
|
||||
cl.dvi: cl.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/cl.texi
|
||||
|
||||
../info/dired-x: dired-x.texi
|
||||
cd $(srcdir); $(MAKEINFO) dired-x.texi
|
||||
dired-x.dvi: dired-x.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/dired-x.texi
|
||||
|
||||
../info/ediff: ediff.texi
|
||||
cd $(srcdir); $(MAKEINFO) ediff.texi
|
||||
ediff.dvi: ediff.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/ediff.texi
|
||||
|
||||
emacs-xtra.dvi: emacs-xtra.texi $(EMACS_XTRA)
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/emacs-xtra.texi
|
||||
|
||||
../info/forms: forms.texi
|
||||
cd $(srcdir); $(MAKEINFO) forms.texi
|
||||
forms.dvi: forms.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/forms.texi
|
||||
|
||||
# gnus/message/emacs-mime/sieve/pgg are part of Gnus:
|
||||
../info/gnus: gnus.texi gnus-faq.texi
|
||||
cd $(srcdir); $(MAKEINFO) gnus.texi
|
||||
gnus.dvi: gnus.texi gnus-faq.texi
|
||||
sed -e '/@iflatex/,/@end iflatex/d' ${srcdir}/gnus.texi > gnustmp.texi
|
||||
$(ENVADD) $(TEXI2DVI) gnustmp.texi
|
||||
cp gnustmp.dvi $*.dvi
|
||||
rm gnustmp.*
|
||||
|
||||
../info/message: message.texi
|
||||
cd $(srcdir); $(MAKEINFO) message.texi
|
||||
message.dvi: message.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/message.texi
|
||||
|
||||
../info/sieve: sieve.texi
|
||||
cd $(srcdir); $(MAKEINFO) sieve.texi
|
||||
sieve.dvi: sieve.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/sieve.texi
|
||||
|
||||
../info/emacs-mime: emacs-mime.texi
|
||||
cd $(srcdir); $(MAKEINFO) --enable-encoding emacs-mime.texi
|
||||
emacs-mime.dvi: emacs-mime.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/emacs-mime.texi
|
||||
|
||||
../info/pgg: pgg.texi
|
||||
cd $(srcdir); $(MAKEINFO) pgg.texi
|
||||
pgg.dvi: pgg.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/pgg.texi
|
||||
|
||||
../info/mh-e: mh-e.texi
|
||||
cd $(srcdir); $(MAKEINFO) mh-e.texi
|
||||
mh-e.dvi: mh-e.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/mh-e.texi
|
||||
|
||||
../info/reftex: reftex.texi
|
||||
cd $(srcdir); $(MAKEINFO) reftex.texi
|
||||
reftex.dvi: reftex.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/reftex.texi
|
||||
|
||||
../info/sc: sc.texi
|
||||
cd $(srcdir); $(MAKEINFO) sc.texi
|
||||
sc.dvi: sc.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/sc.texi
|
||||
|
||||
../info/vip: vip.texi
|
||||
cd $(srcdir); $(MAKEINFO) vip.texi
|
||||
vip.dvi: vip.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/vip.texi
|
||||
|
||||
../info/viper: viper.texi
|
||||
cd $(srcdir); $(MAKEINFO) viper.texi
|
||||
viper.dvi: viper.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/viper.texi
|
||||
|
||||
../info/widget: widget.texi
|
||||
cd $(srcdir); $(MAKEINFO) widget.texi
|
||||
widget.dvi: widget.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/widget.texi
|
||||
|
||||
../info/efaq: faq.texi
|
||||
cd $(srcdir); $(MAKEINFO) faq.texi
|
||||
faq.dvi: faq.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/faq.texi
|
||||
|
||||
../etc/GNU: gnu1.texi gnu.texi
|
||||
cd $(srcdir) && makeinfo --no-headers -o ../etc/GNU gnu1.texi
|
||||
|
||||
../info/autotype: autotype.texi
|
||||
cd $(srcdir); $(MAKEINFO) autotype.texi
|
||||
autotype.dvi: autotype.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/autotype.texi
|
||||
|
||||
../info/calc: calc.texi
|
||||
cd $(srcdir); $(MAKEINFO) calc.texi
|
||||
|
||||
calc.dvi: calc.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/calc.texi
|
||||
|
||||
# This is produced with --no-split to avoid making files whose
|
||||
# names clash on DOS 8+3 filesystems
|
||||
../info/idlwave: idlwave.texi
|
||||
cd $(srcdir); $(MAKEINFO) --no-split idlwave.texi
|
||||
idlwave.dvi: idlwave.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/idlwave.texi
|
||||
|
||||
../info/eudc: eudc.texi
|
||||
cd $(srcdir); $(MAKEINFO) eudc.texi
|
||||
eudc.dvi: eudc.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/eudc.texi
|
||||
|
||||
../info/ebrowse: ebrowse.texi
|
||||
cd $(srcdir); $(MAKEINFO) ebrowse.texi
|
||||
ebrowse.dvi: ebrowse.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/ebrowse.texi
|
||||
|
||||
../info/woman: woman.texi
|
||||
cd $(srcdir); $(MAKEINFO) woman.texi
|
||||
woman.dvi: woman.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/woman.texi
|
||||
|
||||
../info/org: org.texi
|
||||
cd $(srcdir); $(MAKEINFO) org.texi
|
||||
org.dvi: org.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/org.texi
|
||||
|
||||
../info/url: url.texi
|
||||
cd $(srcdir); $(MAKEINFO) url.texi
|
||||
url.dvi: url.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/url.texi
|
||||
|
||||
../info/speedbar: speedbar.texi
|
||||
cd $(srcdir); $(MAKEINFO) speedbar.texi
|
||||
speedbar.dvi: speedbar.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/speedbar.texi
|
||||
|
||||
../info/tramp: tramp.texi trampver.texi
|
||||
cd $(srcdir); $(MAKEINFO) -D emacs tramp.texi
|
||||
tramp.dvi: tramp.texi trampver.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/tramp.texi
|
||||
|
||||
../info/ses: ses.texi
|
||||
cd $(srcdir); $(MAKEINFO) ses.texi
|
||||
ses.dvi: ses.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/ses.texi
|
||||
|
||||
../info/smtpmail: smtpmail.texi
|
||||
cd $(srcdir); $(MAKEINFO) smtpmail.texi
|
||||
smtpmail.dvi: smtpmail.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/smtpmail.texi
|
||||
|
||||
../info/flymake: flymake.texi
|
||||
cd $(srcdir); $(MAKEINFO) flymake.texi
|
||||
flymake.dvi: flymake.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/flymake.texi
|
||||
|
||||
../info/newsticker: newsticker.texi
|
||||
cd $(srcdir); $(MAKEINFO) newsticker.texi
|
||||
newsticker.dvi: newsticker.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/newsticker.texi
|
||||
|
||||
../info/rcirc: rcirc.texi
|
||||
cd $(srcdir); $(MAKEINFO) rcirc.texi
|
||||
rcirc.dvi: rcirc.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/rcirc.texi
|
||||
|
||||
../info/erc: erc.texi
|
||||
cd $(srcdir); $(MAKEINFO) erc.texi
|
||||
erc.dvi: erc.texi
|
||||
$(ENVADD) $(TEXI2DVI) ${srcdir}/erc.texi
|
||||
|
||||
mostlyclean:
|
||||
rm -f *.log *.cp *.fn *.ky *.pg *.vr core *.tp *.core gnustmp.*
|
||||
|
||||
clean: mostlyclean
|
||||
rm -f *.dvi
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
rm -f *.aux *.cps *.fns *.kys *.pgs *.vrs *.toc
|
||||
for file in $(INFO_TARGETS); do rm -f $${file}*; done
|
||||
|
||||
|
||||
# Formerly this directory had texindex.c and getopt.c in it
|
||||
# and this makefile built them to make texindex.
|
||||
# That caused trouble because this is run entirely in the source directory.
|
||||
# Since we expect to get texi2dvi from elsewhere,
|
||||
# it is ok to expect texindex from elsewhere also.
|
457
man/abbrevs.texi
457
man/abbrevs.texi
|
@ -1,457 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2001, 2002, 2003,
|
||||
@c 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Abbrevs
|
||||
@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 could 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}.
|
||||
|
||||
``Hippie'' expansion generalizes abbreviation expansion.
|
||||
@xref{Hippie Expand, , Hippie Expansion, autotype, Features for
|
||||
Automatic Typing}.
|
||||
|
||||
@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.
|
||||
|
||||
Abbrevs can have @dfn{mode-specific} definitions, 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.
|
||||
|
||||
You can define abbrevs interactively during the editing session. You
|
||||
can also save lists of abbrev definitions in files for use 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 define-global-abbrev @key{RET} @var{abbrev} @key{RET} @var{exp} @key{RET}
|
||||
Define @var{abbrev} as an abbrev expanding into @var{exp}.
|
||||
@item M-x define-mode-abbrev @key{RET} @var{abbrev} @key{RET} @var{exp} @key{RET}
|
||||
Define @var{abbrev} as a mode-specific abbrev expanding into @var{exp}.
|
||||
@item M-x kill-all-abbrevs
|
||||
Discard all abbrev definitions, 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 abbrev text itself is already in the buffer, you can use the
|
||||
commands @kbd{C-x a i g} (@code{inverse-add-global-abbrev}) and
|
||||
@kbd{C-x a i l} (@code{inverse-add-mode-abbrev}) to define it as an
|
||||
abbrev by specify the expansion in the minibuffer. 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).
|
||||
|
||||
@findex define-mode-abbrev
|
||||
@findex define-global-abbrev
|
||||
You can define an abbrev without inserting either the abbrev or its
|
||||
expansion in the buffer using the command @code{define-global-abbrev}.
|
||||
It reads two arguments---the abbrev, and its expansion. The command
|
||||
@code{define-mode-abbrev} does likewise for a mode-specific abbrev.
|
||||
|
||||
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 before replacing it.
|
||||
|
||||
@findex kill-all-abbrevs
|
||||
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. @kbd{M-x kill-all-abbrevs} removes all
|
||||
abbrev definitions, both global and local.
|
||||
|
||||
@node Expanding Abbrevs
|
||||
@section Controlling Abbrev Expansion
|
||||
|
||||
When Abbrev mode is enabled, 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 or whitespace 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} (setting it non-@code{nil} specifies
|
||||
@samp{FIND OUTER OTTER}).
|
||||
|
||||
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 and attach a prefix to the expansion;
|
||||
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, not expanding it.
|
||||
|
||||
@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 any abbrev first 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. With a numeric argument, list
|
||||
only local abbrevs.
|
||||
@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
|
||||
@var{various other tables@dots{}}
|
||||
(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.
|
||||
|
||||
Some abbrevs are marked with @samp{(sys)}. These ``system'' abbrevs
|
||||
(@pxref{Abbrevs,,, elisp, The Emacs Lisp Reference Manual}) are
|
||||
pre-defined by various modes, and are not saved to your abbrev file.
|
||||
To disable a ``system'' abbrev, define an abbrev of the same name that
|
||||
expands to itself, and save it to your abbrev file.
|
||||
|
||||
@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. The function @code{quietly-read-abbrev-file} is similar
|
||||
except that it does not display a message in the echo area; you cannot
|
||||
invoke it interactively, and it is used primarily in the @file{.emacs}
|
||||
file. If either of these functions is called with @code{nil} as the
|
||||
argument, it uses the file name specified in the variable
|
||||
@code{abbrev-file-name}, which is by default @code{"~/.abbrev_defs"}.
|
||||
That file is your standard abbrev definition file, and Emacs loads
|
||||
abbrevs from it automatically when it starts up.
|
||||
|
||||
@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}). It saves them in the file specified by
|
||||
@code{abbrev-file-name}. 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 after point,
|
||||
describing all current abbrev definitions; @kbd{M-x define-abbrevs} parses
|
||||
the entire current buffer and defines abbrevs accordingly.
|
||||
|
||||
@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 abbreviations 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
|
||||
away 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}.
|
||||
|
||||
@vindex dabbrev-ignored-buffer-regexps
|
||||
For finer control over which buffers to scan, customize the variable
|
||||
@code{dabbrev-ignored-buffer-regexps}. Its value is a list of regular
|
||||
expressions. If a buffer's name matches any of these regular
|
||||
expressions, dynamic abbrev expansion skips that buffer.
|
||||
|
||||
A negative argument to @kbd{M-/}, as in @kbd{C-u - M-/}, says to
|
||||
search first for expansions after point, then other buffers, and
|
||||
consider expansions before point only as a last resort. If you repeat
|
||||
the @kbd{M-/} to look for another expansion, do not specify an
|
||||
argument. Repeating @kbd{M-/} cycles through 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 additional 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 abbrev. 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 it is @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 dynamic abbrev you are expanding}, 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 dynamic abbrev. If it is @code{t},
|
||||
the dynamic abbrev's case pattern is preserved in most cases; if it is
|
||||
@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 dynamic 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: dynamic abbrevs 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 abbrev expansion 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 abbrev expression should ignore.
|
||||
|
||||
@ignore
|
||||
arch-tag: 638e0079-9540-48ec-9166-414083e16445
|
||||
@end ignore
|
1574
man/ack.texi
1574
man/ack.texi
File diff suppressed because it is too large
Load diff
1410
man/ada-mode.texi
1410
man/ada-mode.texi
File diff suppressed because it is too large
Load diff
306
man/anti.texi
306
man/anti.texi
|
@ -1,306 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
|
||||
@node Antinews, Mac OS, X Resources, Top
|
||||
@appendix Emacs 21 Antinews
|
||||
|
||||
For those users who live backwards in time, here is information about
|
||||
downgrading to Emacs version 21.4. We hope you will enjoy the greater
|
||||
simplicity that results from the absence of many Emacs @value{EMACSVER}
|
||||
features.
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
The buffer position and line number are now displayed at the end of
|
||||
the mode line, where they can be more easily seen.
|
||||
|
||||
@item
|
||||
The mode line of the selected window is no longer displayed with a
|
||||
special face. All mode lines are created equal. Meanwhile, you can
|
||||
use the variable @code{mode-line-inverse-video} to control whether
|
||||
mode lines are highlighted at all---@code{nil} means don't highlight
|
||||
them.
|
||||
|
||||
@item
|
||||
Clicking on a link with the left mouse button (@kbd{mouse-1}) will
|
||||
always set point at the position clicked, instead of following the
|
||||
link. If you want to follow the link, use the middle mouse button
|
||||
(@kbd{mouse-2}).
|
||||
|
||||
@item
|
||||
Emacs is tired of X droppings. If you drop a file or a piece of text
|
||||
onto an Emacs window, nothing will happen.
|
||||
|
||||
@item
|
||||
On an xterm, even if you enable Xterm Mouse mode, Emacs provides a
|
||||
more convincing simulation of a text terminal by not responding to
|
||||
mouse clicks on the mode line, header line, or display margin.
|
||||
|
||||
@item
|
||||
For simplicity, windows always have fringes. We wouldn't want to
|
||||
in-fringe anyone's windows. Likewise, horizontal scrolling always
|
||||
works in the same automatic way.
|
||||
|
||||
@item
|
||||
The horizontal-bar cursor shape has been removed.
|
||||
|
||||
@item
|
||||
If command line arguments are given, Emacs will not display a splash
|
||||
screen, so that you can immediately get on with your editing. The
|
||||
command-line option @samp{--no-splash} is therefore obsolete, and has
|
||||
been removed.
|
||||
|
||||
@item
|
||||
These command line options have also been removed: @samp{--color},
|
||||
@samp{--fullwidth}, @samp{--fullheight}, @samp{--fullscreen},
|
||||
@samp{--no-blinking-cursor}, @samp{--no-desktop}, and @samp{-Q}.
|
||||
|
||||
@item
|
||||
The @samp{--geometry} option applies only to the initial frame, and
|
||||
the @samp{-f} option will not read arguments for interactive
|
||||
functions.
|
||||
|
||||
@item
|
||||
We have standardized on one location for the user init file: the file
|
||||
named @file{.emacs} in your home directory. Emacs will not look for
|
||||
the init file in @file{~/.emacs.d/init.el}. Similarly, don't try
|
||||
putting @file{.emacs_SHELL} as @file{init_SHELL.sh} in
|
||||
@file{~/.emacs.d}; Emacs won't find it.
|
||||
|
||||
@item
|
||||
Emacs will not read @file{~/.abbrev_defs} automatically. If you want
|
||||
to load abbrev definitions from a file, you must always do so
|
||||
explicitly.
|
||||
|
||||
@item
|
||||
When you are logged in as root, all files now give you writable
|
||||
buffers, reflecting the fact that you can write any files.
|
||||
|
||||
@item
|
||||
The maximum size of buffers and integer variables has been halved. On
|
||||
32-bit machines, the maximum buffer size is now 128 megabytes.
|
||||
|
||||
@item
|
||||
An unquoted @samp{$} in a file name is now an error, if the following
|
||||
name is not recognized as an environment variable. Thus,
|
||||
the file name @file{foo$bar} would probably be an error. Meanwhile,
|
||||
the @code{setenv} command does not expand @samp{$} at all.
|
||||
|
||||
@item
|
||||
If a single command accumulates too much undo information, Emacs never
|
||||
discards it. If Emacs runs out of memory as a result, it will handle
|
||||
this by crashing.
|
||||
|
||||
@item
|
||||
Many commands have been removed from the menus or rearranged.
|
||||
|
||||
@item
|
||||
The @kbd{C-h} (help) subcommands have been rearranged---especially
|
||||
those that display specific files. Type @kbd{C-h C-h} to see a list
|
||||
of these commands; that will show you what is different.
|
||||
|
||||
@item
|
||||
The @kbd{C-h v} and @kbd{C-h f} commands no longer show a hyperlink to
|
||||
the C source code, even if it is available. If you want to find the
|
||||
source code, grep for it.
|
||||
|
||||
@item
|
||||
The apropos commands will not accept a list of words to match, in
|
||||
order to encourage you to be more specific. Also, the user option
|
||||
@code{apropos-sort-by-scores} has been removed.
|
||||
|
||||
@item
|
||||
The minibuffer prompt is now displayed using the default face.
|
||||
The colon is enough to show you what part is the prompt.
|
||||
|
||||
@item
|
||||
Minibuffer completion commands always complete the entire minibuffer
|
||||
contents, just as if you had typed them at the end of the minibuffer,
|
||||
no matter where point is actually located.
|
||||
|
||||
@item
|
||||
The command @code{backward-kill-sexp} is now bound to @kbd{C-M-delete}
|
||||
and @kbd{C-M-backspace}. Be careful when using these key sequences!
|
||||
It may shut down your X server, or reboot your operating system.
|
||||
|
||||
@item
|
||||
Commands to set the mark at a place away from point, including
|
||||
@kbd{M-@@}, @kbd{M-h}, etc., don't do anything special when you repeat
|
||||
them. In most cases, typing these commands multiple times is
|
||||
equivalent to typing them once. @kbd{M-h} ignores numeric arguments.
|
||||
|
||||
@item
|
||||
The user option @code{set-mark-command-repeat-pop} has been removed.
|
||||
|
||||
@item
|
||||
@kbd{C-@key{SPC} C-@key{SPC}} has no special meaning--it just sets the
|
||||
mark twice. Neither does @kbd{C-u C-x C-x}, which simply exchanges
|
||||
point and mark like @kbd{C-x C-x}.
|
||||
|
||||
@item
|
||||
The function @code{sentence-end} has been eliminated in favor of a
|
||||
more straightforward approach: directly setting the variable
|
||||
@code{sentence-end}. For example, to end each sentence with a single
|
||||
space, use
|
||||
|
||||
@lisp
|
||||
(setq sentence-end "[.?!][]\"')@}]*\\($\\|[ \t]\\)[ \t\n]*")
|
||||
@end lisp
|
||||
|
||||
@item
|
||||
The variable @code{fill-nobreak-predicate} is no longer customizable,
|
||||
and it can only hold a single function.
|
||||
|
||||
@item
|
||||
Nobreak spaces and hyphens are displayed just like normal characters,
|
||||
and the user option @code{nobreak-char-display} has been removed.
|
||||
|
||||
@item
|
||||
@kbd{C-w} in an incremental search always grabs an entire word
|
||||
into the search string. More precisely, it grabs text through
|
||||
the next end of a word.
|
||||
|
||||
@item
|
||||
Yanking now preserves all text properties that were in the killed
|
||||
text. The variable @code{yank-excluded-properties} has been removed.
|
||||
|
||||
@item
|
||||
Occur mode, Info mode, and Comint-derived modes now control
|
||||
fontification in their own way, and @kbd{M-x font-lock-mode} has
|
||||
nothing to do with it. To control fontification in Info mode, use the
|
||||
variable @code{Info-fontify}.
|
||||
|
||||
@item
|
||||
@samp{M-x shell} is now completely standard in regard to scrolling
|
||||
behavior. It no longer has the option of scrolling the input line to
|
||||
the bottom of the window the way a text terminal running a shell does.
|
||||
|
||||
@item
|
||||
The Grep package has been merged with Compilation mode. Many
|
||||
grep-specific commands and user options have thus been eliminated.
|
||||
Also, @kbd{M-x grep} never tries the GNU grep @samp{-H} option,
|
||||
and instead silently appends @file{/dev/null} to the command line.
|
||||
|
||||
@item
|
||||
In Dired's @kbd{!} command, @samp{*} and @samp{?} now
|
||||
cause substitution of the file names wherever they appear---not
|
||||
only when they are surrounded by whitespace.
|
||||
|
||||
@item
|
||||
When a file is managed with version control, the command @kbd{C-x C-q}
|
||||
(whose general meaning is to make a buffer read-only or writable) now
|
||||
does so by checking the file in or out. Checking the file out makes
|
||||
the buffer writable; checking it in makes the buffer read-only.
|
||||
|
||||
You can still use @kbd{C-x v v} to do these operations if you wish;
|
||||
its meaning is unchanged. If you want to control the buffer's
|
||||
read-only flag without performing any version control operation,
|
||||
use @kbd{M-x toggle-read-only}.
|
||||
|
||||
@item
|
||||
SGML mode does not handle XML syntax, and does not have indentation
|
||||
support.
|
||||
|
||||
@item
|
||||
Many Info mode commands have been removed. Incremental search in Info
|
||||
searches only the current node.
|
||||
|
||||
@item
|
||||
Many @code{etags} features for customizing parsing using regexps
|
||||
have been removed.
|
||||
|
||||
@item
|
||||
The Emacs server now runs a small C program called @file{emacsserver},
|
||||
rather than trying to handle everything in Emacs Lisp. Now there can
|
||||
only be one Emacs server running at a time. The @code{server-mode}
|
||||
command and @code{server-name} user option have been eliminated.
|
||||
|
||||
@item
|
||||
The @file{emacsclient} program no longer accepts the @samp{--eval},
|
||||
@samp{--display} and @samp{--server-file} command line options, and
|
||||
can only establish local connections using Unix domain sockets.
|
||||
|
||||
@item
|
||||
The command @code{quail-show-key}, for showing how to input a
|
||||
character, has been removed.
|
||||
|
||||
@item
|
||||
The default value of @code{keyboard-coding-system} is always
|
||||
@code{nil}, regardless of your locale settings. If you want some
|
||||
other value, set it yourself.
|
||||
|
||||
@item
|
||||
Unicode support and unification between Latin-@var{n} character sets
|
||||
have been removed. Cutting and pasting X selections does not support
|
||||
``extended segments'', so there are certain coding systems it cannot
|
||||
handle.
|
||||
|
||||
@item
|
||||
The input methods for Emacs are included in a separate distribution
|
||||
called ``Leim.'' To use this, you must extract the Leim tar file on
|
||||
top of the Emacs distribution, into the same directory, before you
|
||||
build Emacs.
|
||||
|
||||
@item
|
||||
The following input methods have been eliminated: belarusian,
|
||||
bulgarian-bds, bulgarian-phonetic, chinese-sisheng, croatian, dutch,
|
||||
georgian, latin-alt-postfix, latin-postfix, latin-prefix,
|
||||
latvian-keyboard, lithuanian-numeric, lithuanian-keyboard,
|
||||
malayalam-inscript, rfc1345, russian-computer, sgml, slovenian,
|
||||
tamil-inscript ucs, ukrainian-computer, vietnamese-telex, and welsh.
|
||||
|
||||
@item
|
||||
The following language environments have been eliminated: Belarusian,
|
||||
Bulgarian, Chinese-EUC-TW, Croatian, French, Georgian, Italian,
|
||||
Latin-6, Latin-7, Latvian, Lithuanian, Malayalam, Russian, Russian,
|
||||
Slovenian, Swedish, Tajik, Tamil, UTF-8, Ukrainian, Ukrainian, Welsh,
|
||||
and Windows-1255.
|
||||
|
||||
@item
|
||||
The @code{code-pages} library, which contained various 8-bit coding
|
||||
systems, has been removed.
|
||||
|
||||
@item
|
||||
The Kmacro package has been replaced with a simple and elegant
|
||||
keyboard macro system. Use @kbd{C-x (} to start a new keyboard macro,
|
||||
@kbd{C-x )} to end the macro, and @kbd{C-x e} to execute the last
|
||||
macro. Use @kbd{M-x name-last-kbd-macro} to name the most recently
|
||||
defined macro.
|
||||
|
||||
@item
|
||||
Emacs no longer displays your breakpoints in the source buffer, so you
|
||||
have to remember where you left them. It can be difficult to inspect
|
||||
the state of your debugged program from the command line, so Emacs
|
||||
tries to demonstrate this in the GUD buffer.
|
||||
|
||||
@item
|
||||
The Calc, CUA, Ibuffer, Ido, Password, Printing, Reveal,
|
||||
Ruler-mode, SES, Table, Tramp, and URL packages have been removed.
|
||||
The Benchmark, Cfengine, Conf, Dns, Flymake, Python, Thumbs, and
|
||||
Wdired modes have also been removed.
|
||||
|
||||
@item
|
||||
The Emacs Lisp Reference Manual and the Introduction to Programming in
|
||||
Emacs Lisp are now distributed separately, not in the Emacs
|
||||
distribution.
|
||||
|
||||
@item
|
||||
On MS Windows, there is no longer any support for tooltips, images,
|
||||
sound, different mouse pointer shapes, or pointing devices with more
|
||||
than 3 buttons. If you want these features, consider switching to
|
||||
another operating system. But even if you don't want these features,
|
||||
you should still switch---for freedom's sake.
|
||||
|
||||
@item
|
||||
Emacs will not use Unicode for clipboard operations on MS Windows.
|
||||
|
||||
@item
|
||||
To keep up with decreasing computer memory capacity and disk space, many
|
||||
other functions and files have been eliminated in Emacs 21.4.
|
||||
@end itemize
|
||||
|
||||
@ignore
|
||||
arch-tag: 32932bd9-46f5-41b2-8a0e-fb0cc4caeb29
|
||||
@end ignore
|
|
@ -1,191 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@c
|
||||
@c This file is included either in emacs-xtra.texi (when producing the
|
||||
@c printed version) or in the main Emacs manual (for the on-line version).
|
||||
@node Autorevert
|
||||
@section Auto Reverting non-file Buffers
|
||||
|
||||
Normally Global Auto Revert Mode only reverts file buffers. There are
|
||||
two ways to auto-revert certain non-file buffers: enabling Auto Revert
|
||||
Mode in those buffers (using @kbd{M-x auto-revert-mode}) and setting
|
||||
@code{global-auto-revert-non-file-buffers} to @code{t}. The latter
|
||||
enables Auto Reverting for all types of buffers for which it is
|
||||
implemented, that is, for the types of buffers listed in the menu
|
||||
below.
|
||||
|
||||
Like file buffers, non-file buffers should normally not revert while
|
||||
you are working on them, or while they contain information that might
|
||||
get lost after reverting. Therefore, they do not revert if they are
|
||||
``modified''. This can get tricky, because deciding when a non-file
|
||||
buffer should be marked modified is usually more difficult than for
|
||||
file buffers.
|
||||
|
||||
Another tricky detail is that, for efficiency reasons, Auto Revert
|
||||
often does not try to detect all possible changes in the buffer, only
|
||||
changes that are ``major'' or easy to detect. Hence, enabling
|
||||
auto-reverting for a non-file buffer does not always guarantee that
|
||||
all information in the buffer is up to date and does not necessarily
|
||||
make manual reverts useless.
|
||||
|
||||
At the other extreme, certain buffers automatically auto-revert every
|
||||
@code{auto-revert-interval} seconds. (This currently only applies to
|
||||
the Buffer Menu.) In this case, Auto Revert does not print any
|
||||
messages while reverting, even when @code{auto-revert-verbose} is
|
||||
non-@code{nil}.
|
||||
|
||||
The details depend on the particular types of buffers and are
|
||||
explained in the corresponding sections.
|
||||
|
||||
@menu
|
||||
* Auto Reverting the Buffer Menu::
|
||||
* Auto Reverting Dired::
|
||||
* Supporting additional buffers::
|
||||
@end menu
|
||||
|
||||
@node Auto Reverting the Buffer Menu
|
||||
@subsection Auto Reverting the Buffer Menu
|
||||
|
||||
If auto-reverting of non-file buffers is enabled, the Buffer Menu
|
||||
automatically reverts every @code{auto-revert-interval} seconds,
|
||||
whether there is a need for it or not. (It would probably take longer
|
||||
to check whether there is a need than to actually revert.)
|
||||
|
||||
If the Buffer Menu inappropriately gets marked modified, just revert
|
||||
it manually using @kbd{g} and auto-reverting will resume. However, if
|
||||
you marked certain buffers to get deleted or to be displayed, you have
|
||||
to be careful, because reverting erases all marks. The fact that
|
||||
adding marks sets the buffer's modified flag prevents Auto Revert from
|
||||
automatically erasing the marks.
|
||||
|
||||
@node Auto Reverting Dired
|
||||
@subsection Auto Reverting Dired buffers
|
||||
|
||||
Auto-reverting Dired buffers currently works on GNU or Unix style
|
||||
operating systems. It may not work satisfactorily on some other
|
||||
systems.
|
||||
|
||||
Dired buffers only auto-revert when the file list of the buffer's main
|
||||
directory changes. They do not auto-revert when information about a
|
||||
particular file changes or when inserted subdirectories change. To be
|
||||
sure that @emph{all} listed information is up to date, you have to
|
||||
manually revert using @kbd{g}, @emph{even} if auto-reverting is
|
||||
enabled in the Dired buffer. Sometimes, you might get the impression
|
||||
that modifying or saving files listed in the main directory actually
|
||||
does cause auto-reverting. This is because making changes to a file,
|
||||
or saving it, very often causes changes in the directory itself, for
|
||||
instance, through backup files or auto-save files. However, this is
|
||||
not guaranteed.
|
||||
|
||||
If the Dired buffer is marked modified and there are no changes you
|
||||
want to protect, then most of the time you can make auto-reverting
|
||||
resume by manually reverting the buffer using @kbd{g}. There is one
|
||||
exception. If you flag or mark files, you can safely revert the
|
||||
buffer. This will not erase the flags or marks (unless the marked
|
||||
file has been deleted, of course). However, the buffer will stay
|
||||
modified, even after reverting, and auto-reverting will not resume.
|
||||
This is because, if you flag or mark files, you may be working on the
|
||||
buffer and you might not want the buffer to change without warning.
|
||||
If you want auto-reverting to resume in the presence of marks and
|
||||
flags, mark the buffer non-modified using @kbd{M-~}. However, adding,
|
||||
deleting or changing marks or flags will mark it modified again.
|
||||
|
||||
Remote Dired buffers are not auto-reverted. Neither are Dired buffers
|
||||
for which you used shell wildcards or file arguments to list only some
|
||||
of the files. @samp{*Find*} and @samp{*Locate*} buffers do not
|
||||
auto-revert either.
|
||||
|
||||
@node Supporting additional buffers
|
||||
@subsection Adding Support for Auto-Reverting additional Buffers.
|
||||
|
||||
This section is intended for Elisp programmers who would like to add
|
||||
support for auto-reverting new types of buffers.
|
||||
|
||||
To support auto-reverting the buffer must first of all have a
|
||||
@code{revert-buffer-function}. @xref{Definition of
|
||||
revert-buffer-function,, Reverting, elisp, the Emacs Lisp Reference Manual}.
|
||||
|
||||
In addition, it @emph{must} have a @code{buffer-stale-function}.
|
||||
|
||||
@defvar buffer-stale-function
|
||||
The value of this variable is a function to check whether a non-file
|
||||
buffer needs reverting. This should be a function with one optional
|
||||
argument @var{noconfirm}. The function should return non-@code{nil}
|
||||
if the buffer should be reverted. The buffer is current when this
|
||||
function is called.
|
||||
|
||||
While this function is mainly intended for use in auto-reverting, it
|
||||
could be used for other purposes as well. For instance, if
|
||||
auto-reverting is not enabled, it could be used to warn the user that
|
||||
the buffer needs reverting. The idea behind the @var{noconfirm}
|
||||
argument is that it should be @code{t} if the buffer is going to be
|
||||
reverted without asking the user and @code{nil} if the function is
|
||||
just going to be used to warn the user that the buffer is out of date.
|
||||
In particular, for use in auto-reverting, @var{noconfirm} is @code{t}.
|
||||
If the function is only going to be used for auto-reverting, you can
|
||||
ignore the @var{noconfirm} argument.
|
||||
|
||||
If you just want to automatically auto-revert every
|
||||
@code{auto-revert-interval} seconds, use:
|
||||
|
||||
@example
|
||||
(set (make-local-variable 'buffer-stale-function)
|
||||
#'(lambda (&optional noconfirm) 'fast))
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
in the buffer's mode function.
|
||||
|
||||
The special return value @samp{fast} tells the caller that the need
|
||||
for reverting was not checked, but that reverting the buffer is fast.
|
||||
It also tells Auto Revert not to print any revert messages, even if
|
||||
@code{auto-revert-verbose} is non-@code{nil}. This is important, as
|
||||
getting revert messages every @code{auto-revert-interval} seconds can
|
||||
be very annoying. The information provided by this return value could
|
||||
also be useful if the function is consulted for purposes other than
|
||||
auto-reverting.
|
||||
@end defvar
|
||||
|
||||
Once the buffer has a @code{revert-buffer-function} and a
|
||||
@code{buffer-stale-function}, several problems usually remain.
|
||||
|
||||
The buffer will only auto-revert if it is marked unmodified. Hence,
|
||||
you will have to make sure that various functions mark the buffer
|
||||
modified if and only if either the buffer contains information that
|
||||
might be lost by reverting or there is reason to believe that the user
|
||||
might be inconvenienced by auto-reverting, because he is actively
|
||||
working on the buffer. The user can always override this by manually
|
||||
adjusting the modified status of the buffer. To support this, calling
|
||||
the @code{revert-buffer-function} on a buffer that is marked
|
||||
unmodified should always keep the buffer marked unmodified.
|
||||
|
||||
It is important to assure that point does not continuously jump around
|
||||
as a consequence of auto-reverting. Of course, moving point might be
|
||||
inevitable if the buffer radically changes.
|
||||
|
||||
You should make sure that the @code{revert-buffer-function} does not
|
||||
print messages that unnecessarily duplicate Auto Revert's own messages
|
||||
if @code{auto-revert-verbose} is @code{t} and effectively override a
|
||||
@code{nil} value for @code{auto-revert-verbose}. Hence, adapting a
|
||||
mode for auto-reverting often involves getting rid of such messages.
|
||||
This is especially important for buffers that automatically
|
||||
auto-revert every @code{auto-revert-interval} seconds.
|
||||
|
||||
Also, you may want to update the documentation string of
|
||||
@code{global-auto-revert-non-file-buffers}.
|
||||
|
||||
@ifinfo
|
||||
Finally, you should add a node to this chapter's menu. This node
|
||||
@end ifinfo
|
||||
@ifnotinfo
|
||||
Finally, you should add a section to this chapter. This section
|
||||
@end ifnotinfo
|
||||
should at the very least make clear whether enabling auto-reverting
|
||||
for the buffer reliably assures that all information in the buffer is
|
||||
completely up to date (or will be after @code{auto-revert-interval}
|
||||
seconds).
|
||||
|
||||
@ignore
|
||||
arch-tag: 2983e613-a272-45f6-9593-3010ad7f865e
|
||||
@end ignore
|
|
@ -1,676 +0,0 @@
|
|||
\input texinfo
|
||||
@c This is an annex of the Emacs manual.
|
||||
@c Copyright (C) 1994, 1995, 2001, 2002, 2003, 2004,
|
||||
@c 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
@c Author: Daniel.Pfeiffer@Informatik.START.dbp.de, fax (+49 69) 7588-2389
|
||||
@setfilename ../info/autotype
|
||||
@c @node Autotypist, Picture, Abbrevs, Top
|
||||
@c @chapter Features for Automatic Typing
|
||||
@settitle Features for Automatic Typing
|
||||
@c @cindex text
|
||||
@c @cindex selfinserting text
|
||||
@c @cindex autotypist
|
||||
|
||||
@copying
|
||||
Copyright @copyright{} 1994, 1995, 1999, 2001, 2002, 2003, 2004,
|
||||
2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
any later version published by the Free Software Foundation; with the
|
||||
Invariant Sections being ``The GNU Manifesto'', ``Distribution'' and
|
||||
``GNU GENERAL PUBLIC LICENSE'', with the Front-Cover texts being ``A GNU
|
||||
Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
|
||||
license is included in the section entitled ``GNU Free Documentation
|
||||
License'' in the Emacs manual.
|
||||
|
||||
(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
|
||||
this GNU Manual, like GNU software. Copies published by the Free
|
||||
Software Foundation raise funds for GNU development.''
|
||||
|
||||
This document is part of a collection distributed under the GNU Free
|
||||
Documentation License. If you want to distribute this document
|
||||
separately from the collection, you can do so by adding a copy of the
|
||||
license to the document, as described in section 6 of the license.
|
||||
@end quotation
|
||||
@end copying
|
||||
|
||||
@dircategory Emacs
|
||||
@direntry
|
||||
* Autotype: (autotype). Convenient features for text that you enter frequently
|
||||
in Emacs.
|
||||
@end direntry
|
||||
|
||||
@titlepage
|
||||
@sp 10
|
||||
|
||||
@center @titlefont{Autotyping}
|
||||
@sp 2
|
||||
@center @subtitlefont{Convenient features for text that you enter
|
||||
frequently in Emacs}
|
||||
@sp 2
|
||||
@center Daniel Pfeiffer
|
||||
@center additions by Dave Love
|
||||
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
@insertcopying
|
||||
@end titlepage
|
||||
|
||||
@node Top
|
||||
@top Autotyping
|
||||
|
||||
Under certain circumstances you will find yourself typing similar things
|
||||
over and over again. This is especially true of form letters and programming
|
||||
language constructs. Project-specific header comments, flow-control
|
||||
constructs or magic numbers are essentially the same every time. Emacs has
|
||||
various features for doing tedious and repetitive typing chores for you
|
||||
in addition to the Abbrev features (@pxref{(emacs)Abbrevs}).
|
||||
|
||||
One solution is using skeletons, flexible rules that say what to
|
||||
insert, and how to do it. Various programming language modes offer some
|
||||
ready-to-use skeletons, and you can adapt them to suit your needs or
|
||||
taste, or define new ones.
|
||||
|
||||
Another feature is automatic insertion of what you want into empty files,
|
||||
depending on the file-name or the mode as appropriate. You can have a file or
|
||||
a skeleton inserted, or you can call a function. Then there is the
|
||||
possibility to have Un*x interpreter scripts automatically take on a magic
|
||||
number and be executable as soon as they are saved. Or you can have a
|
||||
copyright notice's year updated, if necessary, every time you save a
|
||||
file. Similarly for time stamps in the file.
|
||||
|
||||
URLs can be inserted based on a word at point. Flexible templates can
|
||||
be defined for inserting and navigating between text more generally. A
|
||||
sort of meta-expansion facility can be used to try a set of alternative
|
||||
completions and expansions of text at point.
|
||||
|
||||
@menu
|
||||
* Using Skeletons:: How to insert a skeleton into your text.
|
||||
* Wrapping Skeletons:: Putting existing text within a skeleton.
|
||||
* Skeletons as Abbrevs:: An alternative for issuing skeleton commands.
|
||||
* Skeleton Language:: Making skeleton commands insert what you want.
|
||||
* Inserting Pairs:: Typing one character and getting another
|
||||
after point.
|
||||
* Autoinserting:: Filling up empty files as soon as you visit them.
|
||||
* Copyrights:: Inserting and updating copyrights.
|
||||
* Executables:: Turning interpreter scripts into executables.
|
||||
* Timestamps:: Updating dates and times in modified files.
|
||||
* QuickURL:: Inserting URLs based on text at point.
|
||||
* Tempo:: Flexible template insertion.
|
||||
* Hippie Expand:: Expansion of text trying various methods.
|
||||
|
||||
* GNU Free Documentation License:: The license for this documentation.
|
||||
* Concept Index::
|
||||
* Command Index::
|
||||
* Variable Index::
|
||||
@end menu
|
||||
|
||||
|
||||
|
||||
@node Using Skeletons
|
||||
@chapter Using Skeletons
|
||||
@cindex skeletons
|
||||
@cindex using skeletons
|
||||
|
||||
When you want Emacs to insert a form letter or a typical construct of the
|
||||
programming language you are using, skeletons are a means of accomplishing
|
||||
this. Normally skeletons each have a command of their own, that, when called,
|
||||
will insert the skeleton. These commands can be issued in the usual ways
|
||||
(@pxref{(emacs)Commands}). Modes that offer various skeletons will often
|
||||
bind these to key-sequences on the @kbd{C-c} prefix, as well as having
|
||||
an @cite{Insert} menu and maybe even predefined abbrevs for them
|
||||
(@pxref{Skeletons as Abbrevs}).
|
||||
|
||||
The simplest kind of skeleton will simply insert some text indented
|
||||
according to the major mode and leave the cursor at a likely place in the
|
||||
middle. Interactive skeletons may prompt you for a string that will be part
|
||||
of the inserted text.
|
||||
|
||||
Skeletons may ask for input several times. They even have a looping
|
||||
mechanism in which you will be asked for input as long as you are willing to
|
||||
furnish it. An example would be multiple ``else if'' conditions. You can
|
||||
recognize this situation by a prompt ending in @key{RET}, @kbd{C-g}
|
||||
or @kbd{C-h}. This
|
||||
means that entering an empty string will simply assume that you are finished.
|
||||
Typing quit on the other hand terminates the loop but also the rest of the
|
||||
skeleton, e.g. an ``else'' clause is skipped. Only a syntactically necessary
|
||||
termination still gets inserted.
|
||||
|
||||
|
||||
|
||||
@node Wrapping Skeletons
|
||||
@chapter Wrapping Skeletons Around Existing Text
|
||||
@cindex wrapping skeletons
|
||||
|
||||
Often you will find yourself with some code that for whatever reason
|
||||
suddenly becomes conditional. Or you have written a bit of text and want to
|
||||
put it in the middle of a form letter. Skeletons provide a means for
|
||||
accomplishing this, and can even, in the case of programming languages,
|
||||
reindent the wrapped code for you.
|
||||
|
||||
Skeleton commands take an optional numeric prefix argument
|
||||
(@pxref{(emacs)Arguments}). This is interpreted in two different ways depending
|
||||
on whether the prefix is positive, i.e. forwards oriented or negative,
|
||||
i.e. backwards oriented.
|
||||
|
||||
A positive prefix means to wrap the skeleton around that many
|
||||
following words. This is accomplished by putting the words there where
|
||||
the point is normally left after that skeleton is inserted (@pxref{Using
|
||||
Skeletons}). The point (@pxref{(emacs)Point}) is left at the next
|
||||
interesting spot in the skeleton instead.
|
||||
|
||||
A negative prefix means to do something similar with that many precedingly
|
||||
marked interregions (@pxref{(emacs)Mark}). In the simplest case, if you type
|
||||
@kbd{M--} just before issuing the skeleton command, that will wrap the
|
||||
skeleton around the current region, just like a positive argument would have
|
||||
wrapped it around a number of words.
|
||||
|
||||
Smaller negative arguments will wrap that many interregions into successive
|
||||
interesting spots within the skeleton, again leaving the point at the next one.
|
||||
We speak about interregions rather than regions here, because we treat them in
|
||||
the order they appear in the buffer, which coincides with successive regions
|
||||
only if they were marked in order.
|
||||
|
||||
That is, if you marked in alphabetical order the points A B C [] (where []
|
||||
represents the point) and call a skeleton command with @kbd{M-- 3}, you will
|
||||
wrap the text from A to B into the first interesting spot of the skeleton, the
|
||||
text from B to C into the next one, the text from C to the point into the
|
||||
third one, and leave the point in the fourth one. If there are less marks in
|
||||
the buffer, or if the skeleton defines less interesting points, the surplus is
|
||||
ignored.
|
||||
|
||||
If, on the other hand, you marked in alphabetical order the points [] A C B,
|
||||
and call a skeleton command with @kbd{M-- 3}, you will wrap the text from
|
||||
point to A, then the text from A to C and finally the text from C to B. This
|
||||
is done because the regions overlap and Emacs would be helplessly lost if it
|
||||
tried to follow the order in which you marked these points.
|
||||
|
||||
|
||||
|
||||
@node Skeletons as Abbrevs
|
||||
@chapter Skeletons as Abbrev Expansions
|
||||
@cindex skeletons as abbrevs
|
||||
|
||||
Rather than use a key binding for every skeleton command, you can also
|
||||
define an abbreviation (@pxref{(emacs)Defining Abbrevs}) that will expand
|
||||
(@pxref{(emacs)Expanding Abbrevs}) into the skeleton.
|
||||
|
||||
Say you want @samp{ifst} to be an abbreviation for the C language if
|
||||
statement. You will tell Emacs that @samp{ifst} expands to the empty string
|
||||
and then calls the skeleton command. In Emacs Lisp you can say something like
|
||||
@code{(define-abbrev c-mode-abbrev-table "ifst" "" 'c-if)}. Or you can edit
|
||||
the output from @kbd{M-x list-abbrevs} to make it look like this:
|
||||
|
||||
@example
|
||||
(c-mode-abbrev-table)
|
||||
"if" 0 "" c-if
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
(Some blank lines of no semantic significance, and other abbrev tables,
|
||||
have been omitted.)
|
||||
|
||||
|
||||
|
||||
@node Skeleton Language
|
||||
@chapter Skeleton Language
|
||||
@cindex skeleton language
|
||||
|
||||
@findex skeleton-insert
|
||||
Skeletons are an shorthand extension to the Lisp language, where various
|
||||
atoms directly perform either actions on the current buffer or rudimentary
|
||||
flow control mechanisms. Skeletons are interpreted by the function
|
||||
@code{skeleton-insert}.
|
||||
|
||||
A skeleton is a list starting with an interactor, which is usually a
|
||||
prompt-string, or @code{nil} when not needed, but can also be a Lisp
|
||||
expression for complex read functions or for returning some calculated value.
|
||||
The rest of the list are any number of elements as described in the following
|
||||
table:
|
||||
|
||||
@table @asis
|
||||
@item @code{"@var{string}"}, @code{?@var{c}}, @code{?\@var{c}}
|
||||
@vindex skeleton-transformation
|
||||
Insert string or character. Literal strings and characters are passed through
|
||||
@code{skeleton-transformation} when that is non-@code{nil}.
|
||||
@item @code{?\n}
|
||||
@c ??? something seems very wrong here.
|
||||
Insert a newline and align under current line. Use newline character
|
||||
@code{?\n} to prevent alignment.
|
||||
@item @code{_}
|
||||
Interesting point. When wrapping skeletons around successive regions, they are
|
||||
put at these places. Point is left at first @code{_} where nothing is wrapped.
|
||||
@item @code{>}
|
||||
Indent line according to major mode. When following element is @code{_}, and
|
||||
there is a interregion that will be wrapped here, indent that interregion.
|
||||
@item @code{&}
|
||||
Logical and. Iff preceding element moved point, i.e. usually inserted
|
||||
something, do following element.
|
||||
@item @code{|}
|
||||
Logical xor. Iff preceding element didn't move point, i.e. usually inserted
|
||||
nothing, do following element.
|
||||
@item @code{-@var{number}}
|
||||
Delete preceding number characters. Depends on value of
|
||||
@code{skeleton-untabify}.
|
||||
@item @code{()} or @code{nil}
|
||||
Ignored.
|
||||
@item @var{lisp-expression}
|
||||
Evaluated, and the return value is again interpreted as a skeleton element.
|
||||
@item @code{str}
|
||||
A special variable that, when evaluated the first time, usually prompts
|
||||
for input according to the skeleton's interactor. It is then set to the
|
||||
return value resulting from the interactor. Each subskeleton has its local
|
||||
copy of this variable.
|
||||
@item @code{v1}, @code{v2}
|
||||
Skeleton-local user variables.
|
||||
@item @code{'@var{expression}}
|
||||
Evaluate following Lisp expression for its side-effect, but prevent it from
|
||||
being interpreted as a skeleton element.
|
||||
@item @var{skeleton}
|
||||
Subskeletons are inserted recursively, not once, but as often as the user
|
||||
enters something at the subskeletons interactor. Thus there must be a
|
||||
@code{str} in the subskeleton. They can also be used non-interactively, when
|
||||
prompt is a lisp-expression that returns successive list-elements.
|
||||
@item @code{resume:}
|
||||
Ignored. Execution resumes here if the user quits during skeleton
|
||||
interpretation.
|
||||
@item @code{quit}
|
||||
A constant which is non-@code{nil} when the @code{resume:} section was entered
|
||||
because the user quit.
|
||||
@end table
|
||||
|
||||
@findex skeleton-further-elements
|
||||
Some modes also use other skeleton elements they themselves defined. For
|
||||
example in shell script mode's skeletons you will find @code{<} which does a
|
||||
rigid indentation backwards, or in CC mode's skeletons you find the
|
||||
self-inserting elements @code{@{} and @code{@}}. These are defined by the
|
||||
buffer-local variable @code{skeleton-further-elements} which is a list of
|
||||
variables bound while interpreting a skeleton.
|
||||
|
||||
@findex define-skeleton
|
||||
The macro @code{define-skeleton} defines a command for interpreting a
|
||||
skeleton. The first argument is the command name, the second is a
|
||||
documentation string, and the rest is an interactor and any number of skeleton
|
||||
elements together forming a skeleton. This skeleton is assigned to a variable
|
||||
of the same name as the command and can thus be overridden from your
|
||||
@file{~/.emacs} file (@pxref{(emacs)Init File}).
|
||||
|
||||
|
||||
|
||||
@node Inserting Pairs
|
||||
@chapter Inserting Matching Pairs of Characters
|
||||
@cindex inserting pairs
|
||||
@cindex pairs
|
||||
|
||||
Various characters usually appear in pairs. When, for example, you insert
|
||||
an open parenthesis, no matter whether you are programming or writing prose,
|
||||
you will surely enter a closing one later. By entering both at the same time
|
||||
and leaving the cursor inbetween, Emacs can guarantee you that such
|
||||
parentheses are always balanced. And if you have a non-qwerty keyboard, where
|
||||
typing some of the stranger programming language symbols makes you bend your
|
||||
fingers backwards, this can be quite relieving too.
|
||||
|
||||
@findex skeleton-pair-insert-maybe
|
||||
@vindex skeleton-pair
|
||||
This is done by binding the first key (@pxref{(emacs)Rebinding}) of
|
||||
the pair to @code{skeleton-pair-insert-maybe} instead of
|
||||
@code{self-insert-command}. The ``maybe'' comes from the fact that
|
||||
this at-first surprising behavior is initially turned off. To enable
|
||||
it, you must set @code{skeleton-pair} to some non-@code{nil} value.
|
||||
And even then, a positive argument (@pxref{(emacs)Arguments}) will
|
||||
make this key behave like a self-inserting key
|
||||
(@pxref{(emacs)Inserting Text}).
|
||||
|
||||
@vindex skeleton-pair-on-word
|
||||
While this breaks with the stated intention of always balancing pairs, it
|
||||
turns out that one often doesn't want pairing to occur, when the following
|
||||
character is part of a word. If you want pairing to occur even then, set
|
||||
@code{skeleton-pair-on-word} to some non-@code{nil} value.
|
||||
|
||||
@vindex skeleton-pair-alist
|
||||
Pairing is possible for all visible characters. By default the
|
||||
parenthesis @samp{(}, the square bracket @samp{[}, the brace
|
||||
@samp{@{}, the pointed bracket @samp{<} and the backquote @samp{`} all
|
||||
pair with the symmetrical character. All other characters pair
|
||||
themselves. This behavior can be modified by the variable
|
||||
@code{skeleton-pair-alist}. This is in fact an alist of skeletons
|
||||
(@pxref{Skeleton Language}), with the first part of each sublist
|
||||
matching the typed character. This is the position of the interactor,
|
||||
but since pairs don't need the @code{str} element, this is ignored.
|
||||
|
||||
Some modes have bound the command @code{skeleton-pair-insert-maybe}
|
||||
to relevant keys. These modes also configure the pairs as
|
||||
appropriate. For example, when typing english prose, you'd expect the
|
||||
backquote (@samp{`}) to pair with the quote (@samp{'}), while in Shell
|
||||
script mode it must pair to itself. They can also inhibit pairing in
|
||||
certain contexts. For example an escaped character stands for itself.
|
||||
|
||||
|
||||
|
||||
@node Autoinserting
|
||||
@chapter Autoinserting Text in Empty Files
|
||||
@cindex autoinserting
|
||||
|
||||
@findex auto-insert
|
||||
@kbd{M-x auto-insert} will put some predefined text at the beginning of
|
||||
the buffer. The main application for this function, as its name suggests,
|
||||
is to have it be called automatically every time an empty, and only an
|
||||
empty file is visited. This is accomplished by putting @code{(add-hook
|
||||
'find-file-hook 'auto-insert)} into your @file{~/.emacs} file
|
||||
(@pxref{(emacs)Init File}).
|
||||
|
||||
@vindex auto-insert-alist
|
||||
What gets inserted, if anything, is determined by the variable
|
||||
@code{auto-insert-alist}. The @sc{car}s of this list are each either
|
||||
a mode name, making an element applicable when a buffer is in that
|
||||
mode. Or they can be a string, which is a regexp matched against the
|
||||
buffer's file name. In that way different kinds of files that have
|
||||
the same mode in Emacs can be distinguished. The @sc{car}s may also
|
||||
be cons cells consisting of mode name or regexp as above and an
|
||||
additional descriptive string.
|
||||
|
||||
When a matching element is found, the @sc{cdr} says what to do. It may
|
||||
be a string, which is a file name, whose contents are to be inserted, if
|
||||
that file is found in the directory @code{auto-insert-directory} or under a
|
||||
absolute file name. Or it can be a skeleton (@pxref{Skeleton Language}) to
|
||||
be inserted.
|
||||
|
||||
It can also be a function, which allows doing various things. The function
|
||||
can simply insert some text, indeed, it can be skeleton command (@pxref{Using
|
||||
Skeletons}). It can be a lambda function which will for example conditionally
|
||||
call another function. Or it can even reset the mode for the buffer. If you
|
||||
want to perform several such actions in order, you use a vector, i.e. several
|
||||
of the above elements between square brackets (@samp{[@r{@dots{}}]}).
|
||||
|
||||
By default C and C++ headers insert a definition of a symbol derived from
|
||||
the filename to prevent multiple inclusions. C and C++ sources insert an
|
||||
include of the header. Makefiles insert the file makefile.inc if it exists.
|
||||
|
||||
TeX and bibTeX mode files insert the file tex-insert.tex if it exists, while
|
||||
LaTeX mode files insert a typical @code{\documentclass} frame. Html
|
||||
files insert a skeleton with the usual frame.
|
||||
|
||||
Ada mode files call the Ada header skeleton command. Emacs lisp
|
||||
source files insert the usual header, with a copyright of your
|
||||
environment variable @env{$ORGANIZATION} or else the FSF, and prompt
|
||||
for valid keywords describing the contents. Files in a @file{bin}
|
||||
directory for which Emacs could determine no specialized mode
|
||||
(@pxref{(emacs)Choosing Modes}) are set to Shell script mode.
|
||||
|
||||
@findex define-auto-insert
|
||||
In Lisp (@pxref{(emacs)Init File}) you can use the function
|
||||
@code{define-auto-insert} to add to or modify
|
||||
@code{auto-insert-alist}. See its documentation with @kbd{C-h f
|
||||
define-auto-insert}.
|
||||
|
||||
@vindex auto-insert
|
||||
The variable @code{auto-insert} says what to do when @code{auto-insert} is
|
||||
called non-interactively, e.g. when a newly found file is empty (see above):
|
||||
@table @asis
|
||||
@item @code{nil}
|
||||
Do nothing.
|
||||
@item @code{t}
|
||||
Insert something if possible, i.e. there is a matching entry in
|
||||
@code{auto-insert-alist}.
|
||||
@item other
|
||||
Insert something if possible, but mark as unmodified.
|
||||
@end table
|
||||
|
||||
@vindex auto-insert-query
|
||||
The variable @code{auto-insert-query} controls whether to ask about
|
||||
inserting something. When this is @code{nil}, inserting is only done with
|
||||
@kbd{M-x auto-insert}. When this is @code{function}, you are queried
|
||||
whenever @code{auto-insert} is called as a function, such as when Emacs
|
||||
visits an empty file and you have set the above-mentioned hook. Otherwise
|
||||
you are alway queried.
|
||||
|
||||
@vindex auto-insert-prompt
|
||||
When querying, the variable @code{auto-insert-prompt}'s value is used as a
|
||||
prompt for a y-or-n-type question. If this includes a @samp{%s} construct,
|
||||
that is replaced by what caused the insertion rule to be chosen. This is
|
||||
either a descriptive text, the mode-name of the buffer or the regular
|
||||
expression that matched the filename.
|
||||
|
||||
|
||||
|
||||
@node Copyrights
|
||||
@chapter Inserting and Updating Copyrights
|
||||
@cindex copyrights
|
||||
|
||||
@findex copyright
|
||||
@kbd{M-x copyright} is a skeleton inserting command, that adds a copyright
|
||||
notice at the point. The ``by'' part is taken from your environment variable
|
||||
@env{$ORGANIZATION} or if that isn't set you are prompted for it. If the
|
||||
buffer has a comment syntax (@pxref{(emacs)Comments}), this is inserted as a comment.
|
||||
|
||||
@findex copyright-update
|
||||
@vindex copyright-limit
|
||||
@vindex copyright-current-year
|
||||
@kbd{M-x copyright-update} looks for a copyright notice in the first
|
||||
@code{copyright-limit} characters of the buffer and updates it when necessary.
|
||||
The current year (variable @code{copyright-current-year}) is added to the
|
||||
existing ones, in the same format as the preceding year, i.e. 1994, '94 or 94.
|
||||
If a dash-separated year list up to last year is found, that is extended to
|
||||
current year, else the year is added separated by a comma. Or it replaces
|
||||
them when this is called with a prefix argument. If a header referring to a
|
||||
wrong version of the GNU General Public License (@pxref{(emacs)Copying}) is found,
|
||||
that is updated too.
|
||||
|
||||
An interesting application for this function is to have it be called
|
||||
automatically every time a file is saved. This is accomplished by
|
||||
putting @code{(add-hook 'before-save-hook 'copyright-update)} into
|
||||
your @file{~/.emacs} file (@pxref{(emacs)Init File}). Alternative,
|
||||
you can do @kbd{M-x customize-variable @key{RET} before-save-hook
|
||||
@key{RET}}. @code{copyright-update} is conveniently listed as an
|
||||
option in the customization buffer.
|
||||
|
||||
@vindex copyright-query
|
||||
The variable @code{copyright-query} controls whether to update the
|
||||
copyright or whether to ask about it. When this is @code{nil} updating is
|
||||
only done with @kbd{M-x copyright-update}. When this is @code{function}
|
||||
you are queried whenever @code{copyright-update} is called as a function,
|
||||
such as in the @code{before-save-hook} feature mentioned above. Otherwise
|
||||
you are always queried.
|
||||
|
||||
|
||||
|
||||
@node Executables
|
||||
@chapter Making Interpreter Scripts Executable
|
||||
@cindex executables
|
||||
|
||||
@vindex executable-prefix
|
||||
@vindex executable-chmod
|
||||
Various interpreter modes such as Shell script mode or AWK mode will
|
||||
automatically insert or update the buffer's magic number, a special
|
||||
comment on the first line that makes the @code{exec} systemcall know
|
||||
how to execute the script. To this end the script is automatically
|
||||
made executable upon saving, with @code{executable-chmod} as argument
|
||||
to the system @code{chmod} command. The magic number is prefixed by
|
||||
the value of @code{executable-prefix}.
|
||||
|
||||
@vindex executable-magicless-file-regexp
|
||||
Any file whose name matches @code{executable-magicless-file-regexp} is not
|
||||
furnished with a magic number, nor is it made executable. This is mainly
|
||||
intended for resource files, which are only meant to be read in.
|
||||
|
||||
@vindex executable-insert
|
||||
The variable @code{executable-insert} says what to do when
|
||||
@code{executable-set-magic} is called non-interactively, e.g. when file has no
|
||||
or the wrong magic number:
|
||||
@table @asis
|
||||
@item @code{nil}
|
||||
Do nothing.
|
||||
@item @code{t}
|
||||
Insert or update magic number.
|
||||
@item other
|
||||
Insert or update magic number, but mark as unmodified.
|
||||
@end table
|
||||
|
||||
@findex executable-set-magic
|
||||
@vindex executable-query
|
||||
The variable @code{executable-query} controls whether to ask about
|
||||
inserting or updating the magic number. When this is @code{nil} updating
|
||||
is only done with @kbd{M-x executable-set-magic}. When this is
|
||||
@code{function} you are queried whenever @code{executable-set-magic} is
|
||||
called as a function, such as when Emacs puts a buffer in Shell script
|
||||
mode. Otherwise you are alway queried.
|
||||
|
||||
@findex executable-self-display
|
||||
@kbd{M-x executable-self-display} adds a magic number to the buffer, which
|
||||
will turn it into a self displaying text file, when called as a Un*x command.
|
||||
The ``interpreter'' used is @code{executable-self-display} with argument
|
||||
@samp{+2}.
|
||||
|
||||
@node Timestamps
|
||||
@chapter Maintaining Timestamps in Modified Files
|
||||
@cindex timestamps
|
||||
|
||||
@findex time-stamp
|
||||
@vindex before-save-hook
|
||||
The @code{time-stamp} command can be used to update automatically a
|
||||
template in a file with a new time stamp every time you save the file.
|
||||
Customize the hook @code{before-save-hook} to add the function
|
||||
@code{time-stamp} to arrange this. It you use Custom to do this,
|
||||
then @code{time-stamp} is conveniently listed as an option in the
|
||||
customization buffer.
|
||||
|
||||
@vindex time-stamp-active
|
||||
@vindex time-stamp-format
|
||||
@vindex time-stamp-start
|
||||
The time stamp is updated only if the customizable variable
|
||||
@code{time-stamp-active} is on, which it is by default; the command
|
||||
@code{time-stamp-toggle-active} can be used to toggle it. The format of
|
||||
the time stamp is set by the customizable variable
|
||||
@code{time-stamp-format}.
|
||||
|
||||
@vindex time-stamp-line-limit
|
||||
@vindex time-stamp-end
|
||||
@vindex time-stamp-count
|
||||
@vindex time-stamp-inserts-lines
|
||||
The variables @code{time-stamp-line-limit}, @code{time-stamp-start},
|
||||
@code{time-stamp-end}, @code{time-stamp-count}, and
|
||||
@code{time-stamp-inserts-lines} control finding the template. Do not
|
||||
change these in your init file or you will be incompatible with other
|
||||
people's files. If you must change them, do so only in the local
|
||||
variables section of the file itself.
|
||||
|
||||
Normally the template must appear in the first 8 lines of a file and
|
||||
look like one of the following:
|
||||
|
||||
@example
|
||||
Time-stamp: <>
|
||||
Time-stamp: " "
|
||||
@end example
|
||||
|
||||
The time stamp is written between the brackets or quotes:
|
||||
|
||||
@example
|
||||
Time-stamp: <1998-02-18 10:20:51 gildea>
|
||||
@end example
|
||||
|
||||
@node QuickURL
|
||||
@chapter QuickURL: Inserting URLs Based on Text at Point
|
||||
|
||||
@vindex quickurl-url-file
|
||||
@findex quickurl
|
||||
@cindex URLs
|
||||
@kbd{M-x quickurl} can be used to insert a URL into a buffer based on
|
||||
the text at point. The URLs are stored in an external file defined by
|
||||
the variable @code{quickurl-url-file} as a list of either cons cells of
|
||||
the form @code{(@var{key} . @var{URL})} or
|
||||
lists of the form @code{(@var{key} @var{URL} @var{comment})}. These
|
||||
specify that @kbd{M-x quickurl} should insert @var{URL} if the word
|
||||
@var{key} is at point, for example:
|
||||
|
||||
@example
|
||||
(("FSF" "http://www.fsf.org/" "The Free Software Foundation")
|
||||
("emacs" . "http://www.emacs.org/")
|
||||
("hagbard" "http://www.hagbard.demon.co.uk" "Hagbard's World"))
|
||||
@end example
|
||||
|
||||
@findex quickurl-add-url
|
||||
@findex quickurl-list
|
||||
@kbd{M-x quickurl-add-url} can be used to add a new @var{key}/@var{URL}
|
||||
pair. @kbd{M-x quickurl-list} provides interactive editing of the URL
|
||||
list.
|
||||
|
||||
@node Tempo
|
||||
@chapter Tempo: Flexible Template Insertion
|
||||
|
||||
@cindex templates
|
||||
The Tempo package provides a simple way to define powerful templates, or
|
||||
macros, if you wish. It is mainly intended for, but not limited to,
|
||||
programmers to be used for creating shortcuts for editing
|
||||
certain kinds of documents.
|
||||
|
||||
@findex tempo-backward-mark
|
||||
@findex tempo-forward-mark
|
||||
A template is defined as a list of items to be inserted in the current
|
||||
buffer at point. Some can be simple strings, while others can control
|
||||
formatting or define special points of interest in the inserted text.
|
||||
@kbd{M-x tempo-backward-mark} and @kbd{M-x tempo-forward-mark} can be
|
||||
used to jump between such points.
|
||||
|
||||
More flexible templates can be created by including Lisp symbols, which
|
||||
will be evaluated as variables, or lists, which will be evaluated
|
||||
as Lisp expressions. Automatic completion of specified tags to expanded
|
||||
templates can be provided.
|
||||
|
||||
@findex tempo-define-template
|
||||
See the documentation for @code{tempo-define-template} for the different
|
||||
items that can be used to define a tempo template with a command for
|
||||
inserting it.
|
||||
|
||||
See the commentary in @file{tempo.el} for more information on using the
|
||||
Tempo package.
|
||||
|
||||
@node Hippie Expand
|
||||
@chapter `Hippie' Expansion
|
||||
|
||||
@findex hippie-expand
|
||||
@kindex M-/
|
||||
@vindex hippie-expand-try-functions-list
|
||||
@kbd{M-x hippie-expand} is a single command providing a variety of
|
||||
completions and expansions. Called repeatedly, it tries all possible
|
||||
completions in succession.
|
||||
|
||||
Which ones to try, and in which order, is determined by the contents of
|
||||
the customizable option @code{hippie-expand-try-functions-list}. Much
|
||||
customization of the expansion behavior can be made by changing the
|
||||
order of, removing, or inserting new functions in this list. Given a
|
||||
positive numeric argument, @kbd{M-x hippie-expand} jumps directly that
|
||||
number of functions forward in this list. Given some other argument (a
|
||||
negative argument or just @kbd{C-u}) it undoes the tried completion.
|
||||
|
||||
See the commentary in @file{hippie-exp.el} for more information on the
|
||||
possibilities.
|
||||
|
||||
Typically you would bind @code{hippie-expand} to @kbd{M-/} with
|
||||
@code{dabbrev-expand}, the standard binding of @kbd{M-/}, providing one
|
||||
of the expansion possibilities.
|
||||
|
||||
@node GNU Free Documentation License
|
||||
@appendix GNU Free Documentation License
|
||||
@include doclicense.texi
|
||||
|
||||
@node Concept Index
|
||||
@unnumbered Concept Index
|
||||
@printindex cp
|
||||
|
||||
@node Command Index
|
||||
@unnumbered Command Index
|
||||
@printindex fn
|
||||
|
||||
@node Variable Index
|
||||
@unnumbered Variable Index
|
||||
@printindex vr
|
||||
|
||||
@setchapternewpage odd
|
||||
@contents
|
||||
@bye
|
||||
|
||||
@ignore
|
||||
arch-tag: 54001b27-5ef8-4a9d-a199-905d650fafba
|
||||
@end ignore
|
776
man/basic.texi
776
man/basic.texi
|
@ -1,776 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,
|
||||
@c 2002, 2003, 2004, 2005, 2006, 2007 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
|
||||
Here we explain the basics of how to enter text, make corrections,
|
||||
and save the text in a file. If this material is new to you, we
|
||||
suggest you first run the Emacs learn-by-doing tutorial, by typing
|
||||
@kbd{Control-h t} inside Emacs. (@code{help-with-tutorial}).
|
||||
|
||||
To clear and redisplay the screen, type @kbd{C-l} (@code{recenter}).
|
||||
|
||||
@menu
|
||||
|
||||
* Inserting Text:: Inserting text by simply typing it.
|
||||
* Moving Point:: Moving the cursor to the place where you want to
|
||||
change something.
|
||||
* Erasing:: Deleting and killing text.
|
||||
* Basic 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:: Making and deleting blank lines.
|
||||
* Continuation Lines:: How Emacs displays lines too wide for the screen.
|
||||
* Position Info:: What page, line, row, or column is point on?
|
||||
* Arguments:: Numeric arguments for repeating a command N times.
|
||||
* Repeating:: Repeating the previous command quickly.
|
||||
@end menu
|
||||
|
||||
@node Inserting Text
|
||||
@section Inserting Text
|
||||
|
||||
@cindex insertion
|
||||
@cindex graphic characters
|
||||
Typing printing characters inserts them into the text you are
|
||||
editing. It inserts them into the buffer at the cursor; more
|
||||
precisely, it inserts them at @dfn{point}, but the cursor normally
|
||||
shows where point is. @xref{Point}.
|
||||
|
||||
Insertion moves the cursor forward, and the following text moves
|
||||
forward with the cursor. If the text in the buffer is @samp{FOOBAR},
|
||||
with the cursor before the @samp{B}, and 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 the large key
|
||||
labeled @key{DEL}, @key{BACKSPACE} or @key{DELETE} which is a short
|
||||
distance above the @key{RET} or @key{ENTER} key. Regardless of the
|
||||
label on that key, Emacs thinks of it as @key{DEL}, and that's what we
|
||||
call it in this manual. @key{DEL} is the key you normally use outside
|
||||
Emacs to erase the last character that you typed.
|
||||
|
||||
The @key{DEL} key deletes the character @emph{before} the cursor.
|
||||
As a consequence, the cursor and all the characters after it move
|
||||
backwards. If you type a printing character and then type @key{DEL},
|
||||
they cancel out.
|
||||
|
||||
On most computers, Emacs sets up @key{DEL} automatically. In some
|
||||
cases, especially with text-only terminals, Emacs may guess wrong. If
|
||||
the key that ought to erase the last character doesn't do it in Emacs,
|
||||
see @ref{DEL Does Not Delete}.
|
||||
|
||||
Most PC keyboards have both a @key{BACKSPACE} key a little ways
|
||||
above @key{RET} or @key{ENTER}, and a @key{DELETE} key elsewhere. On
|
||||
these keyboards, Emacs tries to set up @key{BACKSPACE} as @key{DEL}.
|
||||
The @key{DELETE} key deletes ``forwards'' like @kbd{C-d} (see below),
|
||||
which means it deletes the character underneath the cursor (after
|
||||
point).
|
||||
|
||||
@kindex RET
|
||||
@cindex newline
|
||||
To end a line and start typing a new one, type @key{RET}. (This
|
||||
key may be labeled @key{RETURN} or @key{ENTER}, but in Emacs we call
|
||||
it @key{RET}.) This inserts a newline character in the buffer. If
|
||||
point is at the end of the line, this creates a new blank line after
|
||||
it. If point is in the middle of a line, the effect is to split that
|
||||
line. Typing @key{DEL} when the cursor is at the beginning of a line
|
||||
deletes the preceding newline character, thus joining the line with
|
||||
the one before it.
|
||||
|
||||
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 Auto Fill mode and other methods of @dfn{filling}
|
||||
text.
|
||||
|
||||
If you prefer printing characters to replace (overwrite) existing
|
||||
text, rather than shove it to the right, you should enable Overwrite
|
||||
mode, a minor mode. @xref{Minor Modes}.
|
||||
|
||||
@cindex quoting
|
||||
@kindex C-q
|
||||
@findex quoted-insert
|
||||
Only printing characters and @key{SPC} insert themselves in Emacs.
|
||||
Other characters act as editing commands and do not insert themselves.
|
||||
These include control characters, and characters with codes above 200
|
||||
octal. If you need to insert one of these characters in the buffer,
|
||||
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}:
|
||||
|
||||
@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 terminates the sequence and then acts
|
||||
as normal input---thus, @kbd{C-q 1 0 1 B} inserts @samp{AB}.
|
||||
|
||||
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
|
||||
|
||||
@cindex 8-bit character codes
|
||||
@noindent
|
||||
When multibyte characters are enabled, if you specify a code in the
|
||||
range 0200 through 0377 octal, @kbd{C-q} assumes that you intend to
|
||||
use some ISO 8859-@var{n} character set, and converts the specified
|
||||
code to the corresponding Emacs character code. @xref{Enabling
|
||||
Multibyte}. You select @emph{which} of the ISO 8859 character sets to
|
||||
use through 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 tells @kbd{C-q} how many copies of the quoted
|
||||
character to insert (@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 you typed. Some
|
||||
major modes rebind @key{DEL} to other commands.
|
||||
|
||||
@node Moving Point
|
||||
@section Changing the Location of Point
|
||||
|
||||
@cindex arrow keys
|
||||
@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 (it is faster to use these control
|
||||
keys than move your hand over to the arrow keys). 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
|
||||
@kindex LEFT
|
||||
@kindex RIGHT
|
||||
@kindex UP
|
||||
@kindex DOWN
|
||||
@findex move-beginning-of-line
|
||||
@findex move-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{move-beginning-of-line}).
|
||||
@item C-e
|
||||
Move to the end of the line (@code{move-end-of-line}).
|
||||
@item C-f
|
||||
Move forward one character (@code{forward-char}). The right-arrow key
|
||||
does the same thing.
|
||||
@item C-b
|
||||
Move backward one character (@code{backward-char}). The left-arrow
|
||||
key has the same effect.
|
||||
@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 move to the middle of the next. The
|
||||
down-arrow key does the same thing.
|
||||
@item C-p
|
||||
Move up one line, vertically (@code{previous-line}). The up-arrow key
|
||||
has the same effect. This command preserves position within the line,
|
||||
like @kbd{C-n}.
|
||||
@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, counting
|
||||
downward from the top of the window (zero means the top line). A
|
||||
negative argument counts lines up from the bottom (@minus{}1 means 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 C-v
|
||||
@itemx @key{PAGEDOWN}
|
||||
@itemx @key{PRIOR}
|
||||
Scroll the display one screen forward, and move point if necessary to
|
||||
put it on the screen (@code{scroll-up}). This doesn't always move
|
||||
point, but it is commonly used to do so. If your keyboard has a
|
||||
@key{PAGEDOWN} or @key{PRIOR} key, it does the same thing.
|
||||
|
||||
Scrolling commands are described further in @ref{Scrolling}.
|
||||
@item M-v
|
||||
@itemx @key{PAGEUP}
|
||||
@itemx @key{NEXT}
|
||||
Scroll one screen backward, and move point if necessary to put it on
|
||||
the screen (@code{scroll-down}). This doesn't always move point, but
|
||||
it is commonly used to do so. If your keyboard has a @key{PAGEUP} or
|
||||
@key{NEXT} key, it does the same thing.
|
||||
@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-g M-g
|
||||
@itemx M-g g
|
||||
@itemx M-x goto-line
|
||||
Read a number @var{n} and move point to the beginning of line number
|
||||
@var{n}. Line 1 is the beginning of the buffer. If point is on or
|
||||
just after a number in the buffer, and you type @key{RET} with the
|
||||
minibuffer empty, that number is used for @var{n}.
|
||||
@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}). When a
|
||||
semipermanent goal column is in effect, those commands always try to
|
||||
move to this column, or as close as possible to it, after moving
|
||||
vertically. The 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} try to
|
||||
preserve the 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 starting at the end of the 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
|
||||
@kbd{C-n} normally stops at the end of the buffer when you use it on
|
||||
the last line of the buffer. However, if you set the variable
|
||||
@code{next-line-add-newlines} to a non-@code{nil} value, @kbd{C-n} on
|
||||
the last line of a buffer creates an additional line at the end and
|
||||
moves down into it.
|
||||
|
||||
@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 @key{DELETE}
|
||||
@itemx @key{BACKSPACE}
|
||||
One of these keys, whichever is the large key above the @key{RET} or
|
||||
@key{ENTER} key, deletes the character before point---it is @key{DEL}.
|
||||
If @key{BACKSPACE} is @key{DEL}, and your keyboard also has @key{DELETE},
|
||||
then @key{DELETE} deletes forwards, like @kbd{C-d}.
|
||||
@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 that line with the following line.
|
||||
|
||||
To erase a larger amount of text, use the @kbd{C-k} key, which
|
||||
erases (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 with the following line.
|
||||
|
||||
@xref{Killing}, for more flexible ways of killing text.
|
||||
|
||||
@node Basic Undo
|
||||
@section Undoing Changes
|
||||
|
||||
Emacs records a list of changes made in the buffer text, so you can
|
||||
you can undo recent changes, as far as the records go.
|
||||
Usually each editing command makes a separate entry in the undo
|
||||
records, but sometimes an entry covers just part of a command, and
|
||||
very simple commands may be grouped.
|
||||
|
||||
@table @kbd
|
||||
@item C-x u
|
||||
Undo one entry of the undo records---usually, one command worth
|
||||
(@code{undo}).
|
||||
@item C-_
|
||||
@itemx C-/
|
||||
The same.
|
||||
@end table
|
||||
|
||||
The command @kbd{C-x u} (or @kbd{C-_} or @kbd{C-/}) is how you undo.
|
||||
Normally this command undoes the last change, and moves point back to
|
||||
where it was before the change.
|
||||
|
||||
If you repeat @kbd{C-x u} (or its aliases), each repetition undoes
|
||||
another, earlier change, back to the limit of the undo information
|
||||
available. If all recorded changes have already been undone, the undo
|
||||
command displays an error message and does nothing.
|
||||
|
||||
The undo command applies only to changes in the buffer; you can't
|
||||
use it to undo mere cursor motion. 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}).
|
||||
|
||||
@node Basic Files
|
||||
@section Files
|
||||
|
||||
Text that you insert in an Emacs buffer lasts only as long as the
|
||||
Emacs session. 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 use the
|
||||
contents of a file in any way, you must specify the file name. That
|
||||
includes editing the file with Emacs.
|
||||
|
||||
Suppose there is a file named @file{test.emacs} in your home
|
||||
directory. To begin editing this file in Emacs, type
|
||||
|
||||
@example
|
||||
C-x C-f test.emacs @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}).
|
||||
|
||||
Emacs obeys this command by @dfn{visiting} the file: it creates a
|
||||
buffer, it copies the contents of the file into the buffer, and then
|
||||
displays the buffer for editing. 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 copies the altered buffer contents back
|
||||
into the file @file{test.emacs}, making them permanent. Until you
|
||||
save, the changed text exists only inside Emacs, and the file
|
||||
@file{test.emacs} is unaltered.
|
||||
|
||||
To create a file, just visit it 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. Emacs actually creates the file the
|
||||
first time you save this buffer with @kbd{C-x C-s}.
|
||||
|
||||
To learn more about using files in Emacs, see @ref{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 of interest; for
|
||||
example, @kbd{C-h k C-n} tells you 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}.
|
||||
|
||||
@node Blank Lines
|
||||
@section Blank Lines
|
||||
|
||||
@cindex inserting blank lines
|
||||
@cindex deleting blank lines
|
||||
Here are special commands and techniques for inserting and deleting
|
||||
blank lines.
|
||||
|
||||
@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
|
||||
To insert a new line of text before an existing line,
|
||||
type 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 specifying how many blank lines to make.
|
||||
@xref{Arguments}, for how. If you have a fill prefix, the @kbd{C-o}
|
||||
command inserts the fill prefix on the new line, if typed 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
|
||||
lone blank line deletes that one. When point is on a nonblank line,
|
||||
@kbd{C-x C-o} deletes all following blank lines (if any).
|
||||
|
||||
@node Continuation Lines
|
||||
@section Continuation Lines
|
||||
|
||||
@cindex continuation line
|
||||
@cindex wrapping
|
||||
@cindex line wrapping
|
||||
@cindex fringes, and continuation lines
|
||||
When a text line is too long to fit in one screen line, Emacs
|
||||
displays it on two or more screen lines. This is called
|
||||
@dfn{continuation} or @dfn{line wrapping}. On graphical displays,
|
||||
Emacs indicates line wrapping with small bent arrows in the left and
|
||||
right window fringes. On text-only terminals, Emacs displays a
|
||||
@samp{\} character at the right margin of a screen line if it is not
|
||||
the last in its text line. This @samp{\} character says that the
|
||||
following screen line is not really a new text line.
|
||||
|
||||
When line wrapping occurs just before a character that is wider than one
|
||||
column, some columns at the end of the previous screen line may be
|
||||
``empty.'' In this case, Emacs displays additional @samp{\}
|
||||
characters in the ``empty'' columns before the @samp{\}
|
||||
character that indicates continuation.
|
||||
|
||||
Continued lines can be difficult to read, since lines can break in
|
||||
the middle of a word. If you prefer, you can make Emacs insert a
|
||||
newline automatically when a line gets too long, by using Auto Fill
|
||||
mode. Or enable Long Lines mode, which ensures that wrapping only
|
||||
occurs between words. @xref{Filling}.
|
||||
|
||||
@cindex truncation
|
||||
@cindex line truncation, and fringes
|
||||
Emacs can optionally @dfn{truncate} long lines---this means
|
||||
displaying just one screen line worth, and the rest of the long line
|
||||
does not appear at all. @samp{$} in the last column or a small
|
||||
straight arrow in the window's right fringe indicates a truncated
|
||||
line.
|
||||
|
||||
@xref{Line Truncation}, for more about line truncation,
|
||||
and other variables that control 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
|
||||
Display the page number of point, and the line number within that page.
|
||||
@item M-x what-line
|
||||
Display the line number of point in the whole buffer.
|
||||
@item M-x line-number-mode
|
||||
@itemx M-x column-number-mode
|
||||
Toggle automatic display of the current line number or column number.
|
||||
@xref{Optional Mode Line}.
|
||||
@item M-=
|
||||
Display the number of lines in the current region (@code{count-lines-region}).
|
||||
@xref{Mark}, for information about the region.
|
||||
@item C-x =
|
||||
Display the character code of character after point, character position of
|
||||
point, and column of point (@code{what-cursor-position}).
|
||||
@item M-x hl-line-mode
|
||||
Enable or disable highlighting of the current line. @xref{Cursor
|
||||
Display}.
|
||||
@item M-x size-indication-mode
|
||||
Toggle automatic display of the size of the buffer.
|
||||
@xref{Optional Mode Line}.
|
||||
@end table
|
||||
|
||||
@findex what-page
|
||||
@findex what-line
|
||||
@cindex line number commands
|
||||
@cindex location of point
|
||||
@cindex cursor location
|
||||
@cindex point location
|
||||
@kbd{M-x what-line} displays the current line number
|
||||
in the echo area. You can also see the current line number in the
|
||||
mode line; see @ref{Mode Line}; but if you narrow the buffer, 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.
|
||||
|
||||
@kbd{M-x what-page} counts pages from the beginning of the file, and
|
||||
counts lines within the page, showing both numbers in the echo area.
|
||||
@xref{Pages}.
|
||||
|
||||
@kindex M-=
|
||||
@findex count-lines-region
|
||||
Use @kbd{M-=} (@code{count-lines-region}) to displays 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}) shows what
|
||||
cursor's column position, and other information about point and the
|
||||
character after it. It displays a line in the echo area that looks
|
||||
like this:
|
||||
|
||||
@smallexample
|
||||
Char: c (99, #o143, #x63) point=28062 of 36168 (78%) column=53
|
||||
@end smallexample
|
||||
|
||||
The four values after @samp{Char:} describe the character that follows
|
||||
point, first by showing it and then by giving its character code in
|
||||
decimal, octal and hex. For a non-@acronym{ASCII} multibyte character, these are
|
||||
followed by @samp{file} 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{file ...}.
|
||||
|
||||
However, if the character displayed is in the range 0200 through
|
||||
0377 octal, it may actually stand for an invalid UTF-8 byte read from
|
||||
a file. In Emacs, that byte is represented as a sequence of 8-bit
|
||||
characters, but all of them together display as the original invalid
|
||||
byte, in octal code. In this case, @kbd{C-x =} shows @samp{part of
|
||||
display ...} instead of @samp{file}.
|
||||
|
||||
@samp{point=} is followed by the position of point expressed as a
|
||||
character count. The start of the buffer is position 1, one character
|
||||
later is position 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 =} displays
|
||||
additional text describing the currently accessible range. For example, it
|
||||
might display this:
|
||||
|
||||
@smallexample
|
||||
Char: C (67, #o103, #x43) 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=36169 of 36168 (EOB) column=0
|
||||
@end smallexample
|
||||
|
||||
@cindex character set of character at point
|
||||
@cindex font of character at point
|
||||
@cindex text properties at point
|
||||
@cindex face at point
|
||||
@w{@kbd{C-u C-x =}} displays the following additional information about a
|
||||
character.
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
The character set name, and the codes that identify the character
|
||||
within that character set; @acronym{ASCII} characters are identified
|
||||
as belonging to the @code{ascii} character set.
|
||||
|
||||
@item
|
||||
The character's syntax and categories.
|
||||
|
||||
@item
|
||||
The character's encodings, both internally in the buffer, and externally
|
||||
if you were to save the file.
|
||||
|
||||
@item
|
||||
What keys to type to input the character in the current input method
|
||||
(if it supports the character).
|
||||
|
||||
@item
|
||||
If you are running Emacs on a graphical display, the font name and
|
||||
glyph code for the character. If you are running Emacs on a text-only
|
||||
terminal, the code(s) sent to the terminal.
|
||||
|
||||
@item
|
||||
The character's text properties (@pxref{Text Properties,,,
|
||||
elisp, the Emacs Lisp Reference Manual}), including any non-default
|
||||
faces used to display the character, and any overlays containing it
|
||||
(@pxref{Overlays,,, elisp, the same manual}).
|
||||
@end itemize
|
||||
|
||||
Here's an example showing the Latin-1 character A with grave accent,
|
||||
in a buffer whose coding system is @code{iso-latin-1}, whose
|
||||
terminal coding system is @code{iso-latin-1} (so the terminal actually
|
||||
displays the character as @samp{@`A}), and which has font-lock-mode
|
||||
(@pxref{Font Lock}) enabled:
|
||||
|
||||
@smallexample
|
||||
character: @`A (2240, #o4300, #x8c0, U+00C0)
|
||||
charset: latin-iso8859-1
|
||||
(Right-Hand Part of Latin Alphabet 1@dots{}
|
||||
code point: #x40
|
||||
syntax: w which means: word
|
||||
category: l:Latin
|
||||
to input: type "`A" with latin-1-prefix
|
||||
buffer code: #x81 #xC0
|
||||
file code: #xC0 (encoded by coding system iso-latin-1)
|
||||
display: terminal code #xC0
|
||||
|
||||
There are text properties here:
|
||||
fontified t
|
||||
@end smallexample
|
||||
|
||||
@node Arguments
|
||||
@section Numeric Arguments
|
||||
@cindex numeric arguments
|
||||
@cindex prefix arguments
|
||||
@cindex arguments to commands
|
||||
|
||||
In mathematics and computer usage, @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 (labeled @key{ALT} on
|
||||
PC keyboards), 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
|
||||
moves 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 set up an argument for the next command.
|
||||
@kbd{Meta--} without digits normally means @minus{}1. Digits and
|
||||
@kbd{-} modified with Control, or Control and Meta, also specify numeric
|
||||
arguments.
|
||||
|
||||
@kindex C-u
|
||||
@findex universal-argument
|
||||
You can also specify a numeric argument by typing @kbd{C-u}
|
||||
(@code{universal-argument}) followed by the digits. The advantage of
|
||||
@kbd{C-u} is that you can type the digits without modifier keys; thus,
|
||||
@kbd{C-u} works on all terminals. For a negative argument, type a
|
||||
minus sign after @kbd{C-u}. A minus sign without digits normally
|
||||
means @minus{}1.
|
||||
|
||||
@kbd{C-u} alone has the special meaning of
|
||||
``four times'': it multiplies the argument for the next command by
|
||||
four. @kbd{C-u C-u} 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).
|
||||
|
||||
Some commands care whether there is an argument, but ignore its
|
||||
value. For example, the command @kbd{M-q} (@code{fill-paragraph})
|
||||
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}.)
|
||||
|
||||
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 exist to make an individual command
|
||||
more convenient, and they are documented in that command's
|
||||
documentation string.
|
||||
|
||||
You can use a numeric argument before a self-inserting character to
|
||||
insert multiple copies of it. This is straightforward when the
|
||||
character is not 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. You
|
||||
can separate the argument from the digit to insert with 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 these argument before the command, and to
|
||||
distinguish them from minibuffer arguments that come after the
|
||||
command.
|
||||
|
||||
@node Repeating
|
||||
@section Repeating a Command
|
||||
@cindex repeating a command
|
||||
|
||||
Many simple commands, such as those invoked with a single key or
|
||||
with @kbd{M-x @var{command-name} @key{RET}}, can be repeated by
|
||||
invoking them with a numeric argument that serves as a repeat count
|
||||
(@pxref{Arguments}). However, if the command you want to repeat
|
||||
prompts for input, or uses a numeric argument in another way, that
|
||||
method won't work.
|
||||
|
||||
@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.
|
||||
|
||||
@ignore
|
||||
arch-tag: cda8952a-c439-41c1-aecf-4bc0d6482956
|
||||
@end ignore
|
665
man/buffers.texi
665
man/buffers.texi
|
@ -1,665 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,
|
||||
@c 2002, 2003, 2004, 2005, 2006, 2007 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{current}. It is also
|
||||
called the @dfn{selected 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 current buffer (most commands do).
|
||||
|
||||
When Emacs has multiple windows, each window has its own chosen
|
||||
buffer and displays it; at any time, only one of the windows is
|
||||
selected, and its chosen buffer is the current buffer. Each window's
|
||||
mode line normally displays the name of the window's chosen buffer
|
||||
(@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}.
|
||||
|
||||
@cindex buffer size, maximum
|
||||
A buffer's size cannot be larger than some maximum, which is defined
|
||||
by the largest buffer position representable by the @dfn{Emacs integer}
|
||||
data type. This is because Emacs tracks buffer positions using that
|
||||
data type. For 32-bit machines, the largest buffer size is 256
|
||||
megabytes.
|
||||
|
||||
@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.
|
||||
* Buffer Convenience:: Convenience and customization features for
|
||||
buffer handling.
|
||||
@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}).
|
||||
@item C-x @key{LEFT}
|
||||
Select the previous buffer in the list of existing buffers.
|
||||
@item C-x @key{RIGHT}
|
||||
Select the next buffer in the list of existing buffers.
|
||||
@item C-u M-g M-g
|
||||
@itemx C-u M-g g
|
||||
Read a number @var{n} and move to line @var{n} in the most recently
|
||||
selected buffer other than the current buffer.
|
||||
@end table
|
||||
|
||||
@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 to enter the buffer
|
||||
name (@pxref{Completion}). An empty argument to @kbd{C-x b}
|
||||
specifies the buffer that was current most recently among those not
|
||||
now displayed in any window.
|
||||
|
||||
@kindex C-x @key{LEFT}
|
||||
@kindex C-x @key{RIGHT}
|
||||
@findex next-buffer
|
||||
@findex previous-buffer
|
||||
For conveniently switching between a few buffers, use the commands
|
||||
@kbd{C-x @key{LEFT}} and @kbd{C-x @key{RIGHT}}. @kbd{C-x @key{RIGHT}}
|
||||
(@code{previous-buffer}) selects the previous buffer (following the order
|
||||
of most recent selection in the current frame), while @kbd{C-x @key{LEFT}}
|
||||
(@code{next-buffer}) moves through buffers in the reverse direction.
|
||||
|
||||
@kindex C-x 4 b
|
||||
@findex switch-to-buffer-other-window
|
||||
@vindex even-window-heights
|
||||
To select a buffer in a window other than the current one, type
|
||||
@kbd{C-x 4 b @var{bufname} @key{RET}}. This runs the command
|
||||
@code{switch-to-buffer-other-window} which displays the buffer
|
||||
@var{bufname} in another window. By default, if displaying the buffer
|
||||
causes two vertically adjacent windows to be displayed, the heights of
|
||||
those windows are evened out; to countermand that and preserve the
|
||||
window configuration, set the variable @code{even-window-heights} to
|
||||
@code{nil}.
|
||||
|
||||
@kindex C-x 5 b
|
||||
@findex switch-to-buffer-other-frame
|
||||
Similarly, @kbd{C-x 5 b @var{buffer} @key{RET}} runs the command
|
||||
@code{switch-to-buffer-other-frame} which selects a buffer in another
|
||||
frame.
|
||||
|
||||
@vindex display-buffer-reuse-frames
|
||||
You can control how certain buffers are handled by these commands by
|
||||
customizing the variables @code{special-display-buffer-names},
|
||||
@code{special-display-regexps}, @code{same-window-buffer-names}, and
|
||||
@code{same-window-regexps}. See @ref{Force Same Window}, and
|
||||
@ref{Special Buffer Frames}, for more about these variables. In
|
||||
addition, if the value of @code{display-buffer-reuse-frames} is
|
||||
non-@code{nil}, and the buffer you want to switch to is already
|
||||
displayed in some frame, Emacs will just raise that frame.
|
||||
|
||||
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}.
|
||||
|
||||
@kbd{C-u M-g M-g}, that is @code{goto-line} with a prefix argument
|
||||
of just @kbd{C-u}, reads a number @var{n} using the minibuffer,
|
||||
selects the most recently selected buffer other than the current
|
||||
buffer in another window, and then moves point to the beginning of
|
||||
line number @var{n} in that buffer. This is mainly useful in a buffer
|
||||
that refers to line numbers in another buffer: if point is on or just
|
||||
after a number, @code{goto-line} uses that number as the default for
|
||||
@var{n}. Note that prefix arguments other than just @kbd{C-u} behave
|
||||
differently. @kbd{C-u 4 M-g M-g} goes to line 4 in the @emph{current}
|
||||
buffer, without reading a number from the minibuffer. (Remember that
|
||||
@kbd{M-g M-g} without prefix argument reads a number @var{n} and then
|
||||
moves to line number @var{n} in the current buffer.)
|
||||
|
||||
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 existing buffers, 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{*} in the first field 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{Save Commands}). @samp{%} indicates a
|
||||
read-only buffer. @samp{.} marks the current buffer. Here is an
|
||||
example of a buffer list:@refill
|
||||
|
||||
@smallexample
|
||||
CRM Buffer Size Mode File
|
||||
. * .emacs 3294 Emacs-Lisp ~/.emacs
|
||||
% *Help* 101 Help
|
||||
search.c 86055 C ~/cvs/emacs/src/search.c
|
||||
% src 20959 Dired by name ~/cvs/emacs/src/
|
||||
* *mail* 42 Mail
|
||||
% HELLO 1607 Fundamental ~/cvs/emacs/etc/HELLO
|
||||
% NEWS 481184 Outline ~/cvs/emacs/etc/NEWS
|
||||
*scratch* 191 Lisp Interaction
|
||||
* *Messages* 1554 Fundamental
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
Note that the buffer @samp{*Help*} was made by a help request; it is
|
||||
not visiting any file. The buffer @code{src} was made by Dired on the
|
||||
directory @file{~/cvs/emacs/src/}. You can list only buffers that are
|
||||
visiting files by giving the command a prefix argument, as in
|
||||
@kbd{C-u C-x C-b}.
|
||||
|
||||
@code{list-buffers} omits buffers whose names begin with a space,
|
||||
unless they visit files: such buffers are used internally by Emacs.
|
||||
|
||||
@need 2000
|
||||
@node Misc Buffer
|
||||
@section Miscellaneous Buffer Operations
|
||||
|
||||
@table @kbd
|
||||
@item C-x C-q
|
||||
Toggle read-only status of buffer (@code{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
|
||||
@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.
|
||||
|
||||
@findex toggle-read-only
|
||||
If you wish to make changes in a read-only buffer, use the command
|
||||
@kbd{C-x C-q} (@code{toggle-read-only}). It makes a read-only buffer
|
||||
writable, and makes a writable buffer read-only. 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 you have files under version control, you may find
|
||||
it convenient to bind @kbd{C-x C-q} to @code{vc-toggle-read-only}
|
||||
instead. Then, typing @kbd{C-x C-q} not only changes the read-only
|
||||
flag, but it also checks the file in or out. @xref{Version
|
||||
Control}.
|
||||
|
||||
@findex rename-buffer
|
||||
@kbd{M-x rename-buffer} changes the name of the current buffer. You
|
||||
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.
|
||||
|
||||
@findex rename-uniquely
|
||||
@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. (With some of these features, such as
|
||||
@kbd{M-x compile}, @kbd{M-x grep} an @kbd{M-x info}, you need to
|
||||
switch to some other buffer before using the command, in order for it
|
||||
to make a different buffer.)
|
||||
|
||||
@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}.
|
||||
|
||||
@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:
|
||||
|
||||
@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 becomes current: one that was
|
||||
current in the recent past but is not displayed 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.
|
||||
@item M-x buffer-menu-other-window.
|
||||
Similar, but do it in another window.
|
||||
@end table
|
||||
|
||||
@findex buffer-menu
|
||||
@findex buffer-menu-other-window
|
||||
The command @code{buffer-menu} writes a list of all Emacs
|
||||
buffers@footnote{Buffers which don't visit files and whose names begin
|
||||
with a space are omitted: these are used internally by Emacs.} 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 selected in
|
||||
one, and the previously current buffer (aside from the buffer
|
||||
@samp{*Buffer List*}) displayed 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
|
||||
|
||||
There is also a command that affects the entire buffer list:
|
||||
|
||||
@table @kbd
|
||||
@item T
|
||||
Delete, or reinsert, lines for non-file buffers. This command toggles
|
||||
the inclusion of such buffers in the buffer list.
|
||||
@end table
|
||||
|
||||
What @code{buffer-menu} actually does is create and switch to a
|
||||
suitable buffer, and turn on Buffer Menu mode in it. 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 list in the @samp{*Buffer List*} buffer looks exactly like the
|
||||
buffer list described in @ref{List Buffers}, because they really are
|
||||
the same. 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 the same buffer 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.
|
||||
|
||||
Normally, 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}). You can make this happen regularly
|
||||
every @code{auto-revert-interval} seconds if you enable Auto Revert
|
||||
mode in this buffer, as long as it is not marked modified. Global
|
||||
Auto Revert mode applies to the @samp{*Buffer List*} buffer only if
|
||||
@code{global-auto-revert-non-file-buffers} is non-@code{nil}.
|
||||
@iftex
|
||||
@inforef{Autorevert,, emacs-xtra}, for details.
|
||||
@end iftex
|
||||
@ifnottex
|
||||
@xref{Autorevert, global-auto-revert-non-file-buffers}, for details.
|
||||
@end ifnottex
|
||||
|
||||
|
||||
The command @code{buffer-menu-other-window} works the same as
|
||||
@code{buffer-menu}, except that it displays the buffers list in
|
||||
another window.
|
||||
|
||||
@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 @key{RET} @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}.
|
||||
@findex clone-indirect-buffer
|
||||
@item M-x clone-indirect-buffer @key{RET}
|
||||
Create an indirect buffer that is a twin copy of the current buffer.
|
||||
@item C-x 4 c
|
||||
@kindex C-x 4 c
|
||||
@findex clone-indirect-buffer-other-window
|
||||
Create an indirect buffer that is a twin copy of the current buffer, and
|
||||
select it in another window (@code{clone-indirect-buffer-other-window}).
|
||||
@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}.
|
||||
|
||||
A quick and handy way to make an indirect buffer is with the command
|
||||
@kbd{M-x clone-indirect-buffer}. It creates and selects an indirect
|
||||
buffer whose base buffer is the current buffer. With a numeric
|
||||
argument, it prompts for the name of the indirect buffer; otherwise it
|
||||
uses the name of the current buffer, with a @samp{<@var{n}>} suffix
|
||||
added. @kbd{C-x 4 c} (@code{clone-indirect-buffer-other-window})
|
||||
works like @kbd{M-x clone-indirect-buffer}, but it selects the new
|
||||
buffer in another window.
|
||||
|
||||
The more general way to make an indirect buffer is with the command
|
||||
@kbd{M-x make-indirect-buffer}. It creates an indirect buffer from
|
||||
buffer @var{base-buffer}, under the name @var{indirect-name}. It
|
||||
prompts for both @var{base-buffer} and @var{indirect-name} using the
|
||||
minibuffer.
|
||||
|
||||
@node Buffer Convenience
|
||||
@section Convenience Features and Customization of Buffer Handling
|
||||
|
||||
This section describes several modes and features that make it more
|
||||
convenient to switch between buffers.
|
||||
|
||||
@menu
|
||||
* Uniquify:: Making buffer names unique with directory parts.
|
||||
* Iswitchb:: Switching between buffers with substrings.
|
||||
* Buffer Menus:: Configurable buffer menu.
|
||||
@end menu
|
||||
|
||||
@node Uniquify
|
||||
@subsection Making Buffer Names Unique
|
||||
|
||||
@cindex unique buffer names
|
||||
@cindex directories in buffer names
|
||||
When several buffers visit identically-named files, Emacs must give
|
||||
the buffers distinct names. The usual method for making buffer names
|
||||
unique adds @samp{<2>}, @samp{<3>}, etc. to the end of the buffer
|
||||
names (all but one of them).
|
||||
|
||||
@vindex uniquify-buffer-name-style
|
||||
Other methods work by adding parts of each file's directory to the
|
||||
buffer name. To select one, customize the variable
|
||||
@code{uniquify-buffer-name-style} (@pxref{Easy Customization}).
|
||||
|
||||
To begin with, the @code{forward} naming method includes part of the
|
||||
file's directory name at the beginning of the buffer name; using this
|
||||
method, buffers visiting the files @file{/u/rms/tmp/Makefile} and
|
||||
@file{/usr/projects/zaphod/Makefile} would be named
|
||||
@samp{tmp/Makefile} and @samp{zaphod/Makefile}, respectively (instead
|
||||
of @samp{Makefile} and @samp{Makefile<2>}).
|
||||
|
||||
In contrast, the @code{post-forward} naming method would call the
|
||||
buffers @samp{Makefile|tmp} and @samp{Makefile|zaphod}, and the
|
||||
@code{reverse} naming method would call them @samp{Makefile\tmp} and
|
||||
@samp{Makefile\zaphod}. The nontrivial difference between
|
||||
@code{post-forward} and @code{reverse} occurs when just one directory
|
||||
name is not enough to distinguish two files; then @code{reverse} puts
|
||||
the directory names in reverse order, so that @file{/top/middle/file}
|
||||
becomes @samp{file\middle\top}, while @code{post-forward} puts them in
|
||||
forward order after the file name, as in @samp{file|top/middle}.
|
||||
|
||||
Which rule to follow for putting the directory names in the buffer
|
||||
name is not very important if you are going to @emph{look} at the
|
||||
buffer names before you type one. But as an experienced user, if you
|
||||
know the rule, you won't have to look. And then you may find that one
|
||||
rule or another is easier for you to remember and apply quickly.
|
||||
|
||||
@node Iswitchb
|
||||
@subsection Switching Between Buffers using Substrings
|
||||
|
||||
@findex iswitchb-mode
|
||||
@cindex Iswitchb mode
|
||||
@cindex mode, Iswitchb
|
||||
@kindex C-x b @r{(Iswitchb mode)}
|
||||
@kindex C-x 4 b @r{(Iswitchb mode)}
|
||||
@kindex C-x 5 b @r{(Iswitchb mode)}
|
||||
@kindex C-x 4 C-o @r{(Iswitchb mode)}
|
||||
|
||||
Iswitchb global minor mode provides convenient switching between
|
||||
buffers using substrings of their names. It replaces the normal
|
||||
definitions of @kbd{C-x b}, @kbd{C-x 4 b}, @kbd{C-x 5 b}, and @kbd{C-x
|
||||
4 C-o} with alternative commands that are somewhat ``smarter.''
|
||||
|
||||
When one of these commands prompts you for a buffer name, you can
|
||||
type in just a substring of the name you want to choose. As you enter
|
||||
the substring, Iswitchb mode continuously displays a list of buffers
|
||||
that match the substring you have typed.
|
||||
|
||||
At any time, you can type @key{RET} to select the first buffer in
|
||||
the list. So the way to select a particular buffer is to make it the
|
||||
first in the list. There are two ways to do this. You can type more
|
||||
of the buffer name and thus narrow down the list, excluding unwanted
|
||||
buffers above the desired one. Alternatively, you can use @kbd{C-s}
|
||||
and @kbd{C-r} to rotate the list until the desired buffer is first.
|
||||
|
||||
@key{TAB} while entering the buffer name performs completion on the
|
||||
string you have entered, based on the displayed list of buffers.
|
||||
|
||||
To enable Iswitchb mode, type @kbd{M-x iswitchb-mode}, or customize
|
||||
the variable @code{iswitchb-mode} to @code{t} (@pxref{Easy
|
||||
Customization}).
|
||||
|
||||
@node Buffer Menus
|
||||
@subsection Customizing Buffer Menus
|
||||
|
||||
@findex bs-show
|
||||
@cindex buffer list, customizable
|
||||
@table @kbd
|
||||
@item M-x bs-show
|
||||
Make a list of buffers similarly to @kbd{M-x list-buffers} but
|
||||
customizable.
|
||||
@end table
|
||||
|
||||
@kbd{M-x bs-show} pops up a buffer list similar to the one normally
|
||||
displayed by @kbd{C-x C-b} but which you can customize. If you prefer
|
||||
this to the usual buffer list, you can bind this command to @kbd{C-x
|
||||
C-b}. To customize this buffer list, use the @code{bs} Custom group
|
||||
(@pxref{Easy Customization}).
|
||||
|
||||
@findex msb-mode
|
||||
@cindex mode, MSB
|
||||
@cindex MSB mode
|
||||
@cindex buffer menu
|
||||
@findex mouse-buffer-menu
|
||||
@kindex C-Down-Mouse-1
|
||||
MSB global minor mode (``MSB'' stands for ``mouse select buffer'')
|
||||
provides a different and customizable mouse buffer menu which you may
|
||||
prefer. It replaces the bindings of @code{mouse-buffer-menu},
|
||||
normally on @kbd{C-Down-Mouse-1}, and the menu bar buffer menu. You
|
||||
can customize the menu in the @code{msb} Custom group.
|
||||
|
||||
@ignore
|
||||
arch-tag: 08c43460-f4f4-4b43-9cb5-1ea9ad991695
|
||||
@end ignore
|
1440
man/building.texi
1440
man/building.texi
File diff suppressed because it is too large
Load diff
|
@ -1,838 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@c
|
||||
@c This file is included either in emacs-xtra.texi (when producing the
|
||||
@c printed version) or in the main Emacs manual (for the on-line version).
|
||||
|
||||
@c Moved here from the Emacs Lisp Reference Manual, 2005-03-26.
|
||||
@node Advanced Calendar/Diary Usage
|
||||
@section Customizing the Calendar and Diary
|
||||
|
||||
There are many customizations that you can use to make the calendar and
|
||||
diary suit your personal tastes.
|
||||
|
||||
@menu
|
||||
* Calendar Customizing:: Defaults you can set.
|
||||
* Holiday Customizing:: Defining your own holidays.
|
||||
* Date Display Format:: Changing the format.
|
||||
* Time Display Format:: Changing the format.
|
||||
* Diary Customizing:: Defaults you can set.
|
||||
* Hebrew/Islamic Entries:: How to obtain them.
|
||||
* Fancy Diary Display:: Enhancing the diary display, sorting entries,
|
||||
using included diary files.
|
||||
* Sexp Diary Entries:: Fancy things you can do.
|
||||
@end menu
|
||||
|
||||
@node Calendar Customizing
|
||||
@subsection Customizing the Calendar
|
||||
@vindex calendar-holiday-marker
|
||||
@vindex diary-entry-marker
|
||||
The variable @code{calendar-holiday-marker} specifies how to mark a
|
||||
date as being a holiday. Its value may be a single-character string
|
||||
to insert next to the date, or a face name to use for displaying the
|
||||
date. Likewise, the variable @code{diary-entry-marker} specifies how
|
||||
to mark a date that has diary entries. The calendar creates faces
|
||||
named @code{holiday-face} and @code{diary-face} for these purposes;
|
||||
those symbols are the default values of these variables.
|
||||
|
||||
@vindex calendar-load-hook
|
||||
The variable @code{calendar-load-hook} is a normal hook run when the
|
||||
calendar package is first loaded (before actually starting to display
|
||||
the calendar).
|
||||
|
||||
@vindex initial-calendar-window-hook
|
||||
Starting the calendar runs the normal hook
|
||||
@code{initial-calendar-window-hook}. Recomputation of the calendar
|
||||
display does not run this hook. But if you leave the calendar with the
|
||||
@kbd{q} command and reenter it, the hook runs again.@refill
|
||||
|
||||
@vindex today-visible-calendar-hook
|
||||
The variable @code{today-visible-calendar-hook} is a normal hook run
|
||||
after the calendar buffer has been prepared with the calendar when the
|
||||
current date is visible in the window. One use of this hook is to
|
||||
replace today's date with asterisks; to do that, use the hook function
|
||||
@code{calendar-star-date}.
|
||||
|
||||
@findex calendar-star-date
|
||||
@example
|
||||
(add-hook 'today-visible-calendar-hook 'calendar-star-date)
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
Another standard hook function marks the current date, either by
|
||||
changing its face or by adding an asterisk. Here's how to use it:
|
||||
|
||||
@findex calendar-mark-today
|
||||
@example
|
||||
(add-hook 'today-visible-calendar-hook 'calendar-mark-today)
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
@vindex calendar-today-marker
|
||||
The variable @code{calendar-today-marker} specifies how to mark
|
||||
today's date. Its value should be a single-character string to insert
|
||||
next to the date or a face name to use for displaying the date. A
|
||||
face named @code{calendar-today-face} is provided for this purpose;
|
||||
that symbol is the default for this variable.
|
||||
|
||||
@vindex today-invisible-calendar-hook
|
||||
@noindent
|
||||
A similar normal hook, @code{today-invisible-calendar-hook} is run if
|
||||
the current date is @emph{not} visible in the window.
|
||||
|
||||
@vindex calendar-move-hook
|
||||
Each of the calendar cursor motion commands runs the hook
|
||||
@code{calendar-move-hook} after it moves the cursor.
|
||||
|
||||
@node Holiday Customizing
|
||||
@subsection Customizing the Holidays
|
||||
|
||||
@vindex calendar-holidays
|
||||
@vindex christian-holidays
|
||||
@vindex hebrew-holidays
|
||||
@vindex islamic-holidays
|
||||
Emacs knows about holidays defined by entries on one of several lists.
|
||||
You can customize these lists of holidays to your own needs, adding or
|
||||
deleting holidays. The lists of holidays that Emacs uses are for
|
||||
general holidays (@code{general-holidays}), local holidays
|
||||
(@code{local-holidays}), Christian holidays (@code{christian-holidays}),
|
||||
Hebrew (Jewish) holidays (@code{hebrew-holidays}), Islamic (Muslim)
|
||||
holidays (@code{islamic-holidays}), and other holidays
|
||||
(@code{other-holidays}).
|
||||
|
||||
@vindex general-holidays
|
||||
The general holidays are, by default, holidays common throughout the
|
||||
United States. To eliminate these holidays, set @code{general-holidays}
|
||||
to @code{nil}.
|
||||
|
||||
@vindex local-holidays
|
||||
There are no default local holidays (but sites may supply some). You
|
||||
can set the variable @code{local-holidays} to any list of holidays, as
|
||||
described below.
|
||||
|
||||
@vindex all-christian-calendar-holidays
|
||||
@vindex all-hebrew-calendar-holidays
|
||||
@vindex all-islamic-calendar-holidays
|
||||
By default, Emacs does not include all the holidays of the religions
|
||||
that it knows, only those commonly found in secular calendars. For a
|
||||
more extensive collection of religious holidays, you can set any (or
|
||||
all) of the variables @code{all-christian-calendar-holidays},
|
||||
@code{all-hebrew-calendar-holidays}, or
|
||||
@code{all-islamic-calendar-holidays} to @code{t}. If you want to
|
||||
eliminate the religious holidays, set any or all of the corresponding
|
||||
variables @code{christian-holidays}, @code{hebrew-holidays}, and
|
||||
@code{islamic-holidays} to @code{nil}.@refill
|
||||
|
||||
@vindex other-holidays
|
||||
You can set the variable @code{other-holidays} to any list of
|
||||
holidays. This list, normally empty, is intended for individual use.
|
||||
|
||||
@cindex holiday forms
|
||||
Each of the lists (@code{general-holidays}, @code{local-holidays},
|
||||
@code{christian-holidays}, @code{hebrew-holidays},
|
||||
@code{islamic-holidays}, and @code{other-holidays}) is a list of
|
||||
@dfn{holiday forms}, each holiday form describing a holiday (or
|
||||
sometimes a list of holidays).
|
||||
|
||||
Here is a table of the possible kinds of holiday form. Day numbers
|
||||
and month numbers count starting from 1, but ``dayname'' numbers
|
||||
count Sunday as 0. The element @var{string} is always the
|
||||
name of the holiday, as a string.
|
||||
|
||||
@table @code
|
||||
@item (holiday-fixed @var{month} @var{day} @var{string})
|
||||
A fixed date on the Gregorian calendar.
|
||||
|
||||
@item (holiday-float @var{month} @var{dayname} @var{k} @var{string})
|
||||
The @var{k}th @var{dayname} in @var{month} on the Gregorian calendar
|
||||
(@var{dayname}=0 for Sunday, and so on); negative @var{k} means count back
|
||||
from the end of the month.
|
||||
|
||||
@item (holiday-hebrew @var{month} @var{day} @var{string})
|
||||
A fixed date on the Hebrew calendar.
|
||||
|
||||
@item (holiday-islamic @var{month} @var{day} @var{string})
|
||||
A fixed date on the Islamic calendar.
|
||||
|
||||
@item (holiday-julian @var{month} @var{day} @var{string})
|
||||
A fixed date on the Julian calendar.
|
||||
|
||||
@item (holiday-sexp @var{sexp} @var{string})
|
||||
A date calculated by the Lisp expression @var{sexp}. The expression
|
||||
should use the variable @code{year} to compute and return the date of a
|
||||
holiday, or @code{nil} if the holiday doesn't happen this year. The
|
||||
value of @var{sexp} must represent the date as a list of the form
|
||||
@code{(@var{month} @var{day} @var{year})}.
|
||||
|
||||
@item (if @var{condition} @var{holiday-form})
|
||||
A holiday that happens only if @var{condition} is true.
|
||||
|
||||
@item (@var{function} @r{[}@var{args}@r{]})
|
||||
A list of dates calculated by the function @var{function}, called with
|
||||
arguments @var{args}.
|
||||
@end table
|
||||
|
||||
For example, suppose you want to add Bastille Day, celebrated in
|
||||
France on July 14. You can do this as follows:
|
||||
|
||||
@smallexample
|
||||
(setq other-holidays '((holiday-fixed 7 14 "Bastille Day")))
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
The holiday form @code{(holiday-fixed 7 14 "Bastille Day")} specifies the
|
||||
fourteenth day of the seventh month (July).
|
||||
|
||||
Many holidays occur on a specific day of the week, at a specific time
|
||||
of month. Here is a holiday form describing Hurricane Supplication Day,
|
||||
celebrated in the Virgin Islands on the fourth Monday in August:
|
||||
|
||||
@smallexample
|
||||
(holiday-float 8 1 4 "Hurricane Supplication Day")
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
Here the 8 specifies August, the 1 specifies Monday (Sunday is 0,
|
||||
Tuesday is 2, and so on), and the 4 specifies the fourth occurrence in
|
||||
the month (1 specifies the first occurrence, 2 the second occurrence,
|
||||
@minus{}1 the last occurrence, @minus{}2 the second-to-last occurrence, and
|
||||
so on).
|
||||
|
||||
You can specify holidays that occur on fixed days of the Hebrew,
|
||||
Islamic, and Julian calendars too. For example,
|
||||
|
||||
@smallexample
|
||||
(setq other-holidays
|
||||
'((holiday-hebrew 10 2 "Last day of Hanukkah")
|
||||
(holiday-islamic 3 12 "Mohammed's Birthday")
|
||||
(holiday-julian 4 2 "Jefferson's Birthday")))
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
adds the last day of Hanukkah (since the Hebrew months are numbered with
|
||||
1 starting from Nisan), the Islamic feast celebrating Mohammed's
|
||||
birthday (since the Islamic months are numbered from 1 starting with
|
||||
Muharram), and Thomas Jefferson's birthday, which is 2 April 1743 on the
|
||||
Julian calendar.
|
||||
|
||||
To include a holiday conditionally, use either Emacs Lisp's @code{if} or the
|
||||
@code{holiday-sexp} form. For example, American presidential elections
|
||||
occur on the first Tuesday after the first Monday in November of years
|
||||
divisible by 4:
|
||||
|
||||
@smallexample
|
||||
(holiday-sexp '(if (= 0 (% year 4))
|
||||
(calendar-gregorian-from-absolute
|
||||
(1+ (calendar-dayname-on-or-before
|
||||
1 (+ 6 (calendar-absolute-from-gregorian
|
||||
(list 11 1 year)))))))
|
||||
"US Presidential Election")
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
or
|
||||
|
||||
@smallexample
|
||||
(if (= 0 (% displayed-year 4))
|
||||
(fixed 11
|
||||
(extract-calendar-day
|
||||
(calendar-gregorian-from-absolute
|
||||
(1+ (calendar-dayname-on-or-before
|
||||
1 (+ 6 (calendar-absolute-from-gregorian
|
||||
(list 11 1 displayed-year)))))))
|
||||
"US Presidential Election"))
|
||||
@end smallexample
|
||||
|
||||
Some holidays just don't fit into any of these forms because special
|
||||
calculations are involved in their determination. In such cases you
|
||||
must write a Lisp function to do the calculation. To include eclipses,
|
||||
for example, add @code{(eclipses)} to @code{other-holidays}
|
||||
and write an Emacs Lisp function @code{eclipses} that returns a
|
||||
(possibly empty) list of the relevant Gregorian dates among the range
|
||||
visible in the calendar window, with descriptive strings, like this:
|
||||
|
||||
@smallexample
|
||||
(((6 27 1991) "Lunar Eclipse") ((7 11 1991) "Solar Eclipse") ... )
|
||||
@end smallexample
|
||||
|
||||
@node Date Display Format
|
||||
@subsection Date Display Format
|
||||
@vindex calendar-date-display-form
|
||||
|
||||
You can customize the manner of displaying dates in the diary, in mode
|
||||
lines, and in messages by setting @code{calendar-date-display-form}.
|
||||
This variable holds a list of expressions that can involve the variables
|
||||
@code{month}, @code{day}, and @code{year}, which are all numbers in
|
||||
string form, and @code{monthname} and @code{dayname}, which are both
|
||||
alphabetic strings. In the American style, the default value of this
|
||||
list is as follows:
|
||||
|
||||
@smallexample
|
||||
((if dayname (concat dayname ", ")) monthname " " day ", " year)
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
while in the European style this value is the default:
|
||||
|
||||
@smallexample
|
||||
((if dayname (concat dayname ", ")) day " " monthname " " year)
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
The ISO standard date representation is this:
|
||||
|
||||
@smallexample
|
||||
(year "-" month "-" day)
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
This specifies a typical American format:
|
||||
|
||||
@smallexample
|
||||
(month "/" day "/" (substring year -2))
|
||||
@end smallexample
|
||||
|
||||
@node Time Display Format
|
||||
@subsection Time Display Format
|
||||
@vindex calendar-time-display-form
|
||||
|
||||
The calendar and diary by default display times of day in the
|
||||
conventional American style with the hours from 1 through 12, minutes,
|
||||
and either @samp{am} or @samp{pm}. If you prefer the European style,
|
||||
also known in the US as military, in which the hours go from 00 to 23,
|
||||
you can alter the variable @code{calendar-time-display-form}. This
|
||||
variable is a list of expressions that can involve the variables
|
||||
@code{12-hours}, @code{24-hours}, and @code{minutes}, which are all
|
||||
numbers in string form, and @code{am-pm} and @code{time-zone}, which are
|
||||
both alphabetic strings. The default value of
|
||||
@code{calendar-time-display-form} is as follows:
|
||||
|
||||
@smallexample
|
||||
(12-hours ":" minutes am-pm
|
||||
(if time-zone " (") time-zone (if time-zone ")"))
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
Here is a value that provides European style times:
|
||||
|
||||
@smallexample
|
||||
(24-hours ":" minutes
|
||||
(if time-zone " (") time-zone (if time-zone ")"))
|
||||
@end smallexample
|
||||
|
||||
@node Diary Customizing
|
||||
@subsection Customizing the Diary
|
||||
|
||||
@vindex holidays-in-diary-buffer
|
||||
Ordinarily, the mode line of the diary buffer window indicates any
|
||||
holidays that fall on the date of the diary entries. The process of
|
||||
checking for holidays can take several seconds, so including holiday
|
||||
information delays the display of the diary buffer noticeably. If you'd
|
||||
prefer to have a faster display of the diary buffer but without the
|
||||
holiday information, set the variable @code{holidays-in-diary-buffer} to
|
||||
@code{nil}.@refill
|
||||
|
||||
@vindex number-of-diary-entries
|
||||
The variable @code{number-of-diary-entries} controls the number of
|
||||
days of diary entries to be displayed at one time. It affects the
|
||||
initial display when @code{view-diary-entries-initially} is @code{t}, as
|
||||
well as the command @kbd{M-x diary}. For example, the default value is
|
||||
1, which says to display only the current day's diary entries. If the
|
||||
value is 2, both the current day's and the next day's entries are
|
||||
displayed. The value can also be a vector of seven elements: for
|
||||
example, if the value is @code{[0 2 2 2 2 4 1]} then no diary entries
|
||||
appear on Sunday, the current date's and the next day's diary entries
|
||||
appear Monday through Thursday, Friday through Monday's entries appear
|
||||
on Friday, while on Saturday only that day's entries appear.
|
||||
|
||||
@vindex print-diary-entries-hook
|
||||
@findex print-diary-entries
|
||||
The variable @code{print-diary-entries-hook} is a normal hook run
|
||||
after preparation of a temporary buffer containing just the diary
|
||||
entries currently visible in the diary buffer. (The other, irrelevant
|
||||
diary entries are really absent from the temporary buffer; in the diary
|
||||
buffer, they are merely hidden.) The default value of this hook does
|
||||
the printing with the command @code{lpr-buffer}. If you want to use a
|
||||
different command to do the printing, just change the value of this
|
||||
hook. Other uses might include, for example, rearranging the lines into
|
||||
order by day and time.
|
||||
|
||||
@vindex diary-date-forms
|
||||
You can customize the form of dates in your diary file, if neither the
|
||||
standard American nor European styles suits your needs, by setting the
|
||||
variable @code{diary-date-forms}. This variable is a list of patterns
|
||||
for recognizing a date. Each date pattern is a list whose elements may
|
||||
be regular expressions (@pxref{Regular Expressions,,, elisp, the Emacs
|
||||
Lisp Reference Manual}) or the symbols @code{month}, @code{day},
|
||||
@code{year}, @code{monthname}, and @code{dayname}. All these elements
|
||||
serve as patterns that match certain kinds of text in the diary file.
|
||||
In order for the date pattern, as a whole, to match, all of its elements
|
||||
must match consecutively.
|
||||
|
||||
A regular expression in a date pattern matches in its usual fashion,
|
||||
using the standard syntax table altered so that @samp{*} is a word
|
||||
constituent.
|
||||
|
||||
The symbols @code{month}, @code{day}, @code{year}, @code{monthname},
|
||||
and @code{dayname} match the month number, day number, year number,
|
||||
month name, and day name of the date being considered. The symbols that
|
||||
match numbers allow leading zeros; those that match names allow
|
||||
three-letter abbreviations and capitalization. All the symbols can
|
||||
match @samp{*}; since @samp{*} in a diary entry means ``any day'', ``any
|
||||
month'', and so on, it should match regardless of the date being
|
||||
considered.
|
||||
|
||||
The default value of @code{diary-date-forms} in the American style is
|
||||
this:
|
||||
|
||||
@example
|
||||
((month "/" day "[^/0-9]")
|
||||
(month "/" day "/" year "[^0-9]")
|
||||
(monthname " *" day "[^,0-9]")
|
||||
(monthname " *" day ", *" year "[^0-9]")
|
||||
(dayname "\\W"))
|
||||
@end example
|
||||
|
||||
The date patterns in the list must be @emph{mutually exclusive} and
|
||||
must not match any portion of the diary entry itself, just the date and
|
||||
one character of whitespace. If, to be mutually exclusive, the pattern
|
||||
must match a portion of the diary entry text---beyond the whitespace
|
||||
that ends the date---then the first element of the date pattern
|
||||
@emph{must} be @code{backup}. This causes the date recognizer to back
|
||||
up to the beginning of the current word of the diary entry, after
|
||||
finishing the match. Even if you use @code{backup}, the date pattern
|
||||
must absolutely not match more than a portion of the first word of the
|
||||
diary entry. The default value of @code{diary-date-forms} in the
|
||||
European style is this list:
|
||||
|
||||
@example
|
||||
((day "/" month "[^/0-9]")
|
||||
(day "/" month "/" year "[^0-9]")
|
||||
(backup day " *" monthname "\\W+\\<[^*0-9]")
|
||||
(day " *" monthname " *" year "[^0-9]")
|
||||
(dayname "\\W"))
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
Notice the use of @code{backup} in the third pattern, because it needs
|
||||
to match part of a word beyond the date itself to distinguish it from
|
||||
the fourth pattern.
|
||||
|
||||
@node Hebrew/Islamic Entries
|
||||
@subsection Hebrew- and Islamic-Date Diary Entries
|
||||
|
||||
Your diary file can have entries based on Hebrew or Islamic dates, as
|
||||
well as entries based on the world-standard Gregorian calendar.
|
||||
However, because recognition of such entries is time-consuming and most
|
||||
people don't use them, you must explicitly enable their use. If you
|
||||
want the diary to recognize Hebrew-date diary entries, for example,
|
||||
you must do this:
|
||||
|
||||
@vindex nongregorian-diary-listing-hook
|
||||
@vindex nongregorian-diary-marking-hook
|
||||
@findex list-hebrew-diary-entries
|
||||
@findex mark-hebrew-diary-entries
|
||||
@smallexample
|
||||
(add-hook 'nongregorian-diary-listing-hook 'list-hebrew-diary-entries)
|
||||
(add-hook 'nongregorian-diary-marking-hook 'mark-hebrew-diary-entries)
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
If you want Islamic-date entries, do this:
|
||||
|
||||
@findex list-islamic-diary-entries
|
||||
@findex mark-islamic-diary-entries
|
||||
@smallexample
|
||||
(add-hook 'nongregorian-diary-listing-hook 'list-islamic-diary-entries)
|
||||
(add-hook 'nongregorian-diary-marking-hook 'mark-islamic-diary-entries)
|
||||
@end smallexample
|
||||
|
||||
Hebrew- and Islamic-date diary entries have the same formats as
|
||||
Gregorian-date diary entries, except that @samp{H} precedes a Hebrew
|
||||
date and @samp{I} precedes an Islamic date. Moreover, because the
|
||||
Hebrew and Islamic month names are not uniquely specified by the first
|
||||
three letters, you may not abbreviate them. For example, a diary entry
|
||||
for the Hebrew date Heshvan 25 could look like this:
|
||||
|
||||
@smallexample
|
||||
HHeshvan 25 Happy Hebrew birthday!
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
and would appear in the diary for any date that corresponds to Heshvan 25
|
||||
on the Hebrew calendar. And here is an Islamic-date diary entry that matches
|
||||
Dhu al-Qada 25:
|
||||
|
||||
@smallexample
|
||||
IDhu al-Qada 25 Happy Islamic birthday!
|
||||
@end smallexample
|
||||
|
||||
As with Gregorian-date diary entries, Hebrew- and Islamic-date entries
|
||||
are nonmarking if they are preceded with an ampersand (@samp{&}).
|
||||
|
||||
Here is a table of commands used in the calendar to create diary entries
|
||||
that match the selected date and other dates that are similar in the Hebrew
|
||||
or Islamic calendar:
|
||||
|
||||
@table @kbd
|
||||
@item i h d
|
||||
Add a diary entry for the Hebrew date corresponding to the selected date
|
||||
(@code{insert-hebrew-diary-entry}).
|
||||
@item i h m
|
||||
Add a diary entry for the day of the Hebrew month corresponding to the
|
||||
selected date (@code{insert-monthly-hebrew-diary-entry}). This diary
|
||||
entry matches any date that has the same Hebrew day-within-month as the
|
||||
selected date.
|
||||
@item i h y
|
||||
Add a diary entry for the day of the Hebrew year corresponding to the
|
||||
selected date (@code{insert-yearly-hebrew-diary-entry}). This diary
|
||||
entry matches any date which has the same Hebrew month and day-within-month
|
||||
as the selected date.
|
||||
@item i i d
|
||||
Add a diary entry for the Islamic date corresponding to the selected date
|
||||
(@code{insert-islamic-diary-entry}).
|
||||
@item i i m
|
||||
Add a diary entry for the day of the Islamic month corresponding to the
|
||||
selected date (@code{insert-monthly-islamic-diary-entry}).
|
||||
@item i i y
|
||||
Add a diary entry for the day of the Islamic year corresponding to the
|
||||
selected date (@code{insert-yearly-islamic-diary-entry}).
|
||||
@end table
|
||||
|
||||
@findex insert-hebrew-diary-entry
|
||||
@findex insert-monthly-hebrew-diary-entry
|
||||
@findex insert-yearly-hebrew-diary-entry
|
||||
@findex insert-islamic-diary-entry
|
||||
@findex insert-monthly-islamic-diary-entry
|
||||
@findex insert-yearly-islamic-diary-entry
|
||||
These commands work much like the corresponding commands for ordinary
|
||||
diary entries: they apply to the date that point is on in the calendar
|
||||
window, and what they do is insert just the date portion of a diary entry
|
||||
at the end of your diary file. You must then insert the rest of the
|
||||
diary entry.
|
||||
|
||||
@node Fancy Diary Display
|
||||
@subsection Fancy Diary Display
|
||||
@vindex diary-display-hook
|
||||
@findex simple-diary-display
|
||||
|
||||
Diary display works by preparing the diary buffer and then running the
|
||||
hook @code{diary-display-hook}. The default value of this hook
|
||||
(@code{simple-diary-display}) hides the irrelevant diary entries and
|
||||
then displays the buffer. However, if you specify the hook as follows,
|
||||
|
||||
@cindex diary buffer
|
||||
@findex fancy-diary-display
|
||||
@example
|
||||
(add-hook 'diary-display-hook 'fancy-diary-display)
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
this enables fancy diary display. It displays diary entries and
|
||||
holidays by copying them into a special buffer that exists only for the
|
||||
sake of display. Copying to a separate buffer provides an opportunity
|
||||
to change the displayed text to make it prettier---for example, to sort
|
||||
the entries by the dates they apply to.
|
||||
|
||||
As with simple diary display, you can print a hard copy of the buffer
|
||||
with @code{print-diary-entries}. To print a hard copy of a day-by-day
|
||||
diary for a week, position point on Sunday of that week, type
|
||||
@kbd{7 d}, and then do @kbd{M-x print-diary-entries}. As usual, the
|
||||
inclusion of the holidays slows down the display slightly; you can speed
|
||||
things up by setting the variable @code{holidays-in-diary-buffer} to
|
||||
@code{nil}.
|
||||
|
||||
@vindex diary-list-include-blanks
|
||||
Ordinarily, the fancy diary buffer does not show days for which there are
|
||||
no diary entries, even if that day is a holiday. If you want such days to be
|
||||
shown in the fancy diary buffer, set the variable
|
||||
@code{diary-list-include-blanks} to @code{t}.@refill
|
||||
|
||||
@cindex sorting diary entries
|
||||
If you use the fancy diary display, you can use the normal hook
|
||||
@code{list-diary-entries-hook} to sort each day's diary entries by their
|
||||
time of day. Here's how:
|
||||
|
||||
@findex sort-diary-entries
|
||||
@example
|
||||
(add-hook 'list-diary-entries-hook 'sort-diary-entries t)
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
For each day, this sorts diary entries that begin with a recognizable
|
||||
time of day according to their times. Diary entries without times come
|
||||
first within each day.
|
||||
|
||||
Fancy diary display also has the ability to process included diary
|
||||
files. This permits a group of people to share a diary file for events
|
||||
that apply to all of them. Lines in the diary file of this form:
|
||||
|
||||
@smallexample
|
||||
#include "@var{filename}"
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
includes the diary entries from the file @var{filename} in the fancy
|
||||
diary buffer. The include mechanism is recursive, so that included files
|
||||
can include other files, and so on; you must be careful not to have a
|
||||
cycle of inclusions, of course. Here is how to enable the include
|
||||
facility:
|
||||
|
||||
@vindex list-diary-entries-hook
|
||||
@vindex mark-diary-entries-hook
|
||||
@findex include-other-diary-files
|
||||
@findex mark-included-diary-files
|
||||
@smallexample
|
||||
(add-hook 'list-diary-entries-hook 'include-other-diary-files)
|
||||
(add-hook 'mark-diary-entries-hook 'mark-included-diary-files)
|
||||
@end smallexample
|
||||
|
||||
The include mechanism works only with the fancy diary display, because
|
||||
ordinary diary display shows the entries directly from your diary file.
|
||||
|
||||
@node Sexp Diary Entries
|
||||
@subsection Sexp Entries and the Fancy Diary Display
|
||||
@cindex sexp diary entries
|
||||
|
||||
Sexp diary entries allow you to do more than just have complicated
|
||||
conditions under which a diary entry applies. If you use the fancy
|
||||
diary display, sexp entries can generate the text of the entry depending
|
||||
on the date itself. For example, an anniversary diary entry can insert
|
||||
the number of years since the anniversary date into the text of the
|
||||
diary entry. Thus the @samp{%d} in this diary entry:
|
||||
|
||||
@findex diary-anniversary
|
||||
@smallexample
|
||||
%%(diary-anniversary 10 31 1948) Arthur's birthday (%d years old)
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
gets replaced by the age, so on October 31, 1990 the entry appears in
|
||||
the fancy diary buffer like this:
|
||||
|
||||
@smallexample
|
||||
Arthur's birthday (42 years old)
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
If the diary file instead contains this entry:
|
||||
|
||||
@smallexample
|
||||
%%(diary-anniversary 10 31 1948) Arthur's %d%s birthday
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
the entry in the fancy diary buffer for October 31, 1990 appears like this:
|
||||
|
||||
@smallexample
|
||||
Arthur's 42nd birthday
|
||||
@end smallexample
|
||||
|
||||
Similarly, cyclic diary entries can interpolate the number of repetitions
|
||||
that have occurred:
|
||||
|
||||
@findex diary-cyclic
|
||||
@smallexample
|
||||
%%(diary-cyclic 50 1 1 1990) Renew medication (%d%s time)
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
looks like this:
|
||||
|
||||
@smallexample
|
||||
Renew medication (5th time)
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
in the fancy diary display on September 8, 1990.
|
||||
|
||||
There is an early reminder diary sexp that includes its entry in the
|
||||
diary not only on the date of occurrence, but also on earlier dates.
|
||||
For example, if you want a reminder a week before your anniversary, you
|
||||
can use
|
||||
|
||||
@findex diary-remind
|
||||
@smallexample
|
||||
%%(diary-remind '(diary-anniversary 12 22 1968) 7) Ed's anniversary
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
and the fancy diary will show
|
||||
@smallexample
|
||||
Ed's anniversary
|
||||
@end smallexample
|
||||
@noindent
|
||||
both on December 15 and on December 22.
|
||||
|
||||
@findex diary-date
|
||||
The function @code{diary-date} applies to dates described by a month,
|
||||
day, year combination, each of which can be an integer, a list of
|
||||
integers, or @code{t}. The value @code{t} means all values. For
|
||||
example,
|
||||
|
||||
@smallexample
|
||||
%%(diary-date '(10 11 12) 22 t) Rake leaves
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
causes the fancy diary to show
|
||||
|
||||
@smallexample
|
||||
Rake leaves
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
on October 22, November 22, and December 22 of every year.
|
||||
|
||||
@findex diary-float
|
||||
The function @code{diary-float} allows you to describe diary entries
|
||||
that apply to dates like the third Friday of November, or the last
|
||||
Tuesday in April. The parameters are the @var{month}, @var{dayname},
|
||||
and an index @var{n}. The entry appears on the @var{n}th @var{dayname}
|
||||
of @var{month}, where @var{dayname}=0 means Sunday, 1 means Monday, and
|
||||
so on. If @var{n} is negative it counts backward from the end of
|
||||
@var{month}. The value of @var{month} can be a list of months, a single
|
||||
month, or @code{t} to specify all months. You can also use an optional
|
||||
parameter @var{day} to specify the @var{n}th @var{dayname} of
|
||||
@var{month} on or after/before @var{day}; the value of @var{day} defaults
|
||||
to 1 if @var{n} is positive and to the last day of @var{month} if
|
||||
@var{n} is negative. For example,
|
||||
|
||||
@smallexample
|
||||
%%(diary-float t 1 -1) Pay rent
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
causes the fancy diary to show
|
||||
|
||||
@smallexample
|
||||
Pay rent
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
on the last Monday of every month.
|
||||
|
||||
The generality of sexp diary entries lets you specify any diary
|
||||
entry that you can describe algorithmically. A sexp diary entry
|
||||
contains an expression that computes whether the entry applies to any
|
||||
given date. If its value is non-@code{nil}, the entry applies to that
|
||||
date; otherwise, it does not. The expression can use the variable
|
||||
@code{date} to find the date being considered; its value is a list
|
||||
(@var{month} @var{day} @var{year}) that refers to the Gregorian
|
||||
calendar.
|
||||
|
||||
The sexp diary entry applies to a date when the expression's value
|
||||
is non-@code{nil}, but some values have more specific meanings. If
|
||||
the value is a string, that string is a description of the event which
|
||||
occurs on that date. The value can also have the form
|
||||
@code{(@var{mark} . @var{string})}; then @var{mark} specifies how to
|
||||
mark the date in the calendar, and @var{string} is the description of
|
||||
the event. If @var{mark} is a single-character string, that character
|
||||
appears next to the date in the calendar. If @var{mark} is a face
|
||||
name, the date is displayed in that face. If @var{mark} is
|
||||
@code{nil}, that specifies no particular highlighting for the date.
|
||||
|
||||
Suppose you get paid on the 21st of the month if it is a weekday, and
|
||||
on the Friday before if the 21st is on a weekend. Here is how to write
|
||||
a sexp diary entry that matches those dates:
|
||||
|
||||
@smallexample
|
||||
&%%(let ((dayname (calendar-day-of-week date))
|
||||
(day (car (cdr date))))
|
||||
(or (and (= day 21) (memq dayname '(1 2 3 4 5)))
|
||||
(and (memq day '(19 20)) (= dayname 5)))
|
||||
) Pay check deposited
|
||||
@end smallexample
|
||||
|
||||
The following sexp diary entries take advantage of the ability (in the fancy
|
||||
diary display) to concoct diary entries whose text varies based on the date:
|
||||
|
||||
@findex diary-sunrise-sunset
|
||||
@findex diary-phases-of-moon
|
||||
@findex diary-day-of-year
|
||||
@findex diary-iso-date
|
||||
@findex diary-julian-date
|
||||
@findex diary-astro-day-number
|
||||
@findex diary-hebrew-date
|
||||
@findex diary-islamic-date
|
||||
@findex diary-french-date
|
||||
@findex diary-mayan-date
|
||||
@table @code
|
||||
@item %%(diary-sunrise-sunset)
|
||||
Make a diary entry for the local times of today's sunrise and sunset.
|
||||
@item %%(diary-phases-of-moon)
|
||||
Make a diary entry for the phases (quarters) of the moon.
|
||||
@item %%(diary-day-of-year)
|
||||
Make a diary entry with today's day number in the current year and the number
|
||||
of days remaining in the current year.
|
||||
@item %%(diary-iso-date)
|
||||
Make a diary entry with today's equivalent ISO commercial date.
|
||||
@item %%(diary-julian-date)
|
||||
Make a diary entry with today's equivalent date on the Julian calendar.
|
||||
@item %%(diary-astro-day-number)
|
||||
Make a diary entry with today's equivalent astronomical (Julian) day number.
|
||||
@item %%(diary-hebrew-date)
|
||||
Make a diary entry with today's equivalent date on the Hebrew calendar.
|
||||
@item %%(diary-islamic-date)
|
||||
Make a diary entry with today's equivalent date on the Islamic calendar.
|
||||
@item %%(diary-french-date)
|
||||
Make a diary entry with today's equivalent date on the French Revolutionary
|
||||
calendar.
|
||||
@item %%(diary-mayan-date)
|
||||
Make a diary entry with today's equivalent date on the Mayan calendar.
|
||||
@end table
|
||||
|
||||
@noindent
|
||||
Thus including the diary entry
|
||||
|
||||
@example
|
||||
&%%(diary-hebrew-date)
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
causes every day's diary display to contain the equivalent date on the
|
||||
Hebrew calendar, if you are using the fancy diary display. (With simple
|
||||
diary display, the line @samp{&%%(diary-hebrew-date)} appears in the
|
||||
diary for any date, but does nothing particularly useful.)
|
||||
|
||||
These functions can be used to construct sexp diary entries based on
|
||||
the Hebrew calendar in certain standard ways:
|
||||
|
||||
@cindex rosh hodesh
|
||||
@findex diary-rosh-hodesh
|
||||
@cindex parasha, weekly
|
||||
@findex diary-parasha
|
||||
@cindex candle lighting times
|
||||
@findex diary-sabbath-candles
|
||||
@cindex omer count
|
||||
@findex diary-omer
|
||||
@cindex yahrzeits
|
||||
@findex diary-yahrzeit
|
||||
@table @code
|
||||
@item %%(diary-rosh-hodesh)
|
||||
Make a diary entry that tells the occurrence and ritual announcement of each
|
||||
new Hebrew month.
|
||||
@item %%(diary-parasha)
|
||||
Make a Saturday diary entry that tells the weekly synagogue scripture reading.
|
||||
@item %%(diary-sabbath-candles)
|
||||
Make a Friday diary entry that tells the @emph{local time} of Sabbath
|
||||
candle lighting.
|
||||
@item %%(diary-omer)
|
||||
Make a diary entry that gives the omer count, when appropriate.
|
||||
@item %%(diary-yahrzeit @var{month} @var{day} @var{year}) @var{name}
|
||||
Make a diary entry marking the anniversary of a date of death. The date
|
||||
is the @emph{Gregorian} (civil) date of death. The diary entry appears
|
||||
on the proper Hebrew calendar anniversary and on the day before. (In
|
||||
the European style, the order of the parameters is changed to @var{day},
|
||||
@var{month}, @var{year}.)
|
||||
@end table
|
||||
|
||||
All the functions documented above take an optional argument
|
||||
@var{mark} which specifies how to mark the date in the calendar display.
|
||||
If one of these functions decides that it applies to a certain date,
|
||||
it returns a value that contains @var{mark}.
|
||||
|
||||
@ignore
|
||||
arch-tag: 52cb299f-fd1f-4616-bfe6-91b988669431
|
||||
@end ignore
|
36190
man/calc.texi
36190
man/calc.texi
File diff suppressed because it is too large
Load diff
1687
man/calendar.texi
1687
man/calendar.texi
File diff suppressed because it is too large
Load diff
6998
man/cc-mode.texi
6998
man/cc-mode.texi
File diff suppressed because it is too large
Load diff
5377
man/cl.texi
5377
man/cl.texi
File diff suppressed because it is too large
Load diff
1263
man/cmdargs.texi
1263
man/cmdargs.texi
File diff suppressed because it is too large
Load diff
|
@ -1,294 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2001, 2002,
|
||||
@c 2003, 2004, 2005, 2006, 2007 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 the fundamental concepts of
|
||||
@dfn{keys} and @dfn{commands}, whereby Emacs interprets your keyboard
|
||||
and mouse input.
|
||||
@end iftex
|
||||
|
||||
@ifnottex
|
||||
@raisesections
|
||||
@end ifnottex
|
||||
|
||||
@node User Input, Keys, Screen, Top
|
||||
@section Kinds of User Input
|
||||
@cindex input with the keyboard
|
||||
@cindex keyboard input
|
||||
@cindex character set (keyboard)
|
||||
@cindex @acronym{ASCII}
|
||||
@cindex C-
|
||||
@cindex Control
|
||||
@cindex control characters
|
||||
|
||||
GNU Emacs is designed for use with keyboard commands because that is
|
||||
the most efficient way to edit. You can do editing with the mouse, as
|
||||
in other editors, and you can give commands with the menu bar and tool
|
||||
bar, and scroll with the scroll bar. But if you keep on editing that
|
||||
way, you won't get the benefits of Emacs. Therefore, this manual
|
||||
documents primarily how to edit with the keyboard. You can force
|
||||
yourself to practice using the keyboard by using the shell command
|
||||
@samp{emacs -nw} to start Emacs, so that the mouse won't work.
|
||||
|
||||
Emacs uses an extension of the @acronym{ASCII} character set for
|
||||
keyboard input; it also accepts non-character input events including
|
||||
function keys and mouse button actions.
|
||||
|
||||
@acronym{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 @acronym{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 known as @key{SPC}, even though strictly speaking it is a
|
||||
graphic character that is blank.
|
||||
|
||||
Emacs extends the @acronym{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 @acronym{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.
|
||||
|
||||
The Emacs character set has room for control variants of all
|
||||
printing characters, and distinguishes @kbd{C-A} from @kbd{C-a}.
|
||||
Graphical terminals make it possible to enter all these characters.
|
||||
For example, @kbd{C--} (that's Control-Minus) and @kbd{C-5} are
|
||||
meaningful Emacs commands on a graphical terminal.
|
||||
|
||||
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} (different from @kbd{M-a},
|
||||
but they are normally equivalent in Emacs), @kbd{M-@key{RET}}, and
|
||||
@kbd{M-C-a}. That last means @kbd{a} with both the @key{CTRL} and
|
||||
@key{META} modifiers. We usually write it as @kbd{C-M-a} rather than
|
||||
@kbd{M-C-a}, for reasons of tradition.
|
||||
|
||||
@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, you can type @kbd{Meta-a}
|
||||
by holding down @key{META} and pressing @kbd{a}. The @key{META} key
|
||||
works much like the @key{SHIFT} key. In fact, this key is more often
|
||||
labeled @key{ALT} or @key{EDIT}, instead of @key{META}; on a Sun
|
||||
keyboard, it may have a diamond on it.
|
||||
|
||||
If there is no @key{META} key, you can still type Meta characters
|
||||
using two-character sequences starting with @key{ESC}. Thus, you can
|
||||
enter @kbd{M-a} by typing @kbd{@key{ESC} a}. You can enter
|
||||
@kbd{C-M-a} by typing @kbd{@key{ESC} C-a}. Unlike @key{META}, which
|
||||
modifies other characters, @key{ESC} is a separate character. You
|
||||
don't hold down @key{ESC} while typing the next character; instead,
|
||||
you press it and release it, then you enter the next character.
|
||||
@key{ESC} is allowed on terminals with @key{META} keys, too, in case
|
||||
you have formed a habit of using it.
|
||||
|
||||
Emacs defines 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 graphical 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.
|
||||
|
||||
If your keyboard lacks one of these modifier keys, you can enter it
|
||||
using @kbd{C-x @@}: @kbd{C-x @@ h} adds the ``hyper'' flag to the next
|
||||
character, @kbd{C-x @@ s} adds the ``super'' flag, and @kbd{C-x @@ a}
|
||||
adds the ``alt'' flag. For instance, @kbd{C-x @@ h C-a} is a way to
|
||||
enter @kbd{Hyper-Control-a}. (Unfortunately there is no way to add
|
||||
two modifiers by using @kbd{C-x @@} twice for the same character,
|
||||
because the first one goes to work on the @kbd{C-x}.)
|
||||
|
||||
Keyboard input includes keyboard keys that are not characters at
|
||||
all, such as function keys and arrow keys. Mouse buttons are also not
|
||||
characters. However, 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 the full Lisp-level details. If you are not
|
||||
doing Lisp programming, but simply want to redefine the meaning of
|
||||
some characters or non-character events, see @ref{Customization}.
|
||||
|
||||
@acronym{ASCII} terminals cannot really send anything to the computer except
|
||||
@acronym{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 catch these special sequences
|
||||
and convert them to function key events before any other part of Emacs
|
||||
gets to see them.
|
||||
|
||||
@cindex keys stolen by window manager
|
||||
@cindex window manager, keys stolen by
|
||||
On graphical displays, the window manager is likely to block the
|
||||
character @kbd{Meta-@key{TAB}} before Emacs can see it. It may also
|
||||
block @kbd{Meta-@key{SPC}}, @kbd{C-M-d} and @kbd{C-M-l}. If you have
|
||||
these problems, we recommend that you customize your window manager to
|
||||
turn off those commands, or put them on key combinations that Emacs
|
||||
does not use.
|
||||
|
||||
@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 is meaningful as a unit---a ``single command.'' Some
|
||||
Emacs command sequences are invoked by just one character or one
|
||||
event; for example, just @kbd{C-f} moves forward one character in the
|
||||
buffer. 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-event
|
||||
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-event key
|
||||
sequences. There's no limit to the length of a key sequence, but in
|
||||
practice people rarely use sequences longer than four events.
|
||||
|
||||
You can't add input events onto a complete key. For example, the
|
||||
two-event 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-o}. (@key{F1} and @key{F2} are
|
||||
aliases for @kbd{C-h} and @kbd{C-x 6}.) This list is not cast in stone;
|
||||
it describes the standard key bindings. If you customize Emacs, you can make
|
||||
new prefix keys, or eliminate some of the standard ones (not
|
||||
recommended for most users). @xref{Key Bindings}.
|
||||
|
||||
If you 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 that too as a prefix). Conversely, if you remove the
|
||||
prefix definition of @kbd{C-x 4}, then @kbd{C-x 4 f} and @kbd{C-x 4
|
||||
@var{anything}} are no longer keys.
|
||||
|
||||
Typing the help character (@kbd{C-h} or @key{F1}) after a prefix key
|
||||
displays a list of the commands starting with that prefix. There are
|
||||
a few prefix keys after which @kbd{C-h} does not work---for historical
|
||||
reasons, they define other meanings for @kbd{C-h} which are painful to
|
||||
change. @key{F1} works after all prefix keys.
|
||||
|
||||
@node Commands, Text Characters, Keys, Top
|
||||
@section Keys and Commands
|
||||
|
||||
@cindex binding
|
||||
@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 how the
|
||||
command does its work. In Emacs Lisp, a command is a Lisp function with
|
||||
special options to read arguments and for interactive use. 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 here is simplified slightly.)
|
||||
|
||||
The bindings between keys and commands are recorded in tables called
|
||||
@dfn{keymaps}. @xref{Keymaps}.
|
||||
|
||||
When we say that ``@kbd{C-n} moves down vertically one line'' we are
|
||||
glossing over a subtle distinction that is irrelevant in ordinary use,
|
||||
but vital for Emacs customization. The command @code{next-line} does
|
||||
a vertical move downward. @kbd{C-n} has this effect @emph{because} it
|
||||
is bound to @code{next-line}. If you rebind @kbd{C-n} to the command
|
||||
@code{forward-word}, @kbd{C-n} will move forward one word instead.
|
||||
Rebinding keys is an important method of customization.
|
||||
|
||||
In the rest of this manual, we usually ignore this distinction to
|
||||
keep things simple. We will often speak of keys like @kbd{C-n} as
|
||||
commands, even though strictly speaking the key is bound to a command.
|
||||
Usually 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 the command @code{next-line} moves
|
||||
vertically down, and the key @kbd{C-n} is normally bound to it.
|
||||
|
||||
Since we are discussing customization, we should 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 store a value. Most of the variables documented in this
|
||||
manual are meant for customization: some command or other part of
|
||||
Emacs examines the variable and behaves differently according to the
|
||||
value that you set. You can ignore the information about variables
|
||||
until you are interested in customizing them. Then read the basic
|
||||
information on variables (@pxref{Variables}) and the information about
|
||||
specific variables will make sense.
|
||||
|
||||
@node Text Characters, Entering Emacs, Commands, Top
|
||||
@section Character Set for Text
|
||||
@cindex characters (in text)
|
||||
|
||||
Text in Emacs buffers is a sequence of characters. In the simplest
|
||||
case, these are @acronym{ASCII} characters, each stored in one 8-bit
|
||||
byte. Both @acronym{ASCII} control characters (octal codes 000
|
||||
through 037, and 0177) and @acronym{ASCII} printing characters (codes
|
||||
040 through 0176) are allowed. The other modifier flags used in
|
||||
keyboard input, such as Meta, are not allowed in buffers.
|
||||
|
||||
Non-@acronym{ASCII} printing characters can also appear in buffers,
|
||||
when multibyte characters are enabled. They have character codes
|
||||
starting at 256, octal 0400, and each one is represented as a sequence
|
||||
of two or more bytes. @xref{International}. Single-byte characters
|
||||
with codes 128 through 255 can also appear in multibyte buffers.
|
||||
However, non-@acronym{ASCII} control characters cannot appear in a
|
||||
buffer.
|
||||
|
||||
Some @acronym{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}.
|
||||
|
||||
If you disable multibyte characters, then you can use only one
|
||||
alphabet of non-@acronym{ASCII} characters, which all fit in one byte.
|
||||
They use octal codes 0200 through 0377. @xref{Unibyte Mode}.
|
||||
|
||||
@ifnottex
|
||||
@lowersections
|
||||
@end ifnottex
|
||||
|
||||
@ignore
|
||||
arch-tag: 9be43eef-d1f4-4d03-a916-c741ea713a45
|
||||
@end ignore
|
2515
man/custom.texi
2515
man/custom.texi
File diff suppressed because it is too large
Load diff
1275
man/dired-x.texi
1275
man/dired-x.texi
File diff suppressed because it is too large
Load diff
|
@ -1,49 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@c
|
||||
@c This file is included either in emacs-xtra.texi (when producing the
|
||||
@c printed version) or in the main Emacs manual (for the on-line version).
|
||||
@node Subdir Switches
|
||||
@section Subdirectory Switches in Dired
|
||||
|
||||
You can insert subdirectories with specified @code{ls} switches in
|
||||
Dired buffers, using @kbd{C-u i}. You can change the @code{ls}
|
||||
switches of an already inserted subdirectory using @kbd{C-u l}.
|
||||
|
||||
In Emacs versions 22.1 and later, Dired remembers the switches, so
|
||||
that reverting the buffer will not change them back to the main
|
||||
directory's switches. Deleting a subdirectory forgets about its
|
||||
switches.
|
||||
|
||||
Using @code{dired-undo} (usually bound to @kbd{C-_} and @kbd{C-x u})
|
||||
to reinsert or delete subdirectories, that were inserted with explicit
|
||||
switches, can bypass Dired's machinery for remembering (or forgetting)
|
||||
switches. Deleting a subdirectory using @code{dired-undo} does not
|
||||
forget its switches. When later reinserted using @kbd{i}, it will be
|
||||
reinserted using its old switches. Using @code{dired-undo} to
|
||||
reinsert a subdirectory that was deleted using the regular
|
||||
Dired commands (not @code{dired-undo}) will originally insert it with
|
||||
its old switches. However, reverting the buffer will relist it using
|
||||
the buffer's default switches. If any of this yields problems, you
|
||||
can easily correct the situation using @kbd{C-u i} or @kbd{C-u l}.
|
||||
|
||||
Dired does not remember the @code{R} switch. Inserting a subdirectory
|
||||
with switches that include the @code{R} switch is equivalent with
|
||||
inserting each of its subdirectories using all remaining switches.
|
||||
For instance, updating or killing a subdirectory that was inserted
|
||||
with the @code{R} switch will not update or kill its subdirectories.
|
||||
|
||||
The buffer's default switches do not affect subdirectories that were
|
||||
inserted using explicitly specified switches. In particular,
|
||||
commands such as @kbd{s}, that change the buffer's switches do not
|
||||
affect such subdirectories. (They do affect subdirectories without
|
||||
explicitly assigned switches, however.)
|
||||
|
||||
You can make Dired forget about all subdirectory switches and relist
|
||||
all subdirectories with the buffer's default switches using
|
||||
@kbd{M-x dired-reset-subdir-switches}. This also reverts the Dired buffer.
|
||||
|
||||
@ignore
|
||||
arch-tag: e3865701-9179-4ffb-bc34-d321111c688d
|
||||
@end ignore
|
1317
man/dired.texi
1317
man/dired.texi
File diff suppressed because it is too large
Load diff
1259
man/display.texi
1259
man/display.texi
File diff suppressed because it is too large
Load diff
|
@ -1,416 +0,0 @@
|
|||
@c -*-texinfo-*-
|
||||
@center Version 1.2, November 2002
|
||||
|
||||
@display
|
||||
Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
@end display
|
||||
@sp 1
|
||||
@enumerate 0
|
||||
@item
|
||||
PREAMBLE
|
||||
|
||||
The purpose of this License is to make a manual, textbook, or other
|
||||
functional and useful document ``free'' in the sense of freedom: to
|
||||
assure everyone the effective freedom to copy and redistribute it,
|
||||
with or without modifying it, either commercially or noncommercially.
|
||||
Secondarily, this License preserves for the author and publisher a way
|
||||
to get credit for their work, while not being considered responsible
|
||||
for modifications made by others.
|
||||
|
||||
This License is a kind of ``copyleft,'' which means that derivative
|
||||
works of the document must themselves be free in the same sense. It
|
||||
complements the GNU General Public License, which is a copyleft
|
||||
license designed for free software.
|
||||
|
||||
We have designed this License in order to use it for manuals for free
|
||||
software, because free software needs free documentation: a free
|
||||
program should come with manuals providing the same freedoms that the
|
||||
software does. But this License is not limited to software manuals;
|
||||
it can be used for any textual work, regardless of subject matter or
|
||||
whether it is published as a printed book. We recommend this License
|
||||
principally for works whose purpose is instruction or reference.
|
||||
|
||||
@sp 1
|
||||
@item
|
||||
APPLICABILITY AND DEFINITIONS
|
||||
|
||||
This License applies to any manual or other work, in any medium, that
|
||||
contains a notice placed by the copyright holder saying it can be
|
||||
distributed under the terms of this License. Such a notice grants a
|
||||
world-wide, royalty-free license, unlimited in duration, to use that
|
||||
work under the conditions stated herein. The ``Document,'' below,
|
||||
refers to any such manual or work. Any member of the public is a
|
||||
licensee, and is addressed as ``you.'' You accept the license if you
|
||||
copy, modify or distribute the work in a way requiring permission
|
||||
under copyright law.
|
||||
|
||||
A ``Modified Version'' of the Document means any work containing the
|
||||
Document or a portion of it, either copied verbatim, or with
|
||||
modifications and/or translated into another language.
|
||||
|
||||
A ``Secondary Section'' is a named appendix or a front-matter section of
|
||||
the Document that deals exclusively with the relationship of the
|
||||
publishers or authors of the Document to the Document's overall subject
|
||||
(or to related matters) and contains nothing that could fall directly
|
||||
within that overall subject. (Thus, if the Document is in part a
|
||||
textbook of mathematics, a Secondary Section may not explain any
|
||||
mathematics.) The relationship could be a matter of historical
|
||||
connection with the subject or with related matters, or of legal,
|
||||
commercial, philosophical, ethical or political position regarding
|
||||
them.
|
||||
|
||||
The ``Invariant Sections'' are certain Secondary Sections whose titles
|
||||
are designated, as being those of Invariant Sections, in the notice
|
||||
that says that the Document is released under this License. If a
|
||||
section does not fit the above definition of Secondary then it is not
|
||||
allowed to be designated as Invariant. The Document may contain zero
|
||||
Invariant Sections. If the Document does not identify any Invariant
|
||||
Sections then there are none.
|
||||
|
||||
The ``Cover Texts'' are certain short passages of text that are listed,
|
||||
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
|
||||
the Document is released under this License. A Front-Cover Text may
|
||||
be at most 5 words, and a Back-Cover Text may be at most 25 words.
|
||||
|
||||
A ``Transparent'' copy of the Document means a machine-readable copy,
|
||||
represented in a format whose specification is available to the
|
||||
general public, that is suitable for revising the document
|
||||
straightforwardly with generic text editors or (for images composed of
|
||||
pixels) generic paint programs or (for drawings) some widely available
|
||||
drawing editor, and that is suitable for input to text formatters or
|
||||
for automatic translation to a variety of formats suitable for input
|
||||
to text formatters. A copy made in an otherwise Transparent file
|
||||
format whose markup, or absence of markup, has been arranged to thwart
|
||||
or discourage subsequent modification by readers is not Transparent.
|
||||
An image format is not Transparent if used for any substantial amount
|
||||
of text. A copy that is not ``Transparent'' is called ``Opaque.''
|
||||
|
||||
|
||||
Examples of suitable formats for Transparent copies include plain
|
||||
ASCII without markup, Texinfo input format, LaTeX input format, SGML
|
||||
or XML using a publicly available DTD, and standard-conforming simple
|
||||
HTML, PostScript or PDF designed for human modification. Examples of
|
||||
transparent image formats include PNG, XCF and JPG. Opaque formats
|
||||
include proprietary formats that can be read and edited only by
|
||||
proprietary word processors, SGML or XML for which the DTD and/or
|
||||
processing tools are not generally available, and the
|
||||
machine-generated HTML, PostScript or PDF produced by some word
|
||||
processors for output purposes only.
|
||||
|
||||
The ``Title Page'' means, for a printed book, the title page itself,
|
||||
plus such following pages as are needed to hold, legibly, the material
|
||||
this License requires to appear in the title page. For works in
|
||||
formats which do not have any title page as such, ``Title Page'' means
|
||||
the text near the most prominent appearance of the work's title,
|
||||
preceding the beginning of the body of the text.
|
||||
|
||||
A section ``Entitled XYZ'' means a named subunit of the Document whose
|
||||
title either is precisely XYZ or contains XYZ in parentheses following
|
||||
text that translates XYZ in another language. (Here XYZ stands for a
|
||||
specific section name mentioned below, such as ``Acknowledgements,''
|
||||
``Dedications,'' ``Endorsements,'' or ``History.'') To ``Preserve the Title''
|
||||
of such a section when you modify the Document means that it remains a
|
||||
section ``Entitled XYZ'' according to this definition.
|
||||
|
||||
The Document may include Warranty Disclaimers next to the notice which
|
||||
states that this License applies to the Document. These Warranty
|
||||
Disclaimers are considered to be included by reference in this
|
||||
License, but only as regards disclaiming warranties: any other
|
||||
implication that these Warranty Disclaimers may have is void and has
|
||||
no effect on the meaning of this License.
|
||||
@sp 1
|
||||
@item
|
||||
VERBATIM COPYING
|
||||
|
||||
You may copy and distribute the Document in any medium, either
|
||||
commercially or noncommercially, provided that this License, the
|
||||
copyright notices, and the license notice saying this License applies
|
||||
to the Document are reproduced in all copies, and that you add no other
|
||||
conditions whatsoever to those of this License. You may not use
|
||||
technical measures to obstruct or control the reading or further
|
||||
copying of the copies you make or distribute. However, you may accept
|
||||
compensation in exchange for copies. If you distribute a large enough
|
||||
number of copies you must also follow the conditions in section 3.
|
||||
|
||||
You may also lend copies, under the same conditions stated above, and
|
||||
you may publicly display copies.
|
||||
@sp 1
|
||||
@item
|
||||
COPYING IN QUANTITY
|
||||
|
||||
If you publish printed copies (or copies in media that commonly have
|
||||
printed covers) of the Document, numbering more than 100, and the
|
||||
Document's license notice requires Cover Texts, you must enclose the
|
||||
copies in covers that carry, clearly and legibly, all these Cover
|
||||
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
|
||||
the back cover. Both covers must also clearly and legibly identify
|
||||
you as the publisher of these copies. The front cover must present
|
||||
the full title with all words of the title equally prominent and
|
||||
visible. You may add other material on the covers in addition.
|
||||
Copying with changes limited to the covers, as long as they preserve
|
||||
the title of the Document and satisfy these conditions, can be treated
|
||||
as verbatim copying in other respects.
|
||||
|
||||
If the required texts for either cover are too voluminous to fit
|
||||
legibly, you should put the first ones listed (as many as fit
|
||||
reasonably) on the actual cover, and continue the rest onto adjacent
|
||||
pages.
|
||||
|
||||
If you publish or distribute Opaque copies of the Document numbering
|
||||
more than 100, you must either include a machine-readable Transparent
|
||||
copy along with each Opaque copy, or state in or with each Opaque copy
|
||||
a computer-network location from which the general network-using
|
||||
public has access to download using public-standard network protocols
|
||||
a complete Transparent copy of the Document, free of added material.
|
||||
If you use the latter option, you must take reasonably prudent steps,
|
||||
when you begin distribution of Opaque copies in quantity, to ensure
|
||||
that this Transparent copy will remain thus accessible at the stated
|
||||
location until at least one year after the last time you distribute an
|
||||
Opaque copy (directly or through your agents or retailers) of that
|
||||
edition to the public.
|
||||
|
||||
It is requested, but not required, that you contact the authors of the
|
||||
Document well before redistributing any large number of copies, to give
|
||||
them a chance to provide you with an updated version of the Document.
|
||||
@sp 1
|
||||
@item
|
||||
MODIFICATIONS
|
||||
|
||||
You may copy and distribute a Modified Version of the Document under
|
||||
the conditions of sections 2 and 3 above, provided that you release
|
||||
the Modified Version under precisely this License, with the Modified
|
||||
Version filling the role of the Document, thus licensing distribution
|
||||
and modification of the Modified Version to whoever possesses a copy
|
||||
of it. In addition, you must do these things in the Modified Version:
|
||||
|
||||
A. Use in the Title Page (and on the covers, if any) a title distinct
|
||||
from that of the Document, and from those of previous versions
|
||||
(which should, if there were any, be listed in the History section
|
||||
of the Document). You may use the same title as a previous version
|
||||
if the original publisher of that version gives permission.@*
|
||||
B. List on the Title Page, as authors, one or more persons or entities
|
||||
responsible for authorship of the modifications in the Modified
|
||||
Version, together with at least five of the principal authors of the
|
||||
Document (all of its principal authors, if it has fewer than five),
|
||||
unless they release you from this requirement.@*
|
||||
C. State on the Title page the name of the publisher of the
|
||||
Modified Version, as the publisher.@*
|
||||
D. Preserve all the copyright notices of the Document.@*
|
||||
E. Add an appropriate copyright notice for your modifications
|
||||
adjacent to the other copyright notices.@*
|
||||
F. Include, immediately after the copyright notices, a license notice
|
||||
giving the public permission to use the Modified Version under the
|
||||
terms of this License, in the form shown in the Addendum below.@*
|
||||
G. Preserve in that license notice the full lists of Invariant Sections
|
||||
and required Cover Texts given in the Document's license notice.@*
|
||||
H. Include an unaltered copy of this License.@*
|
||||
I. Preserve the section Entitled ``History,'' Preserve its Title, and add
|
||||
to it an item stating at least the title, year, new authors, and
|
||||
publisher of the Modified Version as given on the Title Page. If
|
||||
there is no section Entitled ``History'' in the Document, create one
|
||||
stating the title, year, authors, and publisher of the Document as
|
||||
given on its Title Page, then add an item describing the Modified
|
||||
Version as stated in the previous sentence.@*
|
||||
J. Preserve the network location, if any, given in the Document for
|
||||
public access to a Transparent copy of the Document, and likewise
|
||||
the network locations given in the Document for previous versions
|
||||
it was based on. These may be placed in the ``History'' section.
|
||||
You may omit a network location for a work that was published at
|
||||
least four years before the Document itself, or if the original
|
||||
publisher of the version it refers to gives permission.@*
|
||||
K. For any section Entitled ``Acknowledgements'' or ``Dedications,''
|
||||
Preserve the Title of the section, and preserve in the section all
|
||||
the substance and tone of each of the contributor acknowledgements
|
||||
and/or dedications given therein.@*
|
||||
L. Preserve all the Invariant Sections of the Document,
|
||||
unaltered in their text and in their titles. Section numbers
|
||||
or the equivalent are not considered part of the section titles.@*
|
||||
M. Delete any section Entitled ``Endorsements.'' Such a section
|
||||
may not be included in the Modified Version.@*
|
||||
N. Do not retitle any existing section to be Entitled ``Endorsements''
|
||||
or to conflict in title with any Invariant Section.@*
|
||||
O. Preserve any Warranty Disclaimers.@*
|
||||
@sp 1
|
||||
If the Modified Version includes new front-matter sections or
|
||||
appendices that qualify as Secondary Sections and contain no material
|
||||
copied from the Document, you may at your option designate some or all
|
||||
of these sections as invariant. To do this, add their titles to the
|
||||
list of Invariant Sections in the Modified Version's license notice.
|
||||
These titles must be distinct from any other section titles.
|
||||
|
||||
You may add a section Entitled ``Endorsements,'' provided it contains
|
||||
nothing but endorsements of your Modified Version by various
|
||||
parties--for example, statements of peer review or that the text has
|
||||
been approved by an organization as the authoritative definition of a
|
||||
standard.
|
||||
|
||||
You may add a passage of up to five words as a Front-Cover Text, and a
|
||||
passage of up to 25 words as a Back-Cover Text, to the end of the list
|
||||
of Cover Texts in the Modified Version. Only one passage of
|
||||
Front-Cover Text and one of Back-Cover Text may be added by (or
|
||||
through arrangements made by) any one entity. If the Document already
|
||||
includes a cover text for the same cover, previously added by you or
|
||||
by arrangement made by the same entity you are acting on behalf of,
|
||||
you may not add another; but you may replace the old one, on explicit
|
||||
permission from the previous publisher that added the old one.
|
||||
|
||||
The author(s) and publisher(s) of the Document do not by this License
|
||||
give permission to use their names for publicity for or to assert or
|
||||
imply endorsement of any Modified Version.
|
||||
@sp 1
|
||||
@item
|
||||
COMBINING DOCUMENTS
|
||||
|
||||
You may combine the Document with other documents released under this
|
||||
License, under the terms defined in section 4 above for modified
|
||||
versions, provided that you include in the combination all of the
|
||||
Invariant Sections of all of the original documents, unmodified, and
|
||||
list them all as Invariant Sections of your combined work in its
|
||||
license notice, and that you preserve all their Warranty Disclaimers.
|
||||
|
||||
The combined work need only contain one copy of this License, and
|
||||
multiple identical Invariant Sections may be replaced with a single
|
||||
copy. If there are multiple Invariant Sections with the same name but
|
||||
different contents, make the title of each such section unique by
|
||||
adding at the end of it, in parentheses, the name of the original
|
||||
author or publisher of that section if known, or else a unique number.
|
||||
Make the same adjustment to the section titles in the list of
|
||||
Invariant Sections in the license notice of the combined work.
|
||||
|
||||
In the combination, you must combine any sections Entitled ``History''
|
||||
in the various original documents, forming one section Entitled
|
||||
``History''; likewise combine any sections Entitled ``Acknowledgements,''
|
||||
and any sections Entitled ``Dedications.'' You must delete all sections
|
||||
Entitled ``Endorsements.''
|
||||
@sp 1
|
||||
@item
|
||||
COLLECTIONS OF DOCUMENTS
|
||||
|
||||
You may make a collection consisting of the Document and other documents
|
||||
released under this License, and replace the individual copies of this
|
||||
License in the various documents with a single copy that is included in
|
||||
the collection, provided that you follow the rules of this License for
|
||||
verbatim copying of each of the documents in all other respects.
|
||||
|
||||
You may extract a single document from such a collection, and distribute
|
||||
it individually under this License, provided you insert a copy of this
|
||||
License into the extracted document, and follow this License in all
|
||||
other respects regarding verbatim copying of that document.
|
||||
@sp 1
|
||||
@item
|
||||
AGGREGATION WITH INDEPENDENT WORKS
|
||||
|
||||
A compilation of the Document or its derivatives with other separate
|
||||
and independent documents or works, in or on a volume of a storage or
|
||||
distribution medium, is called an ``aggregate'' if the copyright
|
||||
resulting from the compilation is not used to limit the legal rights
|
||||
of the compilation's users beyond what the individual works permit.
|
||||
When the Document is included in an aggregate, this License does not
|
||||
apply to the other works in the aggregate which are not themselves
|
||||
derivative works of the Document.
|
||||
|
||||
If the Cover Text requirement of section 3 is applicable to these
|
||||
copies of the Document, then if the Document is less than one half of
|
||||
the entire aggregate, the Document's Cover Texts may be placed on
|
||||
covers that bracket the Document within the aggregate, or the
|
||||
electronic equivalent of covers if the Document is in electronic form.
|
||||
Otherwise they must appear on printed covers that bracket the whole
|
||||
aggregate.
|
||||
@sp 1
|
||||
@item
|
||||
TRANSLATION
|
||||
|
||||
Translation is considered a kind of modification, so you may
|
||||
distribute translations of the Document under the terms of section 4.
|
||||
Replacing Invariant Sections with translations requires special
|
||||
permission from their copyright holders, but you may include
|
||||
translations of some or all Invariant Sections in addition to the
|
||||
original versions of these Invariant Sections. You may include a
|
||||
translation of this License, and all the license notices in the
|
||||
Document, and any Warranty Disclaimers, provided that you also include
|
||||
the original English version of this License and the original versions
|
||||
of those notices and disclaimers. In case of a disagreement between
|
||||
the translation and the original version of this License or a notice
|
||||
or disclaimer, the original version will prevail.
|
||||
|
||||
If a section in the Document is Entitled ``Acknowledgements,''
|
||||
``Dedications,'' or ``History,'' the requirement (section 4) to Preserve
|
||||
its Title (section 1) will typically require changing the actual
|
||||
title.
|
||||
@sp 1
|
||||
@item
|
||||
TERMINATION
|
||||
|
||||
You may not copy, modify, sublicense, or distribute the Document except
|
||||
as expressly provided for under this License. Any other attempt to
|
||||
copy, modify, sublicense or distribute the Document is void, and will
|
||||
automatically terminate your rights under this License. However,
|
||||
parties who have received copies, or rights, from you under this
|
||||
License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
@sp 1
|
||||
@item
|
||||
FUTURE REVISIONS OF THIS LICENSE
|
||||
|
||||
The Free Software Foundation may publish new, revised versions
|
||||
of the GNU Free Documentation License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns. See
|
||||
http://www.gnu.org/copyleft/.
|
||||
|
||||
Each version of the License is given a distinguishing version number.
|
||||
If the Document specifies that a particular numbered version of this
|
||||
License ``or any later version'' applies to it, you have the option of
|
||||
following the terms and conditions either of that specified version or
|
||||
of any later version that has been published (not as a draft) by the
|
||||
Free Software Foundation. If the Document does not specify a version
|
||||
number of this License, you may choose any version ever published (not
|
||||
as a draft) by the Free Software Foundation.
|
||||
|
||||
@end enumerate
|
||||
|
||||
@unnumberedsec ADDENDUM: How to use this License for your documents
|
||||
|
||||
To use this License in a document you have written, include a copy of
|
||||
the License in the document and put the following copyright and
|
||||
license notices just after the title page:
|
||||
|
||||
@smallexample
|
||||
@group
|
||||
Copyright (C) @var{year} @var{your name}.
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled ``GNU
|
||||
Free Documentation License.''
|
||||
@end group
|
||||
@end smallexample
|
||||
|
||||
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
|
||||
replace the ``with...Texts.'' line with this:
|
||||
|
||||
@smallexample
|
||||
@group
|
||||
with the Invariant Sections being @var{list their titles}, with the
|
||||
Front-Cover Texts being @var{list}, and with the Back-Cover Texts being
|
||||
@var{list}.
|
||||
@end group
|
||||
@end smallexample
|
||||
|
||||
If you have Invariant Sections without Cover Texts, or some other
|
||||
combination of the three, merge those two alternatives to suit the
|
||||
situation.
|
||||
|
||||
If your document contains nontrivial examples of program code, we
|
||||
recommend releasing these examples in parallel under your choice of
|
||||
free software license, such as the GNU General Public License,
|
||||
to permit their use in free software.
|
||||
|
||||
@ignore
|
||||
arch-tag: c1679162-1d8a-4f02-bc52-2e71765f0165
|
||||
@end ignore
|
1462
man/ebrowse.texi
1462
man/ebrowse.texi
File diff suppressed because it is too large
Load diff
2546
man/ediff.texi
2546
man/ediff.texi
File diff suppressed because it is too large
Load diff
1832
man/emacs-mime.texi
1832
man/emacs-mime.texi
File diff suppressed because it is too large
Load diff
|
@ -1,126 +0,0 @@
|
|||
\input texinfo @c -*-texinfo-*-
|
||||
@comment %**start of header
|
||||
@setfilename ../info/emacs-xtra
|
||||
@settitle Specialized Emacs Features
|
||||
@syncodeindex fn cp
|
||||
@syncodeindex vr cp
|
||||
@syncodeindex ky cp
|
||||
@comment %**end of header
|
||||
|
||||
@copying
|
||||
This manual describes specialized features of Emacs.
|
||||
|
||||
Copyright @copyright{} 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with the Front-Cover texts being ``A GNU
|
||||
Manual,'' and with the Back-Cover Texts as in (a) below. A copy of the
|
||||
license is included in the section entitled ``GNU Free Documentation
|
||||
License'' in the Emacs manual.
|
||||
|
||||
(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
|
||||
this GNU Manual, like GNU software. Copies published by the Free
|
||||
Software Foundation raise funds for GNU development.''
|
||||
|
||||
This document is part of a collection distributed under the GNU Free
|
||||
Documentation License. If you want to distribute this document
|
||||
separately from the collection, you can do so by adding a copy of the
|
||||
license to the document, as described in section 6 of the license.
|
||||
@end quotation
|
||||
@end copying
|
||||
|
||||
@dircategory Emacs
|
||||
@direntry
|
||||
* Emacs-Xtra: (emacs-xtra). Specialized Emacs features.
|
||||
@end direntry
|
||||
|
||||
@titlepage
|
||||
@title Specialized Emacs Features
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
@insertcopying
|
||||
@end titlepage
|
||||
|
||||
@contents
|
||||
|
||||
@ifnottex
|
||||
@node Top
|
||||
@top Specialized Emacs Features
|
||||
|
||||
@insertcopying
|
||||
|
||||
@end ifnottex
|
||||
|
||||
@menu
|
||||
* Introduction:: What documentation belongs here?
|
||||
@iftex
|
||||
* Picture Mode:: Editing pictures made up of characters using
|
||||
the quarter-plane screen model.
|
||||
|
||||
* Autorevert:: Auto Reverting non-file buffers.
|
||||
* Subdir Switches:: Subdirectory switches in Dired.
|
||||
* Advanced Calendar/Diary Usage:: Advanced Calendar/Diary customization.
|
||||
* Emerge:: A convenient way of merging two versions of a program.
|
||||
* Advanced VC Usage:: Advanced VC (version control) features.
|
||||
* Fortran:: Fortran mode and its special features.
|
||||
* MS-DOS:: Using Emacs on MS-DOS (otherwise known as @dfn{MS-DOG}).
|
||||
@end iftex
|
||||
* Index::
|
||||
@end menu
|
||||
|
||||
@node Introduction
|
||||
@unnumbered Introduction
|
||||
|
||||
This manual contains detailed information about various features that
|
||||
are too specialized to be included in the printed Emacs manual. It is
|
||||
intended to be readable by anyone having a basic knowledge of Emacs.
|
||||
However, certain sections may be intended for a more specialized
|
||||
audience, such as Elisp authors. This should be clearly pointed out
|
||||
at the beginning of these sections.
|
||||
|
||||
Certain packages, or collections of related features, have their own
|
||||
manuals, separate from the main Emacs User's manual. This manual is
|
||||
intended as a complement, rather than an alternative, to reading those
|
||||
additional manuals; in a nutshell, it is a collection of smaller
|
||||
specialized features, too small or too obscure to justify their own
|
||||
manual.
|
||||
|
||||
Sections intended specifically for Elisp programmers can follow the
|
||||
style of the Elisp manual. Other sections should follow the style of
|
||||
the Emacs manual.
|
||||
|
||||
@iftex
|
||||
@c ``Picture Mode'' is a chapter, not a section, so it's outside @raisesections.
|
||||
@include picture-xtra.texi
|
||||
|
||||
@raisesections
|
||||
@include arevert-xtra.texi
|
||||
|
||||
@include dired-xtra.texi
|
||||
|
||||
@include cal-xtra.texi
|
||||
|
||||
@include emerge-xtra.texi
|
||||
|
||||
@include vc-xtra.texi
|
||||
|
||||
@include fortran-xtra.texi
|
||||
|
||||
@include msdog-xtra.texi
|
||||
|
||||
@lowersections
|
||||
@end iftex
|
||||
|
||||
@node Index
|
||||
@unnumbered Index
|
||||
|
||||
@printindex cp
|
||||
|
||||
@bye
|
||||
|
||||
@ignore
|
||||
arch-tag: 75c33f13-32c6-41b6-9537-847a312e2e49
|
||||
@end ignore
|
1365
man/emacs.texi
1365
man/emacs.texi
File diff suppressed because it is too large
Load diff
|
@ -1,414 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@c
|
||||
@c This file is included either in emacs-xtra.texi (when producing the
|
||||
@c printed version) or in the main Emacs manual (for the on-line version).
|
||||
@node Emerge
|
||||
@section Merging Files with Emerge
|
||||
@cindex Emerge
|
||||
@cindex merging files
|
||||
|
||||
It's not unusual for programmers to get their signals crossed and
|
||||
modify the same program in two different directions. To recover from
|
||||
this confusion, you need to merge the two versions. Emerge makes this
|
||||
easier. For other ways to compare files, see
|
||||
@iftex
|
||||
@ref{Comparing Files,,, emacs, the Emacs Manual},
|
||||
@end iftex
|
||||
@ifnottex
|
||||
@ref{Comparing Files},
|
||||
@end ifnottex
|
||||
and @ref{Top, Ediff,, ediff, The Ediff Manual}.
|
||||
|
||||
@menu
|
||||
* Overview of Emerge:: How to start Emerge. Basic concepts.
|
||||
* Submodes of Emerge:: Fast mode vs. Edit mode.
|
||||
Skip Prefers mode and Auto Advance mode.
|
||||
* State of Difference:: You do the merge by specifying state A or B
|
||||
for each difference.
|
||||
* Merge Commands:: Commands for selecting a difference,
|
||||
changing states of differences, etc.
|
||||
* Exiting Emerge:: What to do when you've finished the merge.
|
||||
* Combining in Emerge:: How to keep both alternatives for a difference.
|
||||
* Fine Points of Emerge:: Misc.
|
||||
@end menu
|
||||
|
||||
@node Overview of Emerge
|
||||
@subsection Overview of Emerge
|
||||
|
||||
To start Emerge, run one of these four commands:
|
||||
|
||||
@table @kbd
|
||||
@item M-x emerge-files
|
||||
@findex emerge-files
|
||||
Merge two specified files.
|
||||
|
||||
@item M-x emerge-files-with-ancestor
|
||||
@findex emerge-files-with-ancestor
|
||||
Merge two specified files, with reference to a common ancestor.
|
||||
|
||||
@item M-x emerge-buffers
|
||||
@findex emerge-buffers
|
||||
Merge two buffers.
|
||||
|
||||
@item M-x emerge-buffers-with-ancestor
|
||||
@findex emerge-buffers-with-ancestor
|
||||
Merge two buffers with reference to a common ancestor in a third
|
||||
buffer.
|
||||
@end table
|
||||
|
||||
@cindex merge buffer (Emerge)
|
||||
@cindex A and B buffers (Emerge)
|
||||
The Emerge commands compare two files or buffers, and display the
|
||||
comparison in three buffers: one for each input text (the @dfn{A buffer}
|
||||
and the @dfn{B buffer}), and one (the @dfn{merge buffer}) where merging
|
||||
takes place. The merge buffer shows the full merged text, not just the
|
||||
differences. Wherever the two input texts differ, you can choose which
|
||||
one of them to include in the merge buffer.
|
||||
|
||||
The Emerge commands that take input from existing buffers use only
|
||||
the accessible portions of those buffers, if they are narrowed.
|
||||
@iftex
|
||||
@xref{Narrowing,,, emacs, the Emacs Manual}.
|
||||
@end iftex
|
||||
@ifnottex
|
||||
@xref{Narrowing}.
|
||||
@end ifnottex
|
||||
|
||||
|
||||
If a common ancestor version is available, from which the two texts to
|
||||
be merged were both derived, Emerge can use it to guess which
|
||||
alternative is right. Wherever one current version agrees with the
|
||||
ancestor, Emerge presumes that the other current version is a deliberate
|
||||
change which should be kept in the merged version. Use the
|
||||
@samp{with-ancestor} commands if you want to specify a common ancestor
|
||||
text. These commands read three file or buffer names---variant A,
|
||||
variant B, and the common ancestor.
|
||||
|
||||
After the comparison is done and the buffers are prepared, the
|
||||
interactive merging starts. You control the merging by typing special
|
||||
@dfn{merge commands} in the merge buffer (@pxref{Merge Commands}).
|
||||
For each run of differences between the input texts, you can choose
|
||||
which one of them to keep, or edit them both together.
|
||||
|
||||
The merge buffer uses a special major mode, Emerge mode, with commands
|
||||
for making these choices. But you can also edit the buffer with
|
||||
ordinary Emacs commands.
|
||||
|
||||
At any given time, the attention of Emerge is focused on one
|
||||
particular difference, called the @dfn{selected} difference. This
|
||||
difference is marked off in the three buffers like this:
|
||||
|
||||
@example
|
||||
vvvvvvvvvvvvvvvvvvvv
|
||||
@var{text that differs}
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
Emerge numbers all the differences sequentially and the mode
|
||||
line always shows the number of the selected difference.
|
||||
|
||||
Normally, the merge buffer starts out with the A version of the text.
|
||||
But when the A version of a difference agrees with the common ancestor,
|
||||
then the B version is initially preferred for that difference.
|
||||
|
||||
Emerge leaves the merged text in the merge buffer when you exit. At
|
||||
that point, you can save it in a file with @kbd{C-x C-w}. If you give a
|
||||
numeric argument to @code{emerge-files} or
|
||||
@code{emerge-files-with-ancestor}, it reads the name of the output file
|
||||
using the minibuffer. (This is the last file name those commands read.)
|
||||
Then exiting from Emerge saves the merged text in the output file.
|
||||
|
||||
Normally, Emerge commands save the output buffer in its file when you
|
||||
exit. If you abort Emerge with @kbd{C-]}, the Emerge command does not
|
||||
save the output buffer, but you can save it yourself if you wish.
|
||||
|
||||
@node Submodes of Emerge
|
||||
@subsection Submodes of Emerge
|
||||
|
||||
You can choose between two modes for giving merge commands: Fast mode
|
||||
and Edit mode. In Fast mode, basic merge commands are single
|
||||
characters, but ordinary Emacs commands are disabled. This is
|
||||
convenient if you use only merge commands. In Edit mode, all merge
|
||||
commands start with the prefix key @kbd{C-c C-c}, and the normal Emacs
|
||||
commands are also available. This allows editing the merge buffer, but
|
||||
slows down Emerge operations.
|
||||
|
||||
Use @kbd{e} to switch to Edit mode, and @kbd{C-c C-c f} to switch to
|
||||
Fast mode. The mode line indicates Edit and Fast modes with @samp{E}
|
||||
and @samp{F}.
|
||||
|
||||
Emerge has two additional submodes that affect how particular merge
|
||||
commands work: Auto Advance mode and Skip Prefers mode.
|
||||
|
||||
If Auto Advance mode is in effect, the @kbd{a} and @kbd{b} commands
|
||||
advance to the next difference. This lets you go through the merge
|
||||
faster as long as you simply choose one of the alternatives from the
|
||||
input. The mode line indicates Auto Advance mode with @samp{A}.
|
||||
|
||||
If Skip Prefers mode is in effect, the @kbd{n} and @kbd{p} commands
|
||||
skip over differences in states prefer-A and prefer-B (@pxref{State of
|
||||
Difference}). Thus you see only differences for which neither version
|
||||
is presumed ``correct.'' The mode line indicates Skip Prefers mode with
|
||||
@samp{S}.
|
||||
|
||||
@findex emerge-auto-advance-mode
|
||||
@findex emerge-skip-prefers-mode
|
||||
Use the command @kbd{s a} (@code{emerge-auto-advance-mode}) to set or
|
||||
clear Auto Advance mode. Use @kbd{s s}
|
||||
(@code{emerge-skip-prefers-mode}) to set or clear Skip Prefers mode.
|
||||
These commands turn on the mode with a positive argument, turns it off
|
||||
with a negative or zero argument, and toggle the mode with no argument.
|
||||
|
||||
@node State of Difference
|
||||
@subsection State of a Difference
|
||||
|
||||
In the merge buffer, a difference is marked with lines of @samp{v} and
|
||||
@samp{^} characters. Each difference has one of these seven states:
|
||||
|
||||
@table @asis
|
||||
@item A
|
||||
The difference is showing the A version. The @kbd{a} command always
|
||||
produces this state; the mode line indicates it with @samp{A}.
|
||||
|
||||
@item B
|
||||
The difference is showing the B version. The @kbd{b} command always
|
||||
produces this state; the mode line indicates it with @samp{B}.
|
||||
|
||||
@item default-A
|
||||
@itemx default-B
|
||||
The difference is showing the A or the B state by default, because you
|
||||
haven't made a choice. All differences start in the default-A state
|
||||
(and thus the merge buffer is a copy of the A buffer), except those for
|
||||
which one alternative is ``preferred'' (see below).
|
||||
|
||||
When you select a difference, its state changes from default-A or
|
||||
default-B to plain A or B. Thus, the selected difference never has
|
||||
state default-A or default-B, and these states are never displayed in
|
||||
the mode line.
|
||||
|
||||
The command @kbd{d a} chooses default-A as the default state, and @kbd{d
|
||||
b} chooses default-B. This chosen default applies to all differences
|
||||
which you haven't ever selected and for which no alternative is preferred.
|
||||
If you are moving through the merge sequentially, the differences you
|
||||
haven't selected are those following the selected one. Thus, while
|
||||
moving sequentially, you can effectively make the A version the default
|
||||
for some sections of the merge buffer and the B version the default for
|
||||
others by using @kbd{d a} and @kbd{d b} between sections.
|
||||
|
||||
@item prefer-A
|
||||
@itemx prefer-B
|
||||
The difference is showing the A or B state because it is
|
||||
@dfn{preferred}. This means that you haven't made an explicit choice,
|
||||
but one alternative seems likely to be right because the other
|
||||
alternative agrees with the common ancestor. Thus, where the A buffer
|
||||
agrees with the common ancestor, the B version is preferred, because
|
||||
chances are it is the one that was actually changed.
|
||||
|
||||
These two states are displayed in the mode line as @samp{A*} and @samp{B*}.
|
||||
|
||||
@item combined
|
||||
The difference is showing a combination of the A and B states, as a
|
||||
result of the @kbd{x c} or @kbd{x C} commands.
|
||||
|
||||
Once a difference is in this state, the @kbd{a} and @kbd{b} commands
|
||||
don't do anything to it unless you give them a numeric argument.
|
||||
|
||||
The mode line displays this state as @samp{comb}.
|
||||
@end table
|
||||
|
||||
@node Merge Commands
|
||||
@subsection Merge Commands
|
||||
|
||||
Here are the Merge commands for Fast mode; in Edit mode, precede them
|
||||
with @kbd{C-c C-c}:
|
||||
|
||||
@table @kbd
|
||||
@item p
|
||||
Select the previous difference.
|
||||
|
||||
@item n
|
||||
Select the next difference.
|
||||
|
||||
@item a
|
||||
Choose the A version of this difference.
|
||||
|
||||
@item b
|
||||
Choose the B version of this difference.
|
||||
|
||||
@item C-u @var{n} j
|
||||
Select difference number @var{n}.
|
||||
|
||||
@item .
|
||||
Select the difference containing point. You can use this command in the
|
||||
merge buffer or in the A or B buffer.
|
||||
|
||||
@item q
|
||||
Quit---finish the merge.
|
||||
|
||||
@item C-]
|
||||
Abort---exit merging and do not save the output.
|
||||
|
||||
@item f
|
||||
Go into Fast mode. (In Edit mode, this is actually @kbd{C-c C-c f}.)
|
||||
|
||||
@item e
|
||||
Go into Edit mode.
|
||||
|
||||
@item l
|
||||
Recenter (like @kbd{C-l}) all three windows.
|
||||
|
||||
@item -
|
||||
Specify part of a prefix numeric argument.
|
||||
|
||||
@item @var{digit}
|
||||
Also specify part of a prefix numeric argument.
|
||||
|
||||
@item d a
|
||||
Choose the A version as the default from here down in
|
||||
the merge buffer.
|
||||
|
||||
@item d b
|
||||
Choose the B version as the default from here down in
|
||||
the merge buffer.
|
||||
|
||||
@item c a
|
||||
Copy the A version of this difference into the kill ring.
|
||||
|
||||
@item c b
|
||||
Copy the B version of this difference into the kill ring.
|
||||
|
||||
@item i a
|
||||
Insert the A version of this difference at point.
|
||||
|
||||
@item i b
|
||||
Insert the B version of this difference at point.
|
||||
|
||||
@item m
|
||||
Put point and mark around the difference.
|
||||
|
||||
@item ^
|
||||
Scroll all three windows down (like @kbd{M-v}).
|
||||
|
||||
@item v
|
||||
Scroll all three windows up (like @kbd{C-v}).
|
||||
|
||||
@item <
|
||||
Scroll all three windows left (like @kbd{C-x <}).
|
||||
|
||||
@item >
|
||||
Scroll all three windows right (like @kbd{C-x >}).
|
||||
|
||||
@item |
|
||||
Reset horizontal scroll on all three windows.
|
||||
|
||||
@item x 1
|
||||
Shrink the merge window to one line. (Use @kbd{C-u l} to restore it
|
||||
to full size.)
|
||||
|
||||
@item x c
|
||||
Combine the two versions of this difference (@pxref{Combining in
|
||||
Emerge}).
|
||||
|
||||
@item x f
|
||||
Show the names of the files/buffers Emerge is operating on, in a Help
|
||||
window. (Use @kbd{C-u l} to restore windows.)
|
||||
|
||||
@item x j
|
||||
Join this difference with the following one.
|
||||
(@kbd{C-u x j} joins this difference with the previous one.)
|
||||
|
||||
@item x s
|
||||
Split this difference into two differences. Before you use this
|
||||
command, position point in each of the three buffers at the place where
|
||||
you want to split the difference.
|
||||
|
||||
@item x t
|
||||
Trim identical lines off the top and bottom of the difference.
|
||||
Such lines occur when the A and B versions are
|
||||
identical but differ from the ancestor version.
|
||||
@end table
|
||||
|
||||
@node Exiting Emerge
|
||||
@subsection Exiting Emerge
|
||||
|
||||
The @kbd{q} command (@code{emerge-quit}) finishes the merge, storing
|
||||
the results into the output file if you specified one. It restores the
|
||||
A and B buffers to their proper contents, or kills them if they were
|
||||
created by Emerge and you haven't changed them. It also disables the
|
||||
Emerge commands in the merge buffer, since executing them later could
|
||||
damage the contents of the various buffers.
|
||||
|
||||
@kbd{C-]} aborts the merge. This means exiting without writing the
|
||||
output file. If you didn't specify an output file, then there is no
|
||||
real difference between aborting and finishing the merge.
|
||||
|
||||
If the Emerge command was called from another Lisp program, then its
|
||||
return value is @code{t} for successful completion, or @code{nil} if you
|
||||
abort.
|
||||
|
||||
@node Combining in Emerge
|
||||
@subsection Combining the Two Versions
|
||||
|
||||
Sometimes you want to keep @emph{both} alternatives for a particular
|
||||
difference. To do this, use @kbd{x c}, which edits the merge buffer
|
||||
like this:
|
||||
|
||||
@example
|
||||
@group
|
||||
#ifdef NEW
|
||||
@var{version from A buffer}
|
||||
#else /* not NEW */
|
||||
@var{version from B buffer}
|
||||
#endif /* not NEW */
|
||||
@end group
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
@vindex emerge-combine-versions-template
|
||||
While this example shows C preprocessor conditionals delimiting the two
|
||||
alternative versions, you can specify the strings to use by setting
|
||||
the variable @code{emerge-combine-versions-template} to a string of your
|
||||
choice. In the string, @samp{%a} says where to put version A, and
|
||||
@samp{%b} says where to put version B. The default setting, which
|
||||
produces the results shown above, looks like this:
|
||||
|
||||
@example
|
||||
@group
|
||||
"#ifdef NEW\n%a#else /* not NEW */\n%b#endif /* not NEW */\n"
|
||||
@end group
|
||||
@end example
|
||||
|
||||
@node Fine Points of Emerge
|
||||
@subsection Fine Points of Emerge
|
||||
|
||||
During the merge, you mustn't try to edit the A and B buffers yourself.
|
||||
Emerge modifies them temporarily, but ultimately puts them back the way
|
||||
they were.
|
||||
|
||||
You can have any number of merges going at once---just don't use any one
|
||||
buffer as input to more than one merge at once, since the temporary
|
||||
changes made in these buffers would get in each other's way.
|
||||
|
||||
Starting Emerge can take a long time because it needs to compare the
|
||||
files fully. Emacs can't do anything else until @code{diff} finishes.
|
||||
Perhaps in the future someone will change Emerge to do the comparison in
|
||||
the background when the input files are large---then you could keep on
|
||||
doing other things with Emacs until Emerge is ready to accept
|
||||
commands.
|
||||
|
||||
@vindex emerge-startup-hook
|
||||
After setting up the merge, Emerge runs the hook
|
||||
@code{emerge-startup-hook}.
|
||||
@iftex
|
||||
@xref{Hooks,,, emacs, the Emacs Manual}.
|
||||
@end iftex
|
||||
@ifnottex
|
||||
@xref{Hooks}.
|
||||
@end ifnottex
|
||||
|
||||
@ignore
|
||||
arch-tag: cda63f09-9c5f-4ea1-adb9-4a820fdfb24e
|
||||
@end ignore
|
|
@ -1,170 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 2001, 2002, 2003,
|
||||
@c 2004, 2005, 2006, 2007 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
|
||||
@command{emacs}. Emacs clears the screen, then displays an initial
|
||||
help message and copyright notice. Some operating systems discard
|
||||
your type-ahead when Emacs starts up; they give Emacs no way to
|
||||
prevent this. On those systems, wait for Emacs to clear the screen
|
||||
before you start typing.
|
||||
|
||||
From a shell window under the X Window System, run Emacs in the
|
||||
background with @command{emacs&}. This way, Emacs won't tie up the
|
||||
shell window, so you can use it to run other shell commands while
|
||||
Emacs is running. You can type Emacs commands as soon as you direct
|
||||
your keyboard input to an Emacs frame.
|
||||
|
||||
@vindex initial-major-mode
|
||||
When Emacs starts up, it creates 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. You can also ignore that capability and just write notes
|
||||
there. 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 through Emacs command-line
|
||||
arguments. @xref{Emacs Invocation}. The feature exists mainly for
|
||||
compatibility with other editors, and for scripts.
|
||||
|
||||
Many editors are designed to edit one file. When done with that
|
||||
file, you exit the editor. The next time you want to edit a file, you
|
||||
must start the editor again. Working this way, it is convenient to
|
||||
use a command-line argument to say which file to edit.
|
||||
|
||||
However, killing Emacs after editing one each and starting it afresh
|
||||
for the next file is both unnecessary and harmful, since it denies you
|
||||
the full power of Emacs. Emacs can visit more than one file in a
|
||||
single editing session, and that is the right way to use it. Exiting
|
||||
the Emacs session loses valuable accumulated context, such as the kill
|
||||
ring, registers, undo history, and mark ring. These features are
|
||||
useful for operating on multiple files, or even continuing to edit one
|
||||
file. If you kill Emacs after each file, you don't take advantage of
|
||||
them.
|
||||
|
||||
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 edit a file, you visit it with the existing Emacs, which
|
||||
eventually has many files in it ready for editing. Usually you do not
|
||||
kill Emacs until you are about to log out. @xref{Files}, for more
|
||||
information on visiting more than one file.
|
||||
|
||||
To edit a file from another program while Emacs is running, you can
|
||||
use the @command{emacsclient} helper program to open a file in the
|
||||
already running Emacs. @xref{Emacs Server}.
|
||||
|
||||
@ifnottex
|
||||
@raisesections
|
||||
@end ifnottex
|
||||
|
||||
@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, and three kinds of
|
||||
exiting: @dfn{iconifying} Emacs, @dfn{suspending} Emacs, and
|
||||
@dfn{killing} Emacs.
|
||||
|
||||
@dfn{Iconifying} means replacing the Emacs frame with a small box or
|
||||
``icon'' on the screen. This is the usual way to exit Emacs when
|
||||
you're using a graphical display---if you bother to ``exit'' at all.
|
||||
(Just switching to another application is usually sufficient.)
|
||||
|
||||
@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. This is the usual way to
|
||||
exit Emacs when running it on a text terminal.
|
||||
|
||||
@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 iconify-or-deiconify-frame
|
||||
On graphical displays, @kbd{C-z} runs the command
|
||||
@code{iconify-or-deiconify-frame}, which temporarily iconifies (or
|
||||
``minimizes'') the selected Emacs frame (@pxref{Frames}). You can
|
||||
then use the window manager to select some other application. (You
|
||||
could select another application without iconifying Emacs first, but
|
||||
getting the Emacs frame out of the way can make it more convenient to
|
||||
find the other application.)
|
||||
|
||||
@findex suspend-emacs
|
||||
On a text terminal, @kbd{C-z} runs the command @code{suspend-emacs}.
|
||||
Suspending Emacs takes you back to the shell from which you invoked
|
||||
Emacs. You can resume Emacs with the shell command @command{%emacs}
|
||||
in most common shells. On systems that don't support suspending
|
||||
programs, @kbd{C-z} starts an inferior shell that communicates
|
||||
directly with the terminal, and Emacs waits until you exit the
|
||||
subshell. (The way to do that is probably with @kbd{C-d} or
|
||||
@command{exit}, but it depends on which shell you use.) On these
|
||||
systems, you can only get back to the shell from which Emacs was run
|
||||
(to log out, for example) when you kill Emacs.
|
||||
|
||||
@vindex cannot-suspend
|
||||
Suspending can fail if you run Emacs under a shell that doesn't
|
||||
support suspendion of its subjobs, 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.
|
||||
|
||||
@kindex C-x C-c
|
||||
@findex save-buffers-kill-emacs
|
||||
To exit and kill Emacs, type @kbd{C-x C-c}
|
||||
(@code{save-buffers-kill-emacs}). A two-character key is used to make
|
||||
it harder to type by accident. This command first offers to save any
|
||||
modified file-visiting buffers. If you do not save them all, it asks
|
||||
for confirmation with @kbd{yes} before killing Emacs, since any
|
||||
changes not saved now 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 also kill the subprocesses.
|
||||
|
||||
@vindex confirm-kill-emacs
|
||||
If the value of the variable @code{confirm-kill-emacs} is
|
||||
non-@code{nil}, @kbd{C-x C-c} assumes that its value is a predicate
|
||||
function, and calls that function. If the result is non-@code{nil}, the
|
||||
session is killed, otherwise Emacs continues to run. One convenient
|
||||
function to use as the value of @code{confirm-kill-emacs} is the
|
||||
function @code{yes-or-no-p}. The default value of
|
||||
@code{confirm-kill-emacs} is @code{nil}.
|
||||
|
||||
You can't resume an Emacs session after killing it. Emacs can,
|
||||
however, record certain session information when you kill it, such as
|
||||
which files you visited, so the next time you start Emacs it will try
|
||||
to visit the same files. @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}).
|
||||
|
||||
@ifnottex
|
||||
@lowersections
|
||||
@end ifnottex
|
||||
|
||||
@ignore
|
||||
arch-tag: df798d8b-f253-4113-b585-f528f078a944
|
||||
@end ignore
|
1027
man/erc.texi
1027
man/erc.texi
File diff suppressed because it is too large
Load diff
948
man/eshell.texi
948
man/eshell.texi
|
@ -1,948 +0,0 @@
|
|||
\input texinfo @c -*-texinfo-*-
|
||||
@c %**start of header
|
||||
@setfilename ../info/eshell
|
||||
@settitle Eshell: The Emacs Shell
|
||||
@synindex vr fn
|
||||
@c %**end of header
|
||||
|
||||
@copying
|
||||
This manual is for Eshell, the Emacs shell.
|
||||
|
||||
Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with the Front-Cover texts being ``A GNU
|
||||
Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
|
||||
license is included in the section entitled ``GNU Free Documentation
|
||||
License'' in the Emacs manual.
|
||||
|
||||
(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
|
||||
this GNU Manual, like GNU software. Copies published by the Free
|
||||
Software Foundation raise funds for GNU development.''
|
||||
|
||||
This document is part of a collection distributed under the GNU Free
|
||||
Documentation License. If you want to distribute this document
|
||||
separately from the collection, you can do so by adding a copy of the
|
||||
license to the document, as described in section 6 of the license.
|
||||
@end quotation
|
||||
@end copying
|
||||
|
||||
@dircategory Emacs
|
||||
@direntry
|
||||
* Eshell: (eshell). A command shell implemented in Emacs Lisp.
|
||||
@end direntry
|
||||
|
||||
@setchapternewpage on
|
||||
|
||||
@titlepage
|
||||
@sp 4
|
||||
@c The title is printed in a large font.
|
||||
@center @titlefont{User's Guide}
|
||||
@sp
|
||||
@center @titlefont{to}
|
||||
@sp
|
||||
@center @titlefont{Eshell: The Emacs Shell}
|
||||
@ignore
|
||||
@sp 2
|
||||
@center release 2.4
|
||||
@c -release-
|
||||
@end ignore
|
||||
@sp 3
|
||||
@center John Wiegley
|
||||
@c -date-
|
||||
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
@insertcopying
|
||||
@end titlepage
|
||||
|
||||
@contents
|
||||
|
||||
@c ================================================================
|
||||
@c The real text starts here
|
||||
@c ================================================================
|
||||
|
||||
@ifnottex
|
||||
@node Top, What is Eshell?, (dir), (dir)
|
||||
@top Eshell
|
||||
|
||||
This manual documents Eshell, a shell-like command interpretor
|
||||
implemented in Emacs Lisp. It invokes no external processes except for
|
||||
those requested by the user. It is intended to be a functional
|
||||
replacement for command shells such as @command{bash}, @command{zsh},
|
||||
@command{rc}, or @command{4dos}; since Emacs itself is capable of
|
||||
handling the sort of tasks accomplished by those tools.
|
||||
@c This manual is updated to release 2.4 of Eshell.
|
||||
@end ifnottex
|
||||
|
||||
@menu
|
||||
* What is Eshell?:: A brief introduction to the Emacs Shell.
|
||||
* Command basics:: The basics of command usage.
|
||||
* Commands::
|
||||
* Arguments::
|
||||
* Input/Output::
|
||||
* Process control::
|
||||
* Extension modules::
|
||||
* Extras and Goodies::
|
||||
* Bugs and ideas:: Known problems, and future ideas.
|
||||
* GNU Free Documentation License:: The license for this documentation.
|
||||
* Concept Index::
|
||||
* Function and Variable Index::
|
||||
* Key Index::
|
||||
@end menu
|
||||
|
||||
@node What is Eshell?
|
||||
@chapter What is Eshell?
|
||||
@cindex what is Eshell?
|
||||
@cindex Eshell, what it is
|
||||
|
||||
Eshell is a @dfn{command shell} written in Emacs Lisp. Everything it
|
||||
does, it uses Emacs' facilities to do. This means that Eshell is as
|
||||
portable as Emacs itself. It also means that cooperation with Lisp code
|
||||
is natural and seamless.
|
||||
|
||||
What is a command shell? To properly understand the role of a shell,
|
||||
it's necessary to visualize what a computer does for you. Basically, a
|
||||
computer is a tool; in order to use that tool, you must tell it what to
|
||||
do---or give it ``commands.'' These commands take many forms, such as
|
||||
clicking with a mouse on certain parts of the screen. But that is only
|
||||
one form of command input.
|
||||
|
||||
By far the most versatile way to express what you want the computer to
|
||||
do is by using an abbreviated language called @dfn{script}. In
|
||||
script, instead of telling the computer, ``list my files, please'',
|
||||
one writes a standard abbreviated command word---@samp{ls}. Typing
|
||||
@samp{ls} in a command shell is a script way of telling the computer
|
||||
to list your files.@footnote{This is comparable to viewing the
|
||||
contents of a folder using a graphical display.}
|
||||
|
||||
The real flexibility of this approach is apparent only when you realize
|
||||
that there are many, many different ways to list files. Perhaps you
|
||||
want them sorted by name, sorted by date, in reverse order, or grouped
|
||||
by type. Most graphical browsers have simple ways to express this. But
|
||||
what about showing only a few files, or only files that meet a certain
|
||||
criteria? In very complex and specific situations, the request becomes
|
||||
too difficult to express using a mouse or pointing device. It is just
|
||||
these kinds of requests that are easily solved using a command shell.
|
||||
|
||||
For example, what if you want to list every Word file on your hard
|
||||
drive, larger than 100 kilobytes in size, and which hasn't been looked
|
||||
at in over six months? That is a good candidate list for deletion, when
|
||||
you go to clean up your hard drive. But have you ever tried asking your
|
||||
computer for such a list? There is no way to do it! At least, not
|
||||
without using a command shell.
|
||||
|
||||
The role of a command shell is to give you more control over what your
|
||||
computer does for you. Not everyone needs this amount of control, and
|
||||
it does come at a cost: Learning the necessary script commands to
|
||||
express what you want done. A complicated query, such as the example
|
||||
above, takes time to learn. But if you find yourself using your
|
||||
computer frequently enough, it is more than worthwhile in the long run.
|
||||
Any tool you use often deserves the time spent learning to master it.
|
||||
@footnote{For the understandably curious, here is what that command
|
||||
looks like: But don't let it fool you; once you know what's going on,
|
||||
it's easier than it looks: @code{ls -lt **/*.doc(Lk+50aM+5)}.}
|
||||
|
||||
@menu
|
||||
* Contributors to Eshell:: People who have helped out!
|
||||
@end menu
|
||||
|
||||
@node Contributors to Eshell
|
||||
@section Contributors to Eshell
|
||||
@cindex contributors
|
||||
@cindex authors
|
||||
|
||||
Contributions to Eshell are welcome. I have limited time to work on
|
||||
this project, but I will gladly add any code you contribute to me to
|
||||
this package.
|
||||
|
||||
The following persons have made contributions to Eshell.
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Eli Zaretskii made it possible for Eshell to run without requiring
|
||||
asynchronous subprocess support. This is important for MS-DOS, which
|
||||
does not have such support.@refill
|
||||
|
||||
@item
|
||||
Miles Bader contributed many fixes during the port to Emacs 21.@refill
|
||||
|
||||
@item
|
||||
Stefan Monnier fixed the things which bothered him, which of course made
|
||||
things better for all.@refill
|
||||
|
||||
@item
|
||||
Gerd Moellmann also helped to contribute bug fixes during the initial
|
||||
integration with Emacs 21.@refill
|
||||
|
||||
@item
|
||||
Alex Schroeder contributed code for interactively querying the user
|
||||
before overwriting files.@refill
|
||||
|
||||
@item
|
||||
Sudish Joseph helped with some XEmacs compatibility issues.@refill
|
||||
@end itemize
|
||||
|
||||
Apart from these, a lot of people have sent suggestions, ideas,
|
||||
requests, bug reports and encouragement. Thanks a lot! Without you
|
||||
there would be no new releases of Eshell.
|
||||
|
||||
@node Command basics
|
||||
@chapter Basic overview
|
||||
|
||||
A command shell is a means of entering verbally-formed commands. This
|
||||
is really all that it does, and every feature described in this manual
|
||||
is a means to that end. Therefore, it's important to take firm hold on
|
||||
exactly what a command is, and how it fits in the overall picture of
|
||||
things.
|
||||
|
||||
@menu
|
||||
* Commands verbs:: Commands always begin with a verb.
|
||||
* Command arguments:: Some verbs require arguments.
|
||||
@end menu
|
||||
|
||||
@node Commands verbs
|
||||
@section Commands verbs
|
||||
|
||||
Commands are expressed using @dfn{script}, a special shorthand language
|
||||
computers can understand with no trouble. Script is an extremely simple
|
||||
language; oddly enough, this is what makes it look so complicated!
|
||||
Whereas normal languages use a variety of embellishments, the form of a
|
||||
script command is always:
|
||||
|
||||
@example
|
||||
@var{verb} [@var{arguments}]
|
||||
@end example
|
||||
|
||||
The verb expresses what you want your computer to do. There are a fixed
|
||||
number of verbs, although this number is usually quite large. On the
|
||||
author's computer, it reaches almost 1400 in number. But of course,
|
||||
only a handful of these are really necessary.
|
||||
|
||||
Sometimes, the verb is all that's written. A verb is always a single
|
||||
word, usually related to the task it performs. @command{reboot} is a
|
||||
good example. Entering that on GNU/Linux will reboot the
|
||||
computer---assuming you have sufficient privileges.
|
||||
|
||||
Other verbs require more information. These are usually very capable
|
||||
verbs, and must be told specifically what to do. The extra information
|
||||
is given in the form of @dfn{arguments}. For example, the
|
||||
@command{echo} verb prints back whatever arguments you type. It
|
||||
requires these arguments to know what to echo. A proper use of
|
||||
@command{echo} looks like this:
|
||||
|
||||
@example
|
||||
echo This is an example of using echo!
|
||||
@end example
|
||||
|
||||
This script command causes the computer to echo back: ``This is an
|
||||
example of using echo!''
|
||||
|
||||
Although command verbs are always simple words, like @command{reboot} or
|
||||
@command{echo}, arguments may have a wide variety of forms. There are
|
||||
textual arguments, numerical arguments---even Lisp arguments.
|
||||
Distinguishing these different types of arguments requires special
|
||||
typing, for the computer to know exactly what you mean.
|
||||
|
||||
@node Command arguments
|
||||
@section Command arguments
|
||||
|
||||
Eshell recognizes several different kinds of command arguments:
|
||||
|
||||
@enumerate
|
||||
@item Strings (also called textual arguments)
|
||||
@item Numbers (floating point or integer)
|
||||
@item Lisp lists
|
||||
@item Lisp symbols
|
||||
@item Emacs buffers
|
||||
@item Emacs process handles
|
||||
@end enumerate
|
||||
|
||||
Most users need to worry only about the first two. The third, Lisp lists,
|
||||
occur very frequently, but almost always behind the scenes.
|
||||
|
||||
Strings are the most common type of argument, and consist of nearly any
|
||||
character. Special characters---those used by Eshell
|
||||
specifically---must be preceded by a backslash (@samp{\}). When in doubt, it
|
||||
is safe to add backslashes anywhere and everywhere.
|
||||
|
||||
Here is a more complicated @command{echo} example:
|
||||
|
||||
@example
|
||||
echo A\ Multi-word\ Argument\ With\ A\ \$\ dollar
|
||||
@end example
|
||||
|
||||
Beyond this, things get a bit more complicated. While not beyond the
|
||||
reach of someone wishing to learn, it is definitely beyond the scope of
|
||||
this manual to present it all in a simplistic manner. Get comfortable
|
||||
with Eshell as a basic command invocation tool, and learn more about the
|
||||
commands on your system; then come back when it all sits more familiarly
|
||||
on your mind. Have fun!
|
||||
|
||||
@node Commands
|
||||
@chapter Commands
|
||||
|
||||
@menu
|
||||
* Invocation::
|
||||
* Completion::
|
||||
* Aliases::
|
||||
* History::
|
||||
* Scripts::
|
||||
* Built-ins::
|
||||
@end menu
|
||||
|
||||
Essentially, a command shell is all about invoking commands---and
|
||||
everything that entails. So understanding how Eshell invokes commands
|
||||
is the key to comprehending how it all works.
|
||||
|
||||
@node Invocation
|
||||
@section Invocation
|
||||
|
||||
Unlike regular system shells, Eshell never invokes kernel functions
|
||||
directly, such as @code{exec(3)}. Instead, it uses the Lisp functions
|
||||
available in the Emacs Lisp library. It does this by transforming the
|
||||
command you specify into a callable Lisp form.@footnote{To see the Lisp
|
||||
form that will be invoked, type: @samp{eshell-parse-command "echo
|
||||
hello"}}
|
||||
|
||||
This transformation, from the string of text typed at the command
|
||||
prompt, to the ultimate invocation of either a Lisp function or external
|
||||
command, follows these steps:
|
||||
|
||||
@enumerate
|
||||
@item Parse the command string into separate arguments.
|
||||
@item
|
||||
@end enumerate
|
||||
|
||||
@node Completion
|
||||
@section Completion
|
||||
|
||||
@node Aliases
|
||||
@section Aliases
|
||||
|
||||
@node History
|
||||
@section History
|
||||
|
||||
Eshell knows a few built-in variables:
|
||||
|
||||
@table @code
|
||||
|
||||
@item $+
|
||||
@vindex $+
|
||||
This variable always contains the current working directory.
|
||||
|
||||
@item $-
|
||||
@vindex $-
|
||||
This variable always contains the previous working directory (the
|
||||
current working directory from before the last @code{cd} command).
|
||||
|
||||
@end table
|
||||
|
||||
@node Scripts
|
||||
@section Scripts
|
||||
|
||||
|
||||
@node Built-ins
|
||||
@section Built-in commands
|
||||
|
||||
Here is a list of built-in commands that Eshell knows about:
|
||||
|
||||
@table @code
|
||||
|
||||
@item cd
|
||||
@findex cd
|
||||
This command changes the current working directory. Usually, it is
|
||||
invoked as @samp{cd foo} where @file{foo} is the new working
|
||||
directory. But @code{cd} knows about a few special arguments:
|
||||
|
||||
When it receives no argument at all, it changes to the home directory.
|
||||
|
||||
Giving the command @samp{cd -} changes back to the previous working
|
||||
directory (this is the same as @samp{cd $-}).
|
||||
|
||||
The command @samp{cd =} shows the directory stack. Each line is
|
||||
numbered.
|
||||
|
||||
With @samp{cd =foo}, Eshell searches the directory stack for a
|
||||
directory matching the regular expression @samp{foo} and changes to
|
||||
that directory.
|
||||
|
||||
With @samp{cd -42}, you can access the directory stack by number.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@node Arguments
|
||||
@chapter Arguments
|
||||
|
||||
@menu
|
||||
* The Parser::
|
||||
* Variables::
|
||||
* Substitution::
|
||||
* Globbing::
|
||||
* Predicates::
|
||||
@end menu
|
||||
|
||||
@node The Parser
|
||||
@section The Parser
|
||||
|
||||
@node Variables
|
||||
@section Variables
|
||||
|
||||
@node Substitution
|
||||
@section Substitution
|
||||
|
||||
@node Globbing
|
||||
@section Globbing
|
||||
|
||||
@node Predicates
|
||||
@section Predicates
|
||||
|
||||
|
||||
@node Input/Output
|
||||
@chapter Input/Output
|
||||
|
||||
@node Process control
|
||||
@chapter Process control
|
||||
|
||||
|
||||
@node Extension modules
|
||||
@chapter Extension modules
|
||||
|
||||
@menu
|
||||
* Writing a module::
|
||||
* Module testing::
|
||||
* Directory handling::
|
||||
* Key rebinding::
|
||||
* Smart scrolling::
|
||||
* Terminal emulation::
|
||||
* Built-in UNIX commands::
|
||||
@end menu
|
||||
|
||||
@node Writing a module
|
||||
@section Writing a module
|
||||
|
||||
@node Module testing
|
||||
@section Module testing
|
||||
|
||||
@node Directory handling
|
||||
@section Directory handling
|
||||
|
||||
@node Key rebinding
|
||||
@section Key rebinding
|
||||
|
||||
@node Smart scrolling
|
||||
@section Smart scrolling
|
||||
|
||||
@node Terminal emulation
|
||||
@section Terminal emulation
|
||||
|
||||
@node Built-in UNIX commands
|
||||
@section Built-in UNIX commands
|
||||
|
||||
|
||||
@node Extras and Goodies
|
||||
@chapter Extras and Goodies
|
||||
|
||||
@node Bugs and ideas
|
||||
@chapter Bugs and ideas
|
||||
@cindex reporting bugs and ideas
|
||||
@cindex bugs, how to report them
|
||||
@cindex author, how to reach
|
||||
@cindex email to the author
|
||||
@cindex FAQ
|
||||
@cindex problems, list of common
|
||||
|
||||
If you find a bug or misfeature, don't hesitate to let me know! Send
|
||||
email to @email{johnw@@gnu.org}. Feature requests should also be sent
|
||||
there. I prefer discussing one thing at a time. If you find several
|
||||
unrelated bugs, please report them separately.
|
||||
|
||||
If you have ideas for improvements, or if you have written some
|
||||
extensions to this package, I would like to hear from you. I hope you
|
||||
find this package useful!
|
||||
|
||||
@menu
|
||||
* Known problems::
|
||||
@end menu
|
||||
|
||||
@node Known problems
|
||||
@section Known problems
|
||||
@cindex known bugs
|
||||
@cindex bugs, known
|
||||
|
||||
Below is complete list of known problems with Eshell version 2.4.2,
|
||||
which is the version included with Emacs 22.
|
||||
|
||||
@table @asis
|
||||
@item Documentation incomplete
|
||||
|
||||
@item Differentiate between aliases and functions
|
||||
|
||||
Allow for a bash-compatible syntax, such as:
|
||||
|
||||
@example
|
||||
alias arg=blah
|
||||
function arg () @{ blah $* @}
|
||||
@end example
|
||||
|
||||
@item @samp{for i in 1 2 3 @{ grep -q a b && *echo has it @} | wc -l} outputs result after prompt
|
||||
|
||||
In fact, piping to a process from a looping construct doesn't work in
|
||||
general. If I change the call to @code{eshell-copy-handles} in
|
||||
@code{eshell-rewrite-for-command} to use @code{eshell-protect}, it seems
|
||||
to work, but the output occurs after the prompt is displayed. The whole
|
||||
structured command thing is too complicated at present.
|
||||
|
||||
@item Error with @command{bc} in @code{eshell-test}
|
||||
|
||||
On some XEmacs system, the subprocess interaction test fails
|
||||
inexplicably, although @command{bc} works fine at the command prompt.
|
||||
|
||||
@item Eshell does not delete @file{*Help*} buffers in XEmacs 21.1.8+
|
||||
|
||||
In XEmacs 21.1.8, the @file{*Help*} buffer has been renamed such that
|
||||
multiple instances of the @file{*Help*} buffer can exist.
|
||||
|
||||
@item Pcomplete sometimes gets stuck
|
||||
|
||||
You press @key{TAB}, but no completions appear, even though the
|
||||
directory has matching files. This behavior is rare.
|
||||
|
||||
@item @samp{grep python $<rpm -qa>} doesn't work, but using @samp{*grep} does
|
||||
|
||||
This happens because the @code{grep} Lisp function returns immediately,
|
||||
and then the asynchronous @command{grep} process expects to examine the
|
||||
temporary file, which has since been deleted.
|
||||
|
||||
@item Problem with C-r repeating text
|
||||
|
||||
If the text @emph{before point} reads "./run", and you type @kbd{C-r r u
|
||||
n}, it will repeat the line for every character typed.
|
||||
|
||||
@item Backspace doesn't scroll back after continuing (in smart mode)
|
||||
|
||||
Hitting space during a process invocation, such as @command{make}, will
|
||||
cause it to track the bottom of the output; but backspace no longer
|
||||
scrolls back.
|
||||
|
||||
@item It's not possible to fully @code{unload-feature} Eshell
|
||||
|
||||
@item Menu support was removed, but never put back
|
||||
|
||||
@item Using C-p and C-n with rebind gets into a locked state
|
||||
|
||||
This happened a few times in Emacs 21, but has been unreproducible
|
||||
since.
|
||||
|
||||
@item If an interactive process is currently running, @kbd{M-!} doesn't work
|
||||
|
||||
@item Use a timer instead of @code{sleep-for} when killing child processes
|
||||
|
||||
@item Piping to a Lisp function is not supported
|
||||
|
||||
Make it so that the Lisp command on the right of the pipe is repeatedly
|
||||
called with the input strings as arguments. This will require changing
|
||||
@code{eshell-do-pipeline} to handle non-process targets.
|
||||
|
||||
@item Input redirection is not supported
|
||||
|
||||
See the above entry.
|
||||
|
||||
@item Problem running @command{less} without arguments on Windows
|
||||
|
||||
The result in the Eshell buffer is:
|
||||
|
||||
@example
|
||||
Spawning child process: invalid argument
|
||||
@end example
|
||||
|
||||
Also a new @command{less} buffer was created with nothing in it@dots{}
|
||||
(presumably this holds the output of @command{less}).
|
||||
|
||||
If @command{less.exe} is invoked from the Eshell command line, the
|
||||
expected output is written to the buffer.
|
||||
|
||||
Note that this happens on NT-Emacs 20.6.1 on Windows 2000. The term.el
|
||||
package and the supplied shell both use the @command{cmdproxy} program
|
||||
for running shells.
|
||||
|
||||
@item Implement @samp{-r}, @samp{-n} and @samp{-s} switches for @command{cp}
|
||||
|
||||
@item Make @kbd{M-5 M-x eshell} switch to ``*eshell<5>*'', creating if need be
|
||||
|
||||
@item @samp{mv @var{dir} @var{file}.tar} does not remove directories
|
||||
|
||||
This is because the tar option --remove-files doesn't do so. Should it
|
||||
be Eshell's job?
|
||||
|
||||
@item Bind @code{standard-output} and @code{standard-error}
|
||||
|
||||
This would be so that if a Lisp function calls @code{print}, everything
|
||||
will happen as it should (albeit slowly).
|
||||
|
||||
@item When an extension module fails to load, @samp{cd /} gives a Lisp error
|
||||
|
||||
@item If a globbing pattern returns one match, should it be a list?
|
||||
|
||||
@item Make sure syntax table is correct in Eshell mode
|
||||
|
||||
So that @kbd{M-DEL} acts in a predictable manner, etc.
|
||||
|
||||
@item Allow all Eshell buffers to share the same history and list-dir
|
||||
|
||||
@item There is a problem with script commands that output to @file{/dev/null}
|
||||
|
||||
If a script file, somewhere in the middle, uses @samp{> /dev/null},
|
||||
output from all subsequent commands is swallowed.
|
||||
|
||||
@item Split up parsing of text after @samp{$} in @file{esh-var.el}
|
||||
|
||||
Make it similar to the way that @file{esh-arg.el} is structured.
|
||||
Then add parsing of @samp{$[?\n]}.
|
||||
|
||||
@item After pressing @kbd{M-RET}, redisplay before running the next command
|
||||
|
||||
@item Argument predicates and modifiers should work anywhere in a path
|
||||
|
||||
@example
|
||||
/usr/local/src/editors/vim $ vi **/CVS(/)/Root(.)
|
||||
Invalid regexp: "Unmatched ( or \\("
|
||||
@end example
|
||||
|
||||
With @command{zsh}, the glob above expands to all files named
|
||||
@file{Root} in directories named @file{CVS}.
|
||||
|
||||
@item Typing @samp{echo $@{locate locate@}/bin<TAB>} results in a Lisp error
|
||||
|
||||
Perhaps it should interpolate all permutations, and make that the
|
||||
globbing result, since otherwise hitting return here will result in
|
||||
``(list of filenames)/bin'', which is never valuable. Thus, one could
|
||||
@command{cat} only C backup files by using @samp{ls $@{identity *.c@}~}.
|
||||
In that case, having an alias command name @command{glob} for
|
||||
@command{identity} would be useful.
|
||||
|
||||
@item Once symbolic mode is supported for @command{umask}, implement @command{chmod} in Lisp
|
||||
|
||||
@item Create @code{eshell-expand-file-name}
|
||||
|
||||
This would use a data table to transform things such as @samp{~+},
|
||||
@samp{...}, etc.
|
||||
|
||||
@item Abstract @file{em-smart.el} into @file{smart-scroll.el}
|
||||
|
||||
It only really needs: to be hooked onto the output filter and the
|
||||
pre-command hook, and to have the input-end and input-start markers.
|
||||
And to know whether the last output group was ``successful.''
|
||||
|
||||
@item Allow for fully persisting the state of Eshell
|
||||
|
||||
This would include: variables, history, buffer, input, dir stack, etc.
|
||||
|
||||
@item Implement D as an argument predicate
|
||||
|
||||
It means that files beginning with a dot should be included in the
|
||||
glob match.
|
||||
|
||||
@item A comma in a predicate list should mean OR
|
||||
|
||||
At the moment, this is not supported.
|
||||
|
||||
@item Error if a glob doesn't expand due to a predicate
|
||||
|
||||
An error should be generated only if @code{eshell-error-if-no-glob} is
|
||||
non-@code{nil}.
|
||||
|
||||
@item @samp{(+ RET SPC TAB} does not cause @code{indent-according-to-mode} to occur
|
||||
|
||||
@item Create @code{eshell-auto-accumulate-list}
|
||||
|
||||
This is a list of commands for which, if the user presses @kbd{RET}, the
|
||||
text is staged as the next Eshell command, rather than being sent to the
|
||||
current interactive process.
|
||||
|
||||
@item Display file and line number if an error occurs in a script
|
||||
|
||||
@item @command{wait} doesn't work with process ids at the moment
|
||||
|
||||
@item Enable the direct-to-process input code in @file{em-term.el}
|
||||
|
||||
@item Problem with repeating @samp{echo $@{find /tmp@}}
|
||||
|
||||
With smart display active, if @kbd{RET} is held down, after a while it
|
||||
can't keep up anymore and starts outputting blank lines. It only
|
||||
happens if an asynchronous process is involved@dots{}
|
||||
|
||||
I think the problem is that @code{eshell-send-input} is resetting the
|
||||
input target location, so that if the asynchronous process is not done
|
||||
by the time the next @kbd{RET} is received, the input processor thinks
|
||||
that the input is meant for the process; which, when smart display is
|
||||
enabled, will be the text of the last command line! That is a bug in
|
||||
itself.
|
||||
|
||||
In holding down @kbd{RET} while an asynchronous process is running,
|
||||
there will be a point in between termination of the process, and the
|
||||
running of @code{eshell-post-command-hook}, which would cause
|
||||
@code{eshell-send-input} to call @code{eshell-copy-old-input}, and then
|
||||
process that text as a command to be run after the process. Perhaps
|
||||
there should be a way of killing pending input between the death of the
|
||||
process, and the @code{post-command-hook}.
|
||||
|
||||
@item Allow for a more aggressive smart display mode
|
||||
|
||||
Perhaps toggled by a command, that makes each output block a smart
|
||||
display block.
|
||||
|
||||
@item Create more meta variables
|
||||
|
||||
@table @samp
|
||||
@item $!
|
||||
The reason for the failure of the last disk command, or the text of the
|
||||
last Lisp error.
|
||||
|
||||
@item $=
|
||||
A special associate array, which can take references of the form
|
||||
@samp{$=[REGEXP]}. It indexes into the directory ring.
|
||||
@end table
|
||||
|
||||
@item Eshell scripts can't execute in the background
|
||||
|
||||
@item Support zsh's ``Parameter Expansion'' syntax, i.e. @samp{$@{@var{name}:-@var{val}@}}
|
||||
|
||||
@item Write an @command{info} alias that can take arguments
|
||||
|
||||
So that the user can enter @samp{info chmod}, for example.
|
||||
|
||||
@item Create a mode @code{eshell-browse}
|
||||
|
||||
It would treat the Eshell buffer as a outline. Collapsing the outline
|
||||
hides all of the output text. Collapsing again would show only the
|
||||
first command run in each directory
|
||||
|
||||
@item Allow other revisions of a file to be referenced using @samp{file@{rev@}}
|
||||
|
||||
This would be expanded by @code{eshell-expand-file-name} (see above).
|
||||
|
||||
@item Print ``You have new mail'' when the ``Mail'' icon is turned on
|
||||
|
||||
@item Implement @kbd{M-|} for Eshell
|
||||
|
||||
@item Implement input redirection
|
||||
|
||||
If it's a Lisp function, input redirection implies @command{xargs} (in a
|
||||
way@dots{}). If input redirection is added, also update the
|
||||
@code{file-name-quote-list}, and the delimiter list.
|
||||
|
||||
@item Allow @samp{#<@var{word} @var{arg}>} as a generic syntax
|
||||
|
||||
With the handling of @emph{word} specified by an
|
||||
@code{eshell-special-alist}.
|
||||
|
||||
@item In @code{eshell-veal-using-options}, allow a @code{:complete} tag
|
||||
|
||||
It would be used to provide completion rules for that command. Then the
|
||||
macro will automagically define the completion function.
|
||||
|
||||
@item For @code{eshell-command-on-region}, apply redirections to the result
|
||||
|
||||
So that @samp{+ > 'blah} would cause the result of the @code{+} (using
|
||||
input from the current region) to be inserting into the symbol
|
||||
@code{blah}.
|
||||
|
||||
If an external command is being invoked, the input is sent as standard
|
||||
input, as if a @samp{cat <region> |} had been invoked.
|
||||
|
||||
If a Lisp command, or an alias, is invoked, then if the line has no
|
||||
newline characters, it is divided by whitespace and passed as arguments
|
||||
to the Lisp function. Otherwise, it is divided at the newline
|
||||
characters. Thus, invoking @code{+} on a series of numbers will add
|
||||
them; @code{min} would display the smallest figure, etc.
|
||||
|
||||
@item Write @code{eshell-script-mode} as a minor mode
|
||||
|
||||
It would provide syntax, abbrev, highlighting and indenting support like
|
||||
@code{emacs-lisp-mode} and @code{shell-mode}.
|
||||
|
||||
@item In the history mechanism, finish the @command{bash}-style support
|
||||
|
||||
This means @samp{!n}, @samp{!#}, @samp{!:%}, and @samp{!:1-} as separate
|
||||
from @samp{!:1*}.
|
||||
|
||||
@item Support the -n command line option for @command{history}
|
||||
|
||||
@item Implement @command{fc} in Lisp
|
||||
|
||||
@item Specifying a frame as a redirection target should imply the currently active window's buffer
|
||||
|
||||
@item Implement @samp{>@var{func-or-func-list}}
|
||||
|
||||
This would allow for an ``output translators'', that take a function to
|
||||
modify output with, and a target. Devise a syntax that works well with
|
||||
pipes, and can accommodate multiple functions (i.e., @samp{>'(upcase
|
||||
regexp-quote)} or @samp{>'upcase}).
|
||||
|
||||
@item Allow Eshell to read/write to/from standard input and output
|
||||
|
||||
This would be optional, rather than always using the Eshell buffer.
|
||||
This would allow it to be run from the command line (perhaps).
|
||||
|
||||
@item Write a @command{help} command
|
||||
|
||||
It would call subcommands with @option{--help}, or @option{-h} or
|
||||
@option{/?}, as appropriate.
|
||||
|
||||
@item Implement @command{stty} in Lisp
|
||||
|
||||
@item Support @command{rc}'s matching operator, e.g. @samp{~ (@var{list}) @var{regexp}}
|
||||
|
||||
@item Implement @command{bg} and @command{fg} as editors of @code{eshell-process-list}
|
||||
|
||||
Using @command{bg} on a process that is already in the background does
|
||||
nothing. Specifying redirection targets replaces (or adds) to the list
|
||||
current being used.
|
||||
|
||||
@item Have @command{jobs} print only the processes for the current shell
|
||||
|
||||
@item How can Eshell learn if a background process has requested input?
|
||||
|
||||
@item Support @samp{2>&1} and @samp{>&} and @samp{2>} and @samp{|&}
|
||||
|
||||
The syntax table for parsing these should be customizable, such that the
|
||||
user could change it to use rc syntax: @samp{>[2=1]}.
|
||||
|
||||
@item Allow @samp{$_[-1]}, which would indicate the last element of the array
|
||||
|
||||
@item Make @samp{$x[*]} equal to listing out the full contents of @samp{x}
|
||||
|
||||
Return them as a list, so that @samp{$_[*]} is all the arguments of the
|
||||
last command.
|
||||
|
||||
@item Copy ANSI code handling from @file{term.el} into @file{em-term.el}
|
||||
|
||||
Make it possible for the user to send char-by-char to the underlying
|
||||
process. Ultimately, I should be able to move away from using term.el
|
||||
altogether, since everything but the ANSI code handling is already part
|
||||
of Eshell. Then, things would work correctly on MS-Windows as well
|
||||
(which doesn't have @file{/bin/sh}, although @file{term.el} tries to use
|
||||
it).
|
||||
|
||||
@item Make the shell spawning commands be visual
|
||||
|
||||
That is, make (@command{su}, @command{bash}, @command{telnet},
|
||||
@command{rlogin}, @command{rsh}, etc.) be part of
|
||||
@code{eshell-visual-commands}. The only exception is if the shell is
|
||||
being used to invoke a single command. Then, the behavior should be
|
||||
based on what that command is.
|
||||
|
||||
@item Create a smart viewing command named @command{open}
|
||||
|
||||
This would search for some way to open its argument (similar to opening
|
||||
a file in the Windows Explorer).
|
||||
|
||||
@item Alias @command{read} to be the same as @command{open}, only read-only
|
||||
|
||||
@item Write a @command{tail} command which uses @code{view-file}
|
||||
|
||||
It would move point to the end of the buffer, and then turns on
|
||||
auto-revert mode in that buffer at frequent intervals---and a
|
||||
@command{head} alias which assumes an upper limit of
|
||||
@code{eshell-maximum-line-length} characters per line.
|
||||
|
||||
@item Make @command{dgrep} load @code{dired}, mark everything, then invoke @code{dired-do-search}
|
||||
|
||||
@item Write mesh.c
|
||||
|
||||
This would run Emacs with the appropriate arguments to invoke Eshell
|
||||
only. That way, it could be listed as a login shell.
|
||||
|
||||
@item Use an intangible @code{PS2} string for multi-line input prompts
|
||||
|
||||
@item Auto-detect when a command is visual, by checking @code{TERMCAP} usage
|
||||
|
||||
@item The first keypress after @kbd{M-x watson} triggers `eshell-send-input'
|
||||
|
||||
@item Make @kbd{/} electric
|
||||
|
||||
So that it automatically expands and corrects pathnames. Or make
|
||||
pathname completion for Pcomplete auto-expand @samp{/u/i/std<TAB>} to
|
||||
@samp{/usr/include/std<TAB>}.
|
||||
|
||||
@item Write the @command{pushd} stack to disk along with @code{last-dir-ring}
|
||||
|
||||
@item Add options to @code{eshell/cat} which would allow it to sort and uniq
|
||||
|
||||
@item Implement @command{wc} in Lisp
|
||||
|
||||
Add support for counting sentences, paragraphs, pages, etc.
|
||||
|
||||
@item Once piping is added, implement @command{sort} and @command{uniq} in Lisp
|
||||
|
||||
@item Implement @command{touch} in Lisp
|
||||
|
||||
@item Implement @command{comm} in Lisp
|
||||
|
||||
@item Implement an @command{epatch} command in Lisp
|
||||
|
||||
This would call @code{ediff-patch-file}, or @code{ediff-patch-buffer},
|
||||
depending on its argument.
|
||||
|
||||
@item Have an option such that @samp{ls -l} generates a dired buffer
|
||||
|
||||
@item Write a version of @command{xargs} based on command rewriting
|
||||
|
||||
That is, @samp{find X | xargs Y} would be indicated using @samp{Y
|
||||
$@{find X@}}. Maybe @code{eshell-do-pipelines} could be changed to
|
||||
perform this on-thy-fly rewriting.
|
||||
|
||||
@item Write an alias for @command{less} that brings up a @code{view-mode} buffer
|
||||
|
||||
Such that the user can press @key{SPC} and @key{DEL}, and then @key{q}
|
||||
to return to Eshell. It would be equivalent to:
|
||||
@samp{X > #<buffer Y>; view-buffer #<buffer Y>}.
|
||||
|
||||
@item Make @code{eshell-mode} as much a full citizen as @code{shell-mode}
|
||||
|
||||
Everywhere in Emacs where @code{shell-mode} is specially noticed, add
|
||||
@code{eshell-mode} there.
|
||||
|
||||
@item Permit the umask to be selectively set on a @command{cp} target
|
||||
|
||||
@item Problem using @kbd{M-x eshell} after using @code{eshell-command}
|
||||
|
||||
If the first thing that I do after entering Emacs is to run
|
||||
@code{eshell-command} and invoke @command{ls}, and then use @kbd{M-x
|
||||
eshell}, it doesn't display anything.
|
||||
|
||||
@item @kbd{M-RET} during a long command (using smart display) doesn't work
|
||||
|
||||
Since it keeps the cursor up where the command was invoked.
|
||||
|
||||
@end table
|
||||
|
||||
@node GNU Free Documentation License
|
||||
@appendix GNU Free Documentation License
|
||||
@include doclicense.texi
|
||||
|
||||
@node Concept Index
|
||||
@unnumbered Concept Index
|
||||
|
||||
@printindex cp
|
||||
|
||||
@node Function and Variable Index
|
||||
@unnumbered Function and Variable Index
|
||||
|
||||
@printindex fn
|
||||
|
||||
@node Key Index
|
||||
@unnumbered Key Index
|
||||
|
||||
@printindex ky
|
||||
@bye
|
||||
|
||||
@ignore
|
||||
arch-tag: 776409ba-cb15-42b9-b2b6-d2bdc7ebad01
|
||||
@end ignore
|
985
man/eudc.texi
985
man/eudc.texi
|
@ -1,985 +0,0 @@
|
|||
\input texinfo.tex
|
||||
@c %**start of header
|
||||
@setfilename ../info/eudc
|
||||
@settitle Emacs Unified Directory Client (EUDC) Manual
|
||||
@afourpaper
|
||||
@c %**end of header
|
||||
|
||||
@copying
|
||||
This file documents EUDC v1.30b.
|
||||
|
||||
EUDC is the Emacs Unified Directory Client, a common interface to
|
||||
directory servers using various protocols such as LDAP or the CCSO white
|
||||
pages directory system (PH/QI)
|
||||
|
||||
Copyright @copyright{} 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with the Front-Cover texts being ``A GNU
|
||||
Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
|
||||
license is included in the section entitled ``GNU Free Documentation
|
||||
License'' in the Emacs manual.
|
||||
|
||||
(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
|
||||
this GNU Manual, like GNU software. Copies published by the Free
|
||||
Software Foundation raise funds for GNU development.''
|
||||
|
||||
This document is part of a collection distributed under the GNU Free
|
||||
Documentation License. If you want to distribute this document
|
||||
separately from the collection, you can do so by adding a copy of the
|
||||
license to the document, as described in section 6 of the license.
|
||||
@end quotation
|
||||
@end copying
|
||||
|
||||
@dircategory Emacs
|
||||
@direntry
|
||||
* EUDC: (eudc). An Emacs client for directory servers (LDAP, PH).
|
||||
@end direntry
|
||||
|
||||
@footnotestyle end
|
||||
|
||||
@titlepage
|
||||
@title{EUDC Manual}
|
||||
@subtitle{The Emacs Unified Directory Client}
|
||||
@author by Oscar Figueiredo
|
||||
@code{1.30b}
|
||||
|
||||
@page
|
||||
@vskip 0pt plus 1fill
|
||||
@insertcopying
|
||||
@end titlepage
|
||||
|
||||
@ifnottex
|
||||
@node Top, Overview, (dir), (dir)
|
||||
@comment node-name, next, previous, up
|
||||
|
||||
|
||||
This manual documents EUDC v1.30b, the Emacs Unified Directory Client.
|
||||
|
||||
A common interface to directory servers using various protocols such as
|
||||
LDAP or the CCSO white pages directory system (PH/QI)
|
||||
|
||||
@end ifnottex
|
||||
|
||||
@menu
|
||||
* Overview:: Summary of EUDC features
|
||||
* Installation:: How to install EUDC
|
||||
* Usage:: The various usage possibilities explained
|
||||
* Credits:: Who's done what
|
||||
* GNU Free Documentation License:: The license for this documentation.
|
||||
* Command and Function Index::
|
||||
* Variables Index::
|
||||
@end menu
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@node Overview, Installation, Top, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Overview
|
||||
|
||||
EUDC, the @dfn{Emacs Unified Directory Client}, provides a common user
|
||||
interface to access directory servers using different directory
|
||||
protocols.
|
||||
|
||||
Currently supported back-ends are:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
LDAP, Lightweight Directory Access Protocol
|
||||
@item
|
||||
CCSO PH/QI
|
||||
@item
|
||||
BBDB, Big Brother's Insidious Database
|
||||
@end itemize
|
||||
|
||||
The main features of the EUDC interface are:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Queries using a customizable form
|
||||
@item
|
||||
Inline query expansion (for instance you can expand a name
|
||||
to an email address in a mail message buffer using a server as an
|
||||
address book)
|
||||
@item
|
||||
Multiple servers can be tried in turn until a match is found for an
|
||||
inline query
|
||||
@item
|
||||
Fast minibuffer queries for email addresses and phone numbers
|
||||
@item
|
||||
Interface to BBDB to let you insert server records into your own BBDB database
|
||||
(@pxref{Top,,BBDB,bbdb,BBDB Manual})
|
||||
@end itemize
|
||||
|
||||
@menu
|
||||
* LDAP:: What is LDAP ?
|
||||
* CCSO PH/QI:: What is CCSO, PH, QI ?
|
||||
* BBDB:: What is BBDB ?
|
||||
@end menu
|
||||
|
||||
|
||||
|
||||
@node LDAP, CCSO PH/QI, Overview, Overview
|
||||
@comment node-name, next, previous, up
|
||||
@section LDAP
|
||||
|
||||
LDAP, @dfn{the Lightweight Directory Access Protocol}, is a communication
|
||||
protocol for directory applications defined in RFC 1777.
|
||||
|
||||
Quoted from RFC 1777:
|
||||
|
||||
@quotation
|
||||
[LDAP] is designed to provide access to the X.500 Directory while not
|
||||
incurring the resource requirements of the Directory Access Protocol
|
||||
(DAP). This protocol is specifically targeted at simple management
|
||||
applications and browser applications that provide simple read/write
|
||||
interactive access to the X.500 Directory, and is intended to be a
|
||||
complement to the DAP itself.
|
||||
@end quotation
|
||||
|
||||
LDAP servers usually store (but are not limited to) information about
|
||||
people such as their name, phone number, email address, office
|
||||
location, etc@enddots{} More information about LDAP can be found at
|
||||
@url{http://www.openldap.org/}
|
||||
|
||||
EUDC requires external support to access LDAP directory servers
|
||||
(@pxref{LDAP Requirements})
|
||||
|
||||
|
||||
@node CCSO PH/QI, BBDB, LDAP, Overview
|
||||
@comment node-name, next, previous, up
|
||||
@section CCSO PH/QI
|
||||
|
||||
The Central Computing Services Office (CCSO) of the University of
|
||||
Illinois at Urbana Champaign (UIUC) created and freely distributes a
|
||||
directory system that is currently in use in more than 300 organizations
|
||||
around the world. The system records information about people such as
|
||||
their address, phone number, email, academic information or any other
|
||||
details it was configured to.
|
||||
|
||||
The system consists of two parts: a database server traditionally called
|
||||
@samp{qi} and a command-line client called @samp{ph}.
|
||||
@url{ftp://uiarchive.cso.uiuc.edu/pub/packages/ph} is the main
|
||||
distribution site. @url{http://www.uiuc.edu/cgi-bin/ph/lookup?Query=.}
|
||||
provides a listing of the active @samp{qi} servers.
|
||||
|
||||
The original command-line @samp{ph} client that comes with the
|
||||
@samp{ph/qi} distribution provides additional features like the
|
||||
possibility to communicate with the server in login-mode which makes it
|
||||
possible to change records in the database. This is not implemented in
|
||||
EUDC.
|
||||
|
||||
|
||||
@node BBDB, , CCSO PH/QI, Overview
|
||||
@comment node-name, next, previous, up
|
||||
@section BBDB
|
||||
|
||||
BBDB is the @dfn{Big Brother's Insidious Database}, a package for Emacs
|
||||
originally written by Jamie Zawinski which provides rolodex-like
|
||||
database functionality featuring tight integration with the Emacs mail
|
||||
and news readers.
|
||||
|
||||
It is often used as an enhanced email address book.
|
||||
|
||||
EUDC considers BBDB as a directory server back end just like LDAP or
|
||||
PH/QI servers, though BBDB has no client/server protocol and thus always
|
||||
resides locally on your machine. The point in this is not to offer an
|
||||
alternate way to query your BBDB database (BBDB itself provides much
|
||||
more flexible ways to do that), but rather to offer an interface to your
|
||||
local directory that is consistent with the interface to external
|
||||
directories (LDAP, PH/QI). This is particularly interesting when
|
||||
performing queries on multiple servers.
|
||||
|
||||
EUDC also offers a means to insert results from directory queries into
|
||||
your own local BBDB (@pxref{Creating BBDB Records})
|
||||
|
||||
@node Installation, Usage, Overview, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Installation
|
||||
|
||||
Add the following to your @file{.emacs} init file:
|
||||
@lisp
|
||||
(require 'eudc)
|
||||
@end lisp
|
||||
This will install EUDC at startup.
|
||||
|
||||
After installing EUDC you will find (the next time you launch Emacs) a
|
||||
new @code{Directory Search} submenu in the @samp{Tools} menu that will
|
||||
give you access to EUDC.
|
||||
|
||||
You may also find it useful to add the following to your @file{.emacs}
|
||||
initialization file to add a shortcut for email address expansion in
|
||||
email composition buffers (@pxref{Inline Query Expansion})
|
||||
|
||||
@lisp
|
||||
(eval-after-load
|
||||
"message"
|
||||
'(define-key message-mode-map [(control ?c) (tab)] 'eudc-expand-inline))
|
||||
(eval-after-load
|
||||
"sendmail"
|
||||
'(define-key mail-mode-map [(control ?c) (tab)] 'eudc-expand-inline))
|
||||
@end lisp
|
||||
|
||||
@menu
|
||||
* LDAP Requirements:: EUDC needs external support for LDAP
|
||||
@end menu
|
||||
|
||||
@node LDAP Requirements, , Installation, Installation
|
||||
@comment node-name, next, previous, up
|
||||
@section LDAP Requirements
|
||||
|
||||
LDAP support is added by means of @file{ldap.el} which is part of Emacs.
|
||||
@file{ldap.el} needs an external command line utility named
|
||||
@file{ldapsearch} which is available as part of LDAP toolkits:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Open LDAP Libraries
|
||||
(@url{http://www.openldap.org/})
|
||||
@item
|
||||
University of Michigan's LDAP Client software
|
||||
(@url{http://www.umich.edu/~dirsvcs/ldap/})
|
||||
@end itemize
|
||||
|
||||
|
||||
@node Usage, Credits, Installation, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Usage
|
||||
|
||||
This chapter describes the usage of EUDC. Most functions and
|
||||
customization options are available through the @samp{Directory Search}
|
||||
submenu of the @samp{Tools} submenu.
|
||||
|
||||
@menu
|
||||
* Querying Servers:: How queries are performed and handled
|
||||
* Query Form:: How to use and customize the query form
|
||||
* Display of Query Results:: Controlling how query results are presented
|
||||
* Inline Query Expansion:: How to use and customize inline queries
|
||||
* The Server Hotlist:: How to use and manage the server hotlist
|
||||
* Multi-server Queries:: How to query multiple servers successively
|
||||
* Creating BBDB Records:: How to insert query results into your BBDB
|
||||
* Server/Protocol Locals:: Customizing on a per server/protocol basis
|
||||
@end menu
|
||||
|
||||
|
||||
@node Querying Servers, Query Form, Usage, Usage
|
||||
@comment node-name, next, previous, up
|
||||
@section Querying Servers
|
||||
|
||||
EUDC's basic functionality is to let you query a directory server and
|
||||
return the results back to you. There are several things you may want
|
||||
to customize in this process.
|
||||
|
||||
|
||||
@menu
|
||||
* Selecting a Server:: The first thing to do
|
||||
* Return Attributes:: Configuring what the server should return
|
||||
* Duplicate Attributes:: What to do when records have duplicate attributes
|
||||
@end menu
|
||||
|
||||
@node Selecting a Server, Return Attributes, Querying Servers, Querying Servers
|
||||
@subsection Selecting a Server
|
||||
|
||||
Before doing any query you will need to set the directory server. You
|
||||
need to specify the name of the host machine running the server software
|
||||
and the protocol to use. If you do not set the server in any fashion,
|
||||
EUDC will ask you for one when you make your first query.
|
||||
|
||||
You can set the server by selecting one from your hotlist of servers
|
||||
(@pxref{The Server Hotlist}) available in the @samp{Server} submenu or
|
||||
by selecting @samp{New Server} in that same menu.
|
||||
|
||||
LDAP servers generally require some configuration before you can perform
|
||||
queries on them. In particular, the @dfn{search base} must be
|
||||
configured. If the server you select has no configured search base then
|
||||
EUDC will propose you to configure it at this point. A customization
|
||||
buffer will be displayed where you can edit the search base and other
|
||||
parameters for the server.
|
||||
|
||||
@defvar eudc-server
|
||||
The name or IP address of the remote directory server. A TCP port number
|
||||
may be specified by appending a colon and a number to the name of the
|
||||
server. You will not need this unless your server runs on a port other
|
||||
than the default (which depends on the protocol).
|
||||
If the directory server resides on your own computer (which is the case
|
||||
if you use the BBDB back end) then `localhost' is a reasonable value but
|
||||
it will be ignored anyway.
|
||||
@end defvar
|
||||
|
||||
@defvar eudc-protocol
|
||||
The directory protocol to use to query the server. Currently supported
|
||||
protocols in this version of EUDC are @code{ph}, @code{ldap} and @code{bbdb}.
|
||||
@end defvar
|
||||
|
||||
@deffn Command eudc-set-server
|
||||
This command accessible from @samp{New Server} submenu lets you specify a
|
||||
new directory server and protocol.
|
||||
@end deffn
|
||||
|
||||
@node Return Attributes, Duplicate Attributes, Selecting a Server, Querying Servers
|
||||
@subsection Return Attributes
|
||||
|
||||
Directory servers may be configured to return a default set of
|
||||
attributes for each record matching a query if the query specifies none.
|
||||
The variable @code{eudc-default-return-attributes} controls the return
|
||||
attributes you want to see, if different from the server defaults.
|
||||
|
||||
@defvar eudc-default-return-attributes
|
||||
A list of the default attributes to extract from directory entries. If
|
||||
set to the symbol @code{all} then all available attributes are
|
||||
returned. A value of @code{nil}, the default, means to return the
|
||||
default attributes as configured in the server.
|
||||
@end defvar
|
||||
|
||||
The server may return several matching records to a query. Some of the
|
||||
records may however not contain all the attributes you requested. You can
|
||||
discard those records.
|
||||
|
||||
@defopt eudc-strict-return-matches
|
||||
If non-@code{nil}, entries that do not contain all the requested return
|
||||
attributes are ignored. Default is @code{t}.
|
||||
@end defopt
|
||||
|
||||
@node Duplicate Attributes, , Return Attributes, Querying Servers
|
||||
@subsection Duplicate Attributes
|
||||
|
||||
Directory standards may authorize different instances of the same
|
||||
attribute in a record. For instance the record of a person may contain
|
||||
several email fields containing different email addresses. When using
|
||||
a QI directory server this is difficult to distinguish from attributes
|
||||
having multi-line values such as the postal address that may contain a
|
||||
line for the street and another one for the zip code and city name. In
|
||||
both cases, EUDC will consider the attribute duplicated.
|
||||
|
||||
EUDC has several methods to deal with duplicated attributes. The
|
||||
available methods are:
|
||||
|
||||
@table @code
|
||||
@item list
|
||||
Makes a list with the different values of the duplicate attribute. The
|
||||
record is returned with only one instance of the attribute with a list
|
||||
of all the different values as a value. This is the default method that
|
||||
is used to handle duplicate fields for which no other method has been
|
||||
specified.
|
||||
@item first
|
||||
Discards all the duplicate values of the field keeping only the first
|
||||
one.
|
||||
@item concat
|
||||
Concatenates the different values using a newline as a separator. The
|
||||
record keeps only one instance of the field the value of which is a
|
||||
single multi-line string.
|
||||
@item duplicate
|
||||
Duplicates the whole record into as many instances as there are different
|
||||
values for the field. This is the default for the email field. Thus a
|
||||
record containing 3 different email addresses is duplicated into three
|
||||
different records each having a single email address. This is
|
||||
particularly useful in combination with @code{select} as the method to
|
||||
handle multiple matches in inline expansion queries (@pxref{Inline Query
|
||||
Expansion}) because you are presented with the 3 addresses in a
|
||||
selection buffer
|
||||
@end table
|
||||
|
||||
Because a method may not be applicable to all fields, the variable
|
||||
@code{eudc-duplicate-attribute-handling-method} lets you specify either a
|
||||
default method for all fields or a method for each individual field.
|
||||
|
||||
@defvar eudc-duplicate-attribute-handling-method
|
||||
A method to handle entries containing duplicate attributes. This is
|
||||
either an alist of elements @code{(@var{attr} . @var{method})}, or a symbol
|
||||
@var{method}. The alist form of the variable associates a method to an
|
||||
individual attribute name; the second form specifies a method applicable
|
||||
to all attribute names. Available methods are: @code{list},
|
||||
@code{first}, @code{concat}, and @code{duplicate} (see above). The default is
|
||||
@code{list}.
|
||||
@end defvar
|
||||
|
||||
|
||||
|
||||
@node Query Form, Display of Query Results, Querying Servers, Usage
|
||||
@comment node-name, next, previous, up
|
||||
@section Query Form
|
||||
|
||||
The simplest way to query your directory server is to use the query
|
||||
form. You display the query form with the @samp{Query with Form} menu
|
||||
item or by invoking the command @kbd{M-x eudc-query-form}. The attribute
|
||||
names presented in this form are defined by the
|
||||
@code{eudc-query-form-attributes} variable (unless a non-@code{nil}
|
||||
argument is supplied to @code{eudc-query-form}).
|
||||
|
||||
Since the different directory protocols to which EUDC interfaces may
|
||||
use different names for equivalent attributes, EUDC defines its own set
|
||||
of attribute names and a mapping between these names and their
|
||||
protocol-specific equivalent through the variable
|
||||
@code{eudc-protocol-attributes-translation-alist}. Names currently
|
||||
defined by EUDC are @code{name}, @code{firstname}, @code{email} and
|
||||
@code{phone}.
|
||||
|
||||
@defvar eudc-query-form-attributes
|
||||
@findex eudc-get-attribute-list
|
||||
A list of attributes presented in the query form. Attribute names in
|
||||
this list should be either EUDC attribute names or valid attribute
|
||||
names. You can get a list of valid attribute names for the current
|
||||
protocol with the @samp{List Valid Attribute Names} menu item or the
|
||||
@kbd{M-x eudc-get-attribute-list} command. Defaults to @code{name},
|
||||
@code{email} and @code{phone}.
|
||||
@end defvar
|
||||
|
||||
@deffn Command eudc-query-form get-fields-from-server
|
||||
Display a form to query the directory server. If given a non-@code{nil}
|
||||
argument the function first queries the server for the existing fields
|
||||
and displays a corresponding form. Not all protocols may support a
|
||||
non-@code{nil} argument here.
|
||||
@end deffn
|
||||
|
||||
Since the names of the fields may not be explicit enough or adapted to
|
||||
be directly displayed as prompt strings in the form, the variable
|
||||
@code{eudc-user-attribute-names-alist} lets you define more explicit
|
||||
names for directory attribute names. This variable is ignored if
|
||||
@code{eudc-use-raw-directory-names} is non-@code{nil}.
|
||||
|
||||
@defvar eudc-user-attribute-names-alist
|
||||
This is an alist of user-defined names for the directory attributes used in
|
||||
query/response forms. Prompt strings for attributes that are not in this
|
||||
alist are derived by splitting the attribute name at underscores and
|
||||
capitalizing the individual words.
|
||||
@end defvar
|
||||
|
||||
@defvar eudc-use-raw-directory-names
|
||||
If non-@code{nil}, use attributes names as defined in the directory.
|
||||
Otherwise, directory query/response forms display the user attribute
|
||||
names defined in @code{eudc-user-attribute-names-alist}.
|
||||
@end defvar
|
||||
|
||||
@node Display of Query Results, Inline Query Expansion, Query Form, Usage
|
||||
@comment node-name, next, previous, up
|
||||
@section Display of Query Results
|
||||
|
||||
Upon successful completion of a form query, EUDC will display a buffer
|
||||
containing the results of the query.
|
||||
|
||||
The fields that are returned for each record
|
||||
are controlled by @code{eudc-default-return-attributes} (@pxref{Return
|
||||
Attributes}).
|
||||
|
||||
The display of each individual field can be performed by an arbitrary
|
||||
function which allows specific processing for binary values, such as
|
||||
images or audio samples, as well as values with semantics, such as
|
||||
URLs.
|
||||
|
||||
@defvar eudc-attribute-display-method-alist
|
||||
An alist specifying methods to display attribute values. Each member of
|
||||
the list is of the form @code{(@var{name} . @var{func})} where
|
||||
@var{name} is a lowercased string naming a directory attribute
|
||||
(translated according to @code{eudc-user-attribute-names-alist} if
|
||||
@code{eudc-use-raw-directory-names} is non-@code{nil}) and @var{func} a
|
||||
function that will be passed the corresponding attribute values for
|
||||
display.
|
||||
@end defvar
|
||||
|
||||
This variable has protocol-local definitions (see @pxref{Server/Protocol
|
||||
Locals}). For instance, it is defined as follows for LDAP:
|
||||
|
||||
@lisp
|
||||
(eudc-protocol-set 'eudc-attribute-display-method-alist
|
||||
'(("jpegphoto" . eudc-display-jpeg-inline)
|
||||
("labeledurl" . eudc-display-url)
|
||||
("audio" . eudc-display-sound)
|
||||
("labeledurl" . eudc-display-url)
|
||||
("url" . eudc-display-url))
|
||||
'ldap)
|
||||
@end lisp
|
||||
|
||||
EUDC provides a set of built-in functions to display binary value types:
|
||||
|
||||
@defun eudc-display-generic-binary data
|
||||
Display a button for unidentified binary @var{data}.
|
||||
@end defun
|
||||
|
||||
@defun eudc-display-url url
|
||||
Display URL and make it clickable.
|
||||
@end defun
|
||||
|
||||
@defun eudc-display-sound data
|
||||
Display a button to play the sound @var{data}.
|
||||
@end defun
|
||||
|
||||
@defun eudc-display-jpeg-inline data
|
||||
Display the JPEG @var{data} inline at point if possible.
|
||||
@end defun
|
||||
|
||||
@defun eudc-display-jpeg-as-button data
|
||||
Display a button for the JPEG @var{data}.
|
||||
@end defun
|
||||
|
||||
Right-clicking on a binary value button pops up a contextual menu with
|
||||
options to process the value. Among these are saving the attribute
|
||||
value to a file or sending it to an external viewer command. External
|
||||
viewers should expect the value on their standard input and should
|
||||
display it or perform arbitrary processing on it. Messages sent to
|
||||
standard output are discarded. External viewers are listed in the
|
||||
variable @code{eudc-external-viewers} which you can customize.
|
||||
|
||||
@defvar eudc-external-viewers
|
||||
This is a list of viewer program specifications. Each specification is
|
||||
a list whose first element is a string naming the viewer for unique
|
||||
identification, the second element is the executable program which
|
||||
should be invoked and the following elements are arguments that should
|
||||
be passed to the program.
|
||||
@end defvar
|
||||
|
||||
|
||||
@node Inline Query Expansion, The Server Hotlist, Display of Query Results, Usage
|
||||
@comment node-name, next, previous, up
|
||||
@section Inline Query Expansion
|
||||
|
||||
Inline query expansion is a powerful method to get completion from your
|
||||
directory server. The most common usage is for expanding names to email
|
||||
addresses in mail message buffers. The expansion is performed by the
|
||||
command @kbd{M-x eudc-expand-inline} which is available from the
|
||||
@samp{Expand Inline Query} menu item but can also be conveniently
|
||||
bound to a key shortcut (@pxref{Installation}). The operation is
|
||||
controlled by the variables @code{eudc-inline-expansion-format},
|
||||
@code{eudc-inline-query-format},
|
||||
@code{eudc-expanding-overwrites-query} and
|
||||
@code{eudc-multiple-match-handling-method}.
|
||||
|
||||
If the query fails for a server, other servers may be tried successively
|
||||
until one of them finds a match (@pxref{Multi-server Queries}).
|
||||
|
||||
@deffn Command eudc-expand-inline replace-p
|
||||
Query the server and expand the query string before point. The query
|
||||
string consists of the buffer substring from the point back to the
|
||||
preceding comma, colon or beginning of
|
||||
line. @code{eudc-inline-query-format} controls how individual words
|
||||
are mapped onto directory attribute names. After querying the server
|
||||
for the given string, the expansion specified by
|
||||
@code{eudc-inline-expansion-format} is inserted in the buffer at
|
||||
point. If @var{replace-p} is @code{t} then this expansion replaces the
|
||||
query string in the buffer. If @code{eudc-expanding-overwrites-query}
|
||||
is non-@code{nil} then the meaning of @var{replace-p} is negated.
|
||||
@end deffn
|
||||
|
||||
@defvar eudc-inline-query-format
|
||||
Format of an inline expansion query.
|
||||
This is actually a list of @var{format}s. A @var{format} is a list of
|
||||
one or more EUDC attribute names. A @var{format} applies if it contains
|
||||
as many attributes as individual words in the inline query string. If
|
||||
several @var{format}s apply then they are tried in order until a match
|
||||
is found. If @code{nil} all the words will be mapped onto the default
|
||||
server/protocol attribute name (generally @code{name}).
|
||||
|
||||
For instance, use the following
|
||||
@lisp
|
||||
(setq eudc-inline-query-format '((name)
|
||||
(firstname)
|
||||
(firstname name)))
|
||||
@end lisp
|
||||
@noindent
|
||||
to indicate that single word expansion queries are to be considered as
|
||||
surnames and if no match is found then they should be tried as first
|
||||
names. Inline queries consisting of two words are considered as
|
||||
consisting of a first name followed by a surname. If the query consists
|
||||
of more than two words, then the first one is considered as the first
|
||||
name and the remaining words are all considered as surname constituents.
|
||||
|
||||
@var{format}s are in fact not limited to EUDC attribute names, you can
|
||||
use server or protocol specific names in them. It may be safer if you
|
||||
do so, to set the variable @code{eudc-inline-query-format} in a protocol
|
||||
or server local fashion (see @pxref{Server/Protocol Locals}).
|
||||
|
||||
For instance you could use the following to match up to three words
|
||||
against the @code{cn} attribute of LDAP servers:
|
||||
@lisp
|
||||
(eudc-protocol-set 'eudc-inline-query-format
|
||||
'((cn)
|
||||
(cn cn)
|
||||
(cn cn cn))
|
||||
'ldap)
|
||||
@end lisp
|
||||
@end defvar
|
||||
|
||||
@defvar eudc-inline-expansion-format
|
||||
This variable lets you control exactly what is inserted into the buffer
|
||||
upon an inline expansion request. It is a list whose first element is a
|
||||
string passed to @code{format}. Remaining elements are symbols
|
||||
corresponding to directory attribute names. The corresponding attribute
|
||||
values are passed as additional arguments to @code{format}. Default is
|
||||
@code{("%s" email)} but you may want to consider a value like @code{("%s
|
||||
<%s>" name email)}
|
||||
@end defvar
|
||||
|
||||
@defvar eudc-multiple-match-handling-method
|
||||
This variable controls what to do when multiple entries match a query
|
||||
for an inline expansion. Possible values are:
|
||||
@table @code
|
||||
@item first
|
||||
The first match is considered as being the only one, the others are
|
||||
discarded.
|
||||
@item select
|
||||
A selection buffer pops up where you can choose a particular match. This
|
||||
is the default value of the variable.
|
||||
@item all
|
||||
The expansion uses all records successively
|
||||
@item abort
|
||||
An error is signaled. The expansion aborts.
|
||||
@end table
|
||||
|
||||
Default is @code{select}
|
||||
@end defvar
|
||||
|
||||
|
||||
|
||||
@node The Server Hotlist, Multi-server Queries, Inline Query Expansion, Usage
|
||||
@comment node-name, next, previous, up
|
||||
@section The Server Hotlist
|
||||
|
||||
EUDC lets you maintain a list of frequently used servers so that you
|
||||
can easily switch from one to another. This hotlist appears in the
|
||||
@samp{Server} submenu. You select a server in this list by clicking on
|
||||
its name. You can add the current server to the list with the command
|
||||
@kbd{M-x eudc-bookmark-current-server}. The list is contained in the variable
|
||||
@code{eudc-server-hotlist} which is stored in and retrieved from the file
|
||||
designated by @code{eudc-options-file}. EUDC also provides a facility to
|
||||
edit the hotlist interactively (@pxref{The Hotlist Edit Buffer}).
|
||||
|
||||
The hotlist is also used to make queries on multiple servers
|
||||
successively (@pxref{Multi-server Queries}). The order in which the
|
||||
servers are tried is the order they appear in the hotlist, therefore it
|
||||
is important to sort the hotlist appropriately.
|
||||
|
||||
@deffn Command eudc-bookmark-server server
|
||||
Add @var{server} to the hotlist of servers
|
||||
@end deffn
|
||||
|
||||
@deffn Command eudc-bookmark-current-server
|
||||
Add the current server to the hotlist of servers
|
||||
@end deffn
|
||||
|
||||
@defvar eudc-options-file
|
||||
The name of a file where EUDC stores its internal variables
|
||||
(the hotlist and the current server). EUDC will try to load
|
||||
that file upon initialization so, if you choose a file name
|
||||
different from the defaults @file{~/.eudc-options}, be sure to set this
|
||||
variable to the appropriate value @emph{before} EUDC is itself
|
||||
loaded.
|
||||
@end defvar
|
||||
|
||||
@menu
|
||||
* The Hotlist Edit Buffer:: An interactive hotlist editing facility
|
||||
@end menu
|
||||
|
||||
@node The Hotlist Edit Buffer, , The Server Hotlist, The Server Hotlist
|
||||
@comment node-name, next, previous, up
|
||||
@subsection The Hotlist Edit Buffer
|
||||
|
||||
The hotlist edit buffer offers a means to manage a list of frequently
|
||||
used servers. Commands are available in the context pop-up menu
|
||||
generally bound to the right mouse button. Those commands also have
|
||||
equivalent key bindings.
|
||||
|
||||
@deffn Command eudc-hotlist-add-server
|
||||
Bound to @kbd{a}.
|
||||
Add a new server to the hotlist on the line after point
|
||||
@end deffn
|
||||
|
||||
@deffn Command eudc-hotlist-delete-server
|
||||
Bound to @kbd{d}.
|
||||
Delete the server on the line point is on
|
||||
@end deffn
|
||||
|
||||
@deffn Command eudc-hotlist-select-server
|
||||
Bound to @kbd{s}.
|
||||
Select the server the point is on as the current directory server for
|
||||
the next queries
|
||||
@end deffn
|
||||
|
||||
@deffn Command eudc-hotlist-transpose-servers
|
||||
Bound to @kbd{t}.
|
||||
Bubble up the server the point is on to the top of the list
|
||||
@end deffn
|
||||
|
||||
@deffn Command eudc-hotlist-quit-edit
|
||||
Bound to @kbd{q}.
|
||||
Save the changes and quit the hotlist edit buffer. Use @kbd{x} or
|
||||
@kbd{M-x kill-buffer} to exit without saving.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node Multi-server Queries, Creating BBDB Records, The Server Hotlist, Usage
|
||||
@comment node-name, next, previous, up
|
||||
@section Multi-server Queries
|
||||
|
||||
When using inline query expansion (@pxref{Inline Query Expansion}), EUDC
|
||||
can try to query successively a sequence of directory servers until one
|
||||
of them successfully finds a match for the query.
|
||||
|
||||
@defvar eudc-inline-expansion-servers
|
||||
This variable controls which servers are tried and in which order when
|
||||
trying to perform an inline query. Possible values are:
|
||||
@table @code
|
||||
@item current-server
|
||||
Only the current directory server is tried
|
||||
@item hotlist
|
||||
The servers in the hotlist are tried in order until one finds a match
|
||||
for the query or `eudc-max-servers-to-query' is reached
|
||||
@item server-then-hotlist
|
||||
The current server then the servers in the hotlist are tried in the
|
||||
order they appear in the hotlist until one of them finds a match or
|
||||
`eudc-max-servers-to-query' is reached. This is the default.
|
||||
@end table
|
||||
@end defvar
|
||||
|
||||
@defvar eudc-max-servers-to-query
|
||||
This variable indicates the maximum number of servers to query when
|
||||
performing a multi-server query. The default, @code{nil}, indicates
|
||||
that all available servers should be tried.
|
||||
@end defvar
|
||||
|
||||
|
||||
|
||||
@node Creating BBDB Records, Server/Protocol Locals, Multi-server Queries, Usage
|
||||
@comment node-name, next, previous, up
|
||||
@section Creating BBDB Records
|
||||
|
||||
@findex eudc-insert-record-at-point-into-bbdb
|
||||
@findex eudc-try-bbdb-insert
|
||||
With EUDC, you can automatically create BBDB records
|
||||
(@pxref{Top,,BBDB,bbdb,BBDB Manual}) from records you get from a
|
||||
directory server. You do this by moving point to the appropriate
|
||||
record in a query result display buffer and invoking the command
|
||||
@kbd{M-x eudc-insert-record-at-point-into-bbdb} with the
|
||||
keyboard binding @kbd{b}@footnote{This key binding does not actually
|
||||
call @code{eudc-insert-record-at-point-into-bbdb} but uses
|
||||
@code{eudc-try-bbdb-insert} instead.}, or with the menu. EUDC
|
||||
cannot update an existing BBDB record and will signal an error if you
|
||||
try to insert a record matching an existing one.
|
||||
|
||||
@findex eudc-batch-export-records-to-bbdb
|
||||
It is also possible to export to BBDB the whole batch of records
|
||||
contained in the directory query result with the command
|
||||
@kbd{M-x eudc-batch-export-records-to-bbdb}.
|
||||
|
||||
Because directory systems may not enforce a strict record format, local
|
||||
server installations may use different attribute names and have
|
||||
different ways to organize the information. Furthermore BBDB has its own
|
||||
record structure. For these reasons converting a record from its
|
||||
external directory format to the BBDB format is a highly customizable
|
||||
process.
|
||||
|
||||
@defvar eudc-bbdb-conversion-alist
|
||||
The value of this variable should be a symbol naming an alist defining a
|
||||
mapping between BBDB field names onto directory attribute names records.
|
||||
This is a protocol-local variable and is initialized upon protocol
|
||||
switch (@pxref{Server/Protocol Locals}). The alist is made of cells of the
|
||||
form @code{(@var{bbdb-field} . @var{spec-or-list})}.
|
||||
@var{bbdb-field} is the name of a field
|
||||
that must be defined in your BBDB environment (standard field names are
|
||||
@code{name}, @code{company}, @code{net}, @code{phone}, @code{address}
|
||||
and @code{notes}).
|
||||
@var{spec-or-list} is either a single mapping specification or a list of
|
||||
mapping specifications. Lists of mapping specifications are valid for
|
||||
the @code{phone} and @code{address} BBDB fields only. @var{spec}s are
|
||||
actually s-expressions which are evaluated as follows:
|
||||
|
||||
@table @asis
|
||||
@item a string
|
||||
evaluates to itself
|
||||
@item a symbol
|
||||
evaluates to the symbol value. Symbols corresponding to directory
|
||||
attribute names present in the record evaluate to the value of the field
|
||||
in the record
|
||||
@item a form
|
||||
is evaluated as a function. The argument list may contain attribute
|
||||
names which evaluate to the corresponding values in the record. The form
|
||||
evaluation should return something appropriate for the particular
|
||||
@var{bbdb-field} (see @code{bbdb-create-internal}).
|
||||
@code{eudc-bbdbify-phone} and @code{eudc-bbdbify-address} are provided as
|
||||
convenience functions to parse phones and addresses.
|
||||
@end table
|
||||
@end defvar
|
||||
|
||||
The default value of the PH-specific value of that variable is
|
||||
@code{eudc-ph-bbdb-conversion-alist}:
|
||||
|
||||
@lisp
|
||||
((name . name)
|
||||
(net . email)
|
||||
(address . (eudc-bbdbify-address address "Address"))
|
||||
(phone . ((eudc-bbdbify-phone phone "Phone")
|
||||
(eudc-bbdbify-phone office_phone "Office Phone"))))
|
||||
@end lisp
|
||||
|
||||
This means that:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
the @code{name} field of the BBDB record gets its value
|
||||
from the @code{name} attribute of the directory record
|
||||
@item
|
||||
the @code{net} field of the BBDB record gets its value
|
||||
from the @code{email} attribute of the directory record
|
||||
@item
|
||||
the @code{address} field of the BBDB record is obtained by parsing the
|
||||
@code{address} attribute of the directory record with the function
|
||||
@code{eudc-bbdbify-address}
|
||||
@item
|
||||
two @code{phone} fields are created (when possible) in the BBDB record.
|
||||
The first one has @cite{Phone} for location and its value is obtained by
|
||||
parsing the @code{phone} attribute of the PH/QI record with the function
|
||||
@code{eudc-bbdbify-phone}. The second one has @cite{Office Phone} for location
|
||||
its value is obtained by parsing the @code{office_phone} attribute of the
|
||||
PH/QI record with the function @code{eudc-bbdbify-phone}.
|
||||
@end itemize
|
||||
|
||||
@defun eudc-bbdbify-phone phone location
|
||||
This is a convenience function provided for use in
|
||||
@code{eudc-bbdb-conversion-alist}. It parses @var{phone} into a vector
|
||||
compatible with @code{bbdb-create-internal}. @var{phone} is either a string
|
||||
supposedly containing a phone number or a list of such strings which are
|
||||
concatenated. @var{location} is used as the phone location for BBDB.
|
||||
@end defun
|
||||
|
||||
@defun eudc-bbdbify-address addr location
|
||||
This is a convenience function provided for use in
|
||||
@code{eudc-bbdb-conversion-alist}. It parses @var{addr} into a vector
|
||||
compatible with @code{bbdb-create-internal}. @var{addr} should be an
|
||||
address string of no more than four lines or a list of lines. The last
|
||||
line is searched for the zip code, city and state name. @var{location}
|
||||
is used as the phone location for BBDB.
|
||||
@end defun
|
||||
|
||||
Note that only a subset of the attributes you selected with
|
||||
@code{eudc-default-return-attributes} and that are actually displayed may
|
||||
actually be inserted as part of the newly created BBDB record.
|
||||
|
||||
|
||||
@node Server/Protocol Locals, , Creating BBDB Records, Usage
|
||||
@comment node-name, next, previous, up
|
||||
@section Server/Protocol Locals
|
||||
|
||||
EUDC can be customized independently for each server or directory
|
||||
protocol. All variables can be given local bindings that are activated
|
||||
when a particular server and/or protocol becomes active. This is much
|
||||
like buffer-local bindings but on a per server or per protocol basis.
|
||||
|
||||
@menu
|
||||
* Manipulating local bindings:: Functions to set and query local bindings
|
||||
@end menu
|
||||
|
||||
@node Manipulating local bindings, , Server/Protocol Locals, Server/Protocol Locals
|
||||
@comment node-name, next, previous, up
|
||||
@subsection Manipulating local bindings
|
||||
|
||||
EUDC offers functions that let you set and query variables on a per
|
||||
server or per protocol basis.
|
||||
|
||||
The following predicates allow you to test the existence of
|
||||
server/protocol local bindings for a particular variable.
|
||||
|
||||
@defun eudc-server-local-variable-p var
|
||||
Return non-@code{nil} if @var{var} has server-local bindings
|
||||
@end defun
|
||||
|
||||
@defun eudc-protocol-local-variable-p var
|
||||
Return non-@code{nil} if @var{var} has protocol-local bindings
|
||||
@end defun
|
||||
|
||||
The following functions allow you to set the value of a variable with
|
||||
various degrees of locality.
|
||||
|
||||
@defun eudc-default-set var val
|
||||
Set the EUDC default value of @var{var} to @var{val}.
|
||||
The current binding of @var{var} (if local to the current server or
|
||||
protocol) is not changed.
|
||||
@end defun
|
||||
|
||||
@defun eudc-protocol-set var val &optional protocol
|
||||
Set the binding of @var{var} local to @var{protocol} to @var{val}. If
|
||||
omitted, @var{protocol} defaults to the current value of
|
||||
@code{eudc-protocol}. The current binding of @var{var} is changed only
|
||||
if @var{protocol} is omitted.
|
||||
@end defun
|
||||
|
||||
@defun eudc-server-set var val &optional server
|
||||
Set the binding of @var{var} local to @var{server} to @var{val}. If
|
||||
omitted, @var{server} defaults to the current value of
|
||||
@code{eudc-server}. The current binding of @var{var} is changed only if
|
||||
@var{server} is omitted.
|
||||
@end defun
|
||||
|
||||
@defun eudc-set var val
|
||||
Set the most local (server, protocol or default) binding of @var{var} to
|
||||
@var{val}. The current binding of @var{var} is also set to @var{val}.
|
||||
@end defun
|
||||
|
||||
The following variables allow you to query the various bindings of a
|
||||
variable (local or non-local).
|
||||
|
||||
@defun eudc-variable-default-value var
|
||||
Return the default binding of @var{var} (outside of a particular server
|
||||
or protocol local binding).
|
||||
Return @code{unbound} if @var{var} has no EUDC default value.
|
||||
@end defun
|
||||
|
||||
@defun eudc-variable-protocol-value var &optional protocol
|
||||
Return the value of @var{var} local to @var{protocol}. Return
|
||||
@code{unbound} if @var{var} has no value local to @var{protocol}.
|
||||
@var{protocol} defaults to @code{eudc-protocol}.
|
||||
@end defun
|
||||
|
||||
@defun eudc-variable-server-value var [server]
|
||||
Return the value of @var{var} local to @var{server}.
|
||||
Return @code{unbound} if @var{var} has no value local to @var{server}.
|
||||
@var{server} defaults to @code{eudc-server}.
|
||||
@end defun
|
||||
|
||||
Changing a protocol-local or server-local value of a variable has no
|
||||
effect on its current value. The following command is used to
|
||||
synchronize the current values of variables with their local values
|
||||
given the current @code{eudc-server} and @code{eudc-protocol}:
|
||||
|
||||
@defun eudc-update-local-variables
|
||||
Update all EUDC variables according to their local settings.
|
||||
@end defun
|
||||
|
||||
|
||||
|
||||
@node Credits, GNU Free Documentation License, Usage, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Credits
|
||||
|
||||
EUDC was written by Oscar Figueiredo based on @file{ph.el} by the
|
||||
same author.
|
||||
|
||||
Thanks to Soren Dayton for his suggestions, his enthusiasm and his help
|
||||
in testing and proofreading the code and docs of @file{ph.el}.
|
||||
|
||||
@node GNU Free Documentation License, Command and Function Index, Credits, Top
|
||||
@appendix GNU Free Documentation License
|
||||
@include doclicense.texi
|
||||
|
||||
@node Command and Function Index, Variables Index, GNU Free Documentation License, Top
|
||||
@comment node-name, next, previous, up
|
||||
@unnumbered Command and Function Index
|
||||
|
||||
@printindex fn
|
||||
|
||||
@node Variables Index, , Command and Function Index, Top
|
||||
@comment node-name, next, previous, up
|
||||
@unnumbered Variables Index
|
||||
|
||||
@printindex vr
|
||||
|
||||
@setchapternewpage odd
|
||||
@contents
|
||||
@bye
|
||||
|
||||
@ignore
|
||||
arch-tag: 1b79460b-4ea1-441d-ab45-05ddd16ef241
|
||||
@end ignore
|
5590
man/faq.texi
5590
man/faq.texi
File diff suppressed because it is too large
Load diff
2950
man/files.texi
2950
man/files.texi
File diff suppressed because it is too large
Load diff
471
man/fixit.texi
471
man/fixit.texi
|
@ -1,471 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2001, 2002,
|
||||
@c 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Fixit, Keyboard Macros, 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-_} 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 the undo command undo earlier
|
||||
and earlier changes, back to the limit of the undo information
|
||||
available. @xref{Undo}, for more information.
|
||||
|
||||
@menu
|
||||
* Undo:: The Undo commands.
|
||||
* 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 Undo
|
||||
@section Undo
|
||||
@cindex undo
|
||||
@cindex changes, undoing
|
||||
|
||||
The @dfn{undo} commands undo recent changes in the buffer's text.
|
||||
Each buffer records changes individually, and the undo command always
|
||||
applies to the current buffer. You can undo all the changes in a
|
||||
buffer for as far as back these records go. Usually each editing
|
||||
command makes a separate entry in the undo records, but some commands
|
||||
such as @code{query-replace} divide their changes into multiple
|
||||
entries for flexibility in undoing. Meanwhile, self-inserting
|
||||
characters are usually grouped to make undoing less tedious.
|
||||
|
||||
@table @kbd
|
||||
@item C-x u
|
||||
@itemx C-_
|
||||
@itemx C-/
|
||||
Undo one entry in the current buffer's undo records (@code{undo}).
|
||||
@end table
|
||||
|
||||
@kindex C-x u
|
||||
@kindex C-_
|
||||
@kindex C-/
|
||||
@findex undo
|
||||
To begin to undo, type the command @kbd{C-x u} (or its aliases,
|
||||
@kbd{C-_} or @kbd{C-/}). This undoes the most recent change in the
|
||||
buffer, and moves point back to where it was before that change.
|
||||
|
||||
Consecutive repetitions of @kbd{C-x u} (or its aliases) undo earlier
|
||||
and earlier changes in the current buffer, back to the limit of the
|
||||
current buffer's undo records. If all the recorded changes have
|
||||
already been undone, the undo command just signals an error.
|
||||
|
||||
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
|
||||
below.
|
||||
|
||||
@findex undo-only
|
||||
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 undo commands again. On the
|
||||
other hand, if you want to resume undoing, without redoing previous
|
||||
undo commands, use @kbd{M-x undo-only}. This is like @code{undo}, but
|
||||
will not redo changes you have just undone.
|
||||
|
||||
@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 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 (@pxref{Transient Mark}), any use of @code{undo} when there is an
|
||||
active region performs selective undo; you do not need a prefix
|
||||
argument.
|
||||
|
||||
Some specialized buffers do not make undo records. Buffers
|
||||
whose names start with spaces never do; these buffers are used
|
||||
internally by Emacs and its extensions to hold text that users don't
|
||||
normally look at or edit.
|
||||
|
||||
@vindex undo-limit
|
||||
@vindex undo-strong-limit
|
||||
@vindex undo-outer-limit
|
||||
@cindex undo limit
|
||||
When the undo records for a buffer becomes too large, Emacs
|
||||
discards the oldest undo records from time to time (during garbage
|
||||
collection). You can specify how much undo records to keep by
|
||||
setting three variables: @code{undo-limit}, @code{undo-strong-limit},
|
||||
and @code{undo-outer-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: a previous command (not the most recent one) which
|
||||
pushes the size past this amount is itself forgotten. The default
|
||||
value of @code{undo-strong-limit} is 30000.
|
||||
|
||||
Regardless of the values of those variables, the most recent change
|
||||
is never discarded unless it gets bigger than @code{undo-outer-limit}
|
||||
(normally 3,000,000). At that point, Emacs discards the undo data and
|
||||
warns you about it. This is the only situation in which you cannot
|
||||
undo the last command. If this happens, you can increase the value of
|
||||
@code{undo-outer-limit} to make it even less likely to happen in the
|
||||
future. But if you didn't expect the command to create such large
|
||||
undo data, then it is probably a bug and you should report it.
|
||||
@xref{Bugs,, Reporting Bugs}.
|
||||
|
||||
The reason the @code{undo} command has three key bindings, @kbd{C-x
|
||||
u}, @kbd{C-_} and @kbd{C-/}, is that it is worthy of a
|
||||
single-character key, but @kbd{C-x u} is more straightforward for
|
||||
beginners to remember and type. Meanwhile, @kbd{C--} on a text-only
|
||||
terminal is really @kbd{C-_}, which makes it a natural and easily
|
||||
typed binding for undoing.
|
||||
|
||||
@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 confusion 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 between the two transposed
|
||||
characters before you type @kbd{C-t}. 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
|
||||
@c Don't index C-M-t and transpose-sexps here, they are indexed in
|
||||
@c programs.texi, in the "List Commands" node.
|
||||
@c @kindex C-M-t
|
||||
@c @findex transpose-sexps
|
||||
@kbd{M-t} transposes the word before point with the word after point
|
||||
(@code{transpose-words}). 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{Expressions}), and @kbd{C-x C-t}
|
||||
(@code{transpose-lines}) exchanges lines. They work like @kbd{M-t}
|
||||
except as regards what units of text they transpose.
|
||||
|
||||
A numeric argument to a transpose command serves as a repeat count: it
|
||||
tells the transpose command to move the character (word, expression, line)
|
||||
before or containing point across several other characters (words,
|
||||
expressions, 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, expression, 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 programs Aspell and Ispell, which are not part of Emacs.
|
||||
@ifnottex
|
||||
@xref{Top, Aspell,, aspell, The Aspell Manual}.
|
||||
@end ifnottex
|
||||
|
||||
@table @kbd
|
||||
@item M-x flyspell-mode
|
||||
Enable Flyspell mode, which highlights all misspelled words.
|
||||
@item M-x flyspell-prog-mode
|
||||
Enable Flyspell mode for comments and strings only.
|
||||
@item M-$
|
||||
Check and correct spelling of the word at point (@code{ispell-word}).
|
||||
@item M-@key{TAB}
|
||||
@itemx @key{ESC} @key{TAB}
|
||||
Complete the word before point based on the spelling dictionary
|
||||
(@code{ispell-complete-word}).
|
||||
@item M-x ispell
|
||||
Spell-check the active region or the current buffer.
|
||||
@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 Aspell or Ispell process, using @var{dict} as the dictionary.
|
||||
@item M-x ispell-kill-ispell
|
||||
Kill the Aspell or 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.
|
||||
|
||||
@findex flyspell-prog-mode
|
||||
Flyspell Prog mode works just like ordinary Flyspell mode, except that
|
||||
it only checks words in comments and string constants. This feature
|
||||
is useful for editing programs. Type @kbd{M-x flyspell-prog-mode} to
|
||||
enable or disable this mode in the current buffer.
|
||||
|
||||
The other Emacs spell-checking features check or look up words when
|
||||
you give an explicit command to do so.
|
||||
|
||||
@kindex M-$
|
||||
@findex ispell-word
|
||||
To check the spelling of the word around or before 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 command checks the whole buffer, except for
|
||||
material that is indented or appears to be cited from other messages.
|
||||
|
||||
@findex ispell
|
||||
@cindex spell-checking the active region
|
||||
The @kbd{M-x ispell} command spell-checks the active region if the
|
||||
Transient Mark mode is on (@pxref{Transient Mark}), otherwise it
|
||||
spell-checks the current buffer.
|
||||
|
||||
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 single-character response. 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}. (The replacement
|
||||
string will be rescanned for more spelling errors.)
|
||||
|
||||
@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. (The replacements
|
||||
will be rescanned for more spelling errors.)
|
||||
|
||||
@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 Aspell or Ispell will
|
||||
consider it correct from now on, even in future sessions.
|
||||
|
||||
@item u
|
||||
Insert the lower-case version of this word in your private dic@-tion@-ary
|
||||
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 as
|
||||
the replacement by typing a digit. You can use @samp{*} in @var{word} as a
|
||||
wildcard.
|
||||
|
||||
@item C-g
|
||||
Quit interactive spell checking, leaving point at the word that was
|
||||
being checked. You can restart checking 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).
|
||||
|
||||
@item ?
|
||||
Show the list of options.
|
||||
@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. (If your window manager intercepts
|
||||
@kbd{M-@key{TAB}}, type @kbd{@key{ESC} @key{TAB}} or @kbd{C-M-i}.) To
|
||||
choose one of the completions listed, click @kbd{Mouse-2} or
|
||||
@kbd{Mouse-1} fast 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 Aspell or 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
|
||||
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 and Aspell use two dictionaries together for spell checking: the
|
||||
standard dictionary and your private dictionary. The variable
|
||||
@code{ispell-dictionary} specifies the file name to use for the
|
||||
standard dictionary; a value of @code{nil} selects the default
|
||||
dictionary. The command @kbd{M-x ispell-change-dictionary} sets this
|
||||
variable and then restarts the subprocess, so that it will use
|
||||
a different standard dictionary.
|
||||
|
||||
@vindex ispell-complete-word-dict
|
||||
Aspell and Ispell use a separate dictionary for word completion.
|
||||
The variable @code{ispell-complete-word-dict} specifies the file name
|
||||
of this dictionary. The completion dictionary must be different
|
||||
because it cannot use root and affix information. For some languages
|
||||
there is a spell checking dictionary but no word completion
|
||||
dictionary.
|
||||
|
||||
@ignore
|
||||
arch-tag: 3359a443-96ed-448f-9f05-c8111ba8eac0
|
||||
@end ignore
|
762
man/flymake.texi
762
man/flymake.texi
|
@ -1,762 +0,0 @@
|
|||
\input texinfo @c -*-texinfo-*-
|
||||
@comment %**start of header
|
||||
@setfilename ../info/flymake
|
||||
@set VERSION 0.3
|
||||
@set UPDATED April 2004
|
||||
@settitle GNU Flymake @value{VERSION}
|
||||
@syncodeindex pg cp
|
||||
@comment %**end of header
|
||||
|
||||
@copying
|
||||
This manual is for GNU Flymake (version @value{VERSION}, @value{UPDATED}),
|
||||
which is a universal on-the-fly syntax checker for GNU Emacs.
|
||||
|
||||
Copyright @copyright{} 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
|
||||
and with the Back-Cover Texts as in (a) below. A copy of the license
|
||||
is included in the section entitled ``GNU Free Documentation License''
|
||||
in the Emacs manual.
|
||||
|
||||
(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
|
||||
this GNU Manual, like GNU software. Copies published by the Free
|
||||
Software Foundation raise funds for GNU development.''
|
||||
|
||||
This document is part of a collection distributed under the GNU Free
|
||||
Documentation License. If you want to distribute this document
|
||||
separately from the collection, you can do so by adding a copy of the
|
||||
license to the document, as described in section 6 of the license.
|
||||
@end quotation
|
||||
@end copying
|
||||
|
||||
@dircategory Emacs
|
||||
@direntry
|
||||
* Flymake: (flymake). A universal on-the-fly syntax checker.
|
||||
@end direntry
|
||||
|
||||
@titlepage
|
||||
@title GNU Flymake
|
||||
@subtitle for version @value{VERSION}, @value{UPDATED}
|
||||
@author Pavel Kobiakov(@email{pk_at_work@@yahoo.com})
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
@insertcopying
|
||||
@end titlepage
|
||||
|
||||
@contents
|
||||
|
||||
@ifnottex
|
||||
@node Top
|
||||
@top GNU Flymake
|
||||
@end ifnottex
|
||||
|
||||
@menu
|
||||
* Overview of Flymake::
|
||||
* Installing Flymake::
|
||||
* Using Flymake::
|
||||
* Configuring Flymake::
|
||||
* Flymake Implementation::
|
||||
* GNU Free Documentation License::
|
||||
* Index::
|
||||
@end menu
|
||||
|
||||
@node Overview of Flymake
|
||||
@chapter Overview
|
||||
@cindex Overview of Flymake
|
||||
|
||||
Flymake is a universal on-the-fly syntax checker implemented as an
|
||||
Emacs minor mode. Flymake runs the pre-configured syntax check tool
|
||||
(compiler for C++ files, @code{perl} for perl files, etc.) in the
|
||||
background, passing it a temporary copy of the current buffer, and
|
||||
parses the output for known error/warning message patterns. Flymake
|
||||
then highlights erroneous lines (i.e. lines for which at least one
|
||||
error or warning has been reported by the syntax check tool), and
|
||||
displays an overall buffer status in the mode line. Status information
|
||||
displayed by Flymake contains total number of errors and warnings
|
||||
reported for the buffer during the last syntax check.
|
||||
|
||||
@code{flymake-goto-next-error} and @code{flymake-goto-prev-error}
|
||||
functions allow for easy navigation to the next/previous erroneous
|
||||
line, respectively.
|
||||
|
||||
Calling @code{flymake-display-err-menu-for-current-line} will popup a
|
||||
menu containing error messages reported by the syntax check tool for
|
||||
the current line. Errors/warnings belonging to another file, such as a
|
||||
@code{.h} header file included by a @code{.c} file, are shown in the
|
||||
current buffer as belonging to the first line. Menu items for such
|
||||
messages also contain a filename and a line number. Selecting such a
|
||||
menu item will automatically open the file and jump to the line with
|
||||
error.
|
||||
|
||||
Syntax check is done 'on-the-fly'. It is started whenever
|
||||
|
||||
@itemize @bullet
|
||||
@item buffer is loaded
|
||||
@item a newline character is added to the buffer
|
||||
@item some changes were made to the buffer more than @code{0.5} seconds ago (the
|
||||
delay is configurable).
|
||||
@end itemize
|
||||
|
||||
Flymake is a universal syntax checker in the sense that it's easily
|
||||
extended to support new syntax check tools and error message
|
||||
patterns. @xref{Configuring Flymake}.
|
||||
|
||||
@node Installing Flymake
|
||||
@chapter Installing
|
||||
@cindex Installing Flymake
|
||||
|
||||
|
||||
Flymake is packaged in a single file, @code{flymake.el}.
|
||||
|
||||
To install/update Flymake, place @code{flymake.el} to a directory
|
||||
somewhere on Emacs load path. You might also want to byte-compile
|
||||
@code{flymake.el} to improve performance.
|
||||
|
||||
Also, place the following line in the @code{.emacs} file.
|
||||
|
||||
@lisp
|
||||
(require 'flymake)
|
||||
@end lisp
|
||||
|
||||
You might also map the most frequently used Flymake functions, such as
|
||||
@code{flymake-goto-next-error}, to some keyboard shortcuts:
|
||||
|
||||
@lisp
|
||||
(global-set-key [f3] 'flymake-display-err-menu-for-current-line)
|
||||
(global-set-key [f4] 'flymake-goto-next-error)
|
||||
@end lisp
|
||||
|
||||
@node Using Flymake
|
||||
@chapter Using Flymake
|
||||
@cindex Using Flymake
|
||||
|
||||
@menu
|
||||
* Flymake mode::
|
||||
* Running the syntax check::
|
||||
* Navigating to error lines::
|
||||
* Viewing error messages::
|
||||
* Syntax check statuses::
|
||||
* Troubleshooting::
|
||||
@end menu
|
||||
|
||||
@node Flymake mode
|
||||
@section Flymake mode
|
||||
@cindex flymake-mode
|
||||
|
||||
Flymake is an Emacs minor mode. To use Flymake, you
|
||||
must first activate @code{flymake-mode} by using the
|
||||
@code{flymake-mode} function.
|
||||
|
||||
Instead of manually activating @code{flymake-mode}, you can configure
|
||||
Flymake to automatically enable @code{flymake-mode} upon opening any
|
||||
file for which syntax check is possible. To do so, place the following
|
||||
line in @code{.emacs}:
|
||||
|
||||
@lisp
|
||||
(add-hook 'find-file-hook 'flymake-find-file-hook)
|
||||
@end lisp
|
||||
|
||||
@node Running the syntax check
|
||||
@section Running the syntax check
|
||||
@cindex Manually starting the syntax check
|
||||
|
||||
When @code{flymake-mode} is active, syntax check is started
|
||||
automatically on any of the three conditions mentioned above. Syntax
|
||||
check can also be started manually by using the
|
||||
@code{flymake-start-syntax-check-for-current-buffer} function. This
|
||||
can be used, for example, when changes were made to some other buffer
|
||||
affecting the current buffer.
|
||||
|
||||
@node Navigating to error lines
|
||||
@section Navigating to error lines
|
||||
@cindex Navigating to error lines
|
||||
|
||||
After syntax check is completed, lines for which at least one error or
|
||||
warning has been reported are highlighted, and total number of errors
|
||||
and warning is shown in the mode line. Use the following functions to
|
||||
navigate the highlighted lines.
|
||||
|
||||
@multitable @columnfractions 0.25 0.75
|
||||
|
||||
@item @code{flymake-goto-next-error}
|
||||
@tab Moves point to the next erroneous line, if any.
|
||||
|
||||
@item @code{flymake-goto-prev-error}
|
||||
@tab Moves point to the previous erroneous line.
|
||||
|
||||
@end multitable
|
||||
|
||||
These functions treat erroneous lines as a linked list. Therefore,
|
||||
@code{flymake-goto-next-error} will go to the first erroneous line
|
||||
when invoked in the end of the buffer.
|
||||
|
||||
@node Viewing error messages
|
||||
@section Viewing error messages
|
||||
@cindex Viewing error messages
|
||||
|
||||
To view error messages belonging to the current line, use the
|
||||
@code{flymake-display-err-menu-for-current-line} function. If there's
|
||||
at least one error or warning reported for the current line, this
|
||||
function will display a popup menu with error/warning texts.
|
||||
Selecting the menu item whose error belongs to another file brings
|
||||
forward that file with the help of the
|
||||
@code{flymake-goto-file-and-line} function.
|
||||
|
||||
@node Syntax check statuses
|
||||
@section Syntax check statuses
|
||||
@cindex Syntax check statuses
|
||||
|
||||
After syntax check is finished, its status is displayed in the mode line.
|
||||
The following statuses are defined.
|
||||
|
||||
@multitable @columnfractions 0.25 0.75
|
||||
@item Flymake* or Flymake:E/W*
|
||||
@tab Flymake is currently running. For the second case, E/W contains the
|
||||
error and warning count for the previous run.
|
||||
|
||||
@item Flymake
|
||||
@tab Syntax check is not running. Usually this means syntax check was
|
||||
successfully passed (no errors, no warnings). Other possibilities are:
|
||||
syntax check was killed as a result of executing
|
||||
@code{flymake-compile}, or syntax check cannot start as compilation
|
||||
is currently in progress.
|
||||
|
||||
@item Flymake:E/W
|
||||
@tab Number of errors/warnings found by the syntax check process.
|
||||
|
||||
@item Flymake:!
|
||||
@tab Flymake was unable to find master file for the current buffer.
|
||||
@end multitable
|
||||
|
||||
The following errors cause a warning message and switch flymake mode
|
||||
OFF for the buffer.
|
||||
|
||||
@multitable @columnfractions 0.25 0.75
|
||||
@item CFGERR
|
||||
@tab Syntax check process returned nonzero exit code, but no
|
||||
errors/warnings were reported. This indicates a possible configuration
|
||||
error (for example, no suitable error message patterns for the
|
||||
syntax check tool).
|
||||
|
||||
@item NOMASTER
|
||||
@tab Flymake was unable to find master file for the current buffer.
|
||||
|
||||
@item NOMK
|
||||
@tab Flymake was unable to find a suitable buildfile for the current buffer.
|
||||
|
||||
@item PROCERR
|
||||
@tab Flymake was unable to launch a syntax check process.
|
||||
@end multitable
|
||||
|
||||
|
||||
@node Troubleshooting
|
||||
@section Troubleshooting
|
||||
@cindex Logging
|
||||
@cindex Troubleshooting
|
||||
|
||||
Flymake uses a simple logging facility for indicating important points
|
||||
in the control flow. The logging facility sends logging messages to
|
||||
the @code{*Messages*} buffer. The information logged can be used for
|
||||
resolving various problems related to Flymake.
|
||||
|
||||
Logging output is controlled by the @code{flymake-log-level}
|
||||
variable. @code{3} is the most verbose level, and @code{-1} switches
|
||||
logging off.
|
||||
|
||||
@node Configuring Flymake
|
||||
@chapter Configuring and Extending Flymake
|
||||
@cindex Configuring and Extending Flymake
|
||||
|
||||
@menu
|
||||
* Customizable variables::
|
||||
* Adding support for a new syntax check tool::
|
||||
@end menu
|
||||
|
||||
Flymake was designed to be easily extended for supporting new syntax
|
||||
check tools and error message patterns.
|
||||
|
||||
@node Customizable variables
|
||||
@section Customizable variables
|
||||
@cindex Customizable variables
|
||||
|
||||
This section summarizes variables used for Flymake
|
||||
configuration.
|
||||
|
||||
@table @code
|
||||
@item flymake-log-level
|
||||
Controls logging output, see @ref{Troubleshooting}.
|
||||
|
||||
@item flymake-allowed-file-name-masks
|
||||
A list of @code{(filename-regexp, init-function, cleanup-function
|
||||
getfname-function)} for configuring syntax check tools. @xref{Adding
|
||||
support for a new syntax check tool}.
|
||||
|
||||
@item flymake-buildfile-dirs
|
||||
A list of directories (relative paths) for searching a
|
||||
buildfile. @xref{Locating the buildfile}.
|
||||
|
||||
@item flymake-master-file-dirs
|
||||
A list of directories for searching a master file. @xref{Locating a
|
||||
master file}.
|
||||
|
||||
@item flymake-get-project-include-dirs-function
|
||||
A function used for obtaining a list of project include dirs (C/C++
|
||||
specific). @xref{Getting the include directories}.
|
||||
|
||||
@item flymake-master-file-count-limit
|
||||
@itemx flymake-check-file-limit
|
||||
Used when looking for a master file. @xref{Locating a master file}.
|
||||
|
||||
@item flymake-err-line-patterns
|
||||
Patterns for error/warning messages in the form @code{(regexp file-idx
|
||||
line-idx err-text-idx)}. @xref{Parsing the output}.
|
||||
|
||||
@item flymake-compilation-prevents-syntax-check
|
||||
A flag indicating whether compilation and syntax check of the same
|
||||
file cannot be run simultaneously.
|
||||
|
||||
@item flymake-no-changes-timeout
|
||||
If any changes are made to the buffer, syntax check is automatically
|
||||
started after @code{flymake-no-changes-timeout} seconds.
|
||||
|
||||
@item flymake-gui-warnings-enabled
|
||||
A boolean flag indicating whether Flymake will show message boxes for
|
||||
non-recoverable errors. If @code{flymake-gui-warnings-enabled} is
|
||||
@code{nil}, these errors will only be logged to the @code{*Messages*}
|
||||
buffer.
|
||||
|
||||
@item flymake-start-syntax-check-on-newline
|
||||
A boolean flag indicating whether to start syntax check after a
|
||||
newline character is added to the buffer.
|
||||
|
||||
@item flymake-errline-face
|
||||
A custom face for highlighting lines for which at least one error has
|
||||
been reported.
|
||||
|
||||
@item flymake-warnline-face
|
||||
A custom face for highlighting lines for which at least one warning
|
||||
and no errors have been reported.
|
||||
|
||||
@end table
|
||||
|
||||
@node Adding support for a new syntax check tool
|
||||
@section Adding support for a new syntax check tool
|
||||
@cindex Adding support for a new syntax check tool
|
||||
|
||||
@menu
|
||||
* Example -- Configuring a tool called directly::
|
||||
* Example -- Configuring a tool called via make::
|
||||
@end menu
|
||||
|
||||
Syntax check tools are configured using the
|
||||
@code{flymake-allowed-file-name-masks} list. Each item of this list
|
||||
has the following format:
|
||||
|
||||
@lisp
|
||||
(filename-regexp, init-function, cleanup-function, getfname-function)
|
||||
@end lisp
|
||||
|
||||
@table @code
|
||||
@item filename-regexp
|
||||
This field is used as a key for locating init/cleanup/getfname
|
||||
functions for the buffer. Items in
|
||||
@code{flymake-allowed-file-name-masks} are searched sequentially. The
|
||||
first item with @code{filename-regexp} matching buffer filename is
|
||||
selected. If no match is found, @code{flymake-mode} is switched off.
|
||||
|
||||
@item init-function
|
||||
@code{init-function} is required to initialize the syntax check,
|
||||
usually by creating a temporary copy of the buffer contents. The
|
||||
function must return @code{(list cmd-name arg-list)}. If
|
||||
@code{init-function} returns null, syntax check is aborted, by
|
||||
@code{flymake-mode} is not switched off.
|
||||
|
||||
@item cleanup-function
|
||||
@code{cleanup-function} is called after the syntax check process is
|
||||
complete and should take care of proper deinitialization, which is
|
||||
usually deleting a temporary copy created by the @code{init-function}.
|
||||
|
||||
@item getfname-function
|
||||
This function is used for translating filenames reported by the syntax
|
||||
check tool into ``real'' filenames. Filenames reported by the tool
|
||||
will be different from the real ones, as actually the tool works with
|
||||
the temporary copy. In most cases, the default implementation
|
||||
provided by Flymake, @code{flymake-get-real-file-name}, can be used as
|
||||
@code{getfname-function}.
|
||||
|
||||
@end table
|
||||
|
||||
To add support for a new syntax check tool, write corresponding
|
||||
@code{init-function}, and, optionally @code{cleanup-function} and
|
||||
@code{getfname-function}. If the format of error messages reported by
|
||||
the new tool is not yet supported by Flymake, add a new entry to
|
||||
the @code{flymake-err-line-patterns} list.
|
||||
|
||||
The following sections contain some examples of configuring Flymake
|
||||
support for various syntax check tools.
|
||||
|
||||
@node Example -- Configuring a tool called directly
|
||||
@subsection Example -- Configuring a tool called directly
|
||||
@cindex Adding support for perl
|
||||
|
||||
In this example, we will add support for @code{perl} as a syntax check
|
||||
tool. @code{perl} supports the @code{-c} option which does syntax
|
||||
checking.
|
||||
|
||||
First, we write the @code{init-function}:
|
||||
|
||||
@lisp
|
||||
(defun flymake-perl-init (buffer)
|
||||
(let* ((temp-file (flymake-init-create-temp-buffer-copy
|
||||
buffer 'flymake-create-temp-inplace))
|
||||
(local-file (concat (flymake-build-relative-filename
|
||||
(file-name-directory
|
||||
(buffer-file-name
|
||||
(current-buffer)))
|
||||
(file-name-directory temp-file))
|
||||
(file-name-nondirectory temp-file))))
|
||||
(list "perl" (list "-wc " local-file))))
|
||||
@end lisp
|
||||
|
||||
@code{flymake-perl-init} creates a temporary copy of the buffer
|
||||
contents with the help of
|
||||
@code{flymake-init-create-temp-buffer-copy}, and builds an appropriate
|
||||
command line.
|
||||
|
||||
Next, we add a new entry to the
|
||||
@code{flymake-allowed-file-name-masks}:
|
||||
|
||||
@lisp
|
||||
(setq flymake-allowed-file-name-masks
|
||||
(cons '(".+\\.pl$"
|
||||
flymake-perl-init
|
||||
flymake-simple-cleanup
|
||||
flymake-get-real-file-name)
|
||||
flymake-allowed-file-name-masks))
|
||||
@end lisp
|
||||
|
||||
Note that we use standard @code{cleanup-function} and
|
||||
@code{getfname-function}.
|
||||
|
||||
Finally, we add an entry to @code{flymake-err-line-patterns}:
|
||||
|
||||
@lisp
|
||||
(setq flymake-err-line-patterns
|
||||
(cons '("\\(.*\\) at \\([^ \n]+\\) line \\([0-9]+\\)[,.\n]"
|
||||
2 3 nil 1)
|
||||
flymake-err-line-patterns))
|
||||
@end lisp
|
||||
|
||||
@node Example -- Configuring a tool called via make
|
||||
@subsection Example -- Configuring a tool called via make
|
||||
@cindex Adding support for C (gcc+make)
|
||||
|
||||
In this example we will add support for C files syntax checked by
|
||||
@code{gcc} called via @code{make}.
|
||||
|
||||
We're not required to write any new functions, as Flymake already has
|
||||
functions for @code{make}. We just add a new entry to the
|
||||
@code{flymake-allowed-file-name-masks}:
|
||||
|
||||
@lisp
|
||||
(setq flymake-allowed-file-name-masks
|
||||
(cons '(".+\\.c$"
|
||||
flymake-simple-make-init
|
||||
flymake-simple-cleanup
|
||||
flymake-get-real-file-name)
|
||||
flymake-allowed-file-name-masks))
|
||||
@end lisp
|
||||
|
||||
@code{flymake-simple-make-init} builds the following @code{make}
|
||||
command line:
|
||||
|
||||
@lisp
|
||||
(list "make"
|
||||
(list "-s" "-C"
|
||||
base-dir
|
||||
(concat "CHK_SOURCES=" source)
|
||||
"SYNTAX_CHECK_MODE=1"
|
||||
"check-syntax"))
|
||||
@end lisp
|
||||
|
||||
@code{base-dir} is a directory containing @code{Makefile}, see @ref{Locating the buildfile}.
|
||||
|
||||
Thus, @code{Makefile} must contain the @code{check-syntax} target. In
|
||||
our case this target might look like this:
|
||||
|
||||
@verbatim
|
||||
check-syntax:
|
||||
gcc -o nul -S ${CHK_SOURCES}
|
||||
@end verbatim
|
||||
|
||||
The format of error messages reported by @code{gcc} is already
|
||||
supported by Flymake, so we don't have to add a new entry to
|
||||
@code{flymake-err-line-patterns}.
|
||||
|
||||
@node Flymake Implementation
|
||||
@chapter Flymake Implementation
|
||||
@cindex Implementation details
|
||||
|
||||
@menu
|
||||
* Determining whether syntax check is possible::
|
||||
* Making a temporary copy::
|
||||
* Locating a master file::
|
||||
* Getting the include directories::
|
||||
* Locating the buildfile::
|
||||
* Starting the syntax check process::
|
||||
* Parsing the output::
|
||||
* Highlighting erroneous lines::
|
||||
* Interaction with other modes::
|
||||
@end menu
|
||||
|
||||
Syntax check is started by calling @code{flymake-start-syntax-check-for-current-buffer}.
|
||||
Flymake first determines whether it is able to do syntax
|
||||
check. It then saves a copy of the buffer in a temporary file in the
|
||||
buffer's directory (or in the system temp directory -- for java
|
||||
files), creates a syntax check command and launches a process with
|
||||
this command. The output is parsed using a list of error message patterns,
|
||||
and error information (file name, line number, type and text) is
|
||||
saved. After the process has finished, Flymake highlights erroneous
|
||||
lines in the buffer using the accumulated error information.
|
||||
|
||||
@node Determining whether syntax check is possible
|
||||
@section Determining whether syntax check is possible
|
||||
@cindex Syntax check models
|
||||
@cindex Master file
|
||||
|
||||
Syntax check is considered possible if there's an entry in
|
||||
@code{flymake-allowed-file-name-masks} matching buffer's filename and
|
||||
its @code{init-function} returns non-@code{nil} value.
|
||||
|
||||
Two syntax check modes are distinguished:
|
||||
|
||||
@enumerate
|
||||
|
||||
@item
|
||||
Buffer can be syntax checked in a standalone fashion, that is, the
|
||||
file (its temporary copy, in fact) can be passed over to the compiler to
|
||||
do the syntax check. Examples are C/C++ (.c, .cpp) and Java (.java)
|
||||
sources.
|
||||
|
||||
@item
|
||||
Buffer can be syntax checked, but additional file, called master file,
|
||||
is required to perform this operation. A master file is a file that
|
||||
includes the current file, so that running a syntax check tool on it
|
||||
will also check syntax in the current file. Examples are C/C++ (.h,
|
||||
.hpp) headers.
|
||||
|
||||
@end enumerate
|
||||
|
||||
These modes are handled inside init/cleanup/getfname functions, see
|
||||
@ref{Adding support for a new syntax check tool}.
|
||||
|
||||
Flymake contains implementations of all functionality required to
|
||||
support different syntax check modes described above (making
|
||||
temporary copies, finding master files, etc.), as well as some
|
||||
tool-specific (routines for @code{make}, @code{Ant}, etc.) code.
|
||||
|
||||
|
||||
@node Making a temporary copy
|
||||
@section Making a temporary copy
|
||||
@cindex Temporary copy of the buffer
|
||||
@cindex Master file
|
||||
|
||||
After the possibility of the syntax check has been determined, a
|
||||
temporary copy of the current buffer is made so that the most recent
|
||||
unsaved changes could be seen by the syntax check tool. Making a copy
|
||||
is quite straightforward in a standalone case (mode @code{1}), as it's
|
||||
just saving buffer contents to a temporary file.
|
||||
|
||||
Things get trickier, however, when master file is involved, as it
|
||||
requires to
|
||||
|
||||
@itemize @bullet
|
||||
@item locate a master file
|
||||
@item patch it to include the current file using its new (temporary)
|
||||
name.
|
||||
@end itemize
|
||||
|
||||
Locating a master file is discussed in the following section.
|
||||
|
||||
Patching just changes all appropriate lines of the master file so that they
|
||||
use the new (temporary) name of the current file. For example, suppose current
|
||||
file name is @code{file.h}, the master file is @code{file.cpp}, and
|
||||
it includes current file via @code{#include "file.h"}. Current file's copy
|
||||
is saved to file @code{file_flymake.h}, so the include line must be
|
||||
changed to @code{#include "file_flymake.h"}. Finally, patched master file
|
||||
is saved to @code{file_flymake_master.cpp}, and the last one is passed to
|
||||
the syntax check tool.
|
||||
|
||||
@node Locating a master file
|
||||
@section Locating a master file
|
||||
@cindex Master file
|
||||
|
||||
Master file is located in two steps.
|
||||
|
||||
First, a list of possible master files is built. A simple name
|
||||
matching is used to find the files. For a C++ header @code{file.h},
|
||||
Flymake searches for all @code{.cpp} files in the directories whose relative paths are
|
||||
stored in a customizable variable @code{flymake-master-file-dirs}, which
|
||||
usually contains something like @code{("." "./src")}. No more than
|
||||
@code{flymake-master-file-count-limit} entries is added to the master file
|
||||
list. The list is then sorted to move files with names @code{file.cpp} to
|
||||
the top.
|
||||
|
||||
Next, each master file in a list is checked to contain the appropriate
|
||||
include directives. No more than @code{flymake-check-file-limit} of each
|
||||
file are parsed.
|
||||
|
||||
For @code{file.h}, the include directives to look for are
|
||||
@code{#include "file.h"}, @code{#include "../file.h"}, etc. Each
|
||||
include is checked against a list of include directories
|
||||
(see @ref{Getting the include directories}) to be sure it points to the
|
||||
correct @code{file.h}.
|
||||
|
||||
First matching master file found stops the search. The master file is then
|
||||
patched and saved to disk. In case no master file is found, syntax check is
|
||||
aborted, and corresponding status (!) is reported in the mode line.
|
||||
|
||||
@node Getting the include directories
|
||||
@section Getting the include directories
|
||||
@cindex Include directories (C/C++ specific)
|
||||
|
||||
Two sets of include directories are distinguished: system include directories
|
||||
and project include directories. The former is just the contents of the
|
||||
@code{INCLUDE} environment variable. The latter is not so easy to obtain,
|
||||
and the way it can be obtained can vary greatly for different projects.
|
||||
Therefore, a customizable variable
|
||||
@code{flymake-get-project-include-dirs-function} is used to provide the
|
||||
way to implement the desired behavior.
|
||||
|
||||
The default implementation, @code{flymake-get-project-include-dirs-imp},
|
||||
uses a @code{make} call. This requires a correct base directory, that is, a
|
||||
directory containing a correct @code{Makefile}, to be determined.
|
||||
|
||||
As obtaining the project include directories might be a costly operation, its
|
||||
return value is cached in the hash table. The cache is cleared in the beginning
|
||||
of every syntax check attempt.
|
||||
|
||||
@node Locating the buildfile
|
||||
@section Locating the buildfile
|
||||
@cindex Locating the buildfile
|
||||
@cindex buildfile, locating
|
||||
@cindex Makefile, locating
|
||||
|
||||
Flymake can be configured to use different tools for performing syntax
|
||||
checks. For example, it can use direct compiler call to syntax check a perl
|
||||
script or a call to @code{make} for a more complicated case of a
|
||||
@code{C/C++} source. The general idea is that simple files, like perl
|
||||
scripts and html pages, can be checked by directly invoking a
|
||||
corresponding tool. Files that are usually more complex and generally
|
||||
used as part of larger projects, might require non-trivial options to
|
||||
be passed to the syntax check tool, like include directories for
|
||||
C++. The latter files are syntax checked using some build tool, like
|
||||
@code{make} or @code{Ant}.
|
||||
|
||||
All @code{make} configuration data is usually stored in a file called
|
||||
@code{Makefile}. To allow for future extensions, flymake uses a notion of
|
||||
buildfile to reference the 'project configuration' file.
|
||||
|
||||
Special function, @code{flymake-find-buildfile} is provided for locating buildfiles.
|
||||
Searching for a buildfile is done in a manner similar to that of searching
|
||||
for possible master files. A customizable variable
|
||||
@code{flymake-buildfile-dirs} holds a list of relative paths to the
|
||||
buildfile. They are checked sequentially until a buildfile is found. In case
|
||||
there's no build file, syntax check is aborted.
|
||||
|
||||
Buildfile values are also cached.
|
||||
|
||||
@node Starting the syntax check process
|
||||
@section Starting the syntax check process
|
||||
@cindex Syntax check process
|
||||
|
||||
The command line (command name and the list of arguments) for launching a process is returned by the
|
||||
initialization function. Flymake then just calls @code{start-process}
|
||||
to start an asynchronous process and configures process filter and
|
||||
sentinel which is used for processing the output of the syntax check
|
||||
tool.
|
||||
|
||||
@node Parsing the output
|
||||
@section Parsing the output
|
||||
@cindex Parsing the output
|
||||
|
||||
The output generated by the syntax check tool is parsed in the process
|
||||
filter/sentinel using the error message patterns stored in the
|
||||
@code{flymake-err-line-patterns} variable. This variable contains a
|
||||
list of items of the form @code{(regexp file-idx line-idx
|
||||
err-text-idx)}, used to determine whether a particular line is an
|
||||
error message and extract file name, line number and error text,
|
||||
respectively. Error type (error/warning) is also guessed by matching
|
||||
error text with the '@code{^[wW]arning}' pattern. Anything that was not
|
||||
classified as a warning is considered an error. Type is then used to
|
||||
sort error menu items, which shows error messages first.
|
||||
|
||||
Flymake is also able to interpret error message patterns missing err-text-idx
|
||||
information. This is done by merely taking the rest of the matched line
|
||||
(@code{(substring line (match-end 0))}) as error text. This trick allows
|
||||
to make use of a huge collection of error message line patterns from
|
||||
@code{compile.el}. All these error patterns are appended to
|
||||
the end of @code{flymake-err-line-patterns}.
|
||||
|
||||
The error information obtained is saved in a buffer local
|
||||
variable. The buffer for which the process output belongs is
|
||||
determined from the process-id@w{}->@w{}buffer mapping updated
|
||||
after every process launch/exit.
|
||||
|
||||
@node Highlighting erroneous lines
|
||||
@section Highlighting erroneous lines
|
||||
@cindex Erroneous lines, faces
|
||||
|
||||
Highlighting is implemented with overlays and happens in the process
|
||||
sentinel, after calling the cleanup function. Two customizable faces
|
||||
are used: @code{flymake-errline-face} and
|
||||
@code{flymake-warnline-face}. Errors belonging outside the current
|
||||
buffer are considered to belong to line 1 of the current buffer.
|
||||
|
||||
@node Interaction with other modes
|
||||
@section Interaction with other modes
|
||||
@cindex Interaction with other modes
|
||||
@cindex Interaction with compile mode
|
||||
|
||||
The only mode flymake currently knows about is @code{compile}.
|
||||
|
||||
Flymake can be configured to not start syntax check if it thinks the
|
||||
compilation is in progress. The check is made by the
|
||||
@code{flymake-compilation-is-running}, which tests the
|
||||
@code{compilation-in-progress} variable. The reason why this might be
|
||||
useful is saving CPU time in case both syntax check and compilation
|
||||
are very CPU intensive. The original reason for adding this feature,
|
||||
though, was working around a locking problem with MS Visual C++ compiler.
|
||||
|
||||
Flymake also provides an alternative command for starting compilation,
|
||||
@code{flymake-compile}:
|
||||
|
||||
@lisp
|
||||
(defun flymake-compile ()
|
||||
"Kill all flymake syntax checks then start compilation."
|
||||
(interactive)
|
||||
(flymake-stop-all-syntax-checks)
|
||||
(call-interactively 'compile))
|
||||
@end lisp
|
||||
|
||||
It just kills all the active syntax check processes before calling
|
||||
@code{compile}.
|
||||
|
||||
@node GNU Free Documentation License
|
||||
@appendix GNU Free Documentation License
|
||||
@include doclicense.texi
|
||||
|
||||
@node Index
|
||||
@unnumbered Index
|
||||
|
||||
@printindex cp
|
||||
|
||||
@bye
|
||||
|
||||
@ignore
|
||||
arch-tag: 9f0db077-5598-49ab-90b9-8df9248a63ec
|
||||
@end ignore
|
985
man/forms.texi
985
man/forms.texi
|
@ -1,985 +0,0 @@
|
|||
\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.)
|
||||
|
||||
@copying
|
||||
This file documents Forms mode, a form-editing major mode for GNU Emacs.
|
||||
|
||||
Copyright @copyright{} 1989, 1997, 2001, 2002, 2003, 2004,
|
||||
2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with the Front-Cover texts being ``A GNU
|
||||
Manual,'' and with the Back-Cover Texts as in (a) below. A copy of the
|
||||
license is included in the section entitled ``GNU Free Documentation
|
||||
License'' in the Emacs manual.
|
||||
|
||||
(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
|
||||
this GNU Manual, like GNU software. Copies published by the Free
|
||||
Software Foundation raise funds for GNU development.''
|
||||
|
||||
This document is part of a collection distributed under the GNU Free
|
||||
Documentation License. If you want to distribute this document
|
||||
separately from the collection, you can do so by adding a copy of the
|
||||
license to the document, as described in section 6 of the license.
|
||||
@end quotation
|
||||
@end copying
|
||||
|
||||
@dircategory Emacs
|
||||
@direntry
|
||||
* Forms: (forms). Emacs package for editing data bases
|
||||
by filling in forms.
|
||||
@end direntry
|
||||
|
||||
@titlepage
|
||||
@sp 6
|
||||
@center @titlefont{Forms Mode User's Manual}
|
||||
@sp 4
|
||||
@center Forms-Mode version 2
|
||||
@sp 1
|
||||
@center for GNU Emacs 22.1
|
||||
@sp 1
|
||||
@center April 2007
|
||||
@sp 5
|
||||
@center Johan Vromans
|
||||
@center @i{jvromans@@squirrel.nl}
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
@insertcopying
|
||||
@end titlepage
|
||||
|
||||
@ifnottex
|
||||
@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.
|
||||
* GNU Free Documentation License:: The license for this documentation.
|
||||
* Credits:: Thanks everyone.
|
||||
* Index:: Index to this manual.
|
||||
@end menu
|
||||
@end ifnottex
|
||||
|
||||
@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 favorite 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 GNU Free Documentation License
|
||||
@appendix GNU Free Documentation License
|
||||
@include doclicense.texi
|
||||
|
||||
@node Index
|
||||
@unnumbered Index
|
||||
@printindex cp
|
||||
|
||||
@contents
|
||||
@bye
|
||||
|
||||
@ignore
|
||||
arch-tag: 2ac9810b-aa49-4ea6-8030-d7f1ecd467ed
|
||||
@end ignore
|
|
@ -1,548 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@c
|
||||
@c This file is included either in emacs-xtra.texi (when producing the
|
||||
@c printed version) or in the main Emacs manual (for the on-line version).
|
||||
@node Fortran
|
||||
@section Fortran Mode
|
||||
@cindex Fortran mode
|
||||
@cindex mode, Fortran
|
||||
|
||||
Fortran mode provides special motion commands for Fortran statements
|
||||
and subprograms, and indentation commands that understand Fortran
|
||||
conventions of nesting, line numbers and continuation statements.
|
||||
Fortran mode has support for Auto Fill mode that breaks long lines into
|
||||
proper Fortran continuation lines.
|
||||
|
||||
Special commands for comments are provided because Fortran comments
|
||||
are unlike those of other languages. Built-in abbrevs optionally save
|
||||
typing when you insert Fortran keywords.
|
||||
|
||||
Use @kbd{M-x fortran-mode} to switch to this major mode. This
|
||||
command runs the hook @code{fortran-mode-hook}.
|
||||
@iftex
|
||||
@xref{Hooks,,, emacs, the Emacs Manual}.
|
||||
@end iftex
|
||||
@ifnottex
|
||||
@xref{Hooks}.
|
||||
@end ifnottex
|
||||
|
||||
@cindex Fortran77 and Fortran90
|
||||
@findex f90-mode
|
||||
@findex fortran-mode
|
||||
Fortran mode is meant for editing Fortran77 ``fixed format'' (and also
|
||||
``tab format'') source code. For editing the modern Fortran90 or
|
||||
Fortran95 ``free format'' source code, use F90 mode (@code{f90-mode}).
|
||||
Emacs normally uses Fortran mode for files with extension @samp{.f},
|
||||
@samp{.F} or @samp{.for}, and F90 mode for the extension @samp{.f90} and
|
||||
@samp{.f95}. GNU Fortran supports both kinds of format.
|
||||
|
||||
@menu
|
||||
* Motion: Fortran Motion. Moving point by statements or subprograms.
|
||||
* Indent: Fortran Indent. Indentation commands for Fortran.
|
||||
* Comments: Fortran Comments. Inserting and aligning comments.
|
||||
* Autofill: Fortran Autofill. Auto fill support for Fortran.
|
||||
* Columns: Fortran Columns. Measuring columns for valid Fortran.
|
||||
* Abbrev: Fortran Abbrev. Built-in abbrevs for Fortran keywords.
|
||||
@end menu
|
||||
|
||||
@node Fortran Motion
|
||||
@subsection Motion Commands
|
||||
|
||||
In addition to the normal commands for moving by and operating on
|
||||
``defuns'' (Fortran subprograms---functions and subroutines, as well as
|
||||
modules for F90 mode), Fortran mode provides special commands to move by
|
||||
statements and other program units.
|
||||
|
||||
@table @kbd
|
||||
@kindex C-c C-n @r{(Fortran mode)}
|
||||
@findex fortran-next-statement
|
||||
@findex f90-next-statement
|
||||
@item C-c C-n
|
||||
Move to the beginning of the next statement
|
||||
(@code{fortran-next-statement}/@code{f90-next-statement}).
|
||||
|
||||
@kindex C-c C-p @r{(Fortran mode)}
|
||||
@findex fortran-previous-statement
|
||||
@findex f90-previous-statement
|
||||
@item C-c C-p
|
||||
Move to the beginning of the previous statement
|
||||
(@code{fortran-previous-statement}/@code{f90-previous-statement}).
|
||||
If there is no previous statement (i.e. if called from the first
|
||||
statement in the buffer), move to the start of the buffer.
|
||||
|
||||
@kindex C-c C-e @r{(F90 mode)}
|
||||
@findex f90-next-block
|
||||
@item C-c C-e
|
||||
Move point forward to the start of the next code block
|
||||
(@code{f90-next-block}). A code block is a subroutine,
|
||||
@code{if}--@code{endif} statement, and so forth. This command exists
|
||||
for F90 mode only, not Fortran mode. With a numeric argument, this
|
||||
moves forward that many blocks.
|
||||
|
||||
@kindex C-c C-a @r{(F90 mode)}
|
||||
@findex f90-previous-block
|
||||
@item C-c C-a
|
||||
Move point backward to the previous code block
|
||||
(@code{f90-previous-block}). This is like @code{f90-next-block}, but
|
||||
moves backwards.
|
||||
|
||||
@kindex C-M-n @r{(Fortran mode)}
|
||||
@findex fortran-end-of-block
|
||||
@findex f90-end-of-block
|
||||
@item C-M-n
|
||||
Move to the end of the current code block
|
||||
(@code{fortran-end-of-block}/@code{f90-end-of-block}). With a numeric
|
||||
argument, move forward that number of blocks. The mark is set before
|
||||
moving point. The F90 mode version of this command checks for
|
||||
consistency of block types and labels (if present), but it does not
|
||||
check the outermost block since that may be incomplete.
|
||||
|
||||
@kindex C-M-p @r{(Fortran mode)}
|
||||
@findex fortran-beginning-of-block
|
||||
@findex f90-beginning-of-block
|
||||
@item C-M-p
|
||||
Move to the start of the current code block
|
||||
(@code{fortran-beginning-of-block}/@code{f90-beginning-of-block}). This
|
||||
is like @code{fortran-end-of-block}, but moves backwards.
|
||||
@end table
|
||||
|
||||
@node Fortran Indent
|
||||
@subsection Fortran Indentation
|
||||
|
||||
Special commands and features are needed for indenting Fortran code in
|
||||
order to make sure various syntactic entities (line numbers, comment line
|
||||
indicators and continuation line flags) appear in the columns that are
|
||||
required for standard, fixed (or tab) format Fortran.
|
||||
|
||||
@menu
|
||||
* Commands: ForIndent Commands. Commands for indenting and filling Fortran.
|
||||
* Contline: ForIndent Cont. How continuation lines indent.
|
||||
* Numbers: ForIndent Num. How line numbers auto-indent.
|
||||
* Conv: ForIndent Conv. Conventions you must obey to avoid trouble.
|
||||
* Vars: ForIndent Vars. Variables controlling Fortran indent style.
|
||||
@end menu
|
||||
|
||||
@node ForIndent Commands
|
||||
@subsubsection Fortran Indentation and Filling Commands
|
||||
|
||||
@table @kbd
|
||||
@item C-M-j
|
||||
Break the current line at point and set up a continuation line
|
||||
(@code{fortran-split-line}).
|
||||
@item M-^
|
||||
Join this line to the previous line (@code{fortran-join-line}).
|
||||
@item C-M-q
|
||||
Indent all the lines of the subprogram point is in
|
||||
(@code{fortran-indent-subprogram}).
|
||||
@item M-q
|
||||
Fill a comment block or statement.
|
||||
@end table
|
||||
|
||||
@kindex C-M-q @r{(Fortran mode)}
|
||||
@findex fortran-indent-subprogram
|
||||
The key @kbd{C-M-q} runs @code{fortran-indent-subprogram}, a command
|
||||
to reindent all the lines of the Fortran subprogram (function or
|
||||
subroutine) containing point.
|
||||
|
||||
@kindex C-M-j @r{(Fortran mode)}
|
||||
@findex fortran-split-line
|
||||
The key @kbd{C-M-j} runs @code{fortran-split-line}, which splits
|
||||
a line in the appropriate fashion for Fortran. In a non-comment line,
|
||||
the second half becomes a continuation line and is indented
|
||||
accordingly. In a comment line, both halves become separate comment
|
||||
lines.
|
||||
|
||||
@kindex M-^ @r{(Fortran mode)}
|
||||
@kindex C-c C-d @r{(Fortran mode)}
|
||||
@findex fortran-join-line
|
||||
@kbd{M-^} or @kbd{C-c C-d} runs the command @code{fortran-join-line},
|
||||
which joins a continuation line back to the previous line, roughly as
|
||||
the inverse of @code{fortran-split-line}. The point must be on a
|
||||
continuation line when this command is invoked.
|
||||
|
||||
@kindex M-q @r{(Fortran mode)}
|
||||
@kbd{M-q} in Fortran mode fills the comment block or statement that
|
||||
point is in. This removes any excess statement continuations.
|
||||
|
||||
@node ForIndent Cont
|
||||
@subsubsection Continuation Lines
|
||||
@cindex Fortran continuation lines
|
||||
|
||||
@vindex fortran-continuation-string
|
||||
Most Fortran77 compilers allow two ways of writing continuation lines.
|
||||
If the first non-space character on a line is in column 5, then that
|
||||
line is a continuation of the previous line. We call this @dfn{fixed
|
||||
format}. (In GNU Emacs we always count columns from 0; but note that
|
||||
the Fortran standard counts from 1.) The variable
|
||||
@code{fortran-continuation-string} specifies what character to put in
|
||||
column 5. A line that starts with a tab character followed by any digit
|
||||
except @samp{0} is also a continuation line. We call this style of
|
||||
continuation @dfn{tab format}. (Fortran90 introduced ``free format,''
|
||||
with another style of continuation lines).
|
||||
|
||||
@vindex indent-tabs-mode @r{(Fortran mode)}
|
||||
@vindex fortran-analyze-depth
|
||||
@vindex fortran-tab-mode-default
|
||||
Fortran mode can use either style of continuation line. When you
|
||||
enter Fortran mode, it tries to deduce the proper continuation style
|
||||
automatically from the buffer contents. It does this by scanning up to
|
||||
@code{fortran-analyze-depth} (default 100) lines from the start of the
|
||||
buffer. The first line that begins with either a tab character or six
|
||||
spaces determines the choice. If the scan fails (for example, if the
|
||||
buffer is new and therefore empty), the value of
|
||||
@code{fortran-tab-mode-default} (@code{nil} for fixed format, and
|
||||
non-@code{nil} for tab format) is used. @samp{/t} in the mode line
|
||||
indicates tab format is selected. Fortran mode sets the value of
|
||||
@code{indent-tabs-mode} accordingly.
|
||||
|
||||
If the text on a line starts with the Fortran continuation marker
|
||||
@samp{$}, or if it begins with any non-whitespace character in column
|
||||
5, Fortran mode treats it as a continuation line. When you indent a
|
||||
continuation line with @key{TAB}, it converts the line to the current
|
||||
continuation style. When you split a Fortran statement with
|
||||
@kbd{C-M-j}, the continuation marker on the newline is created according
|
||||
to the continuation style.
|
||||
|
||||
The setting of continuation style affects several other aspects of
|
||||
editing in Fortran mode. In fixed format mode, the minimum column
|
||||
number for the body of a statement is 6. Lines inside of Fortran
|
||||
blocks that are indented to larger column numbers always use only the
|
||||
space character for whitespace. In tab format mode, the minimum
|
||||
column number for the statement body is 8, and the whitespace before
|
||||
column 8 must always consist of one tab character.
|
||||
|
||||
@node ForIndent Num
|
||||
@subsubsection Line Numbers
|
||||
|
||||
If a number is the first non-whitespace in the line, Fortran
|
||||
indentation assumes it is a line number and moves it to columns 0
|
||||
through 4. (Columns always count from 0 in GNU Emacs.)
|
||||
|
||||
@vindex fortran-line-number-indent
|
||||
Line numbers of four digits or less are normally indented one space.
|
||||
The variable @code{fortran-line-number-indent} controls this; it
|
||||
specifies the maximum indentation a line number can have. The default
|
||||
value of the variable is 1. Fortran mode tries to prevent line number
|
||||
digits passing column 4, reducing the indentation below the specified
|
||||
maximum if necessary. If @code{fortran-line-number-indent} has the
|
||||
value 5, line numbers are right-justified to end in column 4.
|
||||
|
||||
@vindex fortran-electric-line-number
|
||||
Simply inserting a line number is enough to indent it according to
|
||||
these rules. As each digit is inserted, the indentation is recomputed.
|
||||
To turn off this feature, set the variable
|
||||
@code{fortran-electric-line-number} to @code{nil}.
|
||||
|
||||
|
||||
@node ForIndent Conv
|
||||
@subsubsection Syntactic Conventions
|
||||
|
||||
Fortran mode assumes that you follow certain conventions that simplify
|
||||
the task of understanding a Fortran program well enough to indent it
|
||||
properly:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Two nested @samp{do} loops never share a @samp{continue} statement.
|
||||
|
||||
@item
|
||||
Fortran keywords such as @samp{if}, @samp{else}, @samp{then}, @samp{do}
|
||||
and others are written without embedded whitespace or line breaks.
|
||||
|
||||
Fortran compilers generally ignore whitespace outside of string
|
||||
constants, but Fortran mode does not recognize these keywords if they
|
||||
are not contiguous. Constructs such as @samp{else if} or @samp{end do}
|
||||
are acceptable, but the second word should be on the same line as the
|
||||
first and not on a continuation line.
|
||||
@end itemize
|
||||
|
||||
@noindent
|
||||
If you fail to follow these conventions, the indentation commands may
|
||||
indent some lines unaesthetically. However, a correct Fortran program
|
||||
retains its meaning when reindented even if the conventions are not
|
||||
followed.
|
||||
|
||||
@node ForIndent Vars
|
||||
@subsubsection Variables for Fortran Indentation
|
||||
|
||||
@vindex fortran-do-indent
|
||||
@vindex fortran-if-indent
|
||||
@vindex fortran-structure-indent
|
||||
@vindex fortran-continuation-indent
|
||||
@vindex fortran-check-all-num@dots{}
|
||||
@vindex fortran-minimum-statement-indent@dots{}
|
||||
Several additional variables control how Fortran indentation works:
|
||||
|
||||
@table @code
|
||||
@item fortran-do-indent
|
||||
Extra indentation within each level of @samp{do} statement (default 3).
|
||||
|
||||
@item fortran-if-indent
|
||||
Extra indentation within each level of @samp{if}, @samp{select case}, or
|
||||
@samp{where} statements (default 3).
|
||||
|
||||
@item fortran-structure-indent
|
||||
Extra indentation within each level of @samp{structure}, @samp{union},
|
||||
@samp{map}, or @samp{interface} statements (default 3).
|
||||
|
||||
@item fortran-continuation-indent
|
||||
Extra indentation for bodies of continuation lines (default 5).
|
||||
|
||||
@item fortran-check-all-num-for-matching-do
|
||||
In Fortran77, a numbered @samp{do} statement is ended by any statement
|
||||
with a matching line number. It is common (but not compulsory) to use a
|
||||
@samp{continue} statement for this purpose. If this variable has a
|
||||
non-@code{nil} value, indenting any numbered statement must check for a
|
||||
@samp{do} that ends there. If you always end @samp{do} statements with
|
||||
a @samp{continue} line (or if you use the more modern @samp{enddo}),
|
||||
then you can speed up indentation by setting this variable to
|
||||
@code{nil}. The default is @code{nil}.
|
||||
|
||||
@item fortran-blink-matching-if
|
||||
If this is @code{t}, indenting an @samp{endif} (or @samp{enddo}
|
||||
statement moves the cursor momentarily to the matching @samp{if} (or
|
||||
@samp{do}) statement to show where it is. The default is @code{nil}.
|
||||
|
||||
@item fortran-minimum-statement-indent-fixed
|
||||
Minimum indentation for Fortran statements when using fixed format
|
||||
continuation line style. Statement bodies are never indented less than
|
||||
this much. The default is 6.
|
||||
|
||||
@item fortran-minimum-statement-indent-tab
|
||||
Minimum indentation for Fortran statements for tab format continuation line
|
||||
style. Statement bodies are never indented less than this much. The
|
||||
default is 8.
|
||||
@end table
|
||||
|
||||
The variables controlling the indentation of comments are described in
|
||||
the following section.
|
||||
|
||||
@node Fortran Comments
|
||||
@subsection Fortran Comments
|
||||
|
||||
The usual Emacs comment commands assume that a comment can follow a
|
||||
line of code. In Fortran77, the standard comment syntax requires an
|
||||
entire line to be just a comment. Therefore, Fortran mode replaces the
|
||||
standard Emacs comment commands and defines some new variables.
|
||||
|
||||
@vindex fortran-comment-line-start
|
||||
Fortran mode can also handle the Fortran90 comment syntax where comments
|
||||
start with @samp{!} and can follow other text. Because only some Fortran77
|
||||
compilers accept this syntax, Fortran mode will not insert such comments
|
||||
unless you have said in advance to do so. To do this, set the variable
|
||||
@code{fortran-comment-line-start} to @samp{"!"}.
|
||||
|
||||
@table @kbd
|
||||
@item M-;
|
||||
Align comment or insert new comment (@code{fortran-indent-comment}).
|
||||
|
||||
@item C-x ;
|
||||
Applies to nonstandard @samp{!} comments only.
|
||||
|
||||
@item C-c ;
|
||||
Turn all lines of the region into comments, or (with argument) turn them back
|
||||
into real code (@code{fortran-comment-region}).
|
||||
@end table
|
||||
|
||||
@findex fortran-indent-comment
|
||||
@kbd{M-;} in Fortran mode is redefined as the command
|
||||
@code{fortran-indent-comment}. Like the usual @kbd{M-;} command, this
|
||||
recognizes any kind of existing comment and aligns its text appropriately;
|
||||
if there is no existing comment, a comment is inserted and aligned. But
|
||||
inserting and aligning comments are not the same in Fortran mode as in
|
||||
other modes.
|
||||
|
||||
When a new comment must be inserted, if the current line is blank, a
|
||||
full-line comment is inserted. On a non-blank line, a nonstandard @samp{!}
|
||||
comment is inserted if you have said you want to use them. Otherwise a
|
||||
full-line comment is inserted on a new line before the current line.
|
||||
|
||||
Nonstandard @samp{!} comments are aligned like comments in other
|
||||
languages, but full-line comments are different. In a standard full-line
|
||||
comment, the comment delimiter itself must always appear in column zero.
|
||||
What can be aligned is the text within the comment. You can choose from
|
||||
three styles of alignment by setting the variable
|
||||
@code{fortran-comment-indent-style} to one of these values:
|
||||
|
||||
@vindex fortran-comment-indent-style
|
||||
@vindex fortran-comment-line-extra-indent
|
||||
@table @code
|
||||
@item fixed
|
||||
Align the text at a fixed column, which is the sum of
|
||||
@code{fortran-comment-line-extra-indent} and the minimum statement
|
||||
indentation. This is the default.
|
||||
|
||||
The minimum statement indentation is
|
||||
@code{fortran-minimum-statement-indent-fixed} for fixed format
|
||||
continuation line style and @code{fortran-minimum-statement-indent-tab}
|
||||
for tab format style.
|
||||
|
||||
@item relative
|
||||
Align the text as if it were a line of code, but with an additional
|
||||
@code{fortran-comment-line-extra-indent} columns of indentation.
|
||||
|
||||
@item nil
|
||||
Don't move text in full-line comments automatically.
|
||||
@end table
|
||||
|
||||
@vindex fortran-comment-indent-char
|
||||
In addition, you can specify the character to be used to indent within
|
||||
full-line comments by setting the variable
|
||||
@code{fortran-comment-indent-char} to the single-character string you want
|
||||
to use.
|
||||
|
||||
@vindex fortran-directive-re
|
||||
Compiler directive lines, or preprocessor lines, have much the same
|
||||
appearance as comment lines. It is important, though, that such lines
|
||||
never be indented at all, no matter what the value of
|
||||
@code{fortran-comment-indent-style}. The variable
|
||||
@code{fortran-directive-re} is a regular expression that specifies which
|
||||
lines are directives. Matching lines are never indented, and receive
|
||||
distinctive font-locking.
|
||||
|
||||
The normal Emacs comment command @kbd{C-x ;} has not been redefined. If
|
||||
you use @samp{!} comments, this command can be used with them. Otherwise
|
||||
it is useless in Fortran mode.
|
||||
|
||||
@kindex C-c ; @r{(Fortran mode)}
|
||||
@findex fortran-comment-region
|
||||
@vindex fortran-comment-region
|
||||
The command @kbd{C-c ;} (@code{fortran-comment-region}) turns all the
|
||||
lines of the region into comments by inserting the string @samp{C$$$} at
|
||||
the front of each one. With a numeric argument, it turns the region
|
||||
back into live code by deleting @samp{C$$$} from the front of each line
|
||||
in it. The string used for these comments can be controlled by setting
|
||||
the variable @code{fortran-comment-region}. Note that here we have an
|
||||
example of a command and a variable with the same name; these two uses
|
||||
of the name never conflict because in Lisp and in Emacs it is always
|
||||
clear from the context which one is meant.
|
||||
|
||||
@node Fortran Autofill
|
||||
@subsection Auto Fill in Fortran Mode
|
||||
|
||||
Fortran mode has specialized support for Auto Fill mode, which is a
|
||||
minor mode that automatically splits statements as you insert them
|
||||
when they become too wide. Splitting a statement involves making
|
||||
continuation lines using @code{fortran-continuation-string}
|
||||
(@pxref{ForIndent Cont}). This splitting happens when you type
|
||||
@key{SPC}, @key{RET}, or @key{TAB}, and also in the Fortran
|
||||
indentation commands. You activate Auto Fill in Fortran mode in the
|
||||
normal way.
|
||||
@iftex
|
||||
@xref{Auto Fill,,, emacs, the Emacs Manual}.
|
||||
@end iftex
|
||||
@ifnottex
|
||||
@xref{Auto Fill}.
|
||||
@end ifnottex
|
||||
|
||||
@vindex fortran-break-before-delimiters
|
||||
Auto Fill breaks lines at spaces or delimiters when the lines get
|
||||
longer than the desired width (the value of @code{fill-column}). The
|
||||
delimiters (besides whitespace) that Auto Fill can break at are
|
||||
@samp{+}, @samp{-}, @samp{/}, @samp{*}, @samp{=}, @samp{<}, @samp{>},
|
||||
and @samp{,}. The line break comes after the delimiter if the
|
||||
variable @code{fortran-break-before-delimiters} is @code{nil}.
|
||||
Otherwise (and by default), the break comes before the delimiter.
|
||||
|
||||
To enable Auto Fill in all Fortran buffers, add
|
||||
@code{turn-on-auto-fill} to @code{fortran-mode-hook}.
|
||||
@iftex
|
||||
@xref{Hooks,,, emacs, the Emacs Manual}.
|
||||
@end iftex
|
||||
@ifnottex
|
||||
@xref{Hooks}.
|
||||
@end ifnottex
|
||||
|
||||
@node Fortran Columns
|
||||
@subsection Checking Columns in Fortran
|
||||
|
||||
@table @kbd
|
||||
@item C-c C-r
|
||||
Display a ``column ruler'' momentarily above the current line
|
||||
(@code{fortran-column-ruler}).
|
||||
@item C-c C-w
|
||||
Split the current window horizontally temporarily so that it is 72
|
||||
columns wide (@code{fortran-window-create-momentarily}). This may
|
||||
help you avoid making lines longer than the 72-character limit that
|
||||
some Fortran compilers impose.
|
||||
@item C-u C-c C-w
|
||||
Split the current window horizontally so that it is 72 columns wide
|
||||
(@code{fortran-window-create}). You can then continue editing.
|
||||
@item M-x fortran-strip-sequence-nos
|
||||
Delete all text in column 72 and beyond.
|
||||
@end table
|
||||
|
||||
@kindex C-c C-r @r{(Fortran mode)}
|
||||
@findex fortran-column-ruler
|
||||
The command @kbd{C-c C-r} (@code{fortran-column-ruler}) shows a column
|
||||
ruler momentarily above the current line. The comment ruler is two lines
|
||||
of text that show you the locations of columns with special significance in
|
||||
Fortran programs. Square brackets show the limits of the columns for line
|
||||
numbers, and curly brackets show the limits of the columns for the
|
||||
statement body. Column numbers appear above them.
|
||||
|
||||
Note that the column numbers count from zero, as always in GNU Emacs.
|
||||
As a result, the numbers may be one less than those you are familiar
|
||||
with; but the positions they indicate in the line are standard for
|
||||
Fortran.
|
||||
|
||||
@vindex fortran-column-ruler-fixed
|
||||
@vindex fortran-column-ruler-tabs
|
||||
The text used to display the column ruler depends on the value of the
|
||||
variable @code{indent-tabs-mode}. If @code{indent-tabs-mode} is
|
||||
@code{nil}, then the value of the variable
|
||||
@code{fortran-column-ruler-fixed} is used as the column ruler.
|
||||
Otherwise, the value of the variable @code{fortran-column-ruler-tab} is
|
||||
displayed. By changing these variables, you can change the column ruler
|
||||
display.
|
||||
|
||||
@kindex C-c C-w @r{(Fortran mode)}
|
||||
@findex fortran-window-create-momentarily
|
||||
@kbd{C-c C-w} (@code{fortran-window-create-momentarily}) temporarily
|
||||
splits the current window horizontally, making a window 72 columns
|
||||
wide, so you can see any lines that are too long. Type a space to
|
||||
restore the normal width.
|
||||
|
||||
@kindex C-u C-c C-w @r{(Fortran mode)}
|
||||
@findex fortran-window-create
|
||||
You can also split the window horizontally and continue editing with
|
||||
the split in place. To do this, use @kbd{C-u C-c C-w} (@code{M-x
|
||||
fortran-window-create}). By editing in this window you can
|
||||
immediately see when you make a line too wide to be correct Fortran.
|
||||
|
||||
@findex fortran-strip-sequence-nos
|
||||
The command @kbd{M-x fortran-strip-sequence-nos} deletes all text in
|
||||
column 72 and beyond, on all lines in the current buffer. This is the
|
||||
easiest way to get rid of old sequence numbers.
|
||||
|
||||
@node Fortran Abbrev
|
||||
@subsection Fortran Keyword Abbrevs
|
||||
|
||||
Fortran mode provides many built-in abbrevs for common keywords and
|
||||
declarations. These are the same sort of abbrev that you can define
|
||||
yourself. To use them, you must turn on Abbrev mode.
|
||||
@iftex
|
||||
@xref{Abbrevs,,, emacs, the Emacs Manual}.
|
||||
@end iftex
|
||||
@ifnottex
|
||||
@xref{Abbrevs}.
|
||||
@end ifnottex
|
||||
|
||||
The built-in abbrevs are unusual in one way: they all start with a
|
||||
semicolon. You cannot normally use semicolon in an abbrev, but Fortran
|
||||
mode makes this possible by changing the syntax of semicolon to ``word
|
||||
constituent.''
|
||||
|
||||
For example, one built-in Fortran abbrev is @samp{;c} for
|
||||
@samp{continue}. If you insert @samp{;c} and then insert a punctuation
|
||||
character such as a space or a newline, the @samp{;c} expands automatically
|
||||
to @samp{continue}, provided Abbrev mode is enabled.@refill
|
||||
|
||||
Type @samp{;?} or @samp{;C-h} to display a list of all the built-in
|
||||
Fortran abbrevs and what they stand for.
|
||||
|
||||
@ignore
|
||||
arch-tag: 23ed7c36-1517-4646-9235-2d5ade5f06f6
|
||||
@end ignore
|
1113
man/frames.texi
1113
man/frames.texi
File diff suppressed because it is too large
Load diff
1323
man/glossary.texi
1323
man/glossary.texi
File diff suppressed because it is too large
Load diff
567
man/gnu.texi
567
man/gnu.texi
|
@ -1,567 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 1986, 1987, 1993, 1995, 2001, 2002, 2003, 2004,
|
||||
@c 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
@ifclear justgnu
|
||||
@node Manifesto,, Microsoft Windows, Top
|
||||
@unnumbered The GNU Manifesto
|
||||
@end ifclear
|
||||
@ifset justgnu
|
||||
Copyright @copyright{} 1985, 1993, 2001, 2002, 2003, 2004,
|
||||
2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with the Front-Cover texts being ``A GNU
|
||||
Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
|
||||
license is included in the section entitled ``GNU Free Documentation
|
||||
License'' in the Emacs manual.
|
||||
|
||||
(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
|
||||
this GNU Manual, like GNU software. Copies published by the Free
|
||||
Software Foundation raise funds for GNU development.''
|
||||
|
||||
This document is part of a collection distributed under the GNU Free
|
||||
Documentation License. If you want to distribute this document
|
||||
separately from the collection, you can do so by adding a copy of the
|
||||
license to the document, as described in section 6 of the license.
|
||||
|
||||
@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 available GNU software, please see
|
||||
our web site, @uref{http://www.gnu.org}. For software tasks and other
|
||||
ways to contribute, see @uref{http://www.gnu.org/help}.
|
||||
@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@footnote{In the 80s I had not yet realized how confusing it was
|
||||
to speak of ``the issue'' of ``intellectual property.'' That term is
|
||||
obviously biased; more subtle is the fact that it lumps together
|
||||
various disparate laws which raise very different issues. Nowadays I
|
||||
urge people to reject the term ``intellectual property'' entirely,
|
||||
lest it lead others to suppose that those laws form one coherent
|
||||
issue. The way to be clear is to discuss patents, copyrights, and
|
||||
trademarks separately. See
|
||||
@uref{http://www.gnu.org/philosophy/not-ipr.xhtml} for more
|
||||
explanation of how this term spreads confusion and bias.} 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@footnote{Subsequently we have discovered the need to
|
||||
distinguish between ``free software'' and ``freeware''. The term
|
||||
``freeware'' means software you are free to redistribute, but usually
|
||||
you are not free to study and change the source code, so most of it is
|
||||
not free software. See
|
||||
@uref{http://www.gnu.org/philosophy/words-to-avoid.html} for more
|
||||
explanation.}, 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.
|
||||
|
||||
@ignore
|
||||
arch-tag: 21eb38f8-6fa0-480a-91cd-f3dab7148542
|
||||
@end ignore
|
2307
man/gnus-faq.texi
2307
man/gnus-faq.texi
File diff suppressed because it is too large
Load diff
29508
man/gnus.texi
29508
man/gnus.texi
File diff suppressed because it is too large
Load diff
721
man/gpl.texi
721
man/gpl.texi
|
@ -1,721 +0,0 @@
|
|||
@c The GNU General Public License.
|
||||
@center Version 3, 29 June 2007
|
||||
|
||||
@c This file is intended to be included within another document,
|
||||
@c hence no sectioning command or @node.
|
||||
|
||||
@display
|
||||
Copyright @copyright{} 2007 Free Software Foundation, Inc. @url{http://fsf.org/}
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this
|
||||
license document, but changing it is not allowed.
|
||||
@end display
|
||||
|
||||
@heading Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom
|
||||
to share and change all versions of a program---to make sure it remains
|
||||
free software for all its users. We, the Free Software Foundation,
|
||||
use the GNU General Public License for most of our software; it
|
||||
applies also to any other work released this way by its authors. You
|
||||
can apply it to your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you
|
||||
have certain responsibilities if you distribute copies of the
|
||||
software, or if you modify it: responsibilities to respect the freedom
|
||||
of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too,
|
||||
receive or can get the source code. And you must show them these
|
||||
terms so they know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the
|
||||
manufacturer can do so. This is fundamentally incompatible with the
|
||||
aim of protecting users' freedom to change the software. The
|
||||
systematic pattern of such abuse occurs in the area of products for
|
||||
individuals to use, which is precisely where it is most unacceptable.
|
||||
Therefore, we have designed this version of the GPL to prohibit the
|
||||
practice for those products. If such problems arise substantially in
|
||||
other domains, we stand ready to extend this provision to those
|
||||
domains in future versions of the GPL, as needed to protect the
|
||||
freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish
|
||||
to avoid the special danger that patents applied to a free program
|
||||
could make it effectively proprietary. To prevent this, the GPL
|
||||
assures that patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
@heading TERMS AND CONDITIONS
|
||||
|
||||
@enumerate 0
|
||||
@item Definitions.
|
||||
|
||||
``This License'' refers to version 3 of the GNU General Public License.
|
||||
|
||||
``Copyright'' also means copyright-like laws that apply to other kinds
|
||||
of works, such as semiconductor masks.
|
||||
|
||||
``The Program'' refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as ``you''. ``Licensees'' and
|
||||
``recipients'' may be individuals or organizations.
|
||||
|
||||
To ``modify'' a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of
|
||||
an exact copy. The resulting work is called a ``modified version'' of
|
||||
the earlier work or a work ``based on'' the earlier work.
|
||||
|
||||
A ``covered work'' means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To ``propagate'' a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To ``convey'' a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user
|
||||
through a computer network, with no transfer of a copy, is not
|
||||
conveying.
|
||||
|
||||
An interactive user interface displays ``Appropriate Legal Notices'' to
|
||||
the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
@item Source Code.
|
||||
|
||||
The ``source code'' for a work means the preferred form of the work for
|
||||
making modifications to it. ``Object code'' means any non-source form
|
||||
of a work.
|
||||
|
||||
A ``Standard Interface'' means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The ``System Libraries'' of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
``Major Component'', in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The ``Corresponding Source'' for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users can
|
||||
regenerate automatically from other parts of the Corresponding Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that same
|
||||
work.
|
||||
|
||||
@item Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not convey,
|
||||
without conditions so long as your license otherwise remains in force.
|
||||
You may convey covered works to others for the sole purpose of having
|
||||
them make modifications exclusively for you, or provide you with
|
||||
facilities for running those works, provided that you comply with the
|
||||
terms of this License in conveying all material for which you do not
|
||||
control copyright. Those thus making or running the covered works for
|
||||
you must do so exclusively on your behalf, under your direction and
|
||||
control, on terms that prohibit them from making any copies of your
|
||||
copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under the
|
||||
conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
@item Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such
|
||||
circumvention is effected by exercising rights under this License with
|
||||
respect to the covered work, and you disclaim any intention to limit
|
||||
operation or modification of the work as a means of enforcing, against
|
||||
the work's users, your or third parties' legal rights to forbid
|
||||
circumvention of technological measures.
|
||||
|
||||
@item Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
@item Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these
|
||||
conditions:
|
||||
|
||||
@enumerate a
|
||||
@item
|
||||
The work must carry prominent notices stating that you modified it,
|
||||
and giving a relevant date.
|
||||
|
||||
@item
|
||||
The work must carry prominent notices stating that it is released
|
||||
under this License and any conditions added under section 7. This
|
||||
requirement modifies the requirement in section 4 to ``keep intact all
|
||||
notices''.
|
||||
|
||||
@item
|
||||
You must license the entire work, as a whole, under this License to
|
||||
anyone who comes into possession of a copy. This License will
|
||||
therefore apply, along with any applicable section 7 additional terms,
|
||||
to the whole of the work, and all its parts, regardless of how they
|
||||
are packaged. This License gives no permission to license the work in
|
||||
any other way, but it does not invalidate such permission if you have
|
||||
separately received it.
|
||||
|
||||
@item
|
||||
If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your work
|
||||
need not make them do so.
|
||||
@end enumerate
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
``aggregate'' if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
@item Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms of
|
||||
sections 4 and 5, provided that you also convey the machine-readable
|
||||
Corresponding Source under the terms of this License, in one of these
|
||||
ways:
|
||||
|
||||
@enumerate a
|
||||
@item
|
||||
Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium customarily
|
||||
used for software interchange.
|
||||
|
||||
@item
|
||||
Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a written
|
||||
offer, valid for at least three years and valid for as long as you
|
||||
offer spare parts or customer support for that product model, to give
|
||||
anyone who possesses the object code either (1) a copy of the
|
||||
Corresponding Source for all the software in the product that is
|
||||
covered by this License, on a durable physical medium customarily used
|
||||
for software interchange, for a price no more than your reasonable
|
||||
cost of physically performing this conveying of source, or (2) access
|
||||
to copy the Corresponding Source from a network server at no charge.
|
||||
|
||||
@item
|
||||
Convey individual copies of the object code with a copy of the written
|
||||
offer to provide the Corresponding Source. This alternative is
|
||||
allowed only occasionally and noncommercially, and only if you
|
||||
received the object code with such an offer, in accord with subsection
|
||||
6b.
|
||||
|
||||
@item
|
||||
Convey the object code by offering access from a designated place
|
||||
(gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to copy
|
||||
the object code is a network server, the Corresponding Source may be
|
||||
on a different server (operated by you or a third party) that supports
|
||||
equivalent copying facilities, provided you maintain clear directions
|
||||
next to the object code saying where to find the Corresponding Source.
|
||||
Regardless of what server hosts the Corresponding Source, you remain
|
||||
obligated to ensure that it is available for as long as needed to
|
||||
satisfy these requirements.
|
||||
|
||||
@item
|
||||
Convey the object code using peer-to-peer transmission, provided you
|
||||
inform other peers where the object code and Corresponding Source of
|
||||
the work are being offered to the general public at no charge under
|
||||
subsection 6d.
|
||||
|
||||
@end enumerate
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A ``User Product'' is either (1) a ``consumer product'', which means any
|
||||
tangible personal property which is normally used for personal,
|
||||
family, or household purposes, or (2) anything designed or sold for
|
||||
incorporation into a dwelling. In determining whether a product is a
|
||||
consumer product, doubtful cases shall be resolved in favor of
|
||||
coverage. For a particular product received by a particular user,
|
||||
``normally used'' refers to a typical or common use of that class of
|
||||
product, regardless of the status of the particular user or of the way
|
||||
in which the particular user actually uses, or expects or is expected
|
||||
to use, the product. A product is a consumer product regardless of
|
||||
whether the product has substantial commercial, industrial or
|
||||
non-consumer uses, unless such uses represent the only significant
|
||||
mode of use of the product.
|
||||
|
||||
``Installation Information'' for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to
|
||||
install and execute modified versions of a covered work in that User
|
||||
Product from a modified version of its Corresponding Source. The
|
||||
information must suffice to ensure that the continued functioning of
|
||||
the modified object code is in no case prevented or interfered with
|
||||
solely because modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or
|
||||
updates for a work that has been modified or installed by the
|
||||
recipient, or for the User Product in which it has been modified or
|
||||
installed. Access to a network may be denied when the modification
|
||||
itself materially and adversely affects the operation of the network
|
||||
or violates the rules and protocols for communication across the
|
||||
network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
@item Additional Terms.
|
||||
|
||||
``Additional permissions'' are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders
|
||||
of that material) supplement the terms of this License with terms:
|
||||
|
||||
@enumerate a
|
||||
@item
|
||||
Disclaiming warranty or limiting liability differently from the terms
|
||||
of sections 15 and 16 of this License; or
|
||||
|
||||
@item
|
||||
Requiring preservation of specified reasonable legal notices or author
|
||||
attributions in that material or in the Appropriate Legal Notices
|
||||
displayed by works containing it; or
|
||||
|
||||
@item
|
||||
Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
@item
|
||||
Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
@item
|
||||
Declining to grant rights under trademark law for use of some trade
|
||||
names, trademarks, or service marks; or
|
||||
|
||||
@item
|
||||
Requiring indemnification of licensors and authors of that material by
|
||||
anyone who conveys the material (or modified versions of it) with
|
||||
contractual assumptions of liability to the recipient, for any
|
||||
liability that these contractual assumptions directly impose on those
|
||||
licensors and authors.
|
||||
@end enumerate
|
||||
|
||||
All other non-permissive additional terms are considered ``further
|
||||
restrictions'' within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions; the
|
||||
above requirements apply either way.
|
||||
|
||||
@item Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your license
|
||||
from a particular copyright holder is reinstated (a) provisionally,
|
||||
unless and until the copyright holder explicitly and finally
|
||||
terminates your license, and (b) permanently, if the copyright holder
|
||||
fails to notify you of the violation by some reasonable means prior to
|
||||
60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
@item Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or run
|
||||
a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
@item Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An ``entity transaction'' is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
@item Patents.
|
||||
|
||||
A ``contributor'' is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's ``contributor version''.
|
||||
|
||||
A contributor's ``essential patent claims'' are all patent claims owned
|
||||
or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, ``control'' includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a ``patent license'' is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To ``grant'' such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. ``Knowingly relying'' means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is ``discriminatory'' if it does not include within the
|
||||
scope of its coverage, prohibits the exercise of, or is conditioned on
|
||||
the non-exercise of one or more of the rights that are specifically
|
||||
granted under this License. You may not convey a covered work if you
|
||||
are a party to an arrangement with a third party that is in the
|
||||
business of distributing software, under which you make payment to the
|
||||
third party based on the extent of your activity of conveying the
|
||||
work, and under which the third party grants, to any of the parties
|
||||
who would receive the covered work from you, a discriminatory patent
|
||||
license (a) in connection with copies of the covered work conveyed by
|
||||
you (or copies made from those copies), or (b) primarily for and in
|
||||
connection with specific products or compilations that contain the
|
||||
covered work, unless you entered into that arrangement, or that patent
|
||||
license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
@item No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey
|
||||
a covered work so as to satisfy simultaneously your obligations under
|
||||
this License and any other pertinent obligations, then as a
|
||||
consequence you may not convey it at all. For example, if you agree
|
||||
to terms that obligate you to collect a royalty for further conveying
|
||||
from those to whom you convey the Program, the only way you could
|
||||
satisfy both those terms and this License would be to refrain entirely
|
||||
from conveying the Program.
|
||||
|
||||
@item Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
@item Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies that a certain numbered version of the GNU General Public
|
||||
License ``or any later version'' applies to it, you have the option of
|
||||
following the terms and conditions either of that numbered version or
|
||||
of any later version published by the Free Software Foundation. If
|
||||
the Program does not specify a version number of the GNU General
|
||||
Public License, you may choose any version ever published by the Free
|
||||
Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions
|
||||
of the GNU General Public License can be used, that proxy's public
|
||||
statement of acceptance of a version permanently authorizes you to
|
||||
choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
@item Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM ``AS IS'' WITHOUT
|
||||
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
|
||||
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
|
||||
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
|
||||
CORRECTION.
|
||||
|
||||
@item Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
|
||||
CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
|
||||
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
|
||||
NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
|
||||
LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
|
||||
TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
|
||||
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
@item Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
@end enumerate
|
||||
|
||||
@heading END OF TERMS AND CONDITIONS
|
||||
|
||||
@heading How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these
|
||||
terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the ``copyright'' line and a pointer to where the full notice is found.
|
||||
|
||||
@smallexample
|
||||
@var{one line to give the program's name and a brief idea of what it does.}
|
||||
Copyright (C) @var{year} @var{name of author}
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at
|
||||
your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see @url{http://www.gnu.org/licenses/}.
|
||||
@end smallexample
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
@smallexample
|
||||
@var{program} Copyright (C) @var{year} @var{name of author}
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type @samp{show w}.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type @samp{show c} for details.
|
||||
@end smallexample
|
||||
|
||||
The hypothetical commands @samp{show w} and @samp{show c} should show
|
||||
the appropriate parts of the General Public License. Of course, your
|
||||
program's commands might be different; for a GUI interface, you would
|
||||
use an ``about box''.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a ``copyright disclaimer'' for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
@url{http://www.gnu.org/licenses/}.
|
||||
|
||||
The GNU General Public License does not permit incorporating your
|
||||
program into proprietary programs. If your program is a subroutine
|
||||
library, you may consider it more useful to permit linking proprietary
|
||||
applications with the library. If this is what you want to do, use
|
||||
the GNU Lesser General Public License instead of this License. But
|
||||
first, please read @url{http://www.gnu.org/philosophy/why-not-lgpl.html}.
|
||||
|
||||
@ignore
|
||||
arch-tag: 0c4a2556-f87e-464f-9b1d-efd920fcaf67
|
||||
@end ignore
|
666
man/help.texi
666
man/help.texi
|
@ -1,666 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,
|
||||
@c 2002, 2003, 2004, 2005, 2006, 2007 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, all accessible through the
|
||||
@dfn{help character}, @kbd{C-h}. This is a prefix key that is used
|
||||
for commands that display documentation; the next character you type
|
||||
should be a @dfn{help options}, to ask for a particular kind of help.
|
||||
You can cancel the @kbd{C-h} command with @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} itself is one of the help options; @kbd{C-h C-h} displays
|
||||
a list of help options, with a brief description of each one
|
||||
(@code{help-for-help}). You can scroll the list with @key{SPC} and
|
||||
@key{DEL}, then type the help option you want. To cancel, type
|
||||
@kbd{C-g}.
|
||||
|
||||
@kbd{C-h} or @key{F1} means ``help'' in various other contexts as
|
||||
well. For instance, you can type them after a prefix key to display
|
||||
list of the keys that can follow the prefix key. (A few prefix keys
|
||||
don't support @kbd{C-h} in this way, because they define other
|
||||
meanings for it, but they all support @key{F1} for help.)
|
||||
|
||||
Most help buffers use a special major mode, Help mode, which lets
|
||||
you scroll conveniently with @key{SPC} and @key{DEL}. You can also
|
||||
follow hyperlinks to URLs, and to other facilities including Info
|
||||
nodes and customization buffers. @xref{Help Mode}.
|
||||
|
||||
@cindex searching documentation efficiently
|
||||
@cindex looking for a subject in documentation
|
||||
If you are looking for a certain feature, but don't know what it is
|
||||
called or where to look, we recommend three methods. First, try an
|
||||
apropos command, then try searching the manual index, then look in the
|
||||
FAQ and the package keywords.
|
||||
|
||||
@table @kbd
|
||||
@item C-h a @var{topics} @key{RET}
|
||||
This searches for commands whose names match the argument
|
||||
@var{topics}. The argument can be a keyword, a list of keywords, or a
|
||||
regular expression (@pxref{Regexps}). This command displays all the
|
||||
matches in a new buffer. @xref{Apropos}.
|
||||
|
||||
@item C-h i d m emacs @key{RET} i @var{topic} @key{RET}
|
||||
This searches for @var{topic} in the indices of the on-line Emacs
|
||||
manual, and displays the first match found. Press @kbd{,} to see
|
||||
subsequent matches. You can use a regular expression as @var{topic}.
|
||||
|
||||
@item C-h i d m emacs @key{RET} s @var{topic} @key{RET}
|
||||
Similar, but searches the @emph{text} of the manual rather than the
|
||||
indices.
|
||||
|
||||
@item C-h C-f
|
||||
This displays the Emacs FAQ. You can use the Info commands
|
||||
to browse it.
|
||||
|
||||
@item C-h p
|
||||
This displays the available Emacs packages based on keywords.
|
||||
@xref{Library Keywords}.
|
||||
@end table
|
||||
|
||||
@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.
|
||||
* Help Mode:: Special features of Help mode and Help buffers.
|
||||
* Library Keywords:: Finding Lisp libraries by keywords (topics).
|
||||
* Language Help:: Help relating to international language support.
|
||||
* Misc Help:: Other help commands.
|
||||
* Help Files:: Commands to display pre-written help files.
|
||||
* Help Echo:: Help on active text and tooltips (`balloon help')
|
||||
@end menu
|
||||
|
||||
@iftex
|
||||
@node Help Summary
|
||||
@end iftex
|
||||
@ifnottex
|
||||
@node Help Summary
|
||||
@section Help Summary
|
||||
@end ifnottex
|
||||
|
||||
Here is a summary of the Emacs interactive help commands. (The
|
||||
character that follows @kbd{C-h} is the ``help option.'') @xref{Help
|
||||
Files}, for other help commands that display fixed files of
|
||||
information.
|
||||
|
||||
@table @kbd
|
||||
@item C-h a @var{topics} @key{RET}
|
||||
Display a list of commands whose names match @var{topics}
|
||||
(@code{apropos-command}; @pxref{Apropos}).
|
||||
@item C-h b
|
||||
Display all active key bindings; minor mode bindings first, then those
|
||||
of the major mode, then global bindings (@code{describe-bindings}).
|
||||
@item C-h c @var{key}
|
||||
Given a key sequence @var{key}, show the name of the command that it
|
||||
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 d @var{topics} @key{RET}
|
||||
Display the commands and variables whose documentation matches
|
||||
@var{topics} (@code{apropos-documentation}).
|
||||
@item C-h e
|
||||
Display the @code{*Messages*} buffer
|
||||
(@code{view-echo-area-messages}).
|
||||
@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,
|
||||
this works for commands too.
|
||||
@item C-h h
|
||||
Display the @file{HELLO} file, which shows examples of various character
|
||||
sets.
|
||||
@item C-h i
|
||||
Run Info, the GNU documentation browser (@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 p
|
||||
Find packages by topic keyword (@code{finder-by-keyword}).
|
||||
@item C-h s
|
||||
Display the current contents of the syntax table, with 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}
|
||||
Show which keys run the command named @var{command} (@code{where-is}).
|
||||
@item C-h C @var{coding} @key{RET}
|
||||
Describe the 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 the input method @var{method} (@code{describe-input-method}).
|
||||
@item C-h L @var{language-env} @key{RET}
|
||||
Display information on the character sets, coding systems, and input
|
||||
methods used in language environment @var{language-env}
|
||||
(@code{describe-language-environment}).
|
||||
@item C-h F @var{function} @key{RET}
|
||||
Enter Info and goes to the node that documents the Emacs function
|
||||
@var{function} (@code{Info-goto-emacs-command-node}).
|
||||
@item C-h K @var{key}
|
||||
Enter Info and goes to the node that documents the key sequence
|
||||
@var{key} (@code{Info-goto-emacs-key-command-node}).
|
||||
@item C-h S @var{symbol} @key{RET}
|
||||
Display the Info documentation on symbol @var{symbol} according to the
|
||||
programming language you are editing (@code{info-lookup-symbol}).
|
||||
@item C-h .
|
||||
Display the help message for a special text area, if point is in one
|
||||
(@code{display-local-help}). (These include, for example, links in
|
||||
@samp{*Help*} buffers.)
|
||||
@end table
|
||||
|
||||
@node Key Help
|
||||
@section Documentation for a Key
|
||||
|
||||
@kindex C-h c
|
||||
@findex describe-key-briefly
|
||||
The help commands to get information about a key sequence are
|
||||
@kbd{C-h c} and @w{@kbd{C-h k}}. @kbd{C-h c @var{key}} displays in
|
||||
the echo area the name of the command that @var{key} is bound to. For
|
||||
example, @kbd{C-h c C-f} displays @samp{forward-char}. Since command
|
||||
names are chosen to describe what the commands do, this gives you 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.
|
||||
It displays this information in a window, since it may not fit in the
|
||||
echo area.
|
||||
|
||||
@kindex C-h K
|
||||
@findex Info-goto-emacs-key-command-node
|
||||
To find the documentation of a key sequence @var{key}, type @kbd{C-h
|
||||
K @var{key}}. This displays the appropriate manual section which
|
||||
contains the documentation of @var{key}.
|
||||
|
||||
@kbd{C-h c}, @kbd{C-h k} and @kbd{C-h K} work for any sort of key
|
||||
sequences, including function keys, menus, and mouse events. For
|
||||
instance, after @kbd{C-h k} you can select a menu item from the menu
|
||||
bar, to view the documentation string of the command it runs.
|
||||
|
||||
@kindex C-h w
|
||||
@findex where-is
|
||||
@kbd{C-h w @var{command} @key{RET}} lists the keys that are bound to
|
||||
@var{command}. It displays the list in the echo area. If it says the
|
||||
command is not on any key, that means you must use @kbd{M-x} to run
|
||||
it. @kbd{C-h w} runs the command @code{where-is}.
|
||||
|
||||
@node Name Help
|
||||
@section Help by Command or Variable Name
|
||||
|
||||
@kindex C-h f
|
||||
@findex describe-function
|
||||
@kbd{C-h f @var{function} @key{RET}} (@code{describe-function})
|
||||
displays the documentation of Lisp function @var{function}, in a
|
||||
window. Since commands are Lisp functions, you can use this method to
|
||||
view the documentation of any command whose name you know. 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 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 completion abbreviations that
|
||||
work in @kbd{M-x} don't work in @kbd{C-h f}. An abbreviation that is
|
||||
unique among command names may not be unique among all function names.
|
||||
|
||||
If you type @kbd{C-h f @key{RET}}, it describes the function called
|
||||
by the innermost Lisp expression in the buffer around point,
|
||||
@emph{provided} that function name is a valid, defined Lisp function.
|
||||
(That name appears as the default while you enter the argument.) 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 @kbd{C-h f @key{RET}} will describe the
|
||||
function @code{make-vector}.
|
||||
|
||||
@kbd{C-h f} is also useful just to verify that you spelled a
|
||||
function name correctly. If the minibuffer prompt for @kbd{C-h f}
|
||||
shows the function name from the buffer as the default, it means that
|
||||
name is defined as a Lisp function. Type @kbd{C-g} to cancel the
|
||||
@kbd{C-h f} command if you don't really want to view the
|
||||
documentation.
|
||||
|
||||
@kindex C-h v
|
||||
@findex describe-variable
|
||||
@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, if that is the name of a
|
||||
defined Lisp variable. @xref{Variables}.
|
||||
|
||||
Help buffers that describe Emacs variables and functions normally
|
||||
have hyperlinks to the corresponding source definition, if you have
|
||||
the source files installed. (@xref{Hyperlinking}.) If you know Lisp
|
||||
(or C), this provides the ultimate documentation. If you don't know
|
||||
Lisp, you should learn it. (The Introduction to Emacs Lisp
|
||||
Programming, available from the FSF through fsf.org, is a good way to
|
||||
get started.) If Emacs feels you are just @emph{using} it, treating
|
||||
it as an object program, its feelings may be hurt. For real intimacy,
|
||||
read the Emacs source code.
|
||||
|
||||
@kindex C-h F
|
||||
@findex Info-goto-emacs-command-node
|
||||
To find a function's documentation in a manual, use @kbd{C-h F}
|
||||
(@code{Info-goto-emacs-command-node}). This knows about various
|
||||
manuals, not just the Emacs manual, and finds the right one.
|
||||
|
||||
@node Apropos
|
||||
@section Apropos
|
||||
|
||||
The @dfn{apropos} commands answer questions like, ``What are the
|
||||
commands for working with files?'' More precisely, you specify an
|
||||
@dfn{apropos pattern}, which means either a word, a list of words, or
|
||||
a regular expression. Each apropos command displays a list of items
|
||||
that match the pattern, in a separate buffer.
|
||||
|
||||
@table @kbd
|
||||
@item C-h a @var{pattern} @key{RET}
|
||||
Search for commands whose names match @var{pattern}.
|
||||
|
||||
@item M-x apropos @key{RET} @var{pattern} @key{RET}
|
||||
Search for functions and variables whose names match @var{pattern}.
|
||||
Both interactive functions (commands) and noninteractive functions can
|
||||
be found by this command.
|
||||
|
||||
@item M-x apropos-variable @key{RET} @var{pattern} @key{RET}
|
||||
Search for user-option variables whose names match @var{pattern}.
|
||||
|
||||
@item M-x apropos-value @key{RET} @var{pattern} @key{RET}
|
||||
Search for functions whose definitions @var{pattern}, and variables
|
||||
whose values match @var{pattern}.
|
||||
|
||||
@item C-h d @var{pattern} @key{RET}
|
||||
Search for functions and variables whose @strong{documentation
|
||||
strings} match @var{pattern}.
|
||||
@end table
|
||||
|
||||
@kindex C-h a
|
||||
@findex apropos-command
|
||||
@cindex apropos
|
||||
The simplest kind of apropos pattern is one word. Anything which
|
||||
contains that word matches the pattern. Thus, to find the commands
|
||||
that work on files, type @kbd{C-h a file @key{RET}}. This displays a
|
||||
list of all command names that contain @samp{file}, including
|
||||
@code{copy-file}, @code{find-file}, and so on. Each command name
|
||||
comes with a brief description and a list of keys you can currently
|
||||
invoke it with. In our 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.
|
||||
|
||||
For more information about a function definition, variable or symbol
|
||||
property listed in the apropos buffer, you can click on it with
|
||||
@kbd{Mouse-1} or @kbd{Mouse-2}, or move there and type @key{RET}.
|
||||
|
||||
When you specify more than one word in the apropos pattern, a name
|
||||
must contain at least two of the words in order to match. Thus, if
|
||||
you are looking for commands to kill a chunk of text before point, you
|
||||
could try @kbd{C-h a kill back backward behind before @key{RET}}. The
|
||||
real command name @code{kill-backward} will match that; if there were
|
||||
a command @code{kill-text-before}, it would also match, since it
|
||||
contains two of the specified words.
|
||||
|
||||
For even greater flexibility, you can specify a regular expression
|
||||
(@pxref{Regexps}). An apropos pattern is interpreted as a regular
|
||||
expression if it contains any of the regular expression special
|
||||
characters, @samp{^$*+?.\[}.
|
||||
|
||||
Following the conventions for naming Emacs commands, here are some
|
||||
words that you'll find useful in apropos patterns. By using them in
|
||||
@kbd{C-h a}, you will also get a feel for the naming conventions.
|
||||
|
||||
@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
|
||||
Use @kbd{M-x apropos} instead of @kbd{C-h a} to list all the Lisp
|
||||
symbols that match an apropos pattern, not just the symbols that are
|
||||
commands. This command does not list key bindings by default; specify
|
||||
a numeric argument if you want it to list them.
|
||||
|
||||
@findex apropos-variable
|
||||
Use @kbd{M-x apropos-variable} to list user-customizable variables
|
||||
that match an apropos pattern. If you specify a prefix argument, it
|
||||
lists all matching variables.
|
||||
|
||||
@kindex C-h d
|
||||
@findex apropos-documentation
|
||||
The @code{apropos-documentation} command is like @code{apropos}
|
||||
except that it searches documentation strings instead of symbol names
|
||||
for matches.
|
||||
|
||||
@findex apropos-value
|
||||
The @code{apropos-value} command is like @code{apropos} except that
|
||||
it searches variables' values for matches for the apropos pattern.
|
||||
With a prefix argument, it also checks symbols' function definitions
|
||||
and property lists.
|
||||
|
||||
@vindex apropos-do-all
|
||||
If the variable @code{apropos-do-all} is non-@code{nil}, the apropos
|
||||
commands always behave as if they had been given a prefix argument.
|
||||
|
||||
@vindex apropos-sort-by-scores
|
||||
@cindex apropos search results, order by score
|
||||
By default, apropos lists the search results in alphabetical order.
|
||||
If the variable @code{apropos-sort-by-scores} is non-@code{nil}, the
|
||||
apropos commands try to guess the relevance of each result, and
|
||||
display the most relevant ones first.
|
||||
|
||||
@vindex apropos-documentation-sort-by-scores
|
||||
By default, apropos lists the search results for
|
||||
@code{apropos-documentation} in order of relevance of the match. If
|
||||
the variable @code{apropos-documentation-sort-by-scores} is
|
||||
@code{nil}, apropos lists the symbols found in alphabetical order.
|
||||
|
||||
@node Help Mode
|
||||
@section Help Mode Commands
|
||||
|
||||
Help buffers provide the same commands as 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-1
|
||||
@itemx Mouse-2
|
||||
Follow a cross reference that you click on.
|
||||
@item C-c C-c
|
||||
Show all documentation about the symbol at point.
|
||||
@end table
|
||||
|
||||
When a function name (@pxref{M-x,, Running Commands by Name}),
|
||||
variable name (@pxref{Variables}), or face name (@pxref{Faces})
|
||||
appears in the documentation, it normally appears inside paired
|
||||
single-quotes. To view the documentation of that command, variable or
|
||||
face, you can click on the name with @kbd{Mouse-1} or @kbd{Mouse-2},
|
||||
or move point there and type @key{RET}. Use @kbd{C-c C-b} to retrace
|
||||
your steps.
|
||||
|
||||
@cindex URL, viewing in help
|
||||
@cindex help, viewing web pages
|
||||
@cindex viewing web pages in help
|
||||
@cindex web pages, viewing in help
|
||||
@findex browse-url
|
||||
You can follow cross references to URLs (web pages) also. This uses
|
||||
the @code{browse-url} command to view the page in the browser you
|
||||
choose. @xref{Browse-URL}.
|
||||
|
||||
@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 to move point to cross references in
|
||||
the help text. @key{TAB} (@code{help-next-ref}) moves point down to
|
||||
the next cross reference. @kbd{S-@key{TAB}} moves up to the previous
|
||||
cross reference (@code{help-previous-ref}).
|
||||
|
||||
To view all documentation about any symbol name that appears in the
|
||||
text, move point to the symbol name and type @kbd{C-c C-c}
|
||||
(@code{help-follow-symbol}). This shows all available documentation
|
||||
about the symbol as a variable, function and/or face. As above, use
|
||||
@kbd{C-c C-b} to retrace your steps.
|
||||
|
||||
@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:
|
||||
|
||||
@multitable {convenience} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
|
||||
@item abbrev@tab abbreviation handling, typing shortcuts, macros.
|
||||
@item bib@tab code related to the @code{bib} bibliography processor.
|
||||
@item c@tab support for the C language and related languages.
|
||||
@item calendar@tab calendar and time management support.
|
||||
@item comm@tab communications, networking, remote access to files.
|
||||
@item convenience@tab convenience features for faster editing.
|
||||
@item data@tab support for editing files of data.
|
||||
@item docs@tab support for Emacs documentation.
|
||||
@item emulations@tab emulations of other editors.
|
||||
@item extensions@tab Emacs Lisp language extensions.
|
||||
@item faces@tab support for multiple fonts.
|
||||
@item files@tab support for editing and manipulating files.
|
||||
@item frames@tab support for Emacs frames and window systems.
|
||||
@item games@tab games, jokes and amusements.
|
||||
@item hardware@tab support for interfacing with exotic hardware.
|
||||
@item help@tab support for on-line help systems.
|
||||
@item hypermedia@tab support for links between text or other media types.
|
||||
@item i18n@tab internationalization and alternate character-set support.
|
||||
@item internal@tab code for Emacs internals, build process, defaults.
|
||||
@item languages@tab specialized modes for editing programming languages.
|
||||
@item lisp@tab Lisp support, including Emacs Lisp.
|
||||
@item local@tab code local to your site.
|
||||
@item maint@tab maintenance aids for the Emacs development group.
|
||||
@item mail@tab modes for electronic-mail handling.
|
||||
@item matching@tab various sorts of searching and matching.
|
||||
@item mouse@tab mouse support.
|
||||
@item multimedia@tab images and sound support.
|
||||
@item news@tab support for netnews reading and posting.
|
||||
@item oop@tab support for object-oriented programming.
|
||||
@item outlines@tab support for hierarchical outlining.
|
||||
@item processes@tab process, subshell, compilation, and job control support.
|
||||
@item terminals@tab support for terminal types.
|
||||
@item tex@tab supporting code for the @TeX{} formatter.
|
||||
@item tools@tab programming tools.
|
||||
@item unix@tab front-ends/assistants for, or emulators of, UNIX-like features.
|
||||
@item wp@tab word processing.
|
||||
@end multitable
|
||||
|
||||
@node Language Help
|
||||
@section Help for International Language Support
|
||||
|
||||
You can use the command @kbd{C-h L}
|
||||
(@code{describe-language-environment}) to get information about a
|
||||
specific language environment. @xref{Language Environments}. This
|
||||
tells you which languages this language environment supports. It also
|
||||
lists the character sets, coding systems, and input methods that work
|
||||
with this language environment, and finally 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 an
|
||||
input method---either a specified input method, or by default the
|
||||
input method currently in use. @xref{Input Methods}.
|
||||
|
||||
The command @kbd{C-h C} (@code{describe-coding-system}) describes
|
||||
coding systems---either a specified coding system, or the ones
|
||||
currently in use. @xref{Coding Systems}.
|
||||
|
||||
@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 browses
|
||||
structured documentation files. The entire Emacs manual is available
|
||||
within Info, along with many other manuals for the GNU system. Type
|
||||
@kbd{h} after entering Info to run a tutorial on using Info.
|
||||
|
||||
@cindex find Info manual by its file name
|
||||
With a numeric argument @var{n}, @kbd{C-h i} selects the Info buffer
|
||||
@samp{*info*<@var{n}>}. This is useful if you want to browse multiple
|
||||
Info manuals simultaneously. If you specify just @kbd{C-u} as the
|
||||
prefix argument, @kbd{C-h i} prompts for the name of a documentation
|
||||
file, so you can browse a file which doesn't have an entry in the
|
||||
top-level Info menu.
|
||||
|
||||
The help commands @kbd{C-h F @var{function} @key{RET}} and @kbd{C-h
|
||||
K @var{key}}, described above, enter Info and go straight to the
|
||||
documentation of @var{function} or @var{key}.
|
||||
|
||||
@kindex C-h S
|
||||
@findex info-lookup-symbol
|
||||
When editing a program, if you have an Info version of the manual
|
||||
for the programming language, you can use @kbd{C-h S}
|
||||
(@code{info-lookup-symbol}) to find symbol (keyword, function or
|
||||
variable) in the proper manual. 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 you
|
||||
typed, use @kbd{C-h l} (@code{view-lossage}). @kbd{C-h l} displays
|
||||
the last 100 characters you typed in Emacs. 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 e
|
||||
@findex view-echo-area-messages
|
||||
To review recent echo area messages, use @kbd{C-h e}
|
||||
(@code{view-echo-area-messages}). This displays the buffer
|
||||
@code{*Messages*}, where those messages are kept.
|
||||
|
||||
@kindex C-h m
|
||||
@findex describe-mode
|
||||
Each Emacs major mode typically redefines a few keys and makes other
|
||||
changes in how editing works. @kbd{C-h m} (@code{describe-mode})
|
||||
displays documentation on the current major mode, which normally
|
||||
describes the commands and features 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}) show other information about the current
|
||||
environment within Emacs. @kbd{C-h b} displays a list of all the key
|
||||
bindings now in effect: first the local bindings of the current minor
|
||||
modes, 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 list of subcommands 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.)
|
||||
|
||||
@node Help Files
|
||||
@section Help Files
|
||||
|
||||
The Emacs help commands described above display dynamic help based
|
||||
on the current state within Emacs, or refer to manuals. Other help
|
||||
commands display pre-written, static help files. These commands all
|
||||
have the form @kbd{C-h C-@var{char}}; that is, @kbd{C-h} followed by a
|
||||
control character.
|
||||
|
||||
@kindex C-h C-c
|
||||
@findex describe-copying
|
||||
@kindex C-h C-d
|
||||
@findex describe-distribution
|
||||
@kindex C-h C-e
|
||||
@findex view-emacs-problems
|
||||
@kindex C-h C-f
|
||||
@findex view-emacs-FAQ
|
||||
@kindex C-h C-n
|
||||
@findex view-emacs-news
|
||||
@kindex C-h C-p
|
||||
@findex describe-project
|
||||
@kindex C-h C-t
|
||||
@findex view-emacs-todo
|
||||
@kindex C-h C-w
|
||||
@findex describe-no-warranty
|
||||
|
||||
@table @kbd
|
||||
@item C-h C-c
|
||||
Display the Emacs copying conditions (@code{describe-copying}).
|
||||
These are the rules under which you can copy and redistribute Emacs.
|
||||
@item C-h C-d
|
||||
Display how to download or order the latest version of
|
||||
Emacs and other GNU software (@code{describe-distribution}).
|
||||
@item C-h C-e
|
||||
Display the list of known Emacs problems, sometimes with suggested
|
||||
workarounds (@code{view-emacs-problems}).
|
||||
@item C-h C-f
|
||||
Display the Emacs frequently-answered-questions list (@code{view-emacs-FAQ}).
|
||||
@item C-h C-n
|
||||
Display the Emacs ``news'' file, which lists new features in the most
|
||||
recent version of Emacs (@code{view-emacs-news}).
|
||||
@item C-h C-p
|
||||
Display general information about the GNU Project
|
||||
(@code{describe-project}).
|
||||
@item C-h C-t
|
||||
Display the Emacs to-do list (@code{view-todo}).
|
||||
@item C-h C-w
|
||||
Display the full details on the complete absence of warranty for GNU
|
||||
Emacs (@code{describe-no-warranty}).
|
||||
@end table
|
||||
|
||||
@node Help Echo
|
||||
@section Help on Active Text and Tooltips
|
||||
|
||||
@cindex tooltips
|
||||
@cindex balloon help
|
||||
When a region of text is ``active,'' so that you can select it with
|
||||
the mouse or a key like @kbd{RET}, it often has associated help text.
|
||||
For instance, most parts of the mode line have help text. On
|
||||
graphical displays, the help text is displayed as a ``tooltip''
|
||||
(sometimes known as ``balloon help''), when you move the mouse over
|
||||
the active text. @xref{Tooltips}. On some systems, it is shown in
|
||||
the echo area. On text-only terminals, if Emacs cannot follow the
|
||||
mouse, it cannot show the help text on mouse-over.
|
||||
|
||||
@kindex C-h .
|
||||
@findex display-local-help
|
||||
@vindex help-at-pt-display-when-idle
|
||||
You can also access text region help info using the keyboard. The
|
||||
command @kbd{C-h .} (@code{display-local-help}) displays any help text
|
||||
associated with the text at point, using the echo area. If you want
|
||||
help text to be displayed automatically whenever it is available at
|
||||
point, set the variable @code{help-at-pt-display-when-idle} to
|
||||
@code{t}.
|
||||
|
||||
@ignore
|
||||
arch-tag: 6f33ab62-bc75-4367-8057-fd67cc15c3a1
|
||||
@end ignore
|
4327
man/idlwave.texi
4327
man/idlwave.texi
File diff suppressed because it is too large
Load diff
244
man/indent.texi
244
man/indent.texi
|
@ -1,244 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2001, 2002,
|
||||
@c 2003, 2004, 2005, 2006, 2007 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.
|
||||
|
||||
@table @kbd
|
||||
@item @key{TAB}
|
||||
Indent the 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 the previous and the current line (@code{delete-indentation}).
|
||||
This would cancel the effect of a preceding @kbd{C-j}.
|
||||
@item C-M-o
|
||||
Split the current line at point; text on the line after point becomes a
|
||||
new line indented to the same column where point is located
|
||||
(@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 lines in the region to the same column (@code{indent-region}).
|
||||
@item C-x @key{TAB}
|
||||
Shift lines in the region 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
|
||||
|
||||
Emacs supports four general categories of operations that could all
|
||||
be called `indentation':
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
Insert a tab character. You can type @kbd{C-q @key{TAB}} to do this.
|
||||
|
||||
A tab character is displayed as a stretch of whitespace which extends
|
||||
to the next display tab stop position, and the default width of a tab
|
||||
stop is eight. @xref{Text Display}, for more details.
|
||||
|
||||
@item
|
||||
Insert whitespace up to the next tab stop. You can set tab stops at
|
||||
your choice of column positions, then type @kbd{M-i} to advance to the
|
||||
next tab stop. The default tab stop settings have a tab stop every
|
||||
eight columns, which means by default @kbd{M-i} inserts a tab
|
||||
character. To set the tab stops, use @kbd{M-x edit-tab-stops}.
|
||||
|
||||
@item
|
||||
Align a line with the previous line. More precisely, the command
|
||||
@kbd{M-x indent-relative} indents the current line under the beginning
|
||||
of some word in the previous line. In Fundamental mode and in Text
|
||||
mode, @key{TAB} runs the command @code{indent-relative}.
|
||||
|
||||
@item
|
||||
The most sophisticated method is @dfn{syntax-driven indentation}.
|
||||
Most programming languages have an indentation convention. For Lisp
|
||||
code, lines are indented according to their nesting in parentheses. C
|
||||
code uses the same general idea, but many details are different.
|
||||
|
||||
@kindex TAB
|
||||
Type @key{TAB} to do syntax-driven indentation, in a mode that
|
||||
supports it. It realigns the current line according with the syntax
|
||||
of the preceding lines. No matter where in the line you are when you
|
||||
type @key{TAB}, it aligns the line as a whole.
|
||||
@end enumerate
|
||||
|
||||
Normally, most of the above methods insert an optimal mix of tabs and
|
||||
spaces to align to the desired column. @xref{Just Spaces}, for how to
|
||||
disable use of tabs. However, @kbd{C-q @key{TAB}} always inserts a
|
||||
tab, even when tabs are disabled for the indentation commands.
|
||||
|
||||
@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, if any,
|
||||
or else at the end of 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. They apply to all the lines that begin in the region.
|
||||
@kbd{C-M-\} (@code{indent-region}) 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.
|
||||
|
||||
@cindex remove indentation
|
||||
To remove all indentation from all of the lines in the region,
|
||||
invoke @kbd{C-x @key{TAB}} with a large negative argument, such as
|
||||
-1000.
|
||||
|
||||
@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 the next 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, @code{indent-relative} runs @code{tab-to-tab-stop}
|
||||
@ifnottex
|
||||
(@pxref{Tab Stops}),
|
||||
@end ifnottex
|
||||
@iftex
|
||||
(see next section),
|
||||
@end iftex
|
||||
unless it is called with a numeric argument, in which case it does
|
||||
nothing.
|
||||
|
||||
@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 @kbd{M-i} (@code{tab-to-tab-stop}).
|
||||
This command inserts indentation before point, enough to reach the
|
||||
next tab stop column.
|
||||
|
||||
@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. The buffer uses Overwrite mode
|
||||
(@pxref{Minor Modes}). @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{Text Display},
|
||||
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, so altering the variable affects only the current buffer,
|
||||
but there is a default value which you can change as well.
|
||||
@xref{Locals}.
|
||||
|
||||
A tab is not always displayed in the same way. By default, tabs are
|
||||
eight columns wide, but some people like to customize their tools to
|
||||
use a different tab width. So by using spaces only, you can make sure
|
||||
that your file looks the same regardless of the tab width setting.
|
||||
|
||||
@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 two
|
||||
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.
|
||||
|
||||
@ignore
|
||||
arch-tag: acc07de7-ae11-4ee8-a159-cb59c473f0fb
|
||||
@end ignore
|
1503
man/info.texi
1503
man/info.texi
File diff suppressed because it is too large
Load diff
699
man/killing.texi
699
man/killing.texi
|
@ -1,699 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,
|
||||
@c 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
|
||||
@node Killing, Yanking, Mark, Top
|
||||
@chapter Killing and Moving Text
|
||||
|
||||
@ifnottex
|
||||
@raisesections
|
||||
@end ifnottex
|
||||
|
||||
@dfn{Killing} means erasing text and copying it into the @dfn{kill
|
||||
ring}, from which you can bring it back into the buffer by
|
||||
@dfn{yanking} it. (Some systems use the terms ``cutting'' and
|
||||
``pasting'' for these operations.) This is the most common way of
|
||||
moving or copying text within Emacs. Killing and yanking 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.
|
||||
|
||||
@iftex
|
||||
@section Deletion and Killing
|
||||
@end iftex
|
||||
|
||||
@cindex killing text
|
||||
@cindex cutting text
|
||||
@cindex deletion
|
||||
Most commands which erase text from the buffer save it in the kill
|
||||
ring. These commands are known as @dfn{kill} commands. The commands
|
||||
that erase text but do not save it in the kill ring are known as
|
||||
@dfn{delete} commands. The @kbd{C-x u} (@code{undo}) command
|
||||
(@pxref{Undo}) can undo both kill and delete commands; the importance
|
||||
of the kill ring is that you can also yank the text in a different
|
||||
place or places. Emacs has only one kill ring for all buffers, so you
|
||||
can kill text in one buffer and yank it in another buffer.
|
||||
|
||||
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 erase significant amounts of nontrivial
|
||||
data generally do a kill operation instead. The commands' names and
|
||||
individual descriptions use the words @samp{kill} and @samp{delete} to
|
||||
say which kind of operation they perform.
|
||||
|
||||
@vindex kill-read-only-ok
|
||||
@cindex read-only text, killing
|
||||
You cannot kill read-only text, since such text does not allow any
|
||||
kind of modification. But some users like to use the kill commands to
|
||||
copy read-only text into the kill ring, without actually changing it.
|
||||
Therefore, the kill commands work specially in a read-only buffer:
|
||||
they move over text, and copy it to the kill ring, without actually
|
||||
deleting it from the buffer. Normally, kill commands beep and display
|
||||
an error message when this happens. But if you set the variable
|
||||
@code{kill-read-only-ok} to a non-@code{nil} value, they just print a
|
||||
message in the echo area to explain why the text has not been erased.
|
||||
|
||||
You can also use the mouse to kill and yank. @xref{Cut and Paste}.
|
||||
|
||||
@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
|
||||
|
||||
@need 1500
|
||||
@node Deletion
|
||||
@subsection Deletion
|
||||
@findex delete-backward-char
|
||||
@findex delete-char
|
||||
|
||||
Deletion means erasing text and not saving it in the kill ring. For
|
||||
the most part, the Emacs commands that delete text are those that
|
||||
erase just one character or only whitespace.
|
||||
|
||||
@table @kbd
|
||||
@item C-d
|
||||
@itemx @key{DELETE}
|
||||
Delete next character (@code{delete-char}). If your keyboard has a
|
||||
@key{DELETE} function key (usually located in the edit keypad), Emacs
|
||||
binds it to @code{delete-char} as well.
|
||||
@item @key{DEL}
|
||||
@itemx @key{BS}
|
||||
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
|
||||
|
||||
@kindex DEL
|
||||
@kindex C-d
|
||||
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 BACKSPACE
|
||||
@kindex BS
|
||||
@kindex DELETE
|
||||
Every keyboard has a large key which is a short distance above the
|
||||
@key{RET} or @key{ENTER} key and is normally used for erasing what you
|
||||
have typed. It may be labeled @key{DEL}, @key{BACKSPACE}, @key{BS},
|
||||
@key{DELETE}, or even with a left arrow. Regardless of the label on
|
||||
the key, in Emacs it called @key{DEL}, and it should delete one
|
||||
character backwards.
|
||||
|
||||
Many keyboards (including standard PC keyboards) have a
|
||||
@key{BACKSPACE} key a short ways above @key{RET} or @key{ENTER}, and a
|
||||
@key{DELETE} key elsewhere. In that case, the @key{BACKSPACE} key is
|
||||
@key{DEL}, and the @key{DELETE} key is equivalent to @kbd{C-d}---or it
|
||||
should be.
|
||||
|
||||
Why do we say ``or it should be''? When Emacs starts up using a
|
||||
graphical display, it determines automatically which key or keys should be
|
||||
equivalent to @key{DEL}. As a result, @key{BACKSPACE} and/or @key{DELETE}
|
||||
keys normally do the right things. But in some unusual cases Emacs
|
||||
gets the wrong information from the system. If these keys don't do
|
||||
what they ought to do, you need to tell Emacs which key to use for
|
||||
@key{DEL}. @xref{DEL Does Not Delete}, for how to do this.
|
||||
|
||||
@findex normal-erase-is-backspace-mode
|
||||
On most text-only terminals, Emacs cannot tell which keys the
|
||||
keyboard really has, so it follows a uniform plan which may or may not
|
||||
fit your keyboard. The uniform plan is that the @acronym{ASCII} @key{DEL}
|
||||
character deletes, and the @acronym{ASCII} @key{BS} (backspace) character asks
|
||||
for help (it is the same as @kbd{C-h}). If this is not right for your
|
||||
keyboard, such as if you find that the key which ought to delete backwards
|
||||
enters Help instead, see @ref{DEL Does Not Delete}.
|
||||
|
||||
@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. With a prefix argument, this only
|
||||
deletes spaces and tab characters before 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 if there were none before). With a numeric argument @var{n}, it
|
||||
leaves @var{n} spaces after point.
|
||||
|
||||
@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). On a solitary blank line, it deletes that 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}).
|
||||
@item C-S-backspace
|
||||
Kill an entire line at once (@code{kill-whole-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 not killed). 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}.
|
||||
|
||||
@kindex C-S-backspace
|
||||
@findex kill-whole-line
|
||||
@kbd{C-S-backspace} (@code{kill-whole-line}) will kill a whole line
|
||||
including its newline regardless of the position of point within the
|
||||
line. Note that many character terminals will prevent you from typing
|
||||
the key sequence @kbd{C-S-backspace}.
|
||||
|
||||
@node Other Kill Commands
|
||||
@subsection Other Kill Commands
|
||||
@findex kill-region
|
||||
@kindex C-w
|
||||
|
||||
@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 the following balanced expression (@code{kill-sexp}). @xref{Expressions}.
|
||||
@item M-z @var{char}
|
||||
Kill through the next occurrence of @var{char} (@code{zap-to-char}).
|
||||
@end table
|
||||
|
||||
The most general kill command 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}); balanced expressions, with @kbd{C-M-k}
|
||||
(@pxref{Expressions}); and sentences, with @kbd{C-x @key{DEL}} and
|
||||
@kbd{M-k} (@pxref{Sentences}).@refill
|
||||
|
||||
@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. This is very safe
|
||||
because Emacs remembers many recent kills, not just the last one.
|
||||
|
||||
@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}). Some systems call this ``copying.''
|
||||
@item C-M-w
|
||||
Append next kill to last batch of killed text (@code{append-next-kill}).
|
||||
@end table
|
||||
|
||||
On graphical displays with window systems, if there is a current
|
||||
selection in some other application, and you selected it more recently
|
||||
than you killed any text in Emacs, @kbd{C-y} copies the selection
|
||||
instead of text killed within Emacs.
|
||||
|
||||
@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}).
|
||||
|
||||
@cindex yanking and text properties
|
||||
@vindex yank-excluded-properties
|
||||
The yank commands discard certain text properties from the text that
|
||||
is yanked, those that might lead to annoying results. For instance,
|
||||
they discard text properties that respond to the mouse or specify key
|
||||
bindings. The variable @code{yank-excluded-properties} specifies the
|
||||
properties to discard. Yanking of register contents and rectangles
|
||||
also discard these properties.
|
||||
|
||||
@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 between @samp{is}
|
||||
and @samp{text}, 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} loops back around 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 from
|
||||
the specified kill ring entry, counting back from the most recent as
|
||||
1. 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 convenient methods 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 the contents of a specified buffer.
|
||||
@item M-x prepend-to-buffer
|
||||
Prepend region to the contents of a specified buffer.
|
||||
@item M-x copy-to-buffer
|
||||
Copy region into a specified buffer, deleting that buffer's old contents.
|
||||
@item M-x insert-buffer
|
||||
Insert the contents of a specified buffer into current buffer at point.
|
||||
@item M-x append-to-file
|
||||
Append region to the contents of a 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,
|
||||
starting from wherever point happens to be at that moment.
|
||||
|
||||
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 whole text in buffer
|
||||
@var{buffername} into the current buffer at point, and sets the mark
|
||||
after the inserted text. Alternatively, you can select the other
|
||||
buffer for editing, then copy 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, CUA Bindings, 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.
|
||||
|
||||
@cindex mark rectangle
|
||||
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 much the same way as 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 C-x r c
|
||||
Clear the region-rectangle by replacing all of its contents with spaces
|
||||
(@code{clear-rectangle}).
|
||||
@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 @var{string} @key{RET}
|
||||
Replace rectangle contents with @var{string} on each line
|
||||
(@code{string-rectangle}).
|
||||
@item M-x string-insert-rectangle @key{RET} @var{string} @key{RET}
|
||||
Insert @var{string} on each line of the rectangle.
|
||||
@end table
|
||||
|
||||
The rectangle operations fall into two classes: commands for
|
||||
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 any following text 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. It is hard to define yank-popping for rectangles,
|
||||
so we do not try.
|
||||
|
||||
@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 the same horizontal position, but 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
|
||||
@kindex C-x r c
|
||||
@findex clear-rectangle
|
||||
There are two commands you can use for making blank rectangles:
|
||||
@kbd{C-x r c} (@code{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{string-rectangle}) replaces the
|
||||
contents of a region-rectangle with a string 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.
|
||||
|
||||
@findex string-insert-rectangle
|
||||
The command @kbd{M-x string-insert-rectangle} is similar to
|
||||
@code{string-rectangle}, but inserts the string on each line,
|
||||
shifting the original text to the right.
|
||||
|
||||
@node CUA Bindings, Registers, Rectangles, Top
|
||||
@section CUA Bindings
|
||||
@findex cua-mode
|
||||
@vindex cua-mode
|
||||
@cindex CUA key bindings
|
||||
@vindex cua-enable-cua-keys
|
||||
The command @kbd{M-x cua-mode} sets up key bindings that are
|
||||
compatible with the Common User Access (CUA) system used in many other
|
||||
applications. @kbd{C-x} means cut (kill), @kbd{C-c} copy, @kbd{C-v}
|
||||
paste (yank), and @kbd{C-z} undo. Standard Emacs commands like
|
||||
@kbd{C-x C-c} still work, because @kbd{C-x} and @kbd{C-c} only take
|
||||
effect when the mark is active (and the region is highlighted).
|
||||
However, if you don't want to override these bindings in Emacs at all,
|
||||
set @code{cua-enable-cua-keys} to @code{nil}.
|
||||
|
||||
In CUA mode, using @kbd{Shift} together with the movement keys
|
||||
activates and highlights the region over which they move. The
|
||||
standard (unshifted) movement keys deactivate the mark, and typed text
|
||||
replaces the active region as in Delete-Selection mode
|
||||
(@pxref{Mouse Commands}).
|
||||
|
||||
To enter an Emacs command like @kbd{C-x C-f} while the mark is
|
||||
active, use one of the following methods: either hold @kbd{Shift}
|
||||
together with the prefix key, e.g. @kbd{S-C-x C-f}, or quickly type
|
||||
the prefix key twice, e.g. @kbd{C-x C-x C-f}.
|
||||
|
||||
@cindex rectangle highlighting
|
||||
CUA mode provides enhanced rectangle support with visible
|
||||
rectangle highlighting. Use @kbd{C-RET} to start a rectangle,
|
||||
extend it using the movement commands, and cut or copy it using
|
||||
@kbd{C-x} or @kbd{C-c}. @kbd{RET} moves the cursor to the next
|
||||
(clockwise) corner of the rectangle, so you can easily expand it in
|
||||
any direction. Normal text you type is inserted to the left or right
|
||||
of each line in the rectangle (on the same side as the cursor).
|
||||
|
||||
With CUA you can easily copy text and rectangles into and out of
|
||||
registers by providing a one-digit numeric prefix to the kill, copy,
|
||||
and yank commands, e.g. @kbd{C-1 C-c} copies the region into register
|
||||
@code{1}, and @kbd{C-2 C-v} yanks the contents of register @code{2}.
|
||||
|
||||
@cindex global mark
|
||||
CUA mode also has a global mark feature which allows easy moving and
|
||||
copying of text between buffers. Use @kbd{C-S-SPC} to toggle the
|
||||
global mark on and off. When the global mark is on, all text that you
|
||||
kill or copy is automatically inserted at the global mark, and text
|
||||
you type is inserted at the global mark rather than at the current
|
||||
position.
|
||||
|
||||
For example, to copy words from various buffers into a word list in
|
||||
a given buffer, set the global mark in the target buffer, then
|
||||
navigate to each of the words you want in the list, mark it (e.g. with
|
||||
@kbd{S-M-f}), copy it to the list with @kbd{C-c} or @kbd{M-w}, and
|
||||
insert a newline after the word in the target list by pressing
|
||||
@key{RET}.
|
||||
|
||||
@ifnottex
|
||||
@lowersections
|
||||
@end ifnottex
|
||||
|
||||
@ignore
|
||||
arch-tag: d8da8f96-0928-449a-816e-ff2d3497866c
|
||||
@end ignore
|
616
man/kmacro.texi
616
man/kmacro.texi
|
@ -1,616 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,
|
||||
@c 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Keyboard Macros, Files, Fixit, Top
|
||||
@chapter Keyboard Macros
|
||||
@cindex defining keyboard macros
|
||||
@cindex keyboard macro
|
||||
|
||||
In this chapter we describe how to record a sequence of editing
|
||||
commands so you can repeat it conveniently later.
|
||||
|
||||
A @dfn{keyboard macro} is a command defined by an Emacs user to stand for
|
||||
another sequence of keys. For example, if you discover that you are
|
||||
about to type @kbd{C-n M-d C-d} forty times, you can speed your work by
|
||||
defining a keyboard macro to do @kbd{C-n M-d C-d}, and then executing
|
||||
it 39 more times.
|
||||
|
||||
You define a keyboard macro by executing and recording the commands
|
||||
which are its definition. Put differently, as you define a keyboard
|
||||
macro, the definition is being executed for the first time. This way,
|
||||
you can see the effects of your commands, so that you don't have to
|
||||
figure them out in your head. When you close the definition, the
|
||||
keyboard macro is defined and also has been, in effect, executed once.
|
||||
You can then do the whole thing over again by invoking the macro.
|
||||
|
||||
Keyboard macros differ from ordinary Emacs commands in that they are
|
||||
written in the Emacs command language rather than in Lisp. This makes it
|
||||
easier for the novice to write them, and makes them more convenient as
|
||||
temporary hacks. However, the Emacs command language is not powerful
|
||||
enough as a programming language to be useful for writing anything
|
||||
intelligent or general. For such things, Lisp must be used.
|
||||
|
||||
@menu
|
||||
* Basic Keyboard Macro:: Defining and running keyboard macros.
|
||||
* Keyboard Macro Ring:: Where previous keyboard macros are saved.
|
||||
* Keyboard Macro Counter:: Inserting incrementing numbers in macros.
|
||||
* Keyboard Macro Query:: Making keyboard macros do different things each time.
|
||||
* Save Keyboard Macro:: Giving keyboard macros names; saving them in files.
|
||||
* Edit Keyboard Macro:: Editing keyboard macros.
|
||||
* Keyboard Macro Step-Edit:: Interactively executing and editing a keyboard
|
||||
macro.
|
||||
@end menu
|
||||
|
||||
@node Basic Keyboard Macro
|
||||
@section Basic Use
|
||||
|
||||
@table @kbd
|
||||
@item @key{F3}
|
||||
@itemx C-x (
|
||||
Start defining a keyboard macro (@code{kmacro-start-macro}).
|
||||
@item @key{F4}
|
||||
If a keyboard macro is being defined, end the definition; otherwise,
|
||||
execute the most recent keyboard macro
|
||||
(@code{kmacro-end-or-call-macro}).
|
||||
@item C-x )
|
||||
End the definition of a keyboard macro (@code{kmacro-end-macro}).
|
||||
@item C-x e
|
||||
Execute the most recent keyboard macro (@code{kmacro-end-and-call-macro}).
|
||||
First end the definition of the keyboard macro, if currently defining it.
|
||||
To immediately execute the keyboard macro again, just repeat the @kbd{e}.
|
||||
@item C-u C-x (
|
||||
Re-execute last keyboard macro, then add more keys to its definition.
|
||||
@item C-u C-u C-x (
|
||||
Add more keys to the last keyboard macro without re-executing it.
|
||||
@item C-x C-k r
|
||||
Run the last keyboard macro on each line that begins in the region
|
||||
(@code{apply-macro-to-region-lines}).
|
||||
@end table
|
||||
|
||||
@kindex F3
|
||||
@kindex F4
|
||||
@kindex C-x (
|
||||
@kindex C-x )
|
||||
@kindex C-x e
|
||||
@findex kmacro-start-macro
|
||||
@findex kmacro-end-macro
|
||||
@findex kmacro-end-and-call-macro
|
||||
To start defining a keyboard macro, type the @kbd{F3} or @kbd{C-x (} command
|
||||
(@code{kmacro-start-macro}). From then on, your keys continue to be
|
||||
executed, but also become part of the definition of the macro. @samp{Def}
|
||||
appears in the mode line to remind you of what is going on. When you are
|
||||
finished, the @kbd{F4} or @kbd{C-x )} command (@code{kmacro-end-macro}) terminates the
|
||||
definition (without becoming part of it!). For example,
|
||||
|
||||
@example
|
||||
C-x ( M-f foo C-x )
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
defines a macro to move forward a word and then insert @samp{foo}.
|
||||
|
||||
The macro thus defined can be invoked again with the @kbd{C-x e}
|
||||
command (@code{kmacro-end-and-call-macro}), which may be given a
|
||||
repeat count as a numeric argument to execute the macro many times.
|
||||
If you enter @kbd{C-x e} while defining a macro, the macro is
|
||||
terminated and executed immediately.
|
||||
|
||||
After executing the macro with @kbd{C-x e}, you can use @kbd{e}
|
||||
repeatedly to immediately repeat the macro one or more times. For example,
|
||||
|
||||
@example
|
||||
C-x ( xyz C-x e e e
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
inserts @samp{xyzxyzxyzxyz} in the current buffer.
|
||||
|
||||
@kbd{C-x )} can also be given a repeat count as an argument, in
|
||||
which case it repeats the macro that many times right after defining
|
||||
it, but defining the macro counts as the first repetition (since it is
|
||||
executed as you define it). Therefore, giving @kbd{C-x )} an argument
|
||||
of 4 executes the macro immediately 3 additional times. An argument
|
||||
of zero to @kbd{C-x e} or @kbd{C-x )} means repeat the macro
|
||||
indefinitely (until it gets an error or you type @kbd{C-g} or, on
|
||||
MS-DOS, @kbd{C-@key{BREAK}}).
|
||||
|
||||
The key @key{F4} is like a combination of @kbd{C-x )} and @kbd{C-x
|
||||
e}. If you're defining a macro, @key{F4} ends the definition.
|
||||
Otherwise it executes the last macro. For example,
|
||||
|
||||
@example
|
||||
F3 xyz F4 F4 F4
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
inserts @samp{xyzxyzxyz} in the current buffer.
|
||||
|
||||
If you wish to repeat an operation at regularly spaced places in the
|
||||
text, define a macro and include as part of the macro the commands to move
|
||||
to the next place you want to use it. For example, if you want to change
|
||||
each line, you should position point at the start of a line, and define a
|
||||
macro to change that line and leave point at the start of the next line.
|
||||
Then repeating the macro will operate on successive lines.
|
||||
|
||||
When a command reads an argument with the minibuffer, your
|
||||
minibuffer input becomes part of the macro along with the command. So
|
||||
when you replay the macro, the command gets the same argument as
|
||||
when you entered the macro. For example,
|
||||
|
||||
@example
|
||||
C-x ( C-a C-@key{SPC} C-n M-w C-x b f o o @key{RET} C-y C-x b @key{RET} C-x )
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
defines a macro that copies the current line into the buffer
|
||||
@samp{foo}, then returns to the original buffer.
|
||||
|
||||
You can use function keys in a keyboard macro, just like keyboard
|
||||
keys. You can even use mouse events, but be careful about that: when
|
||||
the macro replays the mouse event, it uses the original mouse position
|
||||
of that event, the position that the mouse had while you were defining
|
||||
the macro. The effect of this may be hard to predict. (Using the
|
||||
current mouse position would be even less predictable.)
|
||||
|
||||
One thing that sometimes works badly in a keyboard macro is the
|
||||
command @kbd{C-M-c} (@code{exit-recursive-edit}). When this command
|
||||
exits a recursive edit that started within the macro, it works as
|
||||
you'd expect. But if it exits a recursive edit that started before
|
||||
you invoked the keyboard macro, it also necessarily exits the keyboard
|
||||
macro as part of the process.
|
||||
|
||||
After you have terminated the definition of a keyboard macro, you can add
|
||||
to the end of its definition by typing @kbd{C-u F3} or @kbd{C-u C-x (}.
|
||||
This is equivalent
|
||||
to plain @kbd{C-x (} followed by retyping the whole definition so far. As
|
||||
a consequence it re-executes the macro as previously defined.
|
||||
|
||||
You can also add to the end of the definition of the last keyboard
|
||||
macro without re-executing it by typing @kbd{C-u C-u C-x (}.
|
||||
|
||||
The variable @code{kmacro-execute-before-append} specifies whether
|
||||
a single @kbd{C-u} prefix causes the existing macro to be re-executed
|
||||
before appending to it.
|
||||
|
||||
@findex apply-macro-to-region-lines
|
||||
@kindex C-x C-k r
|
||||
The command @kbd{C-x C-k r} (@code{apply-macro-to-region-lines})
|
||||
repeats the last defined keyboard macro on each line that begins in
|
||||
the region. It does this line by line, by moving point to the
|
||||
beginning of the line and then executing the macro.
|
||||
|
||||
@node Keyboard Macro Ring
|
||||
@section The Keyboard Macro Ring
|
||||
|
||||
All defined keyboard macros are recorded in the ``keyboard macro ring,''
|
||||
a list of sequences of keys. There is only one keyboard macro ring,
|
||||
shared by all buffers.
|
||||
|
||||
@table @kbd
|
||||
@item C-x C-k C-k
|
||||
Execute the keyboard macro at the head of the ring (@code{kmacro-end-or-call-macro-repeat}).
|
||||
@item C-x C-k C-n
|
||||
Rotate the keyboard macro ring to the next macro (defined earlier)
|
||||
(@code{kmacro-cycle-ring-next}).
|
||||
@item C-x C-k C-p
|
||||
Rotate the keyboard macro ring to the previous macro (defined later)
|
||||
(@code{kmacro-cycle-ring-previous}).
|
||||
@end table
|
||||
|
||||
All commands which operate on the keyboard macro ring use the
|
||||
same @kbd{C-x C-k} prefix. Most of these commands can be executed and
|
||||
repeated immediately after each other without repeating the @kbd{C-x
|
||||
C-k} prefix. For example,
|
||||
|
||||
@example
|
||||
C-x C-k C-p C-p C-k C-k C-k C-n C-n C-k C-p C-k C-d
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
will rotate the keyboard macro ring to the ``second previous'' macro,
|
||||
execute the resulting head macro three times, rotate back to the
|
||||
original head macro, execute that once, rotate to the ``previous''
|
||||
macro, execute that, and finally delete it from the macro ring.
|
||||
|
||||
@findex kmacro-end-or-call-macro-repeat
|
||||
@kindex C-x C-k C-k
|
||||
The command @kbd{C-x C-k C-k} (@code{kmacro-end-or-call-macro-repeat})
|
||||
executes the keyboard macro at the head of the macro ring. You can
|
||||
repeat the macro immediately by typing another @kbd{C-k}, or you can
|
||||
rotate the macro ring immediately by typing @kbd{C-n} or @kbd{C-p}.
|
||||
|
||||
When a keyboard macro is being defined, @kbd{C-x C-k C-k} behaves like
|
||||
@kbd{C-x )} except that, immediately afterward, you can use most key
|
||||
bindings of this section without the @kbd{C-x C-k} prefix. For
|
||||
instance, another @kbd{C-k} will re-execute the macro.
|
||||
|
||||
@findex kmacro-cycle-ring-next
|
||||
@kindex C-x C-k C-n
|
||||
@findex kmacro-cycle-ring-previous
|
||||
@kindex C-x C-k C-p
|
||||
The commands @kbd{C-x C-k C-n} (@code{kmacro-cycle-ring-next}) and
|
||||
@kbd{C-x C-k C-p} (@code{kmacro-cycle-ring-previous}) rotate the
|
||||
macro ring, bringing the next or previous keyboard macro to the head
|
||||
of the macro ring. The definition of the new head macro is displayed
|
||||
in the echo area. You can continue to rotate the macro ring
|
||||
immediately by repeating just @kbd{C-n} and @kbd{C-p} until the
|
||||
desired macro is at the head of the ring. To execute the new macro
|
||||
ring head immediately, just type @kbd{C-k}.
|
||||
|
||||
Note that Emacs treats the head of the macro ring as the ``last
|
||||
defined keyboard macro.'' For instance, @kbd{C-x e} will execute that
|
||||
macro, and @kbd{C-x C-k n} will give it a name.
|
||||
|
||||
@ignore @c This interface is too kludgy
|
||||
@c and the functionality duplicates the functionality above -- rms.
|
||||
@findex kmacro-view-macro-repeat
|
||||
@kindex C-x C-k C-v
|
||||
The command @kbd{C-x C-k C-v} (@code{kmacro-view-macro-repeat})
|
||||
displays the last keyboard macro, or when repeated (with @kbd{C-v}),
|
||||
it displays the previous macro on the macro ring, just like @kbd{C-x
|
||||
C-k C-p}, but without actually rotating the macro ring. If you enter
|
||||
@kbd{C-k} immediately after displaying a macro from the ring, that
|
||||
macro is executed, but still without altering the macro ring.
|
||||
|
||||
So while e.g. @kbd{C-x C-k C-p C-p C-p C-k C-k} makes the 3rd previous
|
||||
macro the current macro and executes it twice, @kbd{C-x C-k C-v C-v
|
||||
C-v C-k C-k} will display and execute the 3rd previous macro once and
|
||||
then the current macro once.
|
||||
@end ignore
|
||||
|
||||
@ignore @c This is just too much feeping creaturism.
|
||||
@c If you are reusing certain macros enough to want these,
|
||||
@c you should give then names. -- rms
|
||||
@findex kmacro-delete-ring-head
|
||||
@kindex C-x C-k C-d
|
||||
|
||||
The command @kbd{C-x C-k C-d} (@code{kmacro-delete-ring-head})
|
||||
removes and deletes the macro currently at the head of the macro
|
||||
ring. You can use this to delete a macro that didn't work as
|
||||
expected, or which you don't need anymore.
|
||||
|
||||
@findex kmacro-swap-ring
|
||||
@kindex C-x C-k C-t
|
||||
|
||||
The command @kbd{C-x C-k C-t} (@code{kmacro-swap-ring})
|
||||
interchanges the head of the macro ring with the previous element on
|
||||
the macro ring.
|
||||
|
||||
@findex kmacro-call-ring-2nd-repeat
|
||||
@kindex C-x C-k C-l
|
||||
|
||||
The command @kbd{C-x C-k C-l} (@code{kmacro-call-ring-2nd-repeat})
|
||||
executes the previous (rather than the head) element on the macro ring.
|
||||
@end ignore
|
||||
|
||||
@vindex kmacro-ring-max
|
||||
The maximum number of macros stored in the keyboard macro ring is
|
||||
determined by the customizable variable @code{kmacro-ring-max}.
|
||||
|
||||
@node Keyboard Macro Counter
|
||||
@section The Keyboard Macro Counter
|
||||
|
||||
@table @kbd
|
||||
@item C-x C-k C-i
|
||||
Insert the keyboard macro counter value in the buffer
|
||||
(@code{kmacro-insert-counter}).
|
||||
@item C-x C-k C-c
|
||||
Set the keyboard macro counter (@code{kmacro-set-counter}).
|
||||
@item C-x C-k C-a
|
||||
Add the prefix arg to the keyboard macro counter (@code{kmacro-add-counter}).
|
||||
@item C-x C-k C-f
|
||||
Specify the format for inserting the keyboard macro counter
|
||||
(@code{kmacro-set-format}).
|
||||
@end table
|
||||
|
||||
Each keyboard macro has an associated counter. Normally, the
|
||||
macro counter is initialized to 0 when you start defining the macro,
|
||||
and incremented by 1 after each insertion of the counter value;
|
||||
that is, if you insert the macro counter twice while defining the
|
||||
macro, the counter will increase by 2 on each repetition of the macro.
|
||||
|
||||
@findex kmacro-insert-counter
|
||||
@kindex C-x C-k C-i
|
||||
The command @kbd{C-x C-k C-i} (@code{kmacro-insert-counter}) inserts
|
||||
the current value of the current keyboard macro's counter, and
|
||||
increments the counter by 1. You can use a numeric prefix argument to
|
||||
specify a different increment. If you just specify a @kbd{C-u}
|
||||
prefix, then the increment is zero, so it repeats the last inserted
|
||||
counter value. For example, if you enter the following sequence while
|
||||
defining a macro
|
||||
|
||||
@example
|
||||
C-x C-k C-i C-x C-k C-i C-u C-x C-k C-i C-x C-k C-i
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
it inserts @samp{0112} in the buffer. The next two iterations
|
||||
of the macro will insert @samp{3445} and @samp{6778}.
|
||||
|
||||
This command usually only makes sense while defining a keyboard
|
||||
macro. But its behavior when no keyboard macro is being defined or
|
||||
executed is predictable: it inserts and increments the counter of the
|
||||
macro at the head of the keyboard macro ring.
|
||||
|
||||
@findex kmacro-set-counter
|
||||
@kindex C-x C-k C-c
|
||||
The command @kbd{C-x C-k C-c} (@code{kmacro-set-counter}) sets the
|
||||
current macro counter to the value of the numeric argument. If you use
|
||||
it inside the macro, it operates on each repetition of the macro. If
|
||||
you specify just @kbd{C-u} as the prefix, while executing the macro,
|
||||
that resets the counter to the value it had at the beginning of the
|
||||
current repetition of the macro (undoing any increments so far in this
|
||||
repetition).
|
||||
|
||||
@findex kmacro-add-counter
|
||||
@kindex C-x C-k C-a
|
||||
The command @kbd{C-x C-k C-a} (@code{kmacro-add-counter}) adds the
|
||||
prefix argument to the current macro counter. With just @kbd{C-u} as
|
||||
argument, it resets the counter to the last value inserted by any
|
||||
keyboard macro. (Normally, when you use this, the last insertion
|
||||
will be in the same macro and it will be the same counter.)
|
||||
|
||||
@findex kmacro-set-format
|
||||
@kindex C-x C-k C-f
|
||||
The command @kbd{C-x C-k C-f} (@code{kmacro-set-format}) prompts for
|
||||
the format to use when inserting the macro counter. The default
|
||||
format is @samp{%d}, which means to insert the number in decimal
|
||||
without any padding. You can exit with empty minibuffer to reset the
|
||||
format to this default. You can specify any format string that the
|
||||
@code{format} function accepts and that makes sense with a single
|
||||
integer extra argument (@pxref{Formatting Strings,,, elisp, The Emacs
|
||||
Lisp Reference Manual}). Do not put the format string inside double
|
||||
quotes when you insert it in the minibuffer.
|
||||
|
||||
If you use this command while no keyboard macro is being defined or
|
||||
executed, the new format affects all subsequent macro definitions.
|
||||
Existing macros continue to use the format in effect when they were
|
||||
defined. If you set the format while defining a keyboard macro, this
|
||||
affects the macro being defined from that point on, but it does not
|
||||
affect subsequent macros. Execution of the macro will, at each step,
|
||||
use the format in effect at that step during its definition. Changes
|
||||
to the macro format during execution of a macro, like the
|
||||
corresponding changes during its definition, have no effect on
|
||||
subsequent macros.
|
||||
|
||||
The format set by @kbd{C-x C-k C-f} does not affect insertion of
|
||||
numbers stored in registers.
|
||||
|
||||
@node Keyboard Macro Query
|
||||
@section Executing Macros with Variations
|
||||
|
||||
@table @kbd
|
||||
@item C-x q
|
||||
When this point is reached during macro execution, ask for confirmation
|
||||
(@code{kbd-macro-query}).
|
||||
@end table
|
||||
|
||||
@kindex C-x q
|
||||
@findex kbd-macro-query
|
||||
Using @kbd{C-x q} (@code{kbd-macro-query}), you can get an effect
|
||||
similar to that of @code{query-replace}, where the macro asks you each
|
||||
time around whether to make a change. While defining the macro,
|
||||
type @kbd{C-x q} at the point where you want the query to occur. During
|
||||
macro definition, the @kbd{C-x q} does nothing, but when you run the
|
||||
macro later, @kbd{C-x q} asks you interactively whether to continue.
|
||||
|
||||
The valid responses when @kbd{C-x q} asks are @key{SPC} (or @kbd{y}),
|
||||
@key{DEL} (or @kbd{n}), @key{RET} (or @kbd{q}), @kbd{C-l} and @kbd{C-r}.
|
||||
The answers are the same as in @code{query-replace}, though not all of
|
||||
the @code{query-replace} options are meaningful.
|
||||
|
||||
These responses include @key{SPC} to continue, and @key{DEL} to skip
|
||||
the remainder of this repetition of the macro and start right away with
|
||||
the next repetition. @key{RET} means to skip the remainder of this
|
||||
repetition and cancel further repetitions. @kbd{C-l} redraws the screen
|
||||
and asks you again for a character to say what to do.
|
||||
|
||||
@kbd{C-r} enters a recursive editing level, in which you can perform
|
||||
editing which is not part of the macro. When you exit the recursive
|
||||
edit using @kbd{C-M-c}, you are asked again how to continue with the
|
||||
keyboard macro. If you type a @key{SPC} at this time, the rest of the
|
||||
macro definition is executed. It is up to you to leave point and the
|
||||
text in a state such that the rest of the macro will do what you
|
||||
want.@refill
|
||||
|
||||
@kbd{C-u C-x q}, which is @kbd{C-x q} with a numeric argument,
|
||||
performs a completely different function. It enters a recursive edit
|
||||
reading input from the keyboard, both when you type it during the
|
||||
definition of the macro, and when it is executed from the macro. During
|
||||
definition, the editing you do inside the recursive edit does not become
|
||||
part of the macro. During macro execution, the recursive edit gives you
|
||||
a chance to do some particularized editing on each repetition.
|
||||
@xref{Recursive Edit}.
|
||||
|
||||
Another way to vary the behavior of a keyboard macro is to use a
|
||||
register as a counter, incrementing it on each repetition of the macro.
|
||||
@xref{RegNumbers}.
|
||||
|
||||
@node Save Keyboard Macro
|
||||
@section Naming and Saving Keyboard Macros
|
||||
|
||||
@table @kbd
|
||||
@item C-x C-k n
|
||||
Give a command name (for the duration of the Emacs session) to the most
|
||||
recently defined keyboard macro (@code{kmacro-name-last-macro}).
|
||||
@item C-x C-k b
|
||||
Bind the most recently defined keyboard macro to a key sequence (for
|
||||
the duration of the session) (@code{kmacro-bind-to-key}).
|
||||
@item M-x insert-kbd-macro
|
||||
Insert in the buffer a keyboard macro's definition, as Lisp code.
|
||||
@end table
|
||||
|
||||
@cindex saving keyboard macros
|
||||
@findex kmacro-name-last-macro
|
||||
@kindex C-x C-k n
|
||||
If you wish to save a keyboard macro for later use, you can give it
|
||||
a name using @kbd{C-x C-k n} (@code{kmacro-name-last-macro}).
|
||||
This reads a name as an argument using the minibuffer and defines that
|
||||
name to execute the last keyboard macro, in its current form. (If you
|
||||
later add to the definition of this macro, that does not alter the
|
||||
name's definition as a macro.) The macro name is a Lisp symbol, and
|
||||
defining it in this way makes it a valid command name for calling with
|
||||
@kbd{M-x} or for binding a key to with @code{global-set-key}
|
||||
(@pxref{Keymaps}). If you specify a name that has a prior definition
|
||||
other than a keyboard macro, an error message is shown and nothing is
|
||||
changed.
|
||||
|
||||
@cindex binding keyboard macros
|
||||
@findex kmacro-bind-to-key
|
||||
@kindex C-x C-k b
|
||||
You can also bind the last keyboard macro (in its current form) to a
|
||||
key, using @kbd{C-x C-k b} (@code{kmacro-bind-to-key}) followed by the
|
||||
key sequence you want to bind. You can bind to any key sequence in
|
||||
the global keymap, but since most key sequences already have other
|
||||
bindings, you should select the key sequence carefully. If you try to
|
||||
bind to a key sequence with an existing binding (in any keymap), this
|
||||
command asks you for confirmation before replacing the existing binding.
|
||||
|
||||
To avoid problems caused by overriding existing bindings, the key
|
||||
sequences @kbd{C-x C-k 0} through @kbd{C-x C-k 9} and @kbd{C-x C-k A}
|
||||
through @kbd{C-x C-k Z} are reserved for your own keyboard macro
|
||||
bindings. In fact, to bind to one of these key sequences, you only
|
||||
need to type the digit or letter rather than the whole key sequences.
|
||||
For example,
|
||||
|
||||
@example
|
||||
C-x C-k b 4
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
will bind the last keyboard macro to the key sequence @kbd{C-x C-k 4}.
|
||||
|
||||
@findex insert-kbd-macro
|
||||
Once a macro has a command name, you can save its definition in a file.
|
||||
Then it can be used in another editing session. First, visit the file
|
||||
you want to save the definition in. Then use this command:
|
||||
|
||||
@example
|
||||
M-x insert-kbd-macro @key{RET} @var{macroname} @key{RET}
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
This inserts some Lisp code that, when executed later, will define the
|
||||
same macro with the same definition it has now. (You need not
|
||||
understand Lisp code to do this, because @code{insert-kbd-macro} writes
|
||||
the Lisp code for you.) Then save the file. You can load the file
|
||||
later with @code{load-file} (@pxref{Lisp Libraries}). If the file you
|
||||
save in is your init file @file{~/.emacs} (@pxref{Init File}) then the
|
||||
macro will be defined each time you run Emacs.
|
||||
|
||||
If you give @code{insert-kbd-macro} a numeric argument, it makes
|
||||
additional Lisp code to record the keys (if any) that you have bound
|
||||
to @var{macroname}, so that the macro will be reassigned the same keys
|
||||
when you load the file.
|
||||
|
||||
@node Edit Keyboard Macro
|
||||
@section Editing a Keyboard Macro
|
||||
|
||||
@table @kbd
|
||||
@item C-x C-k C-e
|
||||
Edit the last defined keyboard macro (@code{kmacro-edit-macro}).
|
||||
@item C-x C-k e @var{name} @key{RET}
|
||||
Edit a previously defined keyboard macro @var{name} (@code{edit-kbd-macro}).
|
||||
@item C-x C-k l
|
||||
Edit the last 100 keystrokes as a keyboard macro
|
||||
(@code{kmacro-edit-lossage}).
|
||||
@end table
|
||||
|
||||
@findex kmacro-edit-macro
|
||||
@kindex C-x C-k C-e
|
||||
@kindex C-x C-k RET
|
||||
You can edit the last keyboard macro by typing @kbd{C-x C-k C-e} or
|
||||
@kbd{C-x C-k RET} (@code{kmacro-edit-macro}). This formats the macro
|
||||
definition in a buffer and enters a specialized major mode for editing
|
||||
it. Type @kbd{C-h m} once in that buffer to display details of how to
|
||||
edit the macro. When you are finished editing, type @kbd{C-c C-c}.
|
||||
|
||||
@findex edit-kbd-macro
|
||||
@kindex C-x C-k e
|
||||
You can edit a named keyboard macro or a macro bound to a key by typing
|
||||
@kbd{C-x C-k e} (@code{edit-kbd-macro}). Follow that with the
|
||||
keyboard input that you would use to invoke the macro---@kbd{C-x e} or
|
||||
@kbd{M-x @var{name}} or some other key sequence.
|
||||
|
||||
@findex kmacro-edit-lossage
|
||||
@kindex C-x C-k l
|
||||
You can edit the last 100 keystrokes as a macro by typing
|
||||
@kbd{C-x C-k l} (@code{kmacro-edit-lossage}).
|
||||
|
||||
@node Keyboard Macro Step-Edit
|
||||
@section Stepwise Editing a Keyboard Macro
|
||||
|
||||
@findex kmacro-step-edit-macro
|
||||
@kindex C-x C-k SPC
|
||||
You can interactively replay and edit the last keyboard
|
||||
macro, one command at a time, by typing @kbd{C-x C-k SPC}
|
||||
(@code{kmacro-step-edit-macro}). Unless you quit the macro using
|
||||
@kbd{q} or @kbd{C-g}, the edited macro replaces the last macro on the
|
||||
macro ring.
|
||||
|
||||
This macro editing feature shows the last macro in the minibuffer
|
||||
together with the first (or next) command to be executed, and prompts
|
||||
you for an action. You can enter @kbd{?} to get a summary of your
|
||||
options. These actions are available:
|
||||
|
||||
@itemize @bullet{}
|
||||
@item
|
||||
@kbd{SPC} and @kbd{y} execute the current command, and advance to the
|
||||
next command in the keyboard macro.
|
||||
@item
|
||||
@kbd{n}, @kbd{d}, and @kbd{DEL} skip and delete the current command.
|
||||
@item
|
||||
@kbd{f} skips the current command in this execution of the keyboard
|
||||
macro, but doesn't delete it from the macro.
|
||||
@item
|
||||
@kbd{@key{TAB}} executes the current command, as well as all similar
|
||||
commands immediately following the current command; for example, @key{TAB}
|
||||
may be used to insert a sequence of characters (corresponding to a
|
||||
sequence of @code{self-insert-command} commands).
|
||||
@item
|
||||
@kbd{c} continues execution (without further editing) until the end of
|
||||
the keyboard macro. If execution terminates normally, the edited
|
||||
macro replaces the original keyboard macro.
|
||||
@item
|
||||
@kbd{C-k} skips and deletes the rest of the keyboard macro,
|
||||
terminates step-editing, and replaces the original keyboard macro
|
||||
with the edited macro.
|
||||
@item
|
||||
@kbd{q} and @kbd{C-g} cancels the step-editing of the keyboard macro;
|
||||
discarding any changes made to the keyboard macro.
|
||||
@item
|
||||
@kbd{i KEY... C-j} reads and executes a series of key sequences (not
|
||||
including the final @kbd{C-j}), and inserts them before the current
|
||||
command in the keyboard macro, without advancing over the current
|
||||
command.
|
||||
@item
|
||||
@kbd{I KEY...} reads one key sequence, executes it, and inserts it
|
||||
before the current command in the keyboard macro, without advancing
|
||||
over the current command.
|
||||
@item
|
||||
@kbd{r KEY... C-j} reads and executes a series of key sequences (not
|
||||
including the final @kbd{C-j}), and replaces the current command in
|
||||
the keyboard macro with them, advancing over the inserted key
|
||||
sequences.
|
||||
@item
|
||||
@kbd{R KEY...} reads one key sequence, executes it, and replaces the
|
||||
current command in the keyboard macro with that key sequence,
|
||||
advancing over the inserted key sequence.
|
||||
@item
|
||||
@kbd{a KEY... C-j} executes the current command, then reads and
|
||||
executes a series of key sequences (not including the final
|
||||
@kbd{C-j}), and inserts them after the current command in the keyboard
|
||||
macro; it then advances over the current command and the inserted key
|
||||
sequences.
|
||||
@item
|
||||
@kbd{A KEY... C-j} executes the rest of the commands in the keyboard
|
||||
macro, then reads and executes a series of key sequences (not
|
||||
including the final @kbd{C-j}), and appends them at the end of the
|
||||
keyboard macro; it then terminates the step-editing and replaces the
|
||||
original keyboard macro with the edited macro.
|
||||
@end itemize
|
||||
|
||||
@ignore
|
||||
arch-tag: c1b0dd3b-3159-4c08-928f-52e763953e9c
|
||||
@end ignore
|
75
man/m-x.texi
75
man/m-x.texi
|
@ -1,75 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2001, 2002,
|
||||
@c 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node M-x, Help, Minibuffer, Top
|
||||
@chapter Running Commands by Name
|
||||
|
||||
Every Emacs command has a name that you can use to run it. For
|
||||
convenience, many commands also have key bindings. You can run those
|
||||
commands by typing the keys, or run them by name. Most Emacs commands
|
||||
have no key bindings, so the only way to run them is by name.
|
||||
(@xref{Key Bindings}, for how to set up key bindings.)
|
||||
|
||||
By convention, a command name consists of one or more words,
|
||||
separated by hyphens; for example, @code{auto-fill-mode} or
|
||||
@code{manual-entry}. Command names mostly use complete English words
|
||||
to make them easier to remember.
|
||||
|
||||
@kindex M-x
|
||||
To run a command by name, start with @kbd{M-x}, type the command
|
||||
name, then terminate it with @key{RET}. @kbd{M-x} uses the minibuffer
|
||||
to read the command name. The string @samp{M-x} appears at the
|
||||
beginning of the minibuffer as a @dfn{prompt} to remind you to enter a
|
||||
command name to be run. @key{RET} exits the minibuffer and runs the
|
||||
command. @xref{Minibuffer}, for more information on the minibuffer.
|
||||
|
||||
You can use completion to enter the command name. For example,
|
||||
to invoke the command @code{forward-char}, you can type
|
||||
|
||||
@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}. The existence of a key binding does not stop you
|
||||
from running the command by name.
|
||||
|
||||
To cancel the @kbd{M-x} and not run a command, type @kbd{C-g} instead
|
||||
of entering the command name. This takes you back to command level.
|
||||
|
||||
To pass a numeric argument to the command you are invoking with
|
||||
@kbd{M-x}, specify the numeric argument before @kbd{M-x}. The
|
||||
argument value appears in the prompt while the command name is being
|
||||
read, and finally @kbd{M-x} passes the argument to that command.
|
||||
|
||||
@vindex suggest-key-bindings
|
||||
When the command you run with @kbd{M-x} has a key binding, Emacs
|
||||
mentions this in the echo area after running the command. For
|
||||
example, if you type @kbd{M-x forward-word}, the message says that you
|
||||
can run the same command by typing @kbd{M-f}. You can turn off these
|
||||
messages by setting the variable @code{suggest-key-bindings} to
|
||||
@code{nil}.
|
||||
|
||||
In this manual, when we speak of running a command by name, we often
|
||||
omit the @key{RET} that terminates the name. Thus we might say
|
||||
@kbd{M-x auto-fill-mode} rather than @kbd{M-x auto-fill-mode
|
||||
@key{RET}}. We mention the @key{RET} only for emphasis, such as when
|
||||
the command is followed by 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.
|
||||
|
||||
@ignore
|
||||
arch-tag: b67bff53-9628-4666-b94e-eda972a7ba56
|
||||
@end ignore
|
429
man/macos.texi
429
man/macos.texi
|
@ -1,429 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 2000, 2001, 2002, 2003, 2004,
|
||||
@c 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Mac OS, Microsoft Windows, Antinews, Top
|
||||
@appendix Emacs and Mac OS
|
||||
@cindex Mac OS
|
||||
@cindex Macintosh
|
||||
|
||||
This section briefly describes the peculiarities of using Emacs
|
||||
under Mac OS with native window system support. For Mac OS X, Emacs
|
||||
can be built either without window system support, with X11, or with
|
||||
Carbon API. This section only applies to the Carbon build. For Mac
|
||||
OS Classic, Emacs can be built with or without Carbon API, and this
|
||||
section applies to either of them because they run on the native
|
||||
window system.
|
||||
|
||||
Emacs built on Mac OS X supports most of its major features except
|
||||
display support of PostScript images. The following features of Emacs
|
||||
are not supported on Mac OS Classic: unexec (@code{dump-emacs}),
|
||||
asynchronous subprocesses (@code{start-process}), and networking
|
||||
(@code{open-network-stream}). As a result, packages such as Gnus,
|
||||
GUD, and Comint do not work. Synchronous subprocesses
|
||||
(@code{call-process}) are supported on non-Carbon build, but
|
||||
specially-crafted external programs are needed. Since external
|
||||
programs to handle commands such as @code{print-buffer} and
|
||||
@code{diff} are not available on Mac OS Classic, they are not
|
||||
supported. Non-Carbon build on Mac OS Classic does not support some
|
||||
features such as file dialogs, drag-and-drop, and Unicode menus.
|
||||
|
||||
@menu
|
||||
* Input: Mac Input. Keyboard and mouse input on Mac.
|
||||
* Intl: Mac International. International character sets on Mac.
|
||||
* Env: Mac Environment Variables. Setting environment variables for Emacs.
|
||||
* Directories: Mac Directories. Volumes and directories on Mac.
|
||||
* Font: Mac Font Specs. Specifying fonts on Mac.
|
||||
* Functions: Mac Functions. Mac-specific Lisp functions.
|
||||
@end menu
|
||||
|
||||
@node Mac Input
|
||||
@section Keyboard and Mouse Input on Mac
|
||||
@cindex Meta (Mac OS)
|
||||
@cindex keyboard coding (Mac OS)
|
||||
|
||||
@vindex mac-control-modifier
|
||||
@vindex mac-command-modifier
|
||||
@vindex mac-option-modifier
|
||||
@vindex mac-function-modifier
|
||||
On Mac, Emacs can use @key{control}, @key{command}, @key{option}, and
|
||||
laptop @key{function} keys as any of Emacs modifier keys except
|
||||
@key{SHIFT} (i.e., @key{ALT}, @key{CTRL}, @key{HYPER}, @key{META}, and
|
||||
@key{SUPER}). The assignment is controlled by the variables
|
||||
@code{mac-control-modifier}, @code{mac-command-modifier},
|
||||
@code{mac-option-modifier}, and @code{mac-function-modifier}. The value
|
||||
for each of these variables can be one of the following symbols:
|
||||
@code{alt}, @code{control}, @code{hyper}, @code{meta}, @code{super}, and
|
||||
@code{nil} (no particular assignment). By default, the @key{control}
|
||||
key works as @key{CTRL}, and the @key{command} key as @key{META}.
|
||||
|
||||
For the @key{option} key, if @code{mac-option-modifier} is set to
|
||||
@code{nil}, which is the default, the key works as the normal
|
||||
@key{option} key, i.e., dead-key processing will work. This is useful
|
||||
for entering non-@acronym{ASCII} Latin characters directly from the
|
||||
Mac keyboard, for example.
|
||||
|
||||
Emacs recognizes the setting in the Keyboard control panel (Mac OS
|
||||
Classic) or the International system preference pane (Mac OS X) and
|
||||
supports international and alternative keyboard layouts (e.g., Dvorak).
|
||||
Selecting one of the layouts from the keyboard layout pull-down menu
|
||||
will affect how the keys typed on the keyboard are interpreted.
|
||||
|
||||
@vindex mac-pass-command-to-system
|
||||
@vindex mac-pass-control-to-system
|
||||
Mac OS intercepts and handles certain key combinations (e.g.,
|
||||
@key{command}-@key{SPC} for switching input languages). These will not
|
||||
be passed to Emacs. One can disable this interception by setting
|
||||
@code{mac-pass-command-to-system} or @code{mac-pass-control-to-system}
|
||||
to @code{nil}.
|
||||
|
||||
@vindex mac-emulate-three-button-mouse
|
||||
Especially for one-button mice, the multiple button feature can be
|
||||
emulated by setting @code{mac-emulate-three-button-mouse} to @code{t}
|
||||
or @code{reverse}. If set to @code{t} (@code{reverse}, respectively),
|
||||
pressing the mouse button with the @key{option} key is recognized as
|
||||
the second (third) button, and that with the @key{command} key is
|
||||
recognized as the third (second) button.
|
||||
|
||||
@vindex mac-wheel-button-is-mouse-2
|
||||
For multi-button mice, the wheel button and the secondary button are
|
||||
recognized as the second and the third button, respectively. If
|
||||
@code{mac-wheel-button-is-mouse-2} is set to @code{nil}, their roles
|
||||
are exchanged.
|
||||
|
||||
@node Mac International
|
||||
@section International Character Set Support on Mac
|
||||
@cindex Mac Roman coding system
|
||||
@cindex clipboard support (Mac OS)
|
||||
|
||||
Mac uses non-standard encodings for the upper 128 single-byte
|
||||
characters. They also deviate from the ISO 2022 standard by using
|
||||
character codes in the range 128-159. The coding systems
|
||||
@code{mac-roman}, @code{mac-centraleurroman}, and @code{mac-cyrillic}
|
||||
are used to represent these Mac encodings.
|
||||
|
||||
You can use input methods provided either by LEIM (@pxref{Input
|
||||
Methods}) or Mac OS to enter international characters. To use the
|
||||
former, see the International Character Set Support section of the
|
||||
manual (@pxref{International}).
|
||||
|
||||
Emacs on Mac OS automatically changes the value of
|
||||
@code{keyboard-coding-system} according to the current keyboard
|
||||
layout. So users don't need to set it manually, and even if set, it
|
||||
will be changed when the keyboard layout change is detected next time.
|
||||
|
||||
The Mac clipboard and the Emacs kill ring (@pxref{Killing}) are
|
||||
synchronized by default: you can yank a piece of text and paste it
|
||||
into another Mac application, or cut or copy one in another Mac
|
||||
application and yank it into a Emacs buffer. This feature can be
|
||||
disabled by setting @code{x-select-enable-clipboard} to @code{nil}.
|
||||
One can still do copy and paste with another application from the Edit
|
||||
menu.
|
||||
|
||||
On Mac, the role of the coding system for selection that is set by
|
||||
@code{set-selection-coding-system} (@pxref{Communication Coding}) is
|
||||
two-fold. First, it is used as a preferred coding system for the
|
||||
traditional text flavor that does not specify any particular encodings
|
||||
and is mainly used by applications on Mac OS Classic. Second, it
|
||||
specifies the intermediate encoding for the UTF-16 text flavor that is
|
||||
mainly used by applications on Mac OS X.
|
||||
|
||||
When pasting UTF-16 text data from the clipboard, it is first
|
||||
converted to the encoding specified by the selection coding system
|
||||
using the converter in the Mac OS system, and then decoded into the
|
||||
Emacs internal encoding using the converter in Emacs. If the first
|
||||
conversion failed, then the UTF-16 data is directly converted to Emacs
|
||||
internal encoding using the converter in Emacs. Copying UTF-16 text
|
||||
to the clipboard goes through the inverse path. The reason for this
|
||||
two-pass decoding is to avoid subtle differences in Unicode mappings
|
||||
between the Mac OS system and Emacs such as various kinds of hyphens,
|
||||
and to minimize users' customization. For example, users that mainly
|
||||
use Latin characters would prefer Greek characters to be decoded into
|
||||
the @code{mule-unicode-0100-24ff} charset, but Japanese users would
|
||||
prefer them to be decoded into the @code{japanese-jisx0208} charset.
|
||||
Since the coding system for selection is automatically set according
|
||||
to the system locale setting, users usually don't have to set it
|
||||
manually.
|
||||
|
||||
The default language environment (@pxref{Language Environments}) is
|
||||
set according to the locale setting at the startup time. On Mac OS,
|
||||
the locale setting is consulted in the following order:
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
Environment variables @env{LC_ALL}, @env{LC_CTYPE} and @env{LANG} as
|
||||
in other systems.
|
||||
|
||||
@item
|
||||
Preference @code{AppleLocale} that is set by default on Mac OS X 10.3
|
||||
and later.
|
||||
|
||||
@item
|
||||
Preference @code{AppleLanguages} that is set by default on Mac OS X
|
||||
10.1 and later.
|
||||
|
||||
@item
|
||||
Variable @code{mac-system-locale} that is derived from the system
|
||||
language and region codes. This variable is available on all
|
||||
supported Mac OS versions including Mac OS Classic.
|
||||
@end enumerate
|
||||
|
||||
The default values of almost all variables about coding systems are
|
||||
also set according to the language environment. So usually you don't
|
||||
have to customize these variables manually.
|
||||
|
||||
@node Mac Environment Variables
|
||||
@section Environment Variables and Command Line Arguments.
|
||||
@cindex environment variables (Mac OS)
|
||||
|
||||
On Mac OS X, when Emacs is run in a terminal, it inherits the values
|
||||
of environment variables from the shell from which it is invoked.
|
||||
However, when it is run from the Finder as a GUI application, it only
|
||||
inherits environment variable values defined in the file
|
||||
@file{~/.MacOSX/environment.plist} that affects all the applications
|
||||
invoked from the Finder or the @command{open} command.
|
||||
|
||||
Command line arguments are specified like
|
||||
|
||||
@example
|
||||
/Applications/Emacs.app/Contents/MacOS/Emacs -g 80x25 &
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
if Emacs is installed at @file{/Applications/Emacs.app}. If Emacs is
|
||||
invoked like this, then it also inherits the values of environment
|
||||
variables from the shell from which it is invoked.
|
||||
|
||||
On Mac OS Classic, environment variables and command line arguments
|
||||
for Emacs can be set by modifying the @samp{STR#} resources 128 and
|
||||
129, respectively. A common environment variable that one may want to
|
||||
set is @samp{HOME}.
|
||||
|
||||
The way to set an environment variable is by adding a string of the
|
||||
form
|
||||
|
||||
@example
|
||||
ENV_VAR=VALUE
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
to resource @samp{STR#} number 128 using @code{ResEdit}. To set up the
|
||||
program to use unibyte characters exclusively, for example, add the
|
||||
string
|
||||
|
||||
@example
|
||||
EMACS_UNIBYTE=1
|
||||
@end example
|
||||
|
||||
@cindex Mac Preferences
|
||||
Although Emacs on Mac does not support X resources (@pxref{X
|
||||
Resources}) directly, one can use the Preferences system in place of X
|
||||
resources. For example, adding the line
|
||||
|
||||
@example
|
||||
Emacs.cursorType: bar
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
to @file{~/.Xresources} in X11 corresponds to the execution of
|
||||
|
||||
@example
|
||||
defaults write org.gnu.Emacs Emacs.cursorType bar
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
on Mac OS X. One can use boolean or numeric values as well as string
|
||||
values as follows:
|
||||
|
||||
@example
|
||||
defaults write org.gnu.Emacs Emacs.toolBar -bool false
|
||||
defaults write org.gnu.Emacs Emacs.lineSpacing -int 3
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
Try @kbd{M-x man RET defaults RET} for the usage of the
|
||||
@command{defaults} command. Alternatively, if you have Developer
|
||||
Tools installed on Mac OS X, you can use Property List Editor to edit
|
||||
the file @file{~/Library/Preferences/org.gnu.Emacs.plist}.
|
||||
|
||||
|
||||
@node Mac Directories
|
||||
@section Volumes and Directories on Mac
|
||||
@cindex file names (Mac OS)
|
||||
|
||||
This node applies to Mac OS Classic only.
|
||||
|
||||
The directory structure in Mac OS Classic is seen by Emacs as
|
||||
|
||||
@example
|
||||
/@var{volumename}/@var{filename}
|
||||
@end example
|
||||
|
||||
So when Emacs requests a file name, doing file name completion on
|
||||
@file{/} will display all volumes on the system. You can use @file{..}
|
||||
to go up a directory level.
|
||||
|
||||
On Mac OS Classic, to access files and folders on the desktop, look
|
||||
in the folder @file{Desktop Folder} in your boot volume (this folder
|
||||
is usually invisible in the Mac @code{Finder}).
|
||||
|
||||
On Mac OS Classic, Emacs creates the Mac folder
|
||||
@file{:Preferences:Emacs:} in the @file{System Folder} and uses it as
|
||||
the temporary directory. Emacs maps the directory name @file{/tmp/}
|
||||
to that. Therefore it is best to avoid naming a volume @file{tmp}.
|
||||
If everything works correctly, the program should leave no files in it
|
||||
when it exits. You should be able to set the environment variable
|
||||
@code{TMPDIR} to use another directory but this folder will still be
|
||||
created.
|
||||
|
||||
|
||||
@node Mac Font Specs
|
||||
@section Specifying Fonts on Mac
|
||||
@cindex font names (Mac OS)
|
||||
|
||||
It is rare that you need to specify a font name in Emacs; usually
|
||||
you specify face attributes instead. For example, you can use 14pt
|
||||
Courier by customizing the default face attributes for all frames:
|
||||
|
||||
@lisp
|
||||
(set-face-attribute 'default nil
|
||||
:family "courier" :height 140)
|
||||
@end lisp
|
||||
|
||||
@noindent
|
||||
Alternatively, an interactive one is also available
|
||||
(@pxref{Face Customization}).
|
||||
|
||||
But when you do need to specify a font name in Emacs on Mac, use a
|
||||
standard X font name:
|
||||
|
||||
@smallexample
|
||||
-@var{maker}-@var{family}-@var{weight}-@var{slant}-@var{widthtype}-@var{style}@dots{}
|
||||
@dots{}-@var{pixels}-@var{height}-@var{horiz}-@var{vert}-@var{spacing}-@var{width}-@var{charset}
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
@xref{Font X}. Wildcards are supported as they are on X.
|
||||
|
||||
Emacs on Mac OS Classic uses QuickDraw Text routines for drawing texts
|
||||
by default. Emacs on Mac OS X uses @acronym{ATSUI, Apple Type Services
|
||||
for Unicode Imaging} as well as QuickDraw Text, and most of the
|
||||
characters other than Chinese, Japanese, and Korean ones are drawn using
|
||||
the former by default.
|
||||
|
||||
@acronym{ATSUI}-compatible fonts have maker name @code{apple} and
|
||||
charset @code{iso10646-1}. For example, 12-point Monaco can be specified
|
||||
by the name:
|
||||
|
||||
@example
|
||||
-apple-monaco-medium-r-normal--12-*-*-*-*-*-iso10646-1
|
||||
@end example
|
||||
|
||||
Note that these names must be specified using a format containing all
|
||||
14 @samp{-}s (not by
|
||||
@samp{-apple-monaco-medium-r-normal--12-*-iso10646-1}, for instance),
|
||||
because every @acronym{ATSUI}-compatible font is a scalable one.
|
||||
|
||||
QuickDraw Text fonts have maker name @code{apple} and various charset
|
||||
names other than @code{iso10646-1}. Native Apple fonts in Mac Roman
|
||||
encoding has charset @code{mac-roman}. You can specify a
|
||||
@code{mac-roman} font for @acronym{ASCII} characters like
|
||||
|
||||
@smalllisp
|
||||
(add-to-list
|
||||
'default-frame-alist
|
||||
'(font . "-apple-monaco-medium-r-normal--13-*-*-*-*-*-mac-roman"))
|
||||
@end smalllisp
|
||||
|
||||
@noindent
|
||||
but that does not extend to ISO-8859-1: specifying a @code{mac-roman}
|
||||
font for Latin-1 characters introduces wrong glyphs.
|
||||
|
||||
Native Apple Traditional Chinese, Simplified Chinese, Japanese,
|
||||
Korean, Central European, Cyrillic, Symbol, and Dingbats fonts have
|
||||
the charsets @samp{big5-0}, @samp{gb2312.1980-0},
|
||||
@samp{jisx0208.1983-sjis} and @samp{jisx0201.1976-0},
|
||||
@samp{ksc5601.1989-0}, @samp{mac-centraleurroman},
|
||||
@samp{mac-cyrillic}, @samp{mac-symbol}, and @samp{mac-dingbats},
|
||||
respectively.
|
||||
|
||||
The use of @code{create-fontset-from-fontset-spec} (@pxref{Defining
|
||||
Fontsets}) for defining fontsets often results in wrong ones especially
|
||||
when using only OS-bundled QuickDraw Text fonts. The recommended way to
|
||||
use them is to create a fontset using
|
||||
@code{create-fontset-from-mac-roman-font}:
|
||||
|
||||
@lisp
|
||||
(create-fontset-from-mac-roman-font
|
||||
"-apple-courier-medium-r-normal--13-*-*-*-*-*-mac-roman"
|
||||
nil "foo")
|
||||
@end lisp
|
||||
|
||||
@noindent
|
||||
and then optionally specifying Chinese, Japanese, or Korean font
|
||||
families using @code{set-fontset-font}:
|
||||
|
||||
@lisp
|
||||
(set-fontset-font "fontset-foo"
|
||||
'chinese-gb2312 '("song" . "gb2312.1980-0"))
|
||||
@end lisp
|
||||
|
||||
Single-byte fonts converted from GNU fonts in BDF format, which are not
|
||||
in the Mac Roman encoding, have foundry, family, and character sets
|
||||
encoded in the names of their font suitcases. E.g., the font suitcase
|
||||
@samp{ETL-Fixed-ISO8859-1} contains fonts which can be referred to by
|
||||
the name @samp{-ETL-fixed-*-iso8859-1}.
|
||||
|
||||
@vindex mac-allow-anti-aliasing
|
||||
Mac OS X 10.2 or later can use two types of text renderings: Quartz 2D
|
||||
(aka Core Graphics) and QuickDraw. By default, Emacs uses the former on
|
||||
such versions. It can be changed by setting
|
||||
@code{mac-allow-anti-aliasing} to @code{t} (Quartz 2D) or @code{nil}
|
||||
(QuickDraw). Both @acronym{ATSUI} and QuickDraw Text drawings are
|
||||
affected by the value of this variable.
|
||||
|
||||
Appearance of text in small sizes will also be affected by the ``Turn
|
||||
off text smoothing for font sizes @var{n} and smaller'' setting in the
|
||||
General pane (Mac OS X 10.1 or 10.2) or in the Appearance pane (10.3 or
|
||||
later) of the System Preferences. This threshold can alternatively be
|
||||
set just for Emacs (i.e., not as the system-wide setting) using the
|
||||
@command{defaults} command:
|
||||
|
||||
@example
|
||||
defaults write org.gnu.Emacs AppleAntiAliasingThreshold @var{n}
|
||||
@end example
|
||||
|
||||
|
||||
@node Mac Functions
|
||||
@section Mac-Specific Lisp Functions
|
||||
@cindex Lisp functions specific to Mac OS
|
||||
|
||||
@findex do-applescript
|
||||
The function @code{do-applescript} takes a string argument,
|
||||
executes it as an AppleScript command, and returns the result as a
|
||||
string.
|
||||
|
||||
@findex mac-file-name-to-posix
|
||||
@findex posix-file-name-to-mac
|
||||
The function @code{mac-file-name-to-posix} takes a Mac file name and
|
||||
returns the GNU or Unix equivalent. The function
|
||||
@code{posix-file-name-to-mac} performs the opposite conversion. They
|
||||
are useful for constructing AppleScript commands to be passed to
|
||||
@code{do-applescript}.
|
||||
|
||||
@findex mac-set-file-creator
|
||||
@findex mac-get-file-creator
|
||||
@findex mac-set-file-type
|
||||
@findex mac-get-file-type
|
||||
The functions @code{mac-set-file-creator},
|
||||
@code{mac-get-file-creator}, @code{mac-set-file-type}, and
|
||||
@code{mac-get-file-type} can be used to set and get creator and file
|
||||
codes.
|
||||
|
||||
@findex mac-get-preference
|
||||
The function @code{mac-get-preference} returns the preferences value
|
||||
converted to a Lisp object for a specified key and application.
|
||||
|
||||
@ignore
|
||||
arch-tag: a822c2ab-4273-4997-927e-c153bb71dcf6
|
||||
@end ignore
|
|
@ -1,862 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 1999, 2000,
|
||||
@c 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Maintaining, Abbrevs, Building, Top
|
||||
@chapter Maintaining Large Programs
|
||||
|
||||
This chapter describes Emacs features for maintaining large
|
||||
programs. The version control features (@pxref{Version Control}) are
|
||||
also particularly useful for this purpose.
|
||||
|
||||
@menu
|
||||
* Change Log:: Maintaining a change history for your program.
|
||||
* Format of ChangeLog:: What the change log file looks like.
|
||||
* Tags:: Go direct to any function in your program in one
|
||||
command. Tags remembers which file it is in.
|
||||
@ifnottex
|
||||
* Emerge:: A convenient way of merging two versions of a program.
|
||||
@end ifnottex
|
||||
@end menu
|
||||
|
||||
@node Change Log
|
||||
@section Change Logs
|
||||
|
||||
A change log file contains a chronological record of when and why you
|
||||
have changed a program, consisting of a sequence of entries describing
|
||||
individual changes. Normally it is kept in a file called
|
||||
@file{ChangeLog} in the same directory as the file you are editing, or
|
||||
one of its parent directories. A single @file{ChangeLog} file can
|
||||
record changes for all the files in its directory and all its
|
||||
subdirectories.
|
||||
|
||||
@cindex change log
|
||||
@kindex C-x 4 a
|
||||
@findex add-change-log-entry-other-window
|
||||
The Emacs command @kbd{C-x 4 a} adds a new entry to the change log
|
||||
file for the file you are editing
|
||||
(@code{add-change-log-entry-other-window}). If that file is actually
|
||||
a backup file, it makes an entry appropriate for the file's
|
||||
parent---that is useful for making log entries for functions that
|
||||
have been deleted in the current version.
|
||||
|
||||
@kbd{C-x 4 a} visits the change log file and creates a new entry
|
||||
unless the most recent entry is for today's date and your name. It
|
||||
also creates a new item for the current file. For many languages, it
|
||||
can even guess the name of the function or other object that was
|
||||
changed.
|
||||
|
||||
@vindex add-log-keep-changes-together
|
||||
When the variable @code{add-log-keep-changes-together} is
|
||||
non-@code{nil}, @kbd{C-x 4 a} adds to any existing item for the file
|
||||
rather than starting a new item.
|
||||
|
||||
@vindex add-log-always-start-new-record
|
||||
If @code{add-log-always-start-new-record} is non-@code{nil},
|
||||
@kbd{C-x 4 a} always makes a new entry, even if the last entry
|
||||
was made by you and on the same date.
|
||||
|
||||
@vindex change-log-version-info-enabled
|
||||
@vindex change-log-version-number-regexp-list
|
||||
@cindex file version in change log entries
|
||||
If the value of the variable @code{change-log-version-info-enabled}
|
||||
is non-@code{nil}, @kbd{C-x 4 a} adds the file's version number to the
|
||||
change log entry. It finds the version number by searching the first
|
||||
ten percent of the file, using regular expressions from the variable
|
||||
@code{change-log-version-number-regexp-list}.
|
||||
|
||||
@cindex Change Log mode
|
||||
@findex change-log-mode
|
||||
The change log file is visited in Change Log mode. In this major
|
||||
mode, each bunch of grouped items counts as one paragraph, and each
|
||||
entry is considered a page. This facilitates editing the entries.
|
||||
@kbd{C-j} and auto-fill indent each new line like the previous line;
|
||||
this is convenient for entering the contents of an entry.
|
||||
|
||||
@findex change-log-merge
|
||||
You can use the command @kbd{M-x change-log-merge} to merge other
|
||||
log files into a buffer in Change Log Mode, preserving the date
|
||||
ordering of entries.
|
||||
|
||||
Version control systems are another way to keep track of changes in your
|
||||
program and keep a change log. @xref{Log Buffer}.
|
||||
|
||||
@node Format of ChangeLog
|
||||
@section Format of ChangeLog
|
||||
|
||||
A change log entry starts with a header line that contains the current
|
||||
date, your name, and your email address (taken from the variable
|
||||
@code{add-log-mailing-address}). Aside from these header lines, every
|
||||
line in the change log starts with a space or a tab. The bulk of the
|
||||
entry consists of @dfn{items}, each of which starts with a line starting
|
||||
with whitespace and a star. Here are two entries, both dated in May
|
||||
1993, with two items and one item respectively.
|
||||
|
||||
@iftex
|
||||
@medbreak
|
||||
@end iftex
|
||||
@smallexample
|
||||
1993-05-25 Richard Stallman <rms@@gnu.org>
|
||||
|
||||
* man.el: Rename symbols `man-*' to `Man-*'.
|
||||
(manual-entry): Make prompt string clearer.
|
||||
|
||||
* simple.el (blink-matching-paren-distance):
|
||||
Change default to 12,000.
|
||||
|
||||
1993-05-24 Richard Stallman <rms@@gnu.org>
|
||||
|
||||
* vc.el (minor-mode-map-alist): Don't use it if it's void.
|
||||
(vc-cancel-version): Doc fix.
|
||||
@end smallexample
|
||||
|
||||
One entry can describe several changes; each change should have its
|
||||
own item, or its own line in an item. Normally there should be a
|
||||
blank line between items. When items are related (parts of the same
|
||||
change, in different places), group them by leaving no blank line
|
||||
between them.
|
||||
|
||||
You should put a copyright notice and permission notice at the
|
||||
end of the change log file. Here is an example:
|
||||
|
||||
@smallexample
|
||||
Copyright 1997, 1998 Free Software Foundation, Inc.
|
||||
Copying and distribution of this file, with or without modification, are
|
||||
permitted provided the copyright notice and this notice are preserved.
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
Of course, you should substitute the proper years and copyright holder.
|
||||
|
||||
@node Tags
|
||||
@section Tags Tables
|
||||
@cindex tags table
|
||||
|
||||
A @dfn{tags table} is a description of how a multi-file program is
|
||||
broken up into files. It lists the names of the component files and the
|
||||
names and positions of the functions (or other named subunits) in each
|
||||
file. Grouping the related files makes it possible to search or replace
|
||||
through all the files with one command. Recording the function names
|
||||
and positions makes possible the @kbd{M-.} command which finds the
|
||||
definition of a function by looking up which of the files it is in.
|
||||
|
||||
Tags tables are stored in files called @dfn{tags table files}. The
|
||||
conventional name for a tags table file is @file{TAGS}.
|
||||
|
||||
Each entry in the tags table records the name of one tag, the name of the
|
||||
file that the tag is defined in (implicitly), and the position in that
|
||||
file of the tag's definition. When a file parsed by @code{etags} is
|
||||
generated from a different source file, like a C file generated from a
|
||||
Cweb source file, the tags of the parsed file reference the source
|
||||
file.
|
||||
|
||||
Just what names from the described files are recorded in the tags table
|
||||
depends on the programming language of the described file. They
|
||||
normally include all file names, functions and subroutines, and may
|
||||
also include global variables, data types, and anything else
|
||||
convenient. Each name recorded is called a @dfn{tag}.
|
||||
|
||||
@cindex C++ class browser, tags
|
||||
@cindex tags, C++
|
||||
@cindex class browser, C++
|
||||
@cindex Ebrowse
|
||||
See also the Ebrowse facility, which is tailored for C++.
|
||||
@xref{Top,, Ebrowse, ebrowse, Ebrowse User's Manual}.
|
||||
|
||||
@menu
|
||||
* Tag Syntax:: Tag syntax for various types of code and text files.
|
||||
* Create Tags Table:: Creating a tags table with @code{etags}.
|
||||
* Etags Regexps:: Create arbitrary tags using regular expressions.
|
||||
* Select Tags Table:: How to visit a tags table.
|
||||
* Find Tag:: Commands to find the definition of a specific tag.
|
||||
* Tags Search:: Using a tags table for searching and replacing.
|
||||
* List Tags:: Listing and finding tags defined in a file.
|
||||
@end menu
|
||||
|
||||
@node Tag Syntax
|
||||
@subsection Source File Tag Syntax
|
||||
|
||||
Here is how tag syntax is defined for the most popular languages:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
In C code, any C function or typedef is a tag, and so are definitions of
|
||||
@code{struct}, @code{union} and @code{enum}.
|
||||
@code{#define} macro definitions, @code{#undef} and @code{enum}
|
||||
constants are also
|
||||
tags, unless you specify @samp{--no-defines} when making the tags table.
|
||||
Similarly, global variables are tags, unless you specify
|
||||
@samp{--no-globals}, and so are struct members, unless you specify
|
||||
@samp{--no-members}. Use of @samp{--no-globals}, @samp{--no-defines}
|
||||
and @samp{--no-members} can make the tags table file much smaller.
|
||||
|
||||
You can tag function declarations and external variables in addition
|
||||
to function definitions by giving the @samp{--declarations} option to
|
||||
@code{etags}.
|
||||
|
||||
@item
|
||||
In C++ code, in addition to all the tag constructs of C code, member
|
||||
functions are also recognized; member variables are also recognized,
|
||||
unless you use the @samp{--no-members} option. Tags for variables and
|
||||
functions in classes are named @samp{@var{class}::@var{variable}} and
|
||||
@samp{@var{class}::@var{function}}. @code{operator} definitions have
|
||||
tag names like @samp{operator+}.
|
||||
|
||||
@item
|
||||
In Java code, tags include all the constructs recognized in C++, plus
|
||||
the @code{interface}, @code{extends} and @code{implements} constructs.
|
||||
Tags for variables and functions in classes are named
|
||||
@samp{@var{class}.@var{variable}} and @samp{@var{class}.@var{function}}.
|
||||
|
||||
@item
|
||||
In La@TeX{} text, the argument of any of the commands @code{\chapter},
|
||||
@code{\section}, @code{\subsection}, @code{\subsubsection},
|
||||
@code{\eqno}, @code{\label}, @code{\ref}, @code{\cite},
|
||||
@code{\bibitem}, @code{\part}, @code{\appendix}, @code{\entry},
|
||||
@code{\index}, @code{\def}, @code{\newcommand}, @code{\renewcommand},
|
||||
@code{\newenvironment} or @code{\renewenvironment} is a tag.@refill
|
||||
|
||||
Other commands can make tags as well, if you specify them in the
|
||||
environment variable @env{TEXTAGS} before invoking @code{etags}. The
|
||||
value of this environment variable should be a colon-separated list of
|
||||
command names. For example,
|
||||
|
||||
@example
|
||||
TEXTAGS="mycommand:myothercommand"
|
||||
export TEXTAGS
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
specifies (using Bourne shell syntax) that the commands
|
||||
@samp{\mycommand} and @samp{\myothercommand} also define tags.
|
||||
|
||||
@item
|
||||
In Lisp code, any function defined with @code{defun}, any variable
|
||||
defined with @code{defvar} or @code{defconst}, and in general the first
|
||||
argument of any expression that starts with @samp{(def} in column zero is
|
||||
a tag.
|
||||
|
||||
@item
|
||||
In Scheme code, tags include anything defined with @code{def} or with a
|
||||
construct whose name starts with @samp{def}. They also include variables
|
||||
set with @code{set!} at top level in the file.
|
||||
@end itemize
|
||||
|
||||
Several other languages are also supported:
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
In Ada code, functions, procedures, packages, tasks and types are
|
||||
tags. Use the @samp{--packages-only} option to create tags for
|
||||
packages only.
|
||||
|
||||
In Ada, the same name can be used for different kinds of entity
|
||||
(e.g.@:, for a procedure and for a function). Also, for things like
|
||||
packages, procedures and functions, there is the spec (i.e.@: the
|
||||
interface) and the body (i.e.@: the implementation). To make it
|
||||
easier to pick the definition you want, Ada tag name have suffixes
|
||||
indicating the type of entity:
|
||||
|
||||
@table @samp
|
||||
@item /b
|
||||
package body.
|
||||
@item /f
|
||||
function.
|
||||
@item /k
|
||||
task.
|
||||
@item /p
|
||||
procedure.
|
||||
@item /s
|
||||
package spec.
|
||||
@item /t
|
||||
type.
|
||||
@end table
|
||||
|
||||
Thus, @kbd{M-x find-tag @key{RET} bidule/b @key{RET}} will go
|
||||
directly to the body of the package @code{bidule}, while @kbd{M-x
|
||||
find-tag @key{RET} bidule @key{RET}} will just search for any tag
|
||||
@code{bidule}.
|
||||
|
||||
@item
|
||||
In assembler code, labels appearing at the beginning of a line,
|
||||
followed by a colon, are tags.
|
||||
|
||||
@item
|
||||
In Bison or Yacc input files, each rule defines as a tag the nonterminal
|
||||
it constructs. The portions of the file that contain C code are parsed
|
||||
as C code.
|
||||
|
||||
@item
|
||||
In Cobol code, tags are paragraph names; that is, any word starting in
|
||||
column 8 and followed by a period.
|
||||
|
||||
@item
|
||||
In Erlang code, the tags are the functions, records and macros defined
|
||||
in the file.
|
||||
|
||||
@item
|
||||
In Fortran code, functions, subroutines and block data are tags.
|
||||
|
||||
@item
|
||||
In HTML input files, the tags are the @code{title} and the @code{h1},
|
||||
@code{h2}, @code{h3} headers. Also, tags are @code{name=} in anchors
|
||||
and all occurrences of @code{id=}.
|
||||
|
||||
@item
|
||||
In Lua input files, all functions are tags.
|
||||
|
||||
@item
|
||||
In makefiles, targets are tags; additionally, variables are tags
|
||||
unless you specify @samp{--no-globals}.
|
||||
|
||||
@item
|
||||
In Objective C code, tags include Objective C definitions for classes,
|
||||
class categories, methods and protocols. Tags for variables and
|
||||
functions in classes are named @samp{@var{class}::@var{variable}} and
|
||||
@samp{@var{class}::@var{function}}.
|
||||
|
||||
@item
|
||||
In Pascal code, the tags are the functions and procedures defined in
|
||||
the file.
|
||||
|
||||
@item
|
||||
In Perl code, the tags are the packages, subroutines and variables
|
||||
defined by the @code{package}, @code{sub}, @code{my} and @code{local}
|
||||
keywords. Use @samp{--globals} if you want to tag global variables.
|
||||
Tags for subroutines are named @samp{@var{package}::@var{sub}}. The
|
||||
name for subroutines defined in the default package is
|
||||
@samp{main::@var{sub}}.
|
||||
|
||||
@item
|
||||
In PHP code, tags are functions, classes and defines. Vars are tags
|
||||
too, unless you use the @samp{--no-members} option.
|
||||
|
||||
@item
|
||||
In PostScript code, the tags are the functions.
|
||||
|
||||
@item
|
||||
In Prolog code, tags are predicates and rules at the beginning of
|
||||
line.
|
||||
|
||||
@item
|
||||
In Python code, @code{def} or @code{class} at the beginning of a line
|
||||
generate a tag.
|
||||
@end itemize
|
||||
|
||||
You can also generate tags based on regexp matching (@pxref{Etags
|
||||
Regexps}) to handle other formats and languages.
|
||||
|
||||
@node Create Tags Table
|
||||
@subsection Creating Tags Tables
|
||||
@cindex @code{etags} program
|
||||
|
||||
The @code{etags} program is used to create a tags table file. It knows
|
||||
the syntax of several languages, as described in
|
||||
@iftex
|
||||
the previous section.
|
||||
@end iftex
|
||||
@ifnottex
|
||||
@ref{Tag Syntax}.
|
||||
@end ifnottex
|
||||
Here is how to run @code{etags}:
|
||||
|
||||
@example
|
||||
etags @var{inputfiles}@dots{}
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
The @code{etags} program reads the specified files, and writes a tags
|
||||
table named @file{TAGS} in the current working directory.
|
||||
|
||||
If the specified files don't exist, @code{etags} looks for
|
||||
compressed versions of them and uncompresses them to read them. Under
|
||||
MS-DOS, @code{etags} also looks for file names like @file{mycode.cgz}
|
||||
if it is given @samp{mycode.c} on the command line and @file{mycode.c}
|
||||
does not exist.
|
||||
|
||||
@code{etags} recognizes the language used in an input file based on
|
||||
its file name and contents. You can specify the language with the
|
||||
@samp{--language=@var{name}} option, described below.
|
||||
|
||||
If the tags table data become outdated due to changes in the files
|
||||
described in the table, the way to update the tags table is the same
|
||||
way it was made in the first place. If the tags table fails to record
|
||||
a tag, or records it for the wrong file, then Emacs cannot possibly
|
||||
find its definition until you update the tags table. However, if the
|
||||
position recorded in the tags table becomes a little bit wrong (due to
|
||||
other editing), the worst consequence is a slight delay in finding the
|
||||
tag. Even if the stored position is very far wrong, Emacs will still
|
||||
find the tag, after searching most of the file for it. That delay is
|
||||
hardly noticeable with today's computers.
|
||||
|
||||
Thus, there is no need to update the tags table after each edit.
|
||||
You should update a tags table when you define new tags that you want
|
||||
to have listed, or when you move tag definitions from one file to
|
||||
another, or when changes become substantial.
|
||||
|
||||
One tags table can virtually include another. Specify the included
|
||||
tags file name with the @samp{--include=@var{file}} option when
|
||||
creating the file that is to include it. The latter file then acts as
|
||||
if it covered all the source files specified in the included file, as
|
||||
well as the files it directly contains.
|
||||
|
||||
If you specify the source files with relative file names when you run
|
||||
@code{etags}, the tags file will contain file names relative to the
|
||||
directory where the tags file was initially written. This way, you can
|
||||
move an entire directory tree containing both the tags file and the
|
||||
source files, and the tags file will still refer correctly to the source
|
||||
files. If the tags file is in @file{/dev}, however, the file names are
|
||||
made relative to the current working directory. This is useful, for
|
||||
example, when writing the tags to @file{/dev/stdout}.
|
||||
|
||||
When using a relative file name, it should not be a symbolic link
|
||||
pointing to a tags file in a different directory, because this would
|
||||
generally render the file names invalid.
|
||||
|
||||
If you specify absolute file names as arguments to @code{etags}, then
|
||||
the tags file will contain absolute file names. This way, the tags file
|
||||
will still refer to the same files even if you move it, as long as the
|
||||
source files remain in the same place. Absolute file names start with
|
||||
@samp{/}, or with @samp{@var{device}:/} on MS-DOS and MS-Windows.
|
||||
|
||||
When you want to make a tags table from a great number of files, you
|
||||
may have problems listing them on the command line, because some systems
|
||||
have a limit on its length. The simplest way to circumvent this limit
|
||||
is to tell @code{etags} to read the file names from its standard input,
|
||||
by typing a dash in place of the file names, like this:
|
||||
|
||||
@smallexample
|
||||
find . -name "*.[chCH]" -print | etags -
|
||||
@end smallexample
|
||||
|
||||
Use the option @samp{--language=@var{name}} to specify the language
|
||||
explicitly. You can intermix these options with file names; each one
|
||||
applies to the file names that follow it. Specify
|
||||
@samp{--language=auto} to tell @code{etags} to resume guessing the
|
||||
language from the file names and file contents. Specify
|
||||
@samp{--language=none} to turn off language-specific processing
|
||||
entirely; then @code{etags} recognizes tags by regexp matching alone
|
||||
(@pxref{Etags Regexps}).
|
||||
|
||||
The option @samp{--parse-stdin=@var{file}} is mostly useful when
|
||||
calling @code{etags} from programs. It can be used (only once) in
|
||||
place of a file name on the command line. @code{Etags} will read from
|
||||
standard input and mark the produced tags as belonging to the file
|
||||
@var{file}.
|
||||
|
||||
@samp{etags --help} outputs the list of the languages @code{etags}
|
||||
knows, and the file name rules for guessing the language. It also prints
|
||||
a list of all the available @code{etags} options, together with a short
|
||||
explanation. If followed by one or more @samp{--language=@var{lang}}
|
||||
options, it outputs detailed information about how tags are generated for
|
||||
@var{lang}.
|
||||
|
||||
@node Etags Regexps
|
||||
@subsection Etags Regexps
|
||||
|
||||
The @samp{--regex} option provides a general way of recognizing tags
|
||||
based on regexp matching. You can freely intermix this option with
|
||||
file names, and each one applies to the source files that follow it.
|
||||
If you specify multiple @samp{--regex} options, all of them are used
|
||||
in parallel. The syntax is:
|
||||
|
||||
@smallexample
|
||||
--regex=[@var{@{language@}}]/@var{tagregexp}/[@var{nameregexp}/]@var{modifiers}
|
||||
@end smallexample
|
||||
|
||||
The essential part of the option value is @var{tagregexp}, the
|
||||
regexp for matching tags. It is always used anchored, that is, it
|
||||
only matches at the beginning of a line. If you want to allow
|
||||
indented tags, use a regexp that matches initial whitespace; start it
|
||||
with @samp{[ \t]*}.
|
||||
|
||||
In these regular expressions, @samp{\} quotes the next character, and
|
||||
all the GCC character escape sequences are supported (@samp{\a} for
|
||||
bell, @samp{\b} for back space, @samp{\d} for delete, @samp{\e} for
|
||||
escape, @samp{\f} for formfeed, @samp{\n} for newline, @samp{\r} for
|
||||
carriage return, @samp{\t} for tab, and @samp{\v} for vertical tab).
|
||||
|
||||
Ideally, @var{tagregexp} should not match more characters than are
|
||||
needed to recognize what you want to tag. If the syntax requires you
|
||||
to write @var{tagregexp} so it matches more characters beyond the tag
|
||||
itself, you should add a @var{nameregexp}, to pick out just the tag.
|
||||
This will enable Emacs to find tags more accurately and to do
|
||||
completion on tag names more reliably. You can find some examples
|
||||
below.
|
||||
|
||||
The @var{modifiers} are a sequence of zero or more characters that
|
||||
modify the way @code{etags} does the matching. A regexp with no
|
||||
modifiers is applied sequentially to each line of the input file, in a
|
||||
case-sensitive way. The modifiers and their meanings are:
|
||||
|
||||
@table @samp
|
||||
@item i
|
||||
Ignore case when matching this regexp.
|
||||
@item m
|
||||
Match this regular expression against the whole file, so that
|
||||
multi-line matches are possible.
|
||||
@item s
|
||||
Match this regular expression against the whole file, and allow
|
||||
@samp{.} in @var{tagregexp} to match newlines.
|
||||
@end table
|
||||
|
||||
The @samp{-R} option cancels all the regexps defined by preceding
|
||||
@samp{--regex} options. It too applies to the file names following
|
||||
it. Here's an example:
|
||||
|
||||
@smallexample
|
||||
etags --regex=/@var{reg1}/i voo.doo --regex=/@var{reg2}/m \
|
||||
bar.ber -R --lang=lisp los.er
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
Here @code{etags} chooses the parsing language for @file{voo.doo} and
|
||||
@file{bar.ber} according to their contents. @code{etags} also uses
|
||||
@var{reg1} to recognize additional tags in @file{voo.doo}, and both
|
||||
@var{reg1} and @var{reg2} to recognize additional tags in
|
||||
@file{bar.ber}. @var{reg1} is checked against each line of
|
||||
@file{voo.doo} and @file{bar.ber}, in a case-insensitive way, while
|
||||
@var{reg2} is checked against the whole @file{bar.ber} file,
|
||||
permitting multi-line matches, in a case-sensitive way. @code{etags}
|
||||
uses only the Lisp tags rules, with no user-specified regexp matching,
|
||||
to recognize tags in @file{los.er}.
|
||||
|
||||
You can restrict a @samp{--regex} option to match only files of a
|
||||
given language by using the optional prefix @var{@{language@}}.
|
||||
(@samp{etags --help} prints the list of languages recognized by
|
||||
@code{etags}.) This is particularly useful when storing many
|
||||
predefined regular expressions for @code{etags} in a file. The
|
||||
following example tags the @code{DEFVAR} macros in the Emacs source
|
||||
files, for the C language only:
|
||||
|
||||
@smallexample
|
||||
--regex='@{c@}/[ \t]*DEFVAR_[A-Z_ \t(]+"\([^"]+\)"/'
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
When you have complex regular expressions, you can store the list of
|
||||
them in a file. The following option syntax instructs @code{etags} to
|
||||
read two files of regular expressions. The regular expressions
|
||||
contained in the second file are matched without regard to case.
|
||||
|
||||
@smallexample
|
||||
--regex=@@@var{case-sensitive-file} --ignore-case-regex=@@@var{ignore-case-file}
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
A regex file for @code{etags} contains one regular expression per
|
||||
line. Empty lines, and lines beginning with space or tab are ignored.
|
||||
When the first character in a line is @samp{@@}, @code{etags} assumes
|
||||
that the rest of the line is the name of another file of regular
|
||||
expressions; thus, one such file can include another file. All the
|
||||
other lines are taken to be regular expressions. If the first
|
||||
non-whitespace text on the line is @samp{--}, that line is a comment.
|
||||
|
||||
For example, we can create a file called @samp{emacs.tags} with the
|
||||
following contents:
|
||||
|
||||
@smallexample
|
||||
-- This is for GNU Emacs C source files
|
||||
@{c@}/[ \t]*DEFVAR_[A-Z_ \t(]+"\([^"]+\)"/\1/
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
and then use it like this:
|
||||
|
||||
@smallexample
|
||||
etags --regex=@@emacs.tags *.[ch] */*.[ch]
|
||||
@end smallexample
|
||||
|
||||
Here are some more examples. The regexps are quoted to protect them
|
||||
from shell interpretation.
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
Tag Octave files:
|
||||
|
||||
@smallexample
|
||||
etags --language=none \
|
||||
--regex='/[ \t]*function.*=[ \t]*\([^ \t]*\)[ \t]*(/\1/' \
|
||||
--regex='/###key \(.*\)/\1/' \
|
||||
--regex='/[ \t]*global[ \t].*/' \
|
||||
*.m
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
Note that tags are not generated for scripts, so that you have to add
|
||||
a line by yourself of the form @samp{###key @var{scriptname}} if you
|
||||
want to jump to it.
|
||||
|
||||
@item
|
||||
Tag Tcl files:
|
||||
|
||||
@smallexample
|
||||
etags --language=none --regex='/proc[ \t]+\([^ \t]+\)/\1/' *.tcl
|
||||
@end smallexample
|
||||
|
||||
@item
|
||||
Tag VHDL files:
|
||||
|
||||
@smallexample
|
||||
etags --language=none \
|
||||
--regex='/[ \t]*\(ARCHITECTURE\|CONFIGURATION\) +[^ ]* +OF/' \
|
||||
--regex='/[ \t]*\(ATTRIBUTE\|ENTITY\|FUNCTION\|PACKAGE\
|
||||
\( BODY\)?\|PROCEDURE\|PROCESS\|TYPE\)[ \t]+\([^ \t(]+\)/\3/'
|
||||
@end smallexample
|
||||
@end itemize
|
||||
|
||||
@node Select Tags Table
|
||||
@subsection Selecting a Tags Table
|
||||
|
||||
@vindex tags-file-name
|
||||
@findex visit-tags-table
|
||||
Emacs has at any time one @dfn{selected} tags table, and all the
|
||||
commands for working with tags tables use the selected one. To select
|
||||
a tags table, type @kbd{M-x visit-tags-table}, which reads the tags
|
||||
table file name as an argument, with @file{TAGS} in the default
|
||||
directory as the default.
|
||||
|
||||
Emacs does not actually read in the tags table contents until you
|
||||
try to use them; all @code{visit-tags-table} does is store the file
|
||||
name in the variable @code{tags-file-name}, and setting the variable
|
||||
yourself is just as good. The variable's initial value is @code{nil};
|
||||
that value tells all the commands for working with tags tables that
|
||||
they must ask for a tags table file name to use.
|
||||
|
||||
Using @code{visit-tags-table} when a tags table is already loaded
|
||||
gives you a choice: you can add the new tags table to the current list
|
||||
of tags tables, or start a new list. The tags commands use all the tags
|
||||
tables in the current list. If you start a new list, the new tags table
|
||||
is used @emph{instead} of others. If you add the new table to the
|
||||
current list, it is used @emph{as well as} the others.
|
||||
|
||||
@vindex tags-table-list
|
||||
You can specify a precise list of tags tables by setting the variable
|
||||
@code{tags-table-list} to a list of strings, like this:
|
||||
|
||||
@c keep this on two lines for formatting in smallbook
|
||||
@example
|
||||
@group
|
||||
(setq tags-table-list
|
||||
'("~/emacs" "/usr/local/lib/emacs/src"))
|
||||
@end group
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
This tells the tags commands to look at the @file{TAGS} files in your
|
||||
@file{~/emacs} directory and in the @file{/usr/local/lib/emacs/src}
|
||||
directory. The order depends on which file you are in and which tags
|
||||
table mentions that file, as explained above.
|
||||
|
||||
Do not set both @code{tags-file-name} and @code{tags-table-list}.
|
||||
|
||||
@node Find Tag
|
||||
@subsection Finding a Tag
|
||||
|
||||
The most important thing that a tags table enables you to do is to find
|
||||
the definition of a specific tag.
|
||||
|
||||
@table @kbd
|
||||
@item M-.@: @var{tag} @key{RET}
|
||||
Find first definition of @var{tag} (@code{find-tag}).
|
||||
@item C-u M-.
|
||||
Find next alternate definition of last tag specified.
|
||||
@item C-u - M-.
|
||||
Go back to previous tag found.
|
||||
@item C-M-. @var{pattern} @key{RET}
|
||||
Find a tag whose name matches @var{pattern} (@code{find-tag-regexp}).
|
||||
@item C-u C-M-.
|
||||
Find the next tag whose name matches the last pattern used.
|
||||
@item C-x 4 .@: @var{tag} @key{RET}
|
||||
Find first definition of @var{tag}, but display it in another window
|
||||
(@code{find-tag-other-window}).
|
||||
@item C-x 5 .@: @var{tag} @key{RET}
|
||||
Find first definition of @var{tag}, and create a new frame to select the
|
||||
buffer (@code{find-tag-other-frame}).
|
||||
@item M-*
|
||||
Pop back to where you previously invoked @kbd{M-.} and friends.
|
||||
@end table
|
||||
|
||||
@kindex M-.
|
||||
@findex find-tag
|
||||
@kbd{M-.}@: (@code{find-tag}) is the command to find the definition of
|
||||
a specified tag. It searches through the tags table for that tag, as a
|
||||
string, and then uses the tags table info to determine the file that the
|
||||
definition is in and the approximate character position in the file of
|
||||
the definition. Then @code{find-tag} visits that file, moves point to
|
||||
the approximate character position, and searches ever-increasing
|
||||
distances away to find the tag definition.
|
||||
|
||||
If an empty argument is given (just type @key{RET}), the balanced
|
||||
expression in the buffer before or around point is used as the
|
||||
@var{tag} argument. @xref{Expressions}.
|
||||
|
||||
You don't need to give @kbd{M-.} the full name of the tag; a part
|
||||
will do. This is because @kbd{M-.} finds tags in the table which
|
||||
contain @var{tag} as a substring. However, it prefers an exact match
|
||||
to a substring match. To find other tags that match the same
|
||||
substring, give @code{find-tag} a numeric argument, as in @kbd{C-u
|
||||
M-.}; this does not read a tag name, but continues searching the tags
|
||||
table's text for another tag containing the same substring last used.
|
||||
If you have a real @key{META} key, @kbd{M-0 M-.}@: is an easier
|
||||
alternative to @kbd{C-u M-.}.
|
||||
|
||||
@kindex C-x 4 .
|
||||
@findex find-tag-other-window
|
||||
@kindex C-x 5 .
|
||||
@findex find-tag-other-frame
|
||||
Like most commands that can switch buffers, @code{find-tag} has a
|
||||
variant that displays the new buffer in another window, and one that
|
||||
makes a new frame for it. The former is @w{@kbd{C-x 4 .}}, which invokes
|
||||
the command @code{find-tag-other-window}. The latter is @w{@kbd{C-x 5 .}},
|
||||
which invokes @code{find-tag-other-frame}.
|
||||
|
||||
To move back to places you've found tags recently, use @kbd{C-u -
|
||||
M-.}; more generally, @kbd{M-.} with a negative numeric argument. This
|
||||
command can take you to another buffer. @w{@kbd{C-x 4 .}} with a negative
|
||||
argument finds the previous tag location in another window.
|
||||
|
||||
@kindex M-*
|
||||
@findex pop-tag-mark
|
||||
@vindex find-tag-marker-ring-length
|
||||
As well as going back to places you've found tags recently, you can go
|
||||
back to places @emph{from where} you found them. Use @kbd{M-*}, which
|
||||
invokes the command @code{pop-tag-mark}, for this. Typically you would
|
||||
find and study the definition of something with @kbd{M-.} and then
|
||||
return to where you were with @kbd{M-*}.
|
||||
|
||||
Both @kbd{C-u - M-.} and @kbd{M-*} allow you to retrace your steps to
|
||||
a depth determined by the variable @code{find-tag-marker-ring-length}.
|
||||
|
||||
@findex find-tag-regexp
|
||||
@kindex C-M-.
|
||||
The command @kbd{C-M-.} (@code{find-tag-regexp}) visits the tags that
|
||||
match a specified regular expression. It is just like @kbd{M-.} except
|
||||
that it does regexp matching instead of substring matching.
|
||||
|
||||
@node Tags Search
|
||||
@subsection Searching and Replacing with Tags Tables
|
||||
@cindex search and replace in multiple files
|
||||
@cindex multiple-file search and replace
|
||||
|
||||
The commands in this section visit and search all the files listed
|
||||
in the selected tags table, one by one. For these commands, the tags
|
||||
table serves only to specify a sequence of files to search. These
|
||||
commands scan the list of tags tables starting with the first tags
|
||||
table (if any) that describes the current file, proceed from there to
|
||||
the end of the list, and then scan from the beginning of the list
|
||||
until they have covered all the tables in the list.
|
||||
|
||||
@table @kbd
|
||||
@item M-x tags-search @key{RET} @var{regexp} @key{RET}
|
||||
Search for @var{regexp} through the files in the selected tags
|
||||
table.
|
||||
@item M-x tags-query-replace @key{RET} @var{regexp} @key{RET} @var{replacement} @key{RET}
|
||||
Perform a @code{query-replace-regexp} on each file in the selected tags table.
|
||||
@item M-,
|
||||
Restart one of the commands above, from the current location of point
|
||||
(@code{tags-loop-continue}).
|
||||
@end table
|
||||
|
||||
@findex tags-search
|
||||
@kbd{M-x tags-search} reads a regexp using the minibuffer, then
|
||||
searches for matches in all the files in the selected tags table, one
|
||||
file at a time. It displays the name of the file being searched so you
|
||||
can follow its progress. As soon as it finds an occurrence,
|
||||
@code{tags-search} returns.
|
||||
|
||||
@kindex M-,
|
||||
@findex tags-loop-continue
|
||||
Having found one match, you probably want to find all the rest. To find
|
||||
one more match, type @kbd{M-,} (@code{tags-loop-continue}) to resume the
|
||||
@code{tags-search}. This searches the rest of the current buffer, followed
|
||||
by the remaining files of the tags table.@refill
|
||||
|
||||
@findex tags-query-replace
|
||||
@kbd{M-x tags-query-replace} performs a single
|
||||
@code{query-replace-regexp} through all the files in the tags table. It
|
||||
reads a regexp to search for and a string to replace with, just like
|
||||
ordinary @kbd{M-x query-replace-regexp}. It searches much like @kbd{M-x
|
||||
tags-search}, but repeatedly, processing matches according to your
|
||||
input. @xref{Replace}, for more information on query replace.
|
||||
|
||||
@vindex tags-case-fold-search
|
||||
@cindex case-sensitivity and tags search
|
||||
You can control the case-sensitivity of tags search commands by
|
||||
customizing the value of the variable @code{tags-case-fold-search}. The
|
||||
default is to use the same setting as the value of
|
||||
@code{case-fold-search} (@pxref{Search Case}).
|
||||
|
||||
It is possible to get through all the files in the tags table with a
|
||||
single invocation of @kbd{M-x tags-query-replace}. But often it is
|
||||
useful to exit temporarily, which you can do with any input event that
|
||||
has no special query replace meaning. You can resume the query replace
|
||||
subsequently by typing @kbd{M-,}; this command resumes the last tags
|
||||
search or replace command that you did.
|
||||
|
||||
The commands in this section carry out much broader searches than the
|
||||
@code{find-tag} family. The @code{find-tag} commands search only for
|
||||
definitions of tags that match your substring or regexp. The commands
|
||||
@code{tags-search} and @code{tags-query-replace} find every occurrence
|
||||
of the regexp, as ordinary search commands and replace commands do in
|
||||
the current buffer.
|
||||
|
||||
These commands create buffers only temporarily for the files that they
|
||||
have to search (those which are not already visited in Emacs buffers).
|
||||
Buffers in which no match is found are quickly killed; the others
|
||||
continue to exist.
|
||||
|
||||
It may have struck you that @code{tags-search} is a lot like
|
||||
@code{grep}. You can also run @code{grep} itself as an inferior of
|
||||
Emacs and have Emacs show you the matching lines one by one.
|
||||
@xref{Grep Searching}.
|
||||
|
||||
@node List Tags
|
||||
@subsection Tags Table Inquiries
|
||||
|
||||
@table @kbd
|
||||
@item M-x list-tags @key{RET} @var{file} @key{RET}
|
||||
Display a list of the tags defined in the program file @var{file}.
|
||||
@item M-x tags-apropos @key{RET} @var{regexp} @key{RET}
|
||||
Display a list of all tags matching @var{regexp}.
|
||||
@end table
|
||||
|
||||
@findex list-tags
|
||||
@kbd{M-x list-tags} reads the name of one of the files described by
|
||||
the selected tags table, and displays a list of all the tags defined in
|
||||
that file. The ``file name'' argument is really just a string to
|
||||
compare against the file names recorded in the tags table; it is read as
|
||||
a string rather than as a file name. Therefore, completion and
|
||||
defaulting are not available, and you must enter the file name the same
|
||||
way it appears in the tags table. Do not include a directory as part of
|
||||
the file name unless the file name recorded in the tags table includes a
|
||||
directory.
|
||||
|
||||
@findex tags-apropos
|
||||
@vindex tags-apropos-verbose
|
||||
@kbd{M-x tags-apropos} is like @code{apropos} for tags
|
||||
(@pxref{Apropos}). It finds all the tags in the selected tags table
|
||||
whose entries match @var{regexp}, and displays them. If the variable
|
||||
@code{tags-apropos-verbose} is non-@code{nil}, it displays the names
|
||||
of the tags files together with the tag names.
|
||||
|
||||
@vindex tags-tag-face
|
||||
@vindex tags-apropos-additional-actions
|
||||
You can customize the appearance of the output by setting the
|
||||
variable @code{tags-tag-face} to a face. You can display additional
|
||||
output with @kbd{M-x tags-apropos} by customizing the variable
|
||||
@code{tags-apropos-additional-actions}---see its documentation for
|
||||
details.
|
||||
|
||||
You can also use the collection of tag names to complete a symbol
|
||||
name in the buffer. @xref{Symbol Completion}.
|
||||
|
||||
@ifnottex
|
||||
@include emerge-xtra.texi
|
||||
@end ifnottex
|
||||
|
||||
@ignore
|
||||
arch-tag: b9d83dfb-82ea-4ff6-bab5-05a3617091fb
|
||||
@end ignore
|
206
man/major.texi
206
man/major.texi
|
@ -1,206 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,
|
||||
@c 2002, 2003, 2004, 2005, 2006, 2007 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
|
||||
user option variable 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. The first group
|
||||
contains modes for normal text, either plain or with mark-up. It
|
||||
includes Text mode, HTML mode, SGML mode, @TeX{} mode and Outline
|
||||
mode. The second group contains modes for specific programming
|
||||
languages. These include Lisp mode (which has several variants), C
|
||||
mode, Fortran mode, and others. 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
|
||||
(@pxref{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.
|
||||
|
||||
To explicitly select a new major, you use an @kbd{M-x} command.
|
||||
Take the name of a major mode and add @code{-mode} to get the name of
|
||||
the 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 must
|
||||
be used 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{mode-function}, Emacs discards the suffix that matched
|
||||
@var{regexp} and searches the list again for another match.
|
||||
|
||||
@vindex magic-mode-alist
|
||||
Sometimes the major mode is determined from the way the file's text
|
||||
begins. The variable @code{magic-mode-alist} controls this. Its value
|
||||
is a list of elements of these forms:
|
||||
|
||||
@example
|
||||
(@var{regexp} . @var{mode-function})
|
||||
(@var{match-function} . @var{mode-function})
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
The first form looks like an element of @code{auto-mode-alist}, but it
|
||||
doesn't work the same: this @var{regexp} is matched against the text
|
||||
at the start of the buffer, not against the file name. Likewise, the
|
||||
second form calls @var{match-function} at the beginning of the buffer,
|
||||
and if the function returns non-@code{nil}, the @var{mode-function} is
|
||||
called. @code{magic-mode-alist} takes priority over
|
||||
@code{auto-mode-alist}.
|
||||
|
||||
You can specify the major mode to use for editing a certain file by
|
||||
special 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 defaults 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 auto-mode-case-fold
|
||||
On systems with case-insensitive file names, only a single
|
||||
case-insensitive search through the @code{auto-mode-alist} is made.
|
||||
On other systems, Emacs normally performs a single case-sensitive
|
||||
search through the alist, but if you set this variable to a
|
||||
non-@code{nil} value, Emacs will perform a second case-insensitive
|
||||
search if the first search fails.
|
||||
|
||||
@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 current 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 @samp{-*-} line or local variables list (if any).
|
||||
@xref{File Variables}.
|
||||
|
||||
@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}).
|
||||
(@kbd{C-x C-s} does this too, if the buffer wasn't visiting a file.)
|
||||
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}.
|
||||
|
||||
@ignore
|
||||
arch-tag: f2558800-cf32-4839-8acb-7d3b4df2a155
|
||||
@end ignore
|
|
@ -1,389 +0,0 @@
|
|||
#### -*- Makefile -*- for the Emacs Manual and other documentation.
|
||||
|
||||
# Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This file is part of GNU Emacs.
|
||||
|
||||
# GNU Emacs is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# GNU Emacs is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with GNU Emacs; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
|
||||
# Where to find the source code. The source code for Emacs's C kernel is
|
||||
# expected to be in $(srcdir)/src, and the source code for Emacs's
|
||||
# utility programs is expected to be in $(srcdir)/lib-src. This is
|
||||
# set by the configure script's `--srcdir' option.
|
||||
srcdir=.
|
||||
|
||||
infodir = $(srcdir)/../info
|
||||
|
||||
# The makeinfo program is part of the Texinfo distribution.
|
||||
MAKEINFO = makeinfo --force
|
||||
MULTI_INSTALL_INFO = $(srcdir)\..\nt\multi-install-info.bat
|
||||
INFO_TARGETS = $(infodir)/emacs $(infodir)/ccmode \
|
||||
$(infodir)/cl $(infodir)/dired-x $(infodir)/ediff \
|
||||
$(infodir)/forms $(infodir)/gnus $(infodir)/message \
|
||||
$(infodir)/sieve $(infodir)/pgg $(infodir)/emacs-mime \
|
||||
$(infodir)/info $(infodir)/mh-e $(infodir)/reftex \
|
||||
$(infodir)/sc $(infodir)/vip $(infodir)/viper \
|
||||
$(infodir)/widget $(infodir)/efaq $(infodir)/ada-mode \
|
||||
$(infodir)/autotype $(infodir)/calc $(infodir)/idlwave \
|
||||
$(infodir)/eudc $(infodir)/ebrowse $(infodir)/pcl-cvs \
|
||||
$(infodir)/woman $(infodir)/eshell $(infodir)/org \
|
||||
$(infodir)/url $(infodir)/speedbar $(infodir)/tramp \
|
||||
$(infodir)/ses $(infodir)/smtpmail $(infodir)/flymake \
|
||||
$(infodir)/newsticker $(infodir)/rcirc $(infodir)/erc
|
||||
DVI_TARGETS = emacs.dvi calc.dvi cc-mode.dvi cl.dvi dired-x.dvi \
|
||||
ediff.dvi forms.dvi gnus.dvi message.dvi emacs-mime.dvi \
|
||||
gnus.dvi message.dvi sieve.dvi pgg.dvi mh-e.dvi \
|
||||
reftex.dvi sc.dvi vip.dvi viper.dvi widget.dvi faq.dvi \
|
||||
ada-mode.dvi autotype.dvi idlwave.dvi eudc.dvi ebrowse.dvi \
|
||||
pcl-cvs.dvi woman.dvi eshell.dvi org.dvi url.dvi \
|
||||
speedbar.dvi tramp.dvi ses.dvi smtpmail.dvi flymake.dvi \
|
||||
newsticker.dvi emacs-xtra.dvi rcirc.dvi erc.dvi
|
||||
INFOSOURCES = info.texi
|
||||
|
||||
# The following rule does not work with all versions of `make'.
|
||||
.SUFFIXES: .texi .dvi
|
||||
.texi.dvi:
|
||||
texi2dvi $<
|
||||
|
||||
TEXI2DVI = texi2dvi
|
||||
ENVADD = $(srcdir)\..\nt\envadd.bat "TEXINPUTS=$(srcdir);$(TEXINPUTS)" \
|
||||
"MAKEINFO=$(MAKEINFO) -I$(srcdir)" /C
|
||||
|
||||
EMACS_XTRA=\
|
||||
$(srcdir)/arevert-xtra.texi \
|
||||
$(srcdir)/cal-xtra.texi \
|
||||
$(srcdir)/dired-xtra.texi \
|
||||
$(srcdir)/picture-xtra.texi \
|
||||
$(srcdir)/emerge-xtra.texi \
|
||||
$(srcdir)/vc-xtra.texi \
|
||||
$(srcdir)/vc1-xtra.texi \
|
||||
$(srcdir)/vc2-xtra.texi \
|
||||
$(srcdir)/fortran-xtra.texi \
|
||||
$(srcdir)/msdog-xtra.texi
|
||||
|
||||
EMACSSOURCES= \
|
||||
$(srcdir)/emacs.texi \
|
||||
$(srcdir)/doclicense.texi \
|
||||
$(srcdir)/screen.texi \
|
||||
$(srcdir)/commands.texi \
|
||||
$(srcdir)/entering.texi \
|
||||
$(srcdir)/basic.texi \
|
||||
$(srcdir)/mini.texi \
|
||||
$(srcdir)/m-x.texi \
|
||||
$(srcdir)/help.texi \
|
||||
$(srcdir)/mark.texi \
|
||||
$(srcdir)/killing.texi \
|
||||
$(srcdir)/regs.texi \
|
||||
$(srcdir)/display.texi \
|
||||
$(srcdir)/search.texi \
|
||||
$(srcdir)/fixit.texi \
|
||||
$(srcdir)/files.texi \
|
||||
$(srcdir)/buffers.texi \
|
||||
$(srcdir)/windows.texi \
|
||||
$(srcdir)/frames.texi \
|
||||
$(srcdir)/mule.texi \
|
||||
$(srcdir)/major.texi \
|
||||
$(srcdir)/indent.texi \
|
||||
$(srcdir)/text.texi \
|
||||
$(srcdir)/programs.texi \
|
||||
$(srcdir)/building.texi \
|
||||
$(srcdir)/maintaining.texi \
|
||||
$(srcdir)/abbrevs.texi \
|
||||
$(srcdir)/sending.texi \
|
||||
$(srcdir)/rmail.texi \
|
||||
$(srcdir)/dired.texi \
|
||||
$(srcdir)/calendar.texi \
|
||||
$(srcdir)/misc.texi \
|
||||
$(srcdir)/custom.texi \
|
||||
$(srcdir)/trouble.texi \
|
||||
$(srcdir)/cmdargs.texi \
|
||||
$(srcdir)/xresources.texi \
|
||||
$(srcdir)/anti.texi \
|
||||
$(srcdir)/macos.texi \
|
||||
$(srcdir)/msdog.texi \
|
||||
$(srcdir)/gnu.texi \
|
||||
$(srcdir)/glossary.texi \
|
||||
$(srcdir)/ack.texi \
|
||||
$(srcdir)/kmacro.texi \
|
||||
$(EMACS_XTRA)
|
||||
|
||||
info: $(INFO_TARGETS)
|
||||
|
||||
dvi: $(DVI_TARGETS)
|
||||
|
||||
# Note that all the Info targets build the Info files
|
||||
# in srcdir. There is no provision for Info files
|
||||
# to exist in the build directory.
|
||||
# In a distribution of Emacs, the Info files should be up to date.
|
||||
|
||||
# The following target uses an explicit -o switch to work around
|
||||
# the @setfilename directive in info.texi, which is required for
|
||||
# the Texinfo distribution.
|
||||
# Some Windows ports of makeinfo seem to require -o to come before the
|
||||
# texi filename, contrary to GNU standards.
|
||||
|
||||
$(infodir)/dir:
|
||||
$(MULTI_INSTALL_INFO) --info-dir=$(infodir) $(INFO_TARGETS)
|
||||
|
||||
$(infodir)/info: $(INFOSOURCES)
|
||||
$(MAKEINFO) --no-split -o $@ info.texi
|
||||
|
||||
info.dvi: $(INFOSOURCES)
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/info.texi
|
||||
|
||||
$(infodir)/emacs: $(EMACSSOURCES)
|
||||
$(MAKEINFO) emacs.texi
|
||||
|
||||
emacs.dvi: $(EMACSSOURCES)
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/emacs.texi
|
||||
|
||||
# This target is here so you could easily get the list of the *.texi
|
||||
# files which belong to the Emacs manual (as opposed to the separate
|
||||
# manuals for CL, CC Mode, Ebrowse, etc.). With this target, you can
|
||||
# say things like "grep foo `make emacsman`".
|
||||
emacsman:
|
||||
@echo $(EMACSSOURCES)
|
||||
|
||||
$(infodir)/ccmode: cc-mode.texi
|
||||
$(MAKEINFO) cc-mode.texi
|
||||
cc-mode.dvi: cc-mode.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/cc-mode.texi
|
||||
|
||||
$(infodir)/ada-mode: ada-mode.texi
|
||||
$(MAKEINFO) ada-mode.texi
|
||||
ada-mode.dvi: ada-mode.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/ada-mode.texi
|
||||
|
||||
$(infodir)/pcl-cvs: pcl-cvs.texi
|
||||
$(MAKEINFO) pcl-cvs.texi
|
||||
pcl-cvs.dvi: pcl-cvs.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/pcl-cvs.texi
|
||||
|
||||
$(infodir)/eshell: eshell.texi
|
||||
$(MAKEINFO) eshell.texi
|
||||
eshell.dvi: eshell.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/eshell.texi
|
||||
|
||||
$(infodir)/cl: cl.texi
|
||||
$(MAKEINFO) cl.texi
|
||||
cl.dvi: cl.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/cl.texi
|
||||
|
||||
$(infodir)/dired-x: dired-x.texi
|
||||
$(MAKEINFO) dired-x.texi
|
||||
dired-x.dvi: dired-x.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/dired-x.texi
|
||||
|
||||
$(infodir)/ediff: ediff.texi
|
||||
$(MAKEINFO) ediff.texi
|
||||
ediff.dvi: ediff.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/ediff.texi
|
||||
|
||||
$(infodir)/flymake: flymake.texi
|
||||
$(MAKEINFO) flymake.texi
|
||||
flymake.dvi: flymake.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/flymake.texi
|
||||
|
||||
$(infodir)/forms: forms.texi
|
||||
$(MAKEINFO) forms.texi
|
||||
forms.dvi: forms.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/forms.texi
|
||||
|
||||
# gnus/message/emacs-mime/sieve/pgg are part of Gnus:
|
||||
$(infodir)/gnus: gnus.texi
|
||||
$(MAKEINFO) gnus.texi
|
||||
gnus.dvi: gnus.texi
|
||||
sed -e "/@iflatex/,/@end iflatex/d" $(srcdir)/gnus.texi > gnustmp.texi
|
||||
$(ENVADD) $(TEXI2DVI) gnustmp.texi
|
||||
cp gnustmp.dvi $*.dvi
|
||||
rm gnustmp.*
|
||||
#
|
||||
$(infodir)/message: message.texi
|
||||
$(MAKEINFO) message.texi
|
||||
message.dvi: message.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/message.texi
|
||||
#
|
||||
$(infodir)/emacs-mime: emacs-mime.texi
|
||||
$(MAKEINFO) --enable-encoding emacs-mime.texi
|
||||
emacs-mime.dvi: emacs-mime.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/emacs-mime.texi
|
||||
#
|
||||
$(infodir)/sieve: sieve.texi
|
||||
$(MAKEINFO) sieve.texi
|
||||
sieve.dvi: sieve.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/sieve.texi
|
||||
#
|
||||
$(infodir)/pgg: pgg.texi
|
||||
$(MAKEINFO) pgg.texi
|
||||
pgg.dvi: pgg.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/pgg.texi
|
||||
|
||||
$(infodir)/mh-e: mh-e.texi
|
||||
$(MAKEINFO) mh-e.texi
|
||||
mh-e.dvi: mh-e.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/mh-e.texi
|
||||
|
||||
$(infodir)/reftex: reftex.texi
|
||||
$(MAKEINFO) reftex.texi
|
||||
reftex.dvi: reftex.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/reftex.texi
|
||||
|
||||
$(infodir)/sc: sc.texi
|
||||
$(MAKEINFO) sc.texi
|
||||
sc.dvi: sc.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/sc.texi
|
||||
|
||||
$(infodir)/vip: vip.texi
|
||||
$(MAKEINFO) vip.texi
|
||||
vip.dvi: vip.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/vip.texi
|
||||
|
||||
$(infodir)/viper: viper.texi
|
||||
$(MAKEINFO) viper.texi
|
||||
viper.dvi: viper.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/viper.texi
|
||||
|
||||
$(infodir)/widget: widget.texi
|
||||
$(MAKEINFO) widget.texi
|
||||
widget.dvi: widget.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/widget.texi
|
||||
|
||||
$(infodir)/efaq: faq.texi
|
||||
$(MAKEINFO) faq.texi
|
||||
faq.dvi: faq.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/faq.texi
|
||||
|
||||
../etc/GNU: gnu1.texi gnu.texi
|
||||
$(MAKEINFO) --no-headers -o ../etc/GNU gnu1.texi
|
||||
|
||||
$(infodir)/autotype: autotype.texi
|
||||
$(MAKEINFO) autotype.texi
|
||||
autotype.dvi: autotype.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/autotype.texi
|
||||
|
||||
$(infodir)/calc: calc.texi
|
||||
$(MAKEINFO) calc.texi
|
||||
|
||||
calc.dvi: calc.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/calc.texi
|
||||
|
||||
# This is produced with --no-split to avoid making files whose
|
||||
# names clash on DOS 8+3 filesystems
|
||||
$(infodir)/idlwave: idlwave.texi
|
||||
$(MAKEINFO) --no-split idlwave.texi
|
||||
idlwave.dvi: idlwave.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/idlwave.texi
|
||||
|
||||
$(infodir)/eudc: eudc.texi
|
||||
$(MAKEINFO) eudc.texi
|
||||
eudc.dvi: eudc.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/eudc.texi
|
||||
|
||||
$(infodir)/ebrowse: ebrowse.texi
|
||||
$(MAKEINFO) ebrowse.texi
|
||||
ebrowse.dvi: ebrowse.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/ebrowse.texi
|
||||
|
||||
$(infodir)/woman: woman.texi
|
||||
$(MAKEINFO) woman.texi
|
||||
woman.dvi: woman.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/woman.texi
|
||||
|
||||
$(infodir)/speedbar: speedbar.texi
|
||||
$(MAKEINFO) speedbar.texi
|
||||
speedbar.dvi: speedbar.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/speedbar.texi
|
||||
|
||||
$(infodir)/tramp: tramp.texi
|
||||
$(MAKEINFO) tramp.texi
|
||||
tramp.dvi: tramp.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/tramp.texi
|
||||
|
||||
$(infodir)/ses: ses.texi
|
||||
$(MAKEINFO) ses.texi
|
||||
ses.dvi: ses.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/ses.texi
|
||||
|
||||
$(infodir)/smtpmail: smtpmail.texi
|
||||
$(MAKEINFO) smtpmail.texi
|
||||
smtpmail.dvi: smtpmail.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/smtpmail.texi
|
||||
|
||||
emacs-xtra.dvi: emacs-xtra.texi $(EMACS_XTRA)
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/emacs-xtra.texi
|
||||
|
||||
$(infodir)/org: org.texi
|
||||
$(MAKEINFO) org.texi
|
||||
org.dvi: org.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/org.texi
|
||||
|
||||
$(infodir)/url: url.texi
|
||||
$(MAKEINFO) url.texi
|
||||
url.dvi: url.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/url.texi
|
||||
|
||||
$(infodir)/newsticker: newsticker.texi
|
||||
$(MAKEINFO) newsticker.texi
|
||||
newsticker.dvi: newsticker.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/newsticker.texi
|
||||
|
||||
$(infodir)/rcirc: rcirc.texi
|
||||
$(MAKEINFO) rcirc.texi
|
||||
rcirc.dvi: rcirc.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/rcirc.texi
|
||||
|
||||
$(infodir)/erc: erc.texi
|
||||
$(MAKEINFO) erc.texi
|
||||
erc.dvi: erc.texi
|
||||
$(ENVADD) $(TEXI2DVI) $(srcdir)/erc.texi
|
||||
|
||||
mostlyclean:
|
||||
- $(DEL) *.log *.cp *.fn *.ky *.pg *.vr core *.tp *.core gnustmp.*
|
||||
|
||||
clean: mostlyclean
|
||||
- $(DEL) *.dvi
|
||||
- $(DEL) $(infodir)/emacs* $(infodir)/ccmode* \
|
||||
$(infodir)/cl* $(infodir)/dired-x* \
|
||||
$(infodir)/ediff* $(infodir)/forms* \
|
||||
$(infodir)/gnus* $(infodir)/info* \
|
||||
$(infodir)/message* $(infodir)/mh-e* \
|
||||
$(infodir)/reftex* $(infodir)/sc* \
|
||||
$(infodir)/vip* $(infodir)/widget* \
|
||||
$(infodir)/efaq* $(infodir)/ada-mode* \
|
||||
$(infodir)/autotype* $(infodir)/calc* \
|
||||
$(infodir)/idlwave* $(infodir)/eudc* \
|
||||
$(infodir)/ebrowse* $(infodir)/pcl-cvs* \
|
||||
$(infodir)/woman* $(infodir)/eshell* \
|
||||
$(infodir)/speedbar* $(infodir)/tramp* \
|
||||
$(infodir)/ses* $(infodir)/smtpmail* \
|
||||
$(infodir)/url* $(infodir)/org* \
|
||||
$(infodir)/flymake* $(infodir)/newsticker* \
|
||||
$(infodir)/sieve* $(infodir)/pgg* \
|
||||
$(infodir)/erc* $(infodir)/rcirc*
|
||||
|
||||
distclean: clean
|
||||
|
||||
maintainer-clean: distclean
|
||||
- $(DEL) *.aux *.cps *.fns *.kys *.pgs *.vrs *.toc
|
||||
# Don't delete these, because they are outside the current directory.
|
||||
# for file in $(INFO_TARGETS); do rm -f $${file}*; done
|
||||
|
||||
|
||||
# Formerly this directory had texindex.c and getopt.c in it
|
||||
# and this makefile built them to make texindex.
|
||||
# That caused trouble because this is run entirely in the source directory.
|
||||
# Since we expect to get texi2dvi from elsewhere,
|
||||
# it is ok to expect texindex from elsewhere also.
|
452
man/mark.texi
452
man/mark.texi
|
@ -1,452 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2001, 2002,
|
||||
@c 2003, 2004, 2005, 2006, 2007 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}).
|
||||
|
||||
Certain Emacs commands set the mark; other editing commands do not
|
||||
affect it, so the mark remains where you set it last. Each Emacs
|
||||
buffer has its own mark, and setting the mark in one buffer has no
|
||||
effect on other buffers' marks. When you return to a buffer that was
|
||||
current earlier, its mark is at the same place as before.
|
||||
|
||||
The ends of the region are always point and the mark. It doesn't
|
||||
matter which of them was put in its current place first, or which one
|
||||
comes earlier in the text---the region starts from point or the mark
|
||||
(whichever comes first), and ends at point or the mark (whichever
|
||||
comes last). Every time you move point, or set the mark in a new
|
||||
place, the region changes.
|
||||
|
||||
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 consists of 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.
|
||||
* Momentary Mark:: Enabling Transient Mark mode momentarily.
|
||||
* 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:
|
||||
|
||||
@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 where you clicked (like
|
||||
@kbd{Mouse-1}).
|
||||
|
||||
Using the mouse to mark a region copies the region into the kill
|
||||
ring in addition to setting the mark; that gives behavior consistent
|
||||
with other window-driven applications. 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
|
||||
When Emacs was developed, terminals had only one cursor, so Emacs
|
||||
does not show where the mark is located--you have to remember. If you
|
||||
enable Transient Mark mode (see below), then the region is highlighted
|
||||
when it is active; you can tell mark is at the other end of the
|
||||
highlighted region. But this only applies when the mark is active.
|
||||
|
||||
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 also 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. Using @kbd{C-x C-x} a second time, if necessary, puts the mark at
|
||||
the new position with point back at its original position.
|
||||
|
||||
For more facilities that allow you to go to previously set marks, see
|
||||
@ref{Mark Ring}.
|
||||
|
||||
@kindex C-@@
|
||||
There is no such character as @kbd{C-@key{SPC}} in @acronym{ASCII};
|
||||
when you type @key{SPC} while holding down @key{CTRL} on a text
|
||||
terminal, what you get is the character @kbd{C-@@}. This key is also
|
||||
bound to @code{set-mark-command}--so unless you are unlucky enough to
|
||||
have a text 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}}.
|
||||
|
||||
@node Transient Mark
|
||||
@section Transient Mark Mode
|
||||
@cindex mode, Transient Mark
|
||||
@cindex Transient Mark mode
|
||||
@cindex highlighting region
|
||||
@cindex region highlighting
|
||||
|
||||
On a terminal that supports colors, Emacs has the ability to
|
||||
highlight the current region. But normally it does not. Why not?
|
||||
|
||||
In the normal mode of use, every command that sets the mark also
|
||||
activates it, and nothing ever deactivates it. Thus, once you have
|
||||
set the mark in a buffer, there is @emph{always} a region in that
|
||||
buffer. Highlighting the region all the time would be a nuisance. So
|
||||
normally Emacs highlights the region only immediately after you have
|
||||
selected one with the mouse.
|
||||
|
||||
If you want region highlighting, you can use Transient Mark mode.
|
||||
This is a more rigid mode of operation in which the region ``lasts''
|
||||
only until you use it; operating on the region text deactivates the
|
||||
mark, so there is no region any more. Therefore, you must explicitly
|
||||
set up a region for each command that uses one.
|
||||
|
||||
When Transient Mark mode is enabled, Emacs highlights the region,
|
||||
whenever there is a region. In Transient Mark mode, most of the time
|
||||
there is no region; therefore, highlighting the region when it exists
|
||||
is useful and not annoying.
|
||||
|
||||
@findex transient-mark-mode
|
||||
To enable Transient Mark mode, type @kbd{M-x transient-mark-mode}.
|
||||
This command toggles the mode; you can use the same command to turn
|
||||
the mode off again.
|
||||
|
||||
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 and thus begins highlighting of the region.
|
||||
As you move point, you will see the highlighted region 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
|
||||
You can tell that the mark is active because the region is highlighted.
|
||||
|
||||
@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
|
||||
If Delete Selection mode is also enabled, some commands delete the
|
||||
region when used while the mark is active. @xref{Mouse Commands}.
|
||||
|
||||
@item
|
||||
Quitting with @kbd{C-g} deactivates the mark.
|
||||
|
||||
@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
|
||||
Commands that normally set the mark before moving long distances (like
|
||||
@kbd{M-<} and @kbd{C-s}) do not alter the mark in Transient Mark mode
|
||||
when the mark is active.
|
||||
|
||||
@item
|
||||
Some commands operate on the region if a region is active. For
|
||||
instance, @kbd{C-x u} in Transient Mark mode operates on the region,
|
||||
when there is a region. (Outside Transient Mark mode, you must type
|
||||
@kbd{C-u C-x u} if you want it to operate on the region.)
|
||||
@xref{Undo}. Other commands that act this way are identified in their
|
||||
own documentation.
|
||||
@end itemize
|
||||
|
||||
The highlighting of the region uses the @code{region} face; you can
|
||||
customize the appearance of the highlighted region 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 mark in the window's buffer is active).
|
||||
|
||||
@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, so you can still use
|
||||
region commands.
|
||||
|
||||
@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 Momentary Mark
|
||||
@section Using Transient Mark Mode Momentarily
|
||||
|
||||
If you don't like Transient Mark mode in general, you might still
|
||||
want to use it once in a while. To do this, type @kbd{C-@key{SPC}
|
||||
C-@key{SPC}} or @kbd{C-u C-x C-x}. These commands set or activate the
|
||||
mark, and enable Transient Mark mode only until the mark is
|
||||
deactivated.
|
||||
|
||||
@table @kbd
|
||||
@item C-@key{SPC} C-@key{SPC}
|
||||
@kindex C-@key{SPC} C-@key{SPC}
|
||||
Set the mark at point (like plain @kbd{C-@key{SPC}}), and enable
|
||||
Transient Mark mode just once until the mark is deactivated. (This is
|
||||
not really a separate command; you are using the @kbd{C-@key{SPC}}
|
||||
command twice.)
|
||||
|
||||
@item C-u C-x C-x
|
||||
@kindex C-u C-x C-x
|
||||
Activate the mark without changing it; enable Transient Mark mode just
|
||||
once, until the mark is deactivated. (This is the @kbd{C-x C-x}
|
||||
command, @code{exchange-point-and-mark}, with a prefix argument.)
|
||||
@end table
|
||||
|
||||
One of the secondary features of Transient Mark mode is that certain
|
||||
commands operate only on the region, when there is an active region.
|
||||
If you don't use Transient Mark mode, the region once set never
|
||||
becomes inactive, so there is no way for these commands to make such a
|
||||
distinction. Enabling Transient Mark mode momentarily gives you a way
|
||||
to use these commands on the region.
|
||||
|
||||
Momentary use of Transient Mark mode is also a way to highlight the
|
||||
region for the time being.
|
||||
|
||||
@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{Printing}).
|
||||
@item
|
||||
Evaluate it as Lisp code with @kbd{M-x eval-region} (@pxref{Lisp Eval}).
|
||||
@item
|
||||
Undo changes within it using @kbd{C-u C-x u} (@pxref{Undo}).
|
||||
@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 following balanced expression (@code{mark-sexp}).
|
||||
@item M-h
|
||||
Put region around current paragraph (@code{mark-paragraph}).
|
||||
@item C-M-h
|
||||
Put region around current defun (@code{mark-defun}).
|
||||
@item C-x h
|
||||
Put region around the 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 balanced expression (@pxref{Expressions}). These commands handle
|
||||
arguments just like @kbd{M-f} and @kbd{C-M-f}. Repeating these
|
||||
commands extends the region. For example, you can type either
|
||||
@kbd{C-u 2 M-@@} or @kbd{M-@@ M-@@} to mark the next two words. These
|
||||
commands also extend the region in Transient Mark mode, regardless of
|
||||
the last command.
|
||||
|
||||
@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. With a prefix argument, if the argument's value is positive,
|
||||
@kbd{M-h} marks that many paragraphs starting with the one surrounding
|
||||
point. If the prefix argument is @minus{}@var{n}, @kbd{M-h} also
|
||||
marks @var{n} paragraphs, running back form the one surrounding point.
|
||||
In that last case, point moves forward to the end of that paragraph,
|
||||
and the mark goes at the start of the region. Repeating the @kbd{M-h}
|
||||
command extends the region to subsequent paragraphs.
|
||||
|
||||
@kbd{C-M-h} (@code{mark-defun}) similarly puts point before, and the
|
||||
mark after, the current (or following) major top-level definition, or
|
||||
defun (@pxref{Moving by Defuns}). Repeating @kbd{C-M-h} extends
|
||||
the region to subsequent 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 in the region), 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 some programs this is called ``select all.'')
|
||||
|
||||
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.
|
||||
|
||||
@vindex set-mark-command-repeat-pop
|
||||
If you set @code{set-mark-command-repeat-pop} to non-@code{nil},
|
||||
then when you repeat the character @kbd{C-@key{SPC}} after typing
|
||||
@kbd{C-u C-@key{SPC}}, each repetition moves point to a previous mark
|
||||
position from the ring. 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. However, in
|
||||
Transient Mark mode, these commands do not set the mark when the mark
|
||||
is already active. 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,, Saving Positions in
|
||||
Registers}).
|
||||
|
||||
@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 earliest 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.
|
||||
|
||||
@ignore
|
||||
arch-tag: f35e4d82-911b-4cfc-a3d7-3c87b2abba20
|
||||
@end ignore
|
2362
man/message.texi
2362
man/message.texi
File diff suppressed because it is too large
Load diff
9793
man/mh-e.texi
9793
man/mh-e.texi
File diff suppressed because it is too large
Load diff
580
man/mini.texi
580
man/mini.texi
|
@ -1,580 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,
|
||||
@c 2002, 2003, 2004, 2005, 2006, 2007 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 where Emacs commands read complicated
|
||||
arguments (anything more a single number). We call it the
|
||||
``minibuffer'' because it's a special-purpose buffer with a small
|
||||
amount of screen space. Minibuffer arguments can be file names,
|
||||
buffer names, Lisp function names, Emacs command names, Lisp
|
||||
expressions, and many other things---whatever the command wants to
|
||||
read. 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, with a
|
||||
cursor. The minibuffer display starts with a @dfn{prompt} in a
|
||||
distinct color; it says what kind of input is expected and how it will
|
||||
be used. Often the prompt is derived from the name of the command
|
||||
that is reading the argument. The prompt normally ends with a colon.
|
||||
|
||||
@cindex default argument
|
||||
Sometimes a @dfn{default argument} appears in the prompt, inside
|
||||
parentheses before the colon. The default will be used as the
|
||||
argument value if you just type @key{RET}. For example, commands that
|
||||
read buffer names show a buffer name as the default. You can type
|
||||
@key{RET} to operate on that default buffer.
|
||||
|
||||
The simplest way to enter a minibuffer argument is to type the text,
|
||||
then @key{RET} to exit the minibuffer. You can cancel the minibuffer,
|
||||
and the command that wants the argument, by typing @kbd{C-g}.
|
||||
|
||||
Since the minibuffer appears in the echo area, it can conflict with
|
||||
other uses of the echo area. Here is how Emacs handles such
|
||||
conflicts:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
An error occurs while the minibuffer is active.
|
||||
|
||||
The error message hides the minibuffer for a few seconds, or until you
|
||||
type something. Then the minibuffer comes back.
|
||||
|
||||
@item
|
||||
A command such as @kbd{C-x =} needs to display a message in the echo
|
||||
area.
|
||||
|
||||
The message hides the minibuffer for a few seconds, or until you type
|
||||
something. Then the minibuffer comes back.
|
||||
|
||||
@item
|
||||
Keystrokes don't echo 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
|
||||
|
||||
When you use the minibuffer to enter a file name, it starts out with
|
||||
some initial text---the @dfn{default directory}, ending in a slash.
|
||||
The file you specify will be in this directory unless you alter or
|
||||
replace it.
|
||||
|
||||
@c Separate paragraph to clean up ugly page break--rms
|
||||
@need 1500
|
||||
For example, if the minibuffer starts out with these contents:
|
||||
|
||||
@example
|
||||
Find File: /u2/emacs/src/
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
(where @samp{Find File:@: } is the prompt), and you type
|
||||
@kbd{buffer.c} as input, that specifies the file
|
||||
@file{/u2/emacs/src/buffer.c}. You can specify the parent directory
|
||||
by adding @file{..}; thus, if you type @kbd{../lisp/simple.el}, you
|
||||
will get @file{/u2/emacs/lisp/simple.el}. Alternatively, you can use
|
||||
@kbd{M-@key{DEL}} to kill the directory names you don't want
|
||||
(@pxref{Words}).
|
||||
|
||||
You can kill the entire default with @kbd{C-a C-k}, but there's no
|
||||
need to do that. It's easier to ignore the default, and enter an
|
||||
absolute file name starting with a slash or a tilde after the default
|
||||
directory. For example, to specify @file{/etc/termcap}, just type
|
||||
that name:
|
||||
|
||||
@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
|
||||
@findex file-name-shadow-mode
|
||||
GNU Emacs interprets a double slash (which is not normally useful in
|
||||
file names) as, ``ignore everything before the second slash in the
|
||||
pair.'' In the example above. @samp{/u2/emacs/src/} is ignored, so
|
||||
you get @file{/etc/termcap}. The ignored part of the file name is
|
||||
dimmed if the terminal allows it; to disable this dimming, turn off
|
||||
File Name Shadow mode (a minor mode) with the command
|
||||
@kbd{M-x file-name-shadow-mode}.
|
||||
|
||||
If the variable @code{insert-default-directory} is @code{nil}, the
|
||||
default directory is never inserted in the minibuffer---so the
|
||||
minibuffer starts out empty. Nonetheless, relative file name
|
||||
arguments are still interpreted based on 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 argument text.
|
||||
|
||||
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}. (The newline character is really the
|
||||
@acronym{ASCII} character control-J.)
|
||||
|
||||
The minibuffer has its own window, which normally has space in the
|
||||
frame at all times, but it only acts like an Emacs window when the
|
||||
minibuffer is active. When active, this window is much like any other
|
||||
Emacs window; for instance, you can switch to another window (with
|
||||
@kbd{C-x o}), edit text there, then return to the minibuffer window to
|
||||
finish the argument. You can even kill text in another window, return
|
||||
to the minibuffer window, and then yank the text into the argument.
|
||||
@xref{Windows}.
|
||||
|
||||
@cindex height of minibuffer
|
||||
@cindex size of minibuffer
|
||||
@cindex growing minibuffer
|
||||
@cindex resizing minibuffer
|
||||
There are some restrictions on the minibuffer window, however: you
|
||||
cannot kill it, or split it, or switch buffers in it---the minibuffer
|
||||
and its window are permanently attached.
|
||||
|
||||
@vindex resize-mini-windows
|
||||
The minibuffer window expands vertically as necessary to hold the
|
||||
text that you put in the minibuffer. If @code{resize-mini-windows} is
|
||||
@code{t} (the default), the window always resizes as needed by its
|
||||
contents. If its value is the symbol @code{grow-only}, the window
|
||||
grows automatically as needed, but shrinks (back to the normal size)
|
||||
only when the minibuffer becomes inactive. If its value is
|
||||
@code{nil}, you have to adjust the height yourself.
|
||||
|
||||
@vindex max-mini-window-height
|
||||
The variable @code{max-mini-window-height} controls the maximum
|
||||
height for resizing the minibuffer window: a floating-point number
|
||||
specifies a fraction of the frame's height; an integer specifies the
|
||||
maximum number of lines; @code{nil} means do not resize the minibuffer
|
||||
window automatically. The default value is 0.25.
|
||||
|
||||
The @kbd{C-M-v} command in the minibuffer scrolls the help text from
|
||||
commands that display help text of any sort in another window.
|
||||
@kbd{M-@key{PAGEUP}} and @kbd{M-@key{PAGEDOWN}} also operate on that
|
||||
help text. This is especially useful with long lists of possible
|
||||
completions. @xref{Other Window}.
|
||||
|
||||
@vindex enable-recursive-minibuffers
|
||||
Emacs normally disallows most commands that use the minibuffer while
|
||||
the minibuffer is active. (Entering the minibuffer from the
|
||||
minibuffer can be confusing.) To allow such commands in the
|
||||
minibuffer, set the variable @code{enable-recursive-minibuffers} to
|
||||
@code{t}.
|
||||
|
||||
@node Completion
|
||||
@section Completion
|
||||
@cindex completion
|
||||
|
||||
Some arguments allow @dfn{completion} to enter their value. This
|
||||
means that after you type part of the argument, Emacs can fill in the
|
||||
rest, or some of it, based on what you have typed so far.
|
||||
|
||||
When completion is available, certain keys---@key{TAB}, @key{RET},
|
||||
and @key{SPC}---are rebound to complete the text in the minibuffer
|
||||
before point into a longer string chosen from a set of @dfn{completion
|
||||
alternatives} provided by the command that requested the argument.
|
||||
(@key{SPC} does not do completion in reading file names, because it is
|
||||
common to use spaces in file names on some systems.) @kbd{?} displays
|
||||
a list of the possible completions at any time.
|
||||
|
||||
For example, @kbd{M-x} uses the minibuffer to read the name of a
|
||||
command, so it provides a list of all Emacs command names for
|
||||
completion candidates. The completion keys match the minibuffer text
|
||||
against these candidates, find any additional name characters implied
|
||||
by the text already present in the minibuffer, and add those
|
||||
characters. This 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 significant in completion when it is significant in the
|
||||
argument you are entering (buffer names, file names, command names,
|
||||
for instance). Thus, @samp{fo} does not complete to @samp{Foo}.
|
||||
Completion ignores case distinctions for certain arguments in which
|
||||
case does not matter.
|
||||
|
||||
Completion acts only on the text before point. If there is text in
|
||||
the minibuffer after point---i.e., if you move point backward after
|
||||
typing some text into the minibuffer---it remains unchanged.
|
||||
|
||||
@menu
|
||||
* Example: Completion Example. Examples of using completion.
|
||||
* Commands: Completion Commands. A list of completion commands.
|
||||
* Strict Completion:: Different types of completion.
|
||||
* Options: Completion Options. Options for completion.
|
||||
@end menu
|
||||
|
||||
@node Completion Example
|
||||
@subsection Completion Example
|
||||
|
||||
@kindex TAB @r{(completion)}
|
||||
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
|
||||
all begin with @code{auto-}, so the @samp{au} in the minibuffer
|
||||
completes to @samp{auto-}.
|
||||
|
||||
If you type @key{TAB} again immediately, it cannot determine the
|
||||
next character; it could be any of @samp{cfilrs}. So it does not add
|
||||
any characters; instead, @key{TAB} displays a list of all possible
|
||||
completions in another window.
|
||||
|
||||
Now type @kbd{f @key{TAB}}. This @key{TAB} sees @samp{auto-f}. The
|
||||
only command name starting with that is @code{auto-fill-mode}, so
|
||||
completion fills in the rest of that. You have been able to enter
|
||||
@samp{auto-fill-mode} by typing just @kbd{au @key{TAB} f @key{TAB}}.
|
||||
|
||||
@node Completion Commands
|
||||
@subsection Completion Commands
|
||||
|
||||
Here is a list of the completion commands defined in the minibuffer
|
||||
when completion is allowed.
|
||||
|
||||
@table @kbd
|
||||
@item @key{TAB}
|
||||
@findex minibuffer-complete
|
||||
Complete the text before point in the minibuffer as much as possible
|
||||
(@code{minibuffer-complete}).
|
||||
@item @key{SPC}
|
||||
Complete up to one word from the minibuffer text before point
|
||||
(@code{minibuffer-complete-word}). @key{SPC} for completion is not
|
||||
available when entering a file name, since file names often include
|
||||
spaces.
|
||||
@item @key{RET}
|
||||
Submit the text in the minibuffer as the argument, possibly completing
|
||||
first as described
|
||||
@iftex
|
||||
in the next subsection (@code{minibuffer-complete-and-exit}).
|
||||
@end iftex
|
||||
@ifnottex
|
||||
in the next node (@code{minibuffer-complete-and-exit}). @xref{Strict
|
||||
Completion}.
|
||||
@end ifnottex
|
||||
@item ?
|
||||
Display a list of possible completions of the text before point
|
||||
(@code{minibuffer-completion-help}).
|
||||
@end table
|
||||
|
||||
@kindex SPC
|
||||
@findex minibuffer-complete-word
|
||||
@key{SPC} completes like @key{TAB}, but only up to 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 only inserts @samp{ill-}, giving @samp{auto-fill-}. Another
|
||||
@key{SPC} at this point completes all the way to
|
||||
@samp{auto-fill-mode}. The command that implements this behavior is
|
||||
called @code{minibuffer-complete-word}.
|
||||
|
||||
When you display a list of possible completions, you can choose
|
||||
one from it:
|
||||
|
||||
@table @kbd
|
||||
@findex mouse-choose-completion
|
||||
@item Mouse-1
|
||||
@itemx Mouse-2
|
||||
Clicking mouse button 1 or 2 on a completion possibility chooses that
|
||||
completion (@code{mouse-choose-completion}). You must click in the
|
||||
list of completions, not in the minibuffer.
|
||||
|
||||
@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 other ways has the same
|
||||
effect.)
|
||||
|
||||
@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 to the completion list window.
|
||||
|
||||
@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 possibility
|
||||
(@code{next-completion}).
|
||||
|
||||
@findex previous-completion
|
||||
@item @key{LEFT}
|
||||
Typing the left-arrow key @key{LEFT} @emph{in the completion list
|
||||
buffer} moves point to the previous completion possibility
|
||||
(@code{previous-completion}).
|
||||
@end table
|
||||
|
||||
@node Strict Completion
|
||||
@subsection Strict Completion
|
||||
|
||||
There are three different ways that @key{RET} can do completion,
|
||||
depending on how the argument will be used.
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
@dfn{Strict} completion accepts only known completion candidates. For
|
||||
example, when @kbd{C-x k} reads the name of a buffer to kill, only the
|
||||
name of an existing buffer makes sense. 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 is an already exact match.
|
||||
Otherwise, @key{RET} does not exit, but it does complete the text. If
|
||||
that 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, for example.
|
||||
|
||||
@item
|
||||
@dfn{Permissive} completion allows any input; the completion
|
||||
candidates are just suggestions. For example, when @kbd{C-x C-f}
|
||||
reads the name of a file to visit, any file name is allowed, including
|
||||
nonexistent file (in case you want to create a file). In permissive
|
||||
completion, @key{RET} does not complete, it just submits the argument
|
||||
as you have entered it.
|
||||
@end itemize
|
||||
|
||||
The completion commands display a list of all possible completions
|
||||
whenever they can't determine even one more character by completion.
|
||||
Also, typing @kbd{?} explicitly requests such a list. You can scroll
|
||||
the list with @kbd{C-M-v} (@pxref{Other Window}).
|
||||
|
||||
@node Completion Options
|
||||
@subsection Completion Options
|
||||
|
||||
@vindex completion-ignored-extensions
|
||||
@cindex ignored file names, in completion
|
||||
When completing file names, certain file names are usually ignored.
|
||||
The variable @code{completion-ignored-extensions} contains a list of
|
||||
strings; a file name ending in any of those strings is ignored as a
|
||||
completion candidate. 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. Displaying a list of possible completions
|
||||
disregards @code{completion-ignored-extensions}; it shows them all.
|
||||
|
||||
If an element of @code{completion-ignored-extensions} ends in a
|
||||
slash (@file{/}), it's a subdirectory name; then that directory and
|
||||
its contents are ignored. Elements of
|
||||
@code{completion-ignored-extensions} which do not end in a slash are
|
||||
ordinary file names, and do not apply to names of directories.
|
||||
|
||||
@vindex completion-auto-help
|
||||
If @code{completion-auto-help} is set to @code{nil}, the completion
|
||||
commands never display a list of possibilities; you must type @kbd{?}
|
||||
to display the list.
|
||||
|
||||
@cindex Partial Completion mode
|
||||
@vindex partial-completion-mode
|
||||
@findex partial-completion-mode
|
||||
Partial Completion mode implements a more powerful kind of
|
||||
completion that can complete multiple words in parallel. For example,
|
||||
it can complete the command name abbreviation @code{p-b} into
|
||||
@code{print-buffer} if no other command starts with two words whose
|
||||
initials are @samp{p} and @samp{b}.
|
||||
|
||||
To enable this mode, use @kbd{M-x partial-completion-mode}, or
|
||||
customize the variable @code{partial-completion-mode}. This mode
|
||||
binds special partial completion commands to @key{TAB}, @key{SPC},
|
||||
@key{RET}, and @kbd{?} in the minibuffer. The usual completion
|
||||
commands are available on @kbd{M-@key{TAB}} (or @kbd{C-M-i}),
|
||||
@kbd{M-@key{SPC}}, @kbd{M-@key{RET}} and @kbd{M-?}.
|
||||
|
||||
Partial completion of directories in file names uses @samp{*} to
|
||||
indicate the places for completion; thus, @file{/u*/b*/f*} might
|
||||
complete to @file{/usr/bin/foo}. For remote files, partial completion
|
||||
enables completion of methods, user names and host names.
|
||||
@xref{Remote Files}.
|
||||
|
||||
@vindex PC-include-file-path
|
||||
@vindex PC-disable-includes
|
||||
Partial Completion mode also extends @code{find-file} so that
|
||||
@samp{<@var{include}>} looks for the file named @var{include} in the
|
||||
directories in the path @code{PC-include-file-path}. If you set
|
||||
@code{PC-disable-includes} to non-@code{nil}, this feature is
|
||||
disabled.
|
||||
|
||||
@cindex Icomplete mode
|
||||
@findex 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 you can easily use it again later.
|
||||
Special commands fetch the text of an earlier argument into the
|
||||
minibuffer, replacing the old minibuffer contents. You can think of
|
||||
them as moving through the history of previous arguments.
|
||||
|
||||
@table @kbd
|
||||
@item @key{UP}
|
||||
@itemx M-p
|
||||
Move to the previous item in the minibuffer history, an earlier argument
|
||||
(@code{previous-history-element}).
|
||||
@item @key{DOWN}
|
||||
@itemx M-n
|
||||
Move to the next item in the minibuffer history
|
||||
(@code{next-history-element}).
|
||||
@item M-r @var{regexp} @key{RET}
|
||||
Move to an earlier item in the minibuffer history that
|
||||
matches @var{regexp} (@code{previous-matching-history-element}).
|
||||
@item M-s @var{regexp} @key{RET}
|
||||
Move to a later item in the minibuffer history that matches
|
||||
@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
|
||||
To move through the minibuffer history list one item at a time, use
|
||||
@kbd{M-p} or up-arrow (@code{previous-history-element}) to fetch the
|
||||
next earlier minibuffer input, and use @kbd{M-n} or down-arrow
|
||||
(@code{next-history-element}) to fetch the next later input. These
|
||||
commands don't move the cursor, they pull different saved strings into
|
||||
the minibuffer. But you can think of them as ``moving'' through the
|
||||
history list.
|
||||
|
||||
The input that you fetch from the history entirely replaces the
|
||||
contents of the minibuffer. To use it again unchanged, just type
|
||||
@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. You can
|
||||
insert the default value into the minibuffer as text by using
|
||||
@kbd{M-n}. You can think of this as moving ``into the future'' in the
|
||||
history.
|
||||
|
||||
@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. @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. These
|
||||
commands are unusual; they use the minibuffer to read the regular
|
||||
expression even though they are invoked from the minibuffer. As with
|
||||
incremental searching, an upper-case 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, even if the name you entered was not
|
||||
absolute.)
|
||||
|
||||
There are several other specific history lists, including one for
|
||||
buffer names, one for arguments of commands like @code{query-replace},
|
||||
one used by @kbd{M-x} for command names, and one used by
|
||||
@code{compile} for compilation commands. 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; adding a new element deletes the oldest
|
||||
element if the list gets too long. If the value of
|
||||
@code{history-length} is @code{t}, though, there is no maximum length.
|
||||
|
||||
@vindex history-delete-duplicates
|
||||
The variable @code{history-delete-duplicates} specifies whether to
|
||||
delete duplicates in history. If it is @code{t}, adding a new element
|
||||
deletes from the list all other elements that are equal to it.
|
||||
|
||||
@node Repetition
|
||||
@section Repeating Minibuffer Commands
|
||||
@cindex command history
|
||||
@cindex history of commands
|
||||
|
||||
Every command that uses the minibuffer once is recorded on a special
|
||||
history list, the @dfn{command history}, 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
|
||||
@table @kbd
|
||||
@item C-x @key{ESC} @key{ESC}
|
||||
Re-execute a recent minibuffer command from the command history
|
||||
(@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 command
|
||||
that used the minibuffer. With no argument, it repeats the last such
|
||||
command. A numeric argument specifies which command to repeat; 1
|
||||
means the last one, 2 the previous, and so on.
|
||||
|
||||
@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. Even if you don't understand Lisp
|
||||
syntax, it will probably be obvious which command is displayed for
|
||||
repetition. If you type just @key{RET}, that repeats the command
|
||||
unchanged. You can also change the command by editing the Lisp
|
||||
expression before you execute it. The repeated command is added to
|
||||
the front of the command history unless it is identical to the most
|
||||
recently item.
|
||||
|
||||
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 repeat it by typing
|
||||
@key{RET}.
|
||||
|
||||
@vindex isearch-resume-in-command-history
|
||||
Incremental search does not, strictly speaking, use the minibuffer.
|
||||
Therefore, although it behaves like a complex command, it normally
|
||||
does not appear in the history list for @kbd{C-x @key{ESC} @key{ESC}}.
|
||||
You can make incremental search commands appear in the history by
|
||||
setting @code{isearch-resume-in-command-history} to a non-@code{nil}
|
||||
value. @xref{Incremental Search}.
|
||||
|
||||
@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.
|
||||
|
||||
@ignore
|
||||
arch-tag: ba913cfd-b70e-400f-b663-22b2c309227f
|
||||
@end ignore
|
2559
man/misc.texi
2559
man/misc.texi
File diff suppressed because it is too large
Load diff
|
@ -1,687 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@c
|
||||
@c This file is included either in emacs-xtra.texi (when producing the
|
||||
@c printed version) or in the main Emacs manual (for the on-line version).
|
||||
@node MS-DOS
|
||||
@section Emacs and MS-DOS
|
||||
@cindex MS-DOG
|
||||
@cindex MS-DOS peculiarities
|
||||
|
||||
This section briefly describes the peculiarities of using Emacs on
|
||||
the MS-DOS ``operating system'' (also known as ``MS-DOG'').
|
||||
@iftex
|
||||
Information about Emacs and Microsoft's current operating system
|
||||
Windows (also known as ``Losedows) is in the main Emacs manual
|
||||
(@pxref{Microsoft Systems,,, emacs, the Emacs Manual}).
|
||||
@end iftex
|
||||
@ifnottex
|
||||
Information about peculiarities common to MS-DOS and Microsoft's
|
||||
current operating systems Windows (also known as ``Losedows) is in
|
||||
@ref{Microsoft Windows}.
|
||||
@end ifnottex
|
||||
|
||||
If you build Emacs for MS-DOS, the binary will also run on Windows
|
||||
3.X, Windows NT, Windows 9X/ME, Windows 2000/XP, or OS/2 as a DOS
|
||||
application; all of this chapter applies for all of those systems, if
|
||||
you use an Emacs that was built for MS-DOS.
|
||||
|
||||
@iftex
|
||||
@xref{Text and Binary,,,emacs, the Emacs Manual}, for information
|
||||
@end iftex
|
||||
@ifnottex
|
||||
@xref{Text and Binary}, for information
|
||||
@end ifnottex
|
||||
about Emacs' special handling of text files under MS-DOS (and Windows).
|
||||
|
||||
@menu
|
||||
* Keyboard: MS-DOS Keyboard. Keyboard conventions on MS-DOS.
|
||||
* Mouse: MS-DOS Mouse. Mouse conventions on MS-DOS.
|
||||
* Display: MS-DOS Display. Fonts, frames and display size on MS-DOS.
|
||||
* Files: MS-DOS File Names. File name conventions on MS-DOS.
|
||||
* Printing: MS-DOS Printing. Printing specifics on MS-DOS.
|
||||
* I18N: MS-DOS and MULE. Support for internationalization on MS-DOS.
|
||||
* Processes: MS-DOS Processes. Running subprocesses on MS-DOS.
|
||||
@end menu
|
||||
|
||||
@node MS-DOS Keyboard
|
||||
@subsection Keyboard Usage on MS-DOS
|
||||
|
||||
@kindex DEL @r{(MS-DOS)}
|
||||
@kindex BS @r{(MS-DOS)}
|
||||
The key that is called @key{DEL} in Emacs (because that's how it is
|
||||
designated on most workstations) is known as @key{BS} (backspace) on a
|
||||
PC. That is why the PC-specific terminal initialization remaps the
|
||||
@key{BS} key to act as @key{DEL}; the @key{DELETE} key is remapped to act
|
||||
as @kbd{C-d} for the same reasons.
|
||||
|
||||
@kindex C-g @r{(MS-DOS)}
|
||||
@kindex C-BREAK @r{(MS-DOS)}
|
||||
@cindex quitting on MS-DOS
|
||||
Emacs built for MS-DOS recognizes @kbd{C-@key{BREAK}} as a quit
|
||||
character, just like @kbd{C-g}. This is because Emacs cannot detect
|
||||
that you have typed @kbd{C-g} until it is ready for more input. As a
|
||||
consequence, you cannot use @kbd{C-g} to stop a running command
|
||||
@iftex
|
||||
(@pxref{Quitting,,,emacs, the Emacs Manual}).
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Quitting}).
|
||||
@end ifnottex
|
||||
By contrast, @kbd{C-@key{BREAK}} @emph{is} detected as soon as you
|
||||
type it (as @kbd{C-g} is on other systems), so it can be used to stop
|
||||
a running command and for emergency escape
|
||||
@iftex
|
||||
(@pxref{Emergency Escape,,,emacs, the Emacs Manual}).
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Emergency Escape}).
|
||||
@end ifnottex
|
||||
|
||||
@cindex Meta (under MS-DOS)
|
||||
@cindex Hyper (under MS-DOS)
|
||||
@cindex Super (under MS-DOS)
|
||||
@vindex dos-super-key
|
||||
@vindex dos-hyper-key
|
||||
The PC keyboard maps use the left @key{ALT} key as the @key{META} key.
|
||||
You have two choices for emulating the @key{SUPER} and @key{HYPER} keys:
|
||||
choose either the right @key{CTRL} key or the right @key{ALT} key by
|
||||
setting the variables @code{dos-hyper-key} and @code{dos-super-key} to 1
|
||||
or 2 respectively. If neither @code{dos-super-key} nor
|
||||
@code{dos-hyper-key} is 1, then by default the right @key{ALT} key is
|
||||
also mapped to the @key{META} key. However, if the MS-DOS international
|
||||
keyboard support program @file{KEYB.COM} is installed, Emacs will
|
||||
@emph{not} map the right @key{ALT} to @key{META}, since it is used for
|
||||
accessing characters like @kbd{~} and @kbd{@@} on non-US keyboard
|
||||
layouts; in this case, you may only use the left @key{ALT} as @key{META}
|
||||
key.
|
||||
|
||||
@kindex C-j @r{(MS-DOS)}
|
||||
@vindex dos-keypad-mode
|
||||
The variable @code{dos-keypad-mode} is a flag variable that controls
|
||||
what key codes are returned by keys in the numeric keypad. You can also
|
||||
define the keypad @key{ENTER} key to act like @kbd{C-j}, by putting the
|
||||
following line into your @file{_emacs} file:
|
||||
|
||||
@smallexample
|
||||
;; @r{Make the @key{ENTER} key from the numeric keypad act as @kbd{C-j}.}
|
||||
(define-key function-key-map [kp-enter] [?\C-j])
|
||||
@end smallexample
|
||||
|
||||
@node MS-DOS Mouse
|
||||
@subsection Mouse Usage on MS-DOS
|
||||
|
||||
@cindex mouse support under MS-DOS
|
||||
Emacs on MS-DOS supports a mouse (on the default terminal only).
|
||||
The mouse commands work as documented, including those that use menus
|
||||
and the menu bar
|
||||
@iftex
|
||||
(@pxref{Menu Bar,,,emacs, the Emacs Manual}).
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Menu Bar}).
|
||||
@end ifnottex
|
||||
Scroll bars don't work in MS-DOS Emacs. PC mice usually have only
|
||||
two buttons; these act as @kbd{Mouse-1} and @kbd{Mouse-2}, but if you
|
||||
press both of them together, that has the effect of @kbd{Mouse-3}. If
|
||||
the mouse does have 3 buttons, Emacs detects that at startup, and all
|
||||
the 3 buttons function normally, as on X.
|
||||
|
||||
Help strings for menu-bar and pop-up menus are displayed in the echo
|
||||
area when the mouse pointer moves across the menu items. Highlighting
|
||||
of mouse-sensitive text
|
||||
@iftex
|
||||
(@pxref{Mouse References,,,emacs, the Emacs Manual})
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Mouse References})
|
||||
@end ifnottex
|
||||
is also supported.
|
||||
|
||||
@cindex mouse, set number of buttons
|
||||
@findex msdos-set-mouse-buttons
|
||||
Some versions of mouse drivers don't report the number of mouse
|
||||
buttons correctly. For example, mice with a wheel report that they
|
||||
have 3 buttons, but only 2 of them are passed to Emacs; the clicks on
|
||||
the wheel, which serves as the middle button, are not passed. In
|
||||
these cases, you can use the @kbd{M-x msdos-set-mouse-buttons} command
|
||||
to tell Emacs how many mouse buttons to expect. You could make such a
|
||||
setting permanent by adding this fragment to your @file{_emacs} init
|
||||
file:
|
||||
|
||||
@example
|
||||
;; @r{Treat the mouse like a 2-button mouse.}
|
||||
(msdos-set-mouse-buttons 2)
|
||||
@end example
|
||||
|
||||
@cindex Windows clipboard support
|
||||
Emacs built for MS-DOS supports clipboard operations when it runs on
|
||||
Windows. Commands that put text on the kill ring, or yank text from
|
||||
the ring, check the Windows clipboard first, just as Emacs does on the
|
||||
X Window System
|
||||
@iftex
|
||||
(@pxref{Mouse Commands,,,emacs, the Emacs Manual}).
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Mouse Commands}).
|
||||
@end ifnottex
|
||||
Only the primary selection and the cut buffer are supported by MS-DOS
|
||||
Emacs on Windows; the secondary selection always appears as empty.
|
||||
|
||||
Due to the way clipboard access is implemented by Windows, the
|
||||
length of text you can put into the clipboard is limited by the amount
|
||||
of free DOS memory that is available to Emacs. Usually, up to 620KB of
|
||||
text can be put into the clipboard, but this limit depends on the system
|
||||
configuration and is lower if you run Emacs as a subprocess of
|
||||
another program. If the killed text does not fit, Emacs outputs a
|
||||
message saying so, and does not put the text into the clipboard.
|
||||
|
||||
Null characters also cannot be put into the Windows clipboard. If the
|
||||
killed text includes null characters, Emacs does not put such text into
|
||||
the clipboard, and displays in the echo area a message to that effect.
|
||||
|
||||
@vindex dos-display-scancodes
|
||||
The variable @code{dos-display-scancodes}, when non-@code{nil},
|
||||
directs Emacs to display the @acronym{ASCII} value and the keyboard scan code of
|
||||
each keystroke; this feature serves as a complement to the
|
||||
@code{view-lossage} command, for debugging.
|
||||
|
||||
@node MS-DOS Display
|
||||
@subsection Display on MS-DOS
|
||||
@cindex faces under MS-DOS
|
||||
@cindex fonts, emulating under MS-DOS
|
||||
|
||||
Display on MS-DOS cannot use font variants, like bold or italic, but
|
||||
it does support multiple faces, each of which can specify a foreground
|
||||
and a background color. Therefore, you can get the full functionality
|
||||
of Emacs packages that use fonts (such as @code{font-lock}, Enriched
|
||||
Text mode, and others) by defining the relevant faces to use different
|
||||
colors. Use the @code{list-colors-display} command
|
||||
@iftex
|
||||
(@pxref{Frame Parameters,,,emacs, the Emacs Manual})
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Frame Parameters})
|
||||
@end ifnottex
|
||||
and the @code{list-faces-display} command
|
||||
@iftex
|
||||
(@pxref{Faces,,,emacs, the Emacs Manual})
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Faces})
|
||||
@end ifnottex
|
||||
to see what colors and faces are available and what they look like.
|
||||
|
||||
@xref{MS-DOS and MULE}, later in this chapter, for information on
|
||||
how Emacs displays glyphs and characters that aren't supported by the
|
||||
native font built into the DOS display.
|
||||
|
||||
@cindex cursor shape on MS-DOS
|
||||
When Emacs starts, it changes the cursor shape to a solid box. This
|
||||
is for compatibility with other systems, where the box cursor is the
|
||||
default in Emacs. This default shape can be changed to a bar by
|
||||
specifying the @code{cursor-type} parameter in the variable
|
||||
@code{default-frame-alist}
|
||||
@iftex
|
||||
(@pxref{Creating Frames,,,emacs, the Emacs Manual}).
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Creating Frames}).
|
||||
@end ifnottex
|
||||
The MS-DOS terminal doesn't support a vertical-bar cursor,
|
||||
so the bar cursor is horizontal, and the @code{@var{width}} parameter,
|
||||
if specified by the frame parameters, actually determines its height.
|
||||
For this reason, the @code{bar} and @code{hbar} cursor types produce
|
||||
the same effect on MS-DOS. As an extension, the bar cursor
|
||||
specification can include the starting scan line of the cursor as well
|
||||
as its width, like this:
|
||||
|
||||
@example
|
||||
'(cursor-type bar @var{width} . @var{start})
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
In addition, if the @var{width} parameter is negative, the cursor bar
|
||||
begins at the top of the character cell.
|
||||
|
||||
@cindex frames on MS-DOS
|
||||
The MS-DOS terminal can only display a single frame at a time. The
|
||||
Emacs frame facilities work on MS-DOS much as they do on text-only
|
||||
terminals
|
||||
@iftex
|
||||
(@pxref{Frames,,,emacs, the Emacs Manual}).
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Frames}).
|
||||
@end ifnottex
|
||||
When you run Emacs from a DOS window on MS-Windows, you can make the
|
||||
visible frame smaller than the full screen, but Emacs still cannot
|
||||
display more than a single frame at a time.
|
||||
|
||||
@cindex frame size under MS-DOS
|
||||
@findex mode4350
|
||||
@findex mode25
|
||||
The @code{mode4350} command switches the display to 43 or 50
|
||||
lines, depending on your hardware; the @code{mode25} command switches
|
||||
to the default 80x25 screen size.
|
||||
|
||||
By default, Emacs only knows how to set screen sizes of 80 columns by
|
||||
25, 28, 35, 40, 43 or 50 rows. However, if your video adapter has
|
||||
special video modes that will switch the display to other sizes, you can
|
||||
have Emacs support those too. When you ask Emacs to switch the frame to
|
||||
@var{n} rows by @var{m} columns dimensions, it checks if there is a
|
||||
variable called @code{screen-dimensions-@var{n}x@var{m}}, and if so,
|
||||
uses its value (which must be an integer) as the video mode to switch
|
||||
to. (Emacs switches to that video mode by calling the BIOS @code{Set
|
||||
Video Mode} function with the value of
|
||||
@code{screen-dimensions-@var{n}x@var{m}} in the @code{AL} register.)
|
||||
For example, suppose your adapter will switch to 66x80 dimensions when
|
||||
put into video mode 85. Then you can make Emacs support this screen
|
||||
size by putting the following into your @file{_emacs} file:
|
||||
|
||||
@example
|
||||
(setq screen-dimensions-66x80 85)
|
||||
@end example
|
||||
|
||||
Since Emacs on MS-DOS can only set the frame size to specific
|
||||
supported dimensions, it cannot honor every possible frame resizing
|
||||
request. When an unsupported size is requested, Emacs chooses the next
|
||||
larger supported size beyond the specified size. For example, if you
|
||||
ask for 36x80 frame, you will get 40x80 instead.
|
||||
|
||||
The variables @code{screen-dimensions-@var{n}x@var{m}} are used only
|
||||
when they exactly match the specified size; the search for the next
|
||||
larger supported size ignores them. In the above example, even if your
|
||||
VGA supports 38x80 dimensions and you define a variable
|
||||
@code{screen-dimensions-38x80} with a suitable value, you will still get
|
||||
40x80 screen when you ask for a 36x80 frame. If you want to get the
|
||||
38x80 size in this case, you can do it by setting the variable named
|
||||
@code{screen-dimensions-36x80} with the same video mode value as
|
||||
@code{screen-dimensions-38x80}.
|
||||
|
||||
Changing frame dimensions on MS-DOS has the effect of changing all the
|
||||
other frames to the new dimensions.
|
||||
|
||||
@node MS-DOS File Names
|
||||
@subsection File Names on MS-DOS
|
||||
@cindex file names under MS-DOS
|
||||
@cindex init file, default name under MS-DOS
|
||||
|
||||
On MS-DOS, file names are case-insensitive and limited to eight
|
||||
characters, plus optionally a period and three more characters. Emacs
|
||||
knows enough about these limitations to handle file names that were
|
||||
meant for other operating systems. For instance, leading dots
|
||||
@samp{.} in file names are invalid in MS-DOS, so Emacs transparently
|
||||
converts them to underscores @samp{_}; thus your default init file
|
||||
@iftex
|
||||
(@pxref{Init File,,,emacs, the Emacs Manual})
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Init File})
|
||||
@end ifnottex
|
||||
is called @file{_emacs} on MS-DOS. Excess characters before or after
|
||||
the period are generally ignored by MS-DOS itself; thus, if you visit
|
||||
the file @file{LongFileName.EvenLongerExtension}, you will silently
|
||||
get @file{longfile.eve}, but Emacs will still display the long file
|
||||
name on the mode line. Other than that, it's up to you to specify
|
||||
file names which are valid under MS-DOS; the transparent conversion as
|
||||
described above only works on file names built into Emacs.
|
||||
|
||||
@cindex backup file names on MS-DOS
|
||||
The above restrictions on the file names on MS-DOS make it almost
|
||||
impossible to construct the name of a backup file
|
||||
@iftex
|
||||
(@pxref{Backup Names,,,emacs, the Emacs Manual})
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Backup Names})
|
||||
@end ifnottex
|
||||
without losing some of the original file name characters. For
|
||||
example, the name of a backup file for @file{docs.txt} is
|
||||
@file{docs.tx~} even if single backup is used.
|
||||
|
||||
@cindex file names under Windows 95/NT
|
||||
@cindex long file names in DOS box under Windows 95/NT
|
||||
If you run Emacs as a DOS application under Windows 9X, Windows ME, or
|
||||
Windows 2000/XP, you can turn on support for long file names. If you do
|
||||
that, Emacs doesn't truncate file names or convert them to lower case;
|
||||
instead, it uses the file names that you specify, verbatim. To enable
|
||||
long file name support, set the environment variable @env{LFN} to
|
||||
@samp{y} before starting Emacs. Unfortunately, Windows NT doesn't allow
|
||||
DOS programs to access long file names, so Emacs built for MS-DOS will
|
||||
only see their short 8+3 aliases.
|
||||
|
||||
@cindex @env{HOME} directory under MS-DOS
|
||||
MS-DOS has no notion of home directory, so Emacs on MS-DOS pretends
|
||||
that the directory where it is installed is the value of the @env{HOME}
|
||||
environment variable. That is, if your Emacs binary,
|
||||
@file{emacs.exe}, is in the directory @file{c:/utils/emacs/bin}, then
|
||||
Emacs acts as if @env{HOME} were set to @samp{c:/utils/emacs}. In
|
||||
particular, that is where Emacs looks for the init file @file{_emacs}.
|
||||
With this in mind, you can use @samp{~} in file names as an alias for
|
||||
the home directory, as you would on GNU or Unix. You can also set
|
||||
@env{HOME} variable in the environment before starting Emacs; its
|
||||
value will then override the above default behavior.
|
||||
|
||||
Emacs on MS-DOS handles the directory name @file{/dev} specially,
|
||||
because of a feature in the emulator libraries of DJGPP that pretends
|
||||
I/O devices have names in that directory. We recommend that you avoid
|
||||
using an actual directory named @file{/dev} on any disk.
|
||||
|
||||
@node MS-DOS Printing
|
||||
@subsection Printing and MS-DOS
|
||||
|
||||
Printing commands, such as @code{lpr-buffer}
|
||||
@iftex
|
||||
(@pxref{Printing,,,emacs, the Emacs Manual}) and @code{ps-print-buffer}
|
||||
(@pxref{PostScript,,,emacs, the Emacs Manual})
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Printing}) and @code{ps-print-buffer} (@pxref{PostScript})
|
||||
@end ifnottex
|
||||
can work on MS-DOS by sending the output to one of the printer ports,
|
||||
if a Posix-style @code{lpr} program is unavailable. The same Emacs
|
||||
variables control printing on all systems, but in some cases they have
|
||||
different default values on MS-DOS.
|
||||
|
||||
@iftex
|
||||
@xref{Windows Printing,,,emacs, the Emacs Manual},
|
||||
@end iftex
|
||||
@ifnottex
|
||||
@xref{Windows Printing},
|
||||
@end ifnottex
|
||||
for details about setting up printing to a networked printer.
|
||||
|
||||
Some printers expect DOS codepage encoding of non-@acronym{ASCII} text, even
|
||||
though they are connected to a Windows machine which uses a different
|
||||
encoding for the same locale. For example, in the Latin-1 locale, DOS
|
||||
uses codepage 850 whereas Windows uses codepage 1252. @xref{MS-DOS and
|
||||
MULE}. When you print to such printers from Windows, you can use the
|
||||
@kbd{C-x RET c} (@code{universal-coding-system-argument}) command before
|
||||
@kbd{M-x lpr-buffer}; Emacs will then convert the text to the DOS
|
||||
codepage that you specify. For example, @kbd{C-x RET c cp850-dos RET
|
||||
M-x lpr-region RET} will print the region while converting it to the
|
||||
codepage 850 encoding. You may need to create the @code{cp@var{nnn}}
|
||||
coding system with @kbd{M-x codepage-setup}.
|
||||
|
||||
@vindex dos-printer
|
||||
@vindex dos-ps-printer
|
||||
For backwards compatibility, the value of @code{dos-printer}
|
||||
(@code{dos-ps-printer}), if it has a value, overrides the value of
|
||||
@code{printer-name} (@code{ps-printer-name}), on MS-DOS.
|
||||
|
||||
|
||||
@node MS-DOS and MULE
|
||||
@subsection International Support on MS-DOS
|
||||
@cindex international support @r{(MS-DOS)}
|
||||
|
||||
Emacs on MS-DOS supports the same international character sets as it
|
||||
does on GNU, Unix and other platforms
|
||||
@iftex
|
||||
(@pxref{International,,,emacs, the Emacs Manual}),
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{International}),
|
||||
@end ifnottex
|
||||
including coding systems for converting between the different
|
||||
character sets. However, due to incompatibilities between
|
||||
MS-DOS/MS-Windows and other systems, there are several DOS-specific
|
||||
aspects of this support that you should be aware of. This section
|
||||
describes these aspects.
|
||||
|
||||
The description below is largely specific to the MS-DOS port of
|
||||
Emacs, especially where it talks about practical implications for
|
||||
Emacs users. For other operating systems, see the @file{code-pages.el}
|
||||
package, which implements support for MS-DOS- and MS-Windows-specific
|
||||
encodings for all platforms other than MS-DOS.
|
||||
|
||||
@table @kbd
|
||||
@item M-x dos-codepage-setup
|
||||
Set up Emacs display and coding systems as appropriate for the current
|
||||
DOS codepage.
|
||||
|
||||
@item M-x codepage-setup
|
||||
Create a coding system for a certain DOS codepage.
|
||||
@end table
|
||||
|
||||
@cindex codepage, MS-DOS
|
||||
@cindex DOS codepages
|
||||
MS-DOS is designed to support one character set of 256 characters at
|
||||
any given time, but gives you a variety of character sets to choose
|
||||
from. The alternative character sets are known as @dfn{DOS codepages}.
|
||||
Each codepage includes all 128 @acronym{ASCII} characters, but the other 128
|
||||
characters (codes 128 through 255) vary from one codepage to another.
|
||||
Each DOS codepage is identified by a 3-digit number, such as 850, 862,
|
||||
etc.
|
||||
|
||||
In contrast to X, which lets you use several fonts at the same time,
|
||||
MS-DOS normally doesn't allow use of several codepages in a single
|
||||
session. MS-DOS was designed to load a single codepage at system
|
||||
startup, and require you to reboot in order to change
|
||||
it@footnote{Normally, one particular codepage is burnt into the
|
||||
display memory, while other codepages can be installed by modifying
|
||||
system configuration files, such as @file{CONFIG.SYS}, and rebooting.
|
||||
While there is third-party software that allows changing the codepage
|
||||
without rebooting, we describe here how a stock MS-DOS system
|
||||
behaves.}. Much the same limitation applies when you run DOS
|
||||
executables on other systems such as MS-Windows.
|
||||
|
||||
@cindex unibyte operation @r{(MS-DOS)}
|
||||
If you invoke Emacs on MS-DOS with the @samp{--unibyte} option
|
||||
@iftex
|
||||
(@pxref{Initial Options,,,emacs, the Emacs Manual}),
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Initial Options}),
|
||||
@end ifnottex
|
||||
Emacs does not perform any conversion of non-@acronym{ASCII}
|
||||
characters. Instead, it reads and writes any non-@acronym{ASCII}
|
||||
characters verbatim, and sends their 8-bit codes to the display
|
||||
verbatim. Thus, unibyte Emacs on MS-DOS supports the current
|
||||
codepage, whatever it may be, but cannot even represent any other
|
||||
characters.
|
||||
|
||||
@vindex dos-codepage
|
||||
For multibyte operation on MS-DOS, Emacs needs to know which
|
||||
characters the chosen DOS codepage can display. So it queries the
|
||||
system shortly after startup to get the chosen codepage number, and
|
||||
stores the number in the variable @code{dos-codepage}. Some systems
|
||||
return the default value 437 for the current codepage, even though the
|
||||
actual codepage is different. (This typically happens when you use the
|
||||
codepage built into the display hardware.) You can specify a different
|
||||
codepage for Emacs to use by setting the variable @code{dos-codepage} in
|
||||
your init file.
|
||||
|
||||
@cindex language environment, automatic selection on @r{MS-DOS}
|
||||
Multibyte Emacs supports only certain DOS codepages: those which can
|
||||
display Far-Eastern scripts, like the Japanese codepage 932, and those
|
||||
that encode a single ISO 8859 character set.
|
||||
|
||||
The Far-Eastern codepages can directly display one of the MULE
|
||||
character sets for these countries, so Emacs simply sets up to use the
|
||||
appropriate terminal coding system that is supported by the codepage.
|
||||
The special features described in the rest of this section mostly
|
||||
pertain to codepages that encode ISO 8859 character sets.
|
||||
|
||||
For the codepages which correspond to one of the ISO character sets,
|
||||
Emacs knows the character set name based on the codepage number. Emacs
|
||||
automatically creates a coding system to support reading and writing
|
||||
files that use the current codepage, and uses this coding system by
|
||||
default. The name of this coding system is @code{cp@var{nnn}}, where
|
||||
@var{nnn} is the codepage number.@footnote{The standard Emacs coding
|
||||
systems for ISO 8859 are not quite right for the purpose, because
|
||||
typically the DOS codepage does not match the standard ISO character
|
||||
codes. For example, the letter @samp{@,{c}} (@samp{c} with cedilla) has
|
||||
code 231 in the standard Latin-1 character set, but the corresponding
|
||||
DOS codepage 850 uses code 135 for this glyph.}
|
||||
|
||||
@cindex mode line @r{(MS-DOS)}
|
||||
All the @code{cp@var{nnn}} coding systems use the letter @samp{D}
|
||||
(for ``DOS'') as their mode-line mnemonic. Since both the terminal
|
||||
coding system and the default coding system for file I/O are set to
|
||||
the proper @code{cp@var{nnn}} coding system at startup, it is normal
|
||||
for the mode line on MS-DOS to begin with @samp{-DD\-}.
|
||||
@iftex
|
||||
@xref{Mode Line,,,emacs, the Emacs Manual}.
|
||||
@end iftex
|
||||
@ifnottex
|
||||
@xref{Mode Line}.
|
||||
@end ifnottex
|
||||
Far-Eastern DOS terminals do not use the @code{cp@var{nnn}} coding
|
||||
systems, and thus their initial mode line looks like the Emacs
|
||||
default.
|
||||
|
||||
Since the codepage number also indicates which script you are using,
|
||||
Emacs automatically runs @code{set-language-environment} to select the
|
||||
language environment for that script
|
||||
@iftex
|
||||
(@pxref{Language Environments,,,emacs, the Emacs Manual}).
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Language Environments}).
|
||||
@end ifnottex
|
||||
|
||||
If a buffer contains a character belonging to some other ISO 8859
|
||||
character set, not the one that the chosen DOS codepage supports, Emacs
|
||||
displays it using a sequence of @acronym{ASCII} characters. For example, if the
|
||||
current codepage doesn't have a glyph for the letter @samp{@`o} (small
|
||||
@samp{o} with a grave accent), it is displayed as @samp{@{`o@}}, where
|
||||
the braces serve as a visual indication that this is a single character.
|
||||
(This may look awkward for some non-Latin characters, such as those from
|
||||
Greek or Hebrew alphabets, but it is still readable by a person who
|
||||
knows the language.) Even though the character may occupy several
|
||||
columns on the screen, it is really still just a single character, and
|
||||
all Emacs commands treat it as one.
|
||||
|
||||
@cindex IBM graphics characters (MS-DOS)
|
||||
@cindex box-drawing characters (MS-DOS)
|
||||
@cindex line-drawing characters (MS-DOS)
|
||||
Not all characters in DOS codepages correspond to ISO 8859
|
||||
characters---some are used for other purposes, such as box-drawing
|
||||
characters and other graphics. Emacs maps these characters to two
|
||||
special character sets called @code{eight-bit-control} and
|
||||
@code{eight-bit-graphic}, and displays them as their IBM glyphs.
|
||||
However, you should be aware that other systems might display these
|
||||
characters differently, so you should avoid them in text that might be
|
||||
copied to a different operating system, or even to another DOS machine
|
||||
that uses a different codepage.
|
||||
|
||||
@vindex dos-unsupported-character-glyph
|
||||
Emacs supports many other characters sets aside from ISO 8859, but it
|
||||
cannot display them on MS-DOS. So if one of these multibyte characters
|
||||
appears in a buffer, Emacs on MS-DOS displays them as specified by the
|
||||
@code{dos-unsupported-character-glyph} variable; by default, this glyph
|
||||
is an empty triangle. Use the @kbd{C-u C-x =} command to display the
|
||||
actual code and character set of such characters.
|
||||
@iftex
|
||||
@xref{Position Info,,,emacs, the Emacs Manual}.
|
||||
@end iftex
|
||||
@ifnottex
|
||||
@xref{Position Info}.
|
||||
@end ifnottex
|
||||
|
||||
@findex codepage-setup
|
||||
By default, Emacs defines a coding system to support the current
|
||||
codepage. To define a coding system for some other codepage (e.g., to
|
||||
visit a file written on a DOS machine in another country), use the
|
||||
@kbd{M-x codepage-setup} command. It prompts for the 3-digit code of
|
||||
the codepage, with completion, then creates the coding system for the
|
||||
specified codepage. You can then use the new coding system to read and
|
||||
write files, but you must specify it explicitly for the file command
|
||||
when you want to use it
|
||||
@iftex
|
||||
(@pxref{Text Coding,,,emacs, the Emacs Manual}).
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Text Coding}).
|
||||
@end ifnottex
|
||||
|
||||
These coding systems are also useful for visiting a file encoded using
|
||||
a DOS codepage, using Emacs running on some other operating system.
|
||||
|
||||
@cindex MS-Windows codepages
|
||||
MS-Windows provides its own codepages, which are different from the
|
||||
DOS codepages for the same locale. For example, DOS codepage 850
|
||||
supports the same character set as Windows codepage 1252; DOS codepage
|
||||
855 supports the same character set as Windows codepage 1251, etc.
|
||||
The MS-Windows version of Emacs uses the current codepage for display
|
||||
when invoked with the @samp{-nw} option. Support for codepages in the
|
||||
Windows port of Emacs is part of the @file{code-pages.el} package.
|
||||
|
||||
@node MS-DOS Processes
|
||||
@subsection Subprocesses on MS-DOS
|
||||
|
||||
@cindex compilation under MS-DOS
|
||||
@cindex inferior processes under MS-DOS
|
||||
@findex compile @r{(MS-DOS)}
|
||||
@findex grep @r{(MS-DOS)}
|
||||
Because MS-DOS is a single-process ``operating system,''
|
||||
asynchronous subprocesses are not available. In particular, Shell
|
||||
mode and its variants do not work. Most Emacs features that use
|
||||
asynchronous subprocesses also don't work on MS-DOS, including
|
||||
Shell mode and GUD. When in doubt, try and see; commands that
|
||||
don't work output an error message saying that asynchronous processes
|
||||
aren't supported.
|
||||
|
||||
Compilation under Emacs with @kbd{M-x compile}, searching files with
|
||||
@kbd{M-x grep} and displaying differences between files with @kbd{M-x
|
||||
diff} do work, by running the inferior processes synchronously. This
|
||||
means you cannot do any more editing until the inferior process
|
||||
finishes.
|
||||
|
||||
Spell checking also works, by means of special support for synchronous
|
||||
invocation of the @code{ispell} program. This is slower than the
|
||||
asynchronous invocation on other platforms
|
||||
|
||||
Instead of the Shell mode, which doesn't work on MS-DOS, you can use
|
||||
the @kbd{M-x eshell} command. This invokes the Eshell package that
|
||||
implements a Posix-like shell entirely in Emacs Lisp.
|
||||
|
||||
By contrast, Emacs compiled as a native Windows application
|
||||
@strong{does} support asynchronous subprocesses.
|
||||
@iftex
|
||||
@xref{Windows Processes,,,emacs, the Emacs Manual}.
|
||||
@end iftex
|
||||
@ifnottex
|
||||
@xref{Windows Processes}.
|
||||
@end ifnottex
|
||||
|
||||
@cindex printing under MS-DOS
|
||||
Printing commands, such as @code{lpr-buffer}
|
||||
@iftex
|
||||
(@pxref{Printing,,,emacs, the Emacs Manual}) and
|
||||
@code{ps-print-buffer} (@pxref{PostScript,,,emacs, the Emacs Manual}),
|
||||
work in MS-DOS by sending the output to one of the printer ports.
|
||||
@xref{MS-DOS Printing,,,emacs, the Emacs Manual}.
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Printing}) and @code{ps-print-buffer} (@pxref{PostScript}),
|
||||
work in MS-DOS by sending the output to one of the printer ports.
|
||||
@xref{MS-DOS Printing}.
|
||||
@end ifnottex
|
||||
|
||||
When you run a subprocess synchronously on MS-DOS, make sure the
|
||||
program terminates and does not try to read keyboard input. If the
|
||||
program does not terminate on its own, you will be unable to terminate
|
||||
it, because MS-DOS provides no general way to terminate a process.
|
||||
Pressing @kbd{C-c} or @kbd{C-@key{BREAK}} might sometimes help in these
|
||||
cases.
|
||||
|
||||
Accessing files on other machines is not supported on MS-DOS. Other
|
||||
network-oriented commands such as sending mail, Web browsing, remote
|
||||
login, etc., don't work either, unless network access is built into
|
||||
MS-DOS with some network redirector.
|
||||
|
||||
@cindex directory listing on MS-DOS
|
||||
@vindex dired-listing-switches @r{(MS-DOS)}
|
||||
Dired on MS-DOS uses the @code{ls-lisp} package where other
|
||||
platforms use the system @code{ls} command. Therefore, Dired on
|
||||
MS-DOS supports only some of the possible options you can mention in
|
||||
the @code{dired-listing-switches} variable. The options that work are
|
||||
@samp{-A}, @samp{-a}, @samp{-c}, @samp{-i}, @samp{-r}, @samp{-S},
|
||||
@samp{-s}, @samp{-t}, and @samp{-u}.
|
||||
|
||||
@ignore
|
||||
arch-tag: 868d50ff-07f8-4a13-a807-dab6f1cdb431
|
||||
@end ignore
|
766
man/msdog.texi
766
man/msdog.texi
|
@ -1,766 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,
|
||||
@c 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Microsoft Windows, Manifesto, Mac OS, Top
|
||||
@appendix Emacs and Microsoft Windows/MS-DOS
|
||||
@cindex Microsoft Windows
|
||||
@cindex MS-Windows, Emacs peculiarities
|
||||
|
||||
This section describes peculiarities of using Emacs on Microsoft
|
||||
Windows. Some of these peculiarities are also relevant to Microsoft's
|
||||
older MS-DOS ``operating system'' (also known as ``MS-DOG'').
|
||||
However, Emacs features that are relevant @emph{only} to MS-DOS are
|
||||
described in a separate
|
||||
@iftex
|
||||
manual (@pxref{MS-DOS,,, emacs-xtra, Specialized Emacs Features}).
|
||||
@end iftex
|
||||
@ifnottex
|
||||
section (@pxref{MS-DOS}).
|
||||
@end ifnottex
|
||||
|
||||
|
||||
The behavior of Emacs on MS-Windows is reasonably similar to what is
|
||||
documented in the rest of the manual, including support for long file
|
||||
names, multiple frames, scroll bars, mouse menus, and subprocesses.
|
||||
However, a few special considerations apply, and they are described
|
||||
here.
|
||||
|
||||
@menu
|
||||
* Text and Binary:: Text files use CRLF to terminate lines.
|
||||
* Windows Files:: File-name conventions on Windows.
|
||||
* ls in Lisp:: Emulation of @code{ls} for Dired.
|
||||
* Windows HOME:: Where Emacs looks for your @file{.emacs}.
|
||||
* Windows Keyboard:: Windows-specific keyboard features.
|
||||
* Windows Mouse:: Windows-specific mouse features.
|
||||
* Windows Processes:: Running subprocesses on Windows.
|
||||
* Windows Printing:: How to specify the printer on MS-Windows.
|
||||
* Windows Misc:: Miscellaneous Windows features.
|
||||
@ifnottex
|
||||
* MS-DOS:: Using Emacs on MS-DOS (otherwise known as @dfn{MS-DOG}).
|
||||
@end ifnottex
|
||||
@end menu
|
||||
|
||||
@node Text and Binary
|
||||
@section Text Files and Binary Files
|
||||
@cindex text and binary files on MS-DOS/MS-Windows
|
||||
|
||||
GNU Emacs uses newline characters to separate text lines. This is the
|
||||
convention used on GNU, Unix, and other Posix-compliant systems.
|
||||
|
||||
@cindex end-of-line conversion on MS-DOS/MS-Windows
|
||||
By contrast, MS-DOS and MS-Windows normally use carriage-return linefeed,
|
||||
a two-character sequence, to separate text lines. (Linefeed is the same
|
||||
character as newline.) Therefore, convenient editing of typical files
|
||||
with Emacs requires conversion of these end-of-line (EOL) sequences.
|
||||
And that is what Emacs normally does: it converts carriage-return
|
||||
linefeed into newline when reading files, and converts newline into
|
||||
carriage-return linefeed when writing files. The same mechanism that
|
||||
handles conversion of international character codes does this conversion
|
||||
also (@pxref{Coding Systems}).
|
||||
|
||||
@cindex cursor location, on MS-DOS
|
||||
@cindex point location, on MS-DOS
|
||||
One consequence of this special format-conversion of most files is
|
||||
that character positions as reported by Emacs (@pxref{Position Info}) do
|
||||
not agree with the file size information known to the operating system.
|
||||
|
||||
In addition, if Emacs recognizes from a file's contents that it uses
|
||||
newline rather than carriage-return linefeed as its line separator, it
|
||||
does not perform EOL conversion when reading or writing that file.
|
||||
Thus, you can read and edit files from GNU and Unix systems on MS-DOS
|
||||
with no special effort, and they will retain their Unix-style
|
||||
end-of-line convention after you edit them.
|
||||
|
||||
The mode line indicates whether end-of-line translation was used for
|
||||
the current buffer. If MS-DOS end-of-line translation is in use for the
|
||||
buffer, the MS-Windows build of Emacs displays a backslash @samp{\} after
|
||||
the coding system mnemonic near the beginning of the mode line
|
||||
(@pxref{Mode Line}). If no EOL translation was performed, the string
|
||||
@samp{(Unix)} is displayed instead of the backslash, to alert you that the
|
||||
file's EOL format is not the usual carriage-return linefeed.
|
||||
|
||||
@cindex DOS-to-Unix conversion of files
|
||||
To visit a file and specify whether it uses DOS-style or Unix-style
|
||||
end-of-line, specify a coding system (@pxref{Text Coding}). For
|
||||
example, @kbd{C-x @key{RET} c unix @key{RET} C-x C-f foobar.txt}
|
||||
visits the file @file{foobar.txt} without converting the EOLs; if some
|
||||
line ends with a carriage-return linefeed pair, Emacs will display
|
||||
@samp{^M} at the end of that line. Similarly, you can direct Emacs to
|
||||
save a buffer in a specified EOL format with the @kbd{C-x @key{RET} f}
|
||||
command. For example, to save a buffer with Unix EOL format, type
|
||||
@kbd{C-x @key{RET} f unix @key{RET} C-x C-s}. If you visit a file
|
||||
with DOS EOL conversion, then save it with Unix EOL format, that
|
||||
effectively converts the file to Unix EOL style, like @code{dos2unix}.
|
||||
|
||||
@cindex untranslated file system
|
||||
@findex add-untranslated-filesystem
|
||||
When you use NFS, Samba, or some other similar method to access file
|
||||
systems that reside on computers using GNU or Unix systems, Emacs
|
||||
should not perform end-of-line translation on any files in these file
|
||||
systems---not even when you create a new file. To request this,
|
||||
designate these file systems as @dfn{untranslated} file systems by
|
||||
calling the function @code{add-untranslated-filesystem}. It takes one
|
||||
argument: the file system name, including a drive letter and
|
||||
optionally a directory. For example,
|
||||
|
||||
@example
|
||||
(add-untranslated-filesystem "Z:")
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
designates drive Z as an untranslated file system, and
|
||||
|
||||
@example
|
||||
(add-untranslated-filesystem "Z:\\foo")
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
designates directory @file{\foo} on drive Z as an untranslated file
|
||||
system.
|
||||
|
||||
Most often you would use @code{add-untranslated-filesystem} in your
|
||||
@file{.emacs} file, or in @file{site-start.el} so that all the users at
|
||||
your site get the benefit of it.
|
||||
|
||||
@findex remove-untranslated-filesystem
|
||||
To countermand the effect of @code{add-untranslated-filesystem}, use
|
||||
the function @code{remove-untranslated-filesystem}. This function takes
|
||||
one argument, which should be a string just like the one that was used
|
||||
previously with @code{add-untranslated-filesystem}.
|
||||
|
||||
Designating a file system as untranslated does not affect character
|
||||
set conversion, only end-of-line conversion. Essentially, it directs
|
||||
Emacs to create new files with the Unix-style convention of using
|
||||
newline at the end of a line. @xref{Coding Systems}.
|
||||
|
||||
@vindex file-name-buffer-file-type-alist
|
||||
@cindex binary files, on MS-DOS/MS-Windows
|
||||
Some kinds of files should not be converted at all, because their
|
||||
contents are not really text. Therefore, Emacs on MS-Windows distinguishes
|
||||
certain files as @dfn{binary files}. (This distinction is not part of
|
||||
MS-Windows; it is made by Emacs only.) Binary files include executable
|
||||
programs, compressed archives, etc. Emacs uses the file name to decide
|
||||
whether to treat a file as binary: the variable
|
||||
@code{file-name-buffer-file-type-alist} defines the file-name patterns
|
||||
that indicate binary files. If a file name matches one of the patterns
|
||||
for binary files (those whose associations are of the type
|
||||
@code{(@var{pattern} . t)}, Emacs reads and writes that file using the
|
||||
@code{no-conversion} coding system (@pxref{Coding Systems}) which turns
|
||||
off @emph{all} coding-system conversions, not only the EOL conversion.
|
||||
@code{file-name-buffer-file-type-alist} also includes file-name patterns
|
||||
for files which are known to be Windows-style text files with
|
||||
carriage-return linefeed EOL format, such as @file{CONFIG.SYS}; Emacs
|
||||
always writes those files with Windows-style EOLs.
|
||||
|
||||
If a file which belongs to an untranslated file system matches one of
|
||||
the file-name patterns in @code{file-name-buffer-file-type-alist}, the
|
||||
EOL conversion is determined by @code{file-name-buffer-file-type-alist}.
|
||||
|
||||
@node Windows Files
|
||||
@section File Names on MS-Windows
|
||||
@cindex file names on MS-Windows
|
||||
|
||||
MS-Windows and MS-DOS normally use a backslash, @samp{\}, to
|
||||
separate name units within a file name, instead of the slash used on
|
||||
other systems. Emacs on MS-DOS/MS-Windows permits use of either slash or
|
||||
backslash, and also knows about drive letters in file names.
|
||||
|
||||
@cindex file-name completion, on MS-Windows
|
||||
On MS-DOS/MS-Windows, file names are case-insensitive, so Emacs by
|
||||
default ignores letter-case in file names during completion.
|
||||
|
||||
@vindex w32-get-true-file-attributes
|
||||
If the variable @code{w32-get-true-file-attributes} is
|
||||
non-@code{nil} (the default), Emacs tries to determine the accurate
|
||||
link counts for files. This option is only useful on NTFS volumes,
|
||||
and it considerably slows down Dired and other features, so use it
|
||||
only on fast machines.
|
||||
|
||||
@node ls in Lisp
|
||||
@section Emulation of @code{ls} on MS-Windows
|
||||
@cindex Dired, and MS-Windows/MS-DOS
|
||||
@cindex @code{ls} emulation
|
||||
|
||||
Dired normally uses the external program @code{ls} (or its close
|
||||
work-alike) to produce the directory listing displayed in Dired
|
||||
buffers (@pxref{Dired}). However, MS-Windows and MS-DOS systems don't
|
||||
come with such a program, although several ports of @sc{gnu} @code{ls}
|
||||
are available. Therefore, Emacs on those systems @emph{emulates}
|
||||
@code{ls} in Lisp, by using the @file{ls-lisp.el} package. While
|
||||
@file{ls-lisp.el} provides a reasonably full emulation of @code{ls},
|
||||
there are some options and features peculiar to that emulation;
|
||||
@iftex
|
||||
for more details, see the documentation of the variables whose names
|
||||
begin with @code{ls-lisp}.
|
||||
@end iftex
|
||||
@ifnottex
|
||||
they are described in this section.
|
||||
|
||||
The @code{ls} emulation supports many of the @code{ls} switches, but
|
||||
it doesn't support all of them. Here's the list of the switches it
|
||||
does support: @option{-A}, @option{-a}, @option{-B}, @option{-C},
|
||||
@option{-c}, @option{-i}, @option{-G}, @option{-g}, @option{-R},
|
||||
@option{-r}, @option{-S}, @option{-s}, @option{-t}, @option{-U},
|
||||
@option{-u}, and @option{-X}. The @option{-F} switch is partially
|
||||
supported (it appends the character that classifies the file, but does
|
||||
not prevent symlink following).
|
||||
|
||||
@vindex ls-lisp-use-insert-directory-program
|
||||
On MS-Windows and MS-DOS, @file{ls-lisp.el} is preloaded when Emacs
|
||||
is built, so the Lisp emulation of @code{ls} is always used on those
|
||||
platforms. If you have a ported @code{ls}, setting
|
||||
@code{ls-lisp-use-insert-directory-program} to a non-@code{nil} value
|
||||
will revert to using an external program named by the variable
|
||||
@code{insert-directory-program}.
|
||||
|
||||
@vindex ls-lisp-ignore-case
|
||||
By default, @file{ls-lisp.el} uses a case-sensitive sort order for
|
||||
the directory listing it produces; this is so the listing looks the
|
||||
same as on other platforms. If you wish that the files be sorted in
|
||||
case-insensitive order, set the variable @code{ls-lisp-ignore-case} to
|
||||
a non-@code{nil} value.
|
||||
|
||||
@vindex ls-lisp-dirs-first
|
||||
By default, files and subdirectories are sorted together, to emulate
|
||||
the behavior of @code{ls}. However, native MS-Windows/MS-DOS file
|
||||
managers list the directories before the files; if you want that
|
||||
behavior, customize the option @code{ls-lisp-dirs-first} to a
|
||||
non-@code{nil} value.
|
||||
|
||||
@vindex ls-lisp-verbosity
|
||||
The variable @code{ls-lisp-verbosity} controls the file attributes
|
||||
that @file{ls-lisp.el} displays. The value should be a list that
|
||||
contains one or more of the symbols @code{links}, @code{uid}, and
|
||||
@code{gid}. @code{links} means display the count of different file
|
||||
names that are associated with (a.k.a.@: @dfn{links to}) the file's
|
||||
data; this is only useful on NTFS volumes. @code{uid} means display
|
||||
the numerical identifier of the user who owns the file. @code{gid}
|
||||
means display the numerical identifier of the file owner's group. The
|
||||
default value is @code{(links uid gid)} i.e.@: all the 3 optional
|
||||
attributes are displayed.
|
||||
|
||||
@vindex ls-lisp-emulation
|
||||
The variable @code{ls-lisp-emulation} controls the flavour of the
|
||||
@code{ls} emulation by setting the defaults for the 3 options
|
||||
described above: @code{ls-lisp-ignore-case},
|
||||
@code{ls-lisp-dirs-first}, and @code{ls-lisp-verbosity}. The value of
|
||||
this option can be one of the following symbols:
|
||||
|
||||
@table @code
|
||||
@item GNU
|
||||
@itemx nil
|
||||
Emulate @sc{gnu} systems; this is the default. This sets
|
||||
@code{ls-lisp-ignore-case} and @code{ls-lisp-dirs-first} to
|
||||
@code{nil}, and @code{ls-lisp-verbosity} to @code{(links uid gid)}.
|
||||
@item UNIX
|
||||
Emulate Unix systems. Like @code{GNU}, but sets
|
||||
@code{ls-lisp-verbosity} to @code{(links uid)}.
|
||||
@item MacOS
|
||||
Emulate MacOS. Sets @code{ls-lisp-ignore-case} to @code{t}, and
|
||||
@code{ls-lisp-dirs-first} and @code{ls-lisp-verbosity} to @code{nil}.
|
||||
@item MS-Windows
|
||||
Emulate MS-Windows. Sets @code{ls-lisp-ignore-case} and
|
||||
@code{ls-lisp-dirs-first} to @code{t}, and @code{ls-lisp-verbosity} to
|
||||
@code{(links)} on Windows NT/2K/XP/2K3 and to @code{nil} on Windows 9X.
|
||||
Note that the default emulation is @emph{not} @code{MS-Windows}, even
|
||||
on Windows, since many users of Emacs on those platforms prefer the
|
||||
@sc{gnu} defaults.
|
||||
@end table
|
||||
|
||||
@noindent
|
||||
Any other value of @code{ls-lisp-emulation} means the same as
|
||||
@code{GNU}. Note that this option needs to be set @emph{before}
|
||||
@file{ls-lisp.el} is loaded, which means that on MS-Windows and MS-DOS
|
||||
you will have to set the value from your @file{.emacs} file and then
|
||||
restart Emacs, since @file{ls-lisp.el} is preloaded.
|
||||
|
||||
@vindex ls-lisp-support-shell-wildcards
|
||||
The variable @code{ls-lisp-support-shell-wildcards} controls how
|
||||
file-name patterns are supported: if it is non-@code{nil} (the
|
||||
default), they are treated as shell-style wildcards; otherwise they
|
||||
are treated as Emacs regular expressions.
|
||||
|
||||
@vindex ls-lisp-format-time-list
|
||||
The variable @code{ls-lisp-format-time-list} defines how to format
|
||||
the date and time of files. @emph{The value of this variable is
|
||||
ignored}, unless Emacs cannot determine the current locale. (However,
|
||||
if the value of @code{ls-lisp-use-localized-time-format} is
|
||||
non-@code{nil}, Emacs obeys @code{ls-lisp-format-time-list} even if
|
||||
the current locale is available; see below.)
|
||||
|
||||
The value of @code{ls-lisp-format-time-list} is a list of 2 strings.
|
||||
The first string is used if the file was modified within the current
|
||||
year, while the second string is used for older files. In each of
|
||||
these two strings you can use @samp{%}-sequences to substitute parts
|
||||
of the time. For example:
|
||||
@lisp
|
||||
("%b %e %H:%M" "%b %e %Y")
|
||||
@end lisp
|
||||
|
||||
@noindent
|
||||
Note that the strings substituted for these @samp{%}-sequences depend
|
||||
on the current locale. @xref{Time Parsing,,, elisp, The Emacs Lisp
|
||||
Reference Manual}, for more about format time specs.
|
||||
|
||||
@vindex ls-lisp-use-localized-time-format
|
||||
Normally, Emacs formats the file time stamps in either traditional
|
||||
or ISO-style time format. However, if the value of the variable
|
||||
@code{ls-lisp-use-localized-time-format} is non-@code{nil}, Emacs
|
||||
formats file time stamps according to what
|
||||
@code{ls-lisp-format-time-list} specifies. The @samp{%}-sequences in
|
||||
@code{ls-lisp-format-time-list} produce locale-dependent month and day
|
||||
names, which might cause misalignment of columns in Dired display.
|
||||
@end ifnottex
|
||||
|
||||
@node Windows HOME
|
||||
@section HOME Directory on MS-Windows
|
||||
@cindex @code{HOME} directory on MS-Windows
|
||||
|
||||
The Windows equivalent of the @code{HOME} directory is the
|
||||
@dfn{user-specific application data directory}. The actual location
|
||||
depends on your Windows version and system configuration; typical values
|
||||
are @file{C:\Documents and Settings\@var{username}\Application Data} on
|
||||
Windows 2K/XP and later, and either @file{C:\WINDOWS\Application Data}
|
||||
or @file{C:\WINDOWS\Profiles\@var{username}\Application Data} on the
|
||||
older Windows 9X/ME systems.
|
||||
|
||||
@cindex init file @file{.emacs} on MS-Windows
|
||||
The home directory is where your init file @file{.emacs} is stored.
|
||||
When Emacs starts, it first checks whether the environment variable
|
||||
@env{HOME} is set. If it is, it looks for the init file in the
|
||||
directory pointed by @env{HOME}. If @env{HOME} is not defined, Emacs
|
||||
checks for an existing @file{.emacs} file in @file{C:\}, the root
|
||||
directory of drive @file{C:}@footnote{
|
||||
The check in @file{C:\} is in preference to the application data
|
||||
directory for compatibility with older versions of Emacs, which didn't
|
||||
check the application data directory.
|
||||
}. If there's no such file in @file{C:\}, Emacs next uses the Windows
|
||||
system calls to find out the exact location of your application data
|
||||
directory. If that fails as well, Emacs falls back to @file{C:\}.
|
||||
|
||||
Whatever the final place is, Emacs sets the value of the @env{HOME}
|
||||
environment variable to point to it, and it will use that location for
|
||||
other files and directories it normally creates in the user's home
|
||||
directory.
|
||||
|
||||
You can always find out where Emacs thinks is your home directory's
|
||||
location by typing @kbd{C-x d ~/ @key{RET}}. This should present the
|
||||
list of files in the home directory, and show its full name on the
|
||||
first line. Likewise, to visit your init file, type @kbd{C-x C-f
|
||||
~/.emacs @key{RET}}.
|
||||
|
||||
@cindex @file{_emacs} init file, MS-Windows
|
||||
Because MS-DOS does not allow file names with leading dots, and
|
||||
because older Windows systems made it hard to create files with such
|
||||
names, the Windows port of Emacs supports an alternative name
|
||||
@file{_emacs} as a fallback, if such a file exists in the home
|
||||
directory, whereas @file{.emacs} does not.
|
||||
|
||||
@node Windows Keyboard
|
||||
@section Keyboard Usage on MS-Windows
|
||||
@cindex keyboard, MS-Windows
|
||||
|
||||
This section describes the Windows-specific features related to
|
||||
keyboard input in Emacs.
|
||||
|
||||
@cindex MS-Windows keyboard shortcuts
|
||||
Many key combinations (known as ``keyboard shortcuts'') that have
|
||||
conventional uses in MS-Windows programs conflict with traditional
|
||||
Emacs key bindings. (These Emacs key bindings were established years
|
||||
before Microsoft was founded.) Examples of conflicts include
|
||||
@kbd{C-c}, @kbd{C-x}, @kbd{C-z}, @kbd{C-a}, and @kbd{W-@key{SPC}}.
|
||||
You can redefine some of them with meanings more like the MS-Windows
|
||||
meanings by enabling CUA Mode (@pxref{CUA Bindings}).
|
||||
|
||||
@kindex F10 @r{(MS-Windows)}
|
||||
@cindex menu bar access using keyboard @r{(MS-Windows)}
|
||||
The @key{F10} key on Windows activates the menu bar in a way that
|
||||
makes it possible to use the menus without a mouse. In this mode, the
|
||||
arrow keys traverse the menus, @key{RET} selects a highlighted menu
|
||||
item, and @key{ESC} closes the menu.
|
||||
|
||||
@iftex
|
||||
@inforef{Windows Keyboard, , emacs}, for information about additional
|
||||
Windows-specific variables in this category.
|
||||
@end iftex
|
||||
@ifnottex
|
||||
@vindex w32-alt-is-meta
|
||||
@cindex @code{Alt} key (MS-Windows)
|
||||
By default, the key labeled @key{Alt} is mapped as the @key{META}
|
||||
key. If you wish it to produce the @code{Alt} modifier instead, set
|
||||
the variable @code{w32-alt-is-meta} to a @code{nil} value.
|
||||
|
||||
@vindex w32-capslock-is-shiftlock
|
||||
By default, the @key{CapsLock} key only affects normal character
|
||||
keys (it converts lower-case characters to their upper-case
|
||||
variants). However, if you set the variable
|
||||
@code{w32-capslock-is-shiftlock} to a non-@code{nil} value, the
|
||||
@key{CapsLock} key will affect non-character keys as well, as if you
|
||||
pressed the @key{Shift} key while typing the non-character key.
|
||||
|
||||
@vindex w32-enable-caps-lock
|
||||
If the variable @code{w32-enable-caps-lock} is set to a @code{nil}
|
||||
value, the @key{CapsLock} key produces the symbol @code{capslock}
|
||||
instead of the shifted version of they keys. The default value is
|
||||
@code{t}.
|
||||
|
||||
@vindex w32-enable-num-lock
|
||||
@cindex keypad keys (MS-Windows)
|
||||
Similarly, if @code{w32-enable-num-lock} is @code{nil}, the
|
||||
@key{NumLock} key will produce the symbol @code{kp-numlock}. The
|
||||
default is @code{t}, which causes @key{NumLock} to work as expected:
|
||||
toggle the meaning of the keys on the numeric keypad.
|
||||
@end ifnottex
|
||||
|
||||
@vindex w32-apps-modifier
|
||||
The variable @code{w32-apps-modifier} controls the effect of the
|
||||
@key{Apps} key (usually located between the right @key{Alt} and the
|
||||
right @key{Ctrl} keys). Its value can be one of the symbols
|
||||
@code{hyper}, @code{super}, @code{meta}, @code{alt}, @code{control},
|
||||
or @code{shift} for the respective modifier, or @code{nil} to appear
|
||||
as the key @code{apps}. The default is @code{nil}.
|
||||
|
||||
@vindex w32-lwindow-modifier
|
||||
@vindex w32-rwindow-modifier
|
||||
@vindex w32-scroll-lock-modifier
|
||||
The variable @code{w32-lwindow-modifier} determines the effect of
|
||||
the left Windows key (usually labeled with @key{start} and the Windows
|
||||
logo). If its value is @code{nil} (the default), the key will produce
|
||||
the symbol @code{lwindow}. Setting it to one of the symbols
|
||||
@code{hyper}, @code{super}, @code{meta}, @code{alt}, @code{control},
|
||||
or @code{shift} will produce the respective modifier. A similar
|
||||
variable @code{w32-rwindow-modifier} controls the effect of the right
|
||||
Windows key, and @code{w32-scroll-lock-modifier} does the same for the
|
||||
@key{ScrLock} key. If these variables are set to @code{nil}, the
|
||||
right Windows key produces the symbol @code{rwindow} and @key{ScrLock}
|
||||
produces the symbol @code{scroll}.
|
||||
|
||||
@vindex w32-pass-alt-to-system
|
||||
@cindex Windows system menu
|
||||
@cindex @code{Alt} key invokes menu (Windows)
|
||||
Emacs compiled as a native Windows application normally turns off
|
||||
the Windows feature that tapping the @key{ALT} key invokes the Windows
|
||||
menu. The reason is that the @key{ALT} serves as @key{META} in Emacs.
|
||||
When using Emacs, users often press the @key{META} key temporarily and
|
||||
then change their minds; if this has the effect of bringing up the
|
||||
Windows menu, it alters the meaning of subsequent commands. Many
|
||||
users find this frustrating.
|
||||
|
||||
You can re-enable Windows' default handling of tapping the @key{ALT}
|
||||
key by setting @code{w32-pass-alt-to-system} to a non-@code{nil}
|
||||
value.
|
||||
|
||||
@ifnottex
|
||||
@vindex w32-pass-lwindow-to-system
|
||||
@vindex w32-pass-rwindow-to-system
|
||||
The variables @code{w32-pass-lwindow-to-system} and
|
||||
@code{w32-pass-rwindow-to-system} determine whether the respective
|
||||
keys are passed to Windows or swallowed by Emacs. If the value is
|
||||
@code{nil}, the respective key is silently swallowed by Emacs,
|
||||
otherwise it is passed to Windows. The default is @code{t} for both
|
||||
of these variables. Passing each of these keys to Windows produces
|
||||
its normal effect: for example, @kbd{@key{Lwindow}} opens the
|
||||
@code{Start} menu, etc.@footnote{
|
||||
Some combinations of the ``Windows'' keys with other keys are caught
|
||||
by Windows at low level in a way that Emacs currently cannot prevent.
|
||||
For example, @kbd{@key{Lwindow} r} always pops up the Windows
|
||||
@samp{Run} dialog. Customizing the value of
|
||||
@code{w32-phantom-key-code} might help in some cases, though.}
|
||||
|
||||
@vindex w32-recognize-altgr
|
||||
@kindex AltGr @r{(MS-Windows)}
|
||||
@cindex AltGr key (MS-Windows)
|
||||
The variable @code{w32-recognize-altgr} controls whether the
|
||||
@key{AltGr} key (if it exists on your keyboard), or its equivalent,
|
||||
the combination of the right @key{Alt} and left @key{Ctrl} keys
|
||||
pressed together, is recognized as the @key{AltGr} key. The default
|
||||
is @code{t}, which means these keys produce @code{AltGr}; setting it
|
||||
to @code{nil} causes @key{AltGr} or the equivalent key combination to
|
||||
be interpreted as the combination of @key{CTRL} and @key{META}
|
||||
modifiers.
|
||||
@end ifnottex
|
||||
|
||||
@node Windows Mouse
|
||||
@section Mouse Usage on MS-Windows
|
||||
@cindex mouse, and MS-Windows
|
||||
|
||||
This section describes the Windows-specific variables related to
|
||||
mouse.
|
||||
|
||||
@vindex w32-mouse-button-tolerance
|
||||
@cindex simulation of middle mouse button
|
||||
The variable @code{w32-mouse-button-tolerance} specifies the
|
||||
time interval, in milliseconds, for faking middle mouse button press
|
||||
on 2-button mice. If both mouse buttons are depressed within this
|
||||
time interval, Emacs generates a middle mouse button click event
|
||||
instead of a double click on one of the buttons.
|
||||
|
||||
@vindex w32-pass-extra-mouse-buttons-to-system
|
||||
If the variable @code{w32-pass-extra-mouse-buttons-to-system} is
|
||||
non-@code{nil}, Emacs passes the fourth and fifth mouse buttons to
|
||||
Windows.
|
||||
|
||||
@vindex w32-swap-mouse-buttons
|
||||
The variable @code{w32-swap-mouse-buttons} controls which of the 3
|
||||
mouse buttons generates the @kbd{mouse-2} events. When it is
|
||||
@code{nil} (the default), the middle button generates @kbd{mouse-2}
|
||||
and the right button generates @kbd{mouse-3} events. If this variable
|
||||
is non-@code{nil}, the roles of these two buttons are reversed.
|
||||
|
||||
@node Windows Processes
|
||||
@section Subprocesses on Windows 9X/ME and Windows NT/2K/XP
|
||||
@cindex subprocesses on MS-Windows
|
||||
|
||||
@cindex DOS applications, running from Emacs
|
||||
Emacs compiled as a native Windows application (as opposed to the DOS
|
||||
version) includes full support for asynchronous subprocesses.
|
||||
In the Windows version, synchronous and asynchronous subprocesses work
|
||||
fine on both
|
||||
Windows 9X/ME and Windows NT/2K/XP as long as you run only 32-bit Windows
|
||||
applications. However, when you run a DOS application in a subprocess,
|
||||
you may encounter problems or be unable to run the application at all;
|
||||
and if you run two DOS applications at the same time in two
|
||||
subprocesses, you may have to reboot your system.
|
||||
|
||||
Since the standard command interpreter (and most command line utilities)
|
||||
on Windows 9X are DOS applications, these problems are significant when
|
||||
using that system. But there's nothing we can do about them; only
|
||||
Microsoft can fix them.
|
||||
|
||||
If you run just one DOS application subprocess, the subprocess should
|
||||
work as expected as long as it is ``well-behaved'' and does not perform
|
||||
direct screen access or other unusual actions. If you have a CPU
|
||||
monitor application, your machine will appear to be 100% busy even when
|
||||
the DOS application is idle, but this is only an artifact of the way CPU
|
||||
monitors measure processor load.
|
||||
|
||||
You must terminate the DOS application before you start any other DOS
|
||||
application in a different subprocess. Emacs is unable to interrupt or
|
||||
terminate a DOS subprocess. The only way you can terminate such a
|
||||
subprocess is by giving it a command that tells its program to exit.
|
||||
|
||||
If you attempt to run two DOS applications at the same time in separate
|
||||
subprocesses, the second one that is started will be suspended until the
|
||||
first one finishes, even if either or both of them are asynchronous.
|
||||
|
||||
@cindex kill DOS application
|
||||
If you can go to the first subprocess, and tell it to exit, the second
|
||||
subprocess should continue normally. However, if the second subprocess
|
||||
is synchronous, Emacs itself will be hung until the first subprocess
|
||||
finishes. If it will not finish without user input, then you have no
|
||||
choice but to reboot if you are running on Windows 9X. If you are
|
||||
running on Windows NT/2K/XP, you can use a process viewer application to kill
|
||||
the appropriate instance of NTVDM instead (this will terminate both DOS
|
||||
subprocesses).
|
||||
|
||||
If you have to reboot Windows 9X in this situation, do not use the
|
||||
@code{Shutdown} command on the @code{Start} menu; that usually hangs the
|
||||
system. Instead, type @kbd{CTL-ALT-@key{DEL}} and then choose
|
||||
@code{Shutdown}. That usually works, although it may take a few minutes
|
||||
to do its job.
|
||||
|
||||
@vindex w32-quote-process-args
|
||||
The variable @code{w32-quote-process-args} controls how Emacs quotes
|
||||
the process arguments. Non-@code{nil} means quote with the @code{"}
|
||||
character. If the value is a character, use that character to escape
|
||||
any quote characters that appear; otherwise chose a suitable escape
|
||||
character based on the type of the program.
|
||||
|
||||
@ifnottex
|
||||
@findex w32-shell-execute
|
||||
The function @code{w32-shell-execute} can be useful for writing
|
||||
customized commands that run MS-Windows applications registered to
|
||||
handle a certain standard Windows operation for a specific type of
|
||||
document or file. This function is a wrapper around the Windows
|
||||
@code{ShellExecute} API. See the MS-Windows API documentation for
|
||||
more details.
|
||||
@end ifnottex
|
||||
|
||||
@node Windows Printing
|
||||
@section Printing and MS-Windows
|
||||
|
||||
Printing commands, such as @code{lpr-buffer} (@pxref{Printing}) and
|
||||
@code{ps-print-buffer} (@pxref{PostScript}) work in MS-DOS and
|
||||
MS-Windows by sending the output to one of the printer ports, if a
|
||||
Posix-style @code{lpr} program is unavailable. The same Emacs
|
||||
variables control printing on all systems, but in some cases they have
|
||||
different default values on MS-DOS and MS-Windows.
|
||||
|
||||
Emacs on Windows automatically determines your default printer and
|
||||
sets the variable @var{printer-name} to that printer's name. But in
|
||||
some rare cases this can fail, or you may wish to use a different
|
||||
printer from within Emacs. The rest of this section explains how to
|
||||
tell Emacs which printer to use.
|
||||
|
||||
@vindex printer-name@r{, (MS-DOS/MW-Windows)}
|
||||
If you want to use your local printer, then set the Lisp variable
|
||||
@code{lpr-command} to @code{""} (its default value on Windows) and
|
||||
@code{printer-name} to the name of the printer port---for example,
|
||||
@code{"PRN"}, the usual local printer port or @code{"LPT2"}, or
|
||||
@code{"COM1"} for a serial printer. You can also set
|
||||
@code{printer-name} to a file name, in which case ``printed'' output
|
||||
is actually appended to that file. If you set @code{printer-name} to
|
||||
@code{"NUL"}, printed output is silently discarded (sent to the system
|
||||
null device).
|
||||
|
||||
You can also use a printer shared by another machine by setting
|
||||
@code{printer-name} to the UNC share name for that printer---for
|
||||
example, @code{"//joes_pc/hp4si"}. (It doesn't matter whether you use
|
||||
forward slashes or backslashes here.) To find out the names of shared
|
||||
printers, run the command @samp{net view} from the command prompt to
|
||||
obtain a list of servers, and @samp{net view @var{server-name}} to see
|
||||
the names of printers (and directories) shared by that server.
|
||||
Alternatively, click the @samp{Network Neighborhood} icon on your
|
||||
desktop, and look for machines which share their printers via the
|
||||
network.
|
||||
|
||||
@cindex @samp{net use}, and printing on MS-Windows
|
||||
@cindex networked printers (MS-Windows)
|
||||
If the printer doesn't appear in the output of @samp{net view}, or
|
||||
if setting @code{printer-name} to the UNC share name doesn't produce a
|
||||
hardcopy on that printer, you can use the @samp{net use} command to
|
||||
connect a local print port such as @code{"LPT2"} to the networked
|
||||
printer. For example, typing @kbd{net use LPT2: \\joes_pc\hp4si}@footnote{
|
||||
Note that the @samp{net use} command requires the UNC share name to be
|
||||
typed with the Windows-style backslashes, while the value of
|
||||
@code{printer-name} can be set with either forward- or backslashes.}
|
||||
causes Windows to @dfn{capture} the @code{LPT2} port and redirect the
|
||||
printed material to the printer connected to the machine @code{joes_pc}.
|
||||
After this command, setting @code{printer-name} to @code{"LPT2"}
|
||||
should produce the hardcopy on the networked printer.
|
||||
|
||||
With some varieties of Windows network software, you can instruct
|
||||
Windows to capture a specific printer port such as @code{"LPT2"}, and
|
||||
redirect it to a networked printer via the @w{@code{Control
|
||||
Panel->Printers}} applet instead of @samp{net use}.
|
||||
|
||||
If you set @code{printer-name} to a file name, it's best to use an
|
||||
absolute file name. Emacs changes the working directory according to
|
||||
the default directory of the current buffer, so if the file name in
|
||||
@code{printer-name} is relative, you will end up with several such
|
||||
files, each one in the directory of the buffer from which the printing
|
||||
was done.
|
||||
|
||||
If the value of @code{printer-name} is correct, but printing does
|
||||
not produce the hardcopy on your printer, it is possible that your
|
||||
printer does not support printing plain text (some cheap printers omit
|
||||
this functionality). In that case, try the PostScript print commands,
|
||||
described below.
|
||||
|
||||
@findex print-buffer @r{(MS-DOS)}
|
||||
@findex print-region @r{(MS-DOS)}
|
||||
@vindex lpr-headers-switches @r{(MS-DOS)}
|
||||
The commands @code{print-buffer} and @code{print-region} call the
|
||||
@code{pr} program, or use special switches to the @code{lpr} program, to
|
||||
produce headers on each printed page. MS-DOS and MS-Windows don't
|
||||
normally have these programs, so by default, the variable
|
||||
@code{lpr-headers-switches} is set so that the requests to print page
|
||||
headers are silently ignored. Thus, @code{print-buffer} and
|
||||
@code{print-region} produce the same output as @code{lpr-buffer} and
|
||||
@code{lpr-region}, respectively. If you do have a suitable @code{pr}
|
||||
program (for example, from GNU Coreutils), set
|
||||
@code{lpr-headers-switches} to @code{nil}; Emacs will then call
|
||||
@code{pr} to produce the page headers, and print the resulting output as
|
||||
specified by @code{printer-name}.
|
||||
|
||||
@vindex print-region-function @r{(MS-DOS)}
|
||||
@cindex lpr usage under MS-DOS
|
||||
@vindex lpr-command @r{(MS-DOS)}
|
||||
@vindex lpr-switches @r{(MS-DOS)}
|
||||
Finally, if you do have an @code{lpr} work-alike, you can set the
|
||||
variable @code{lpr-command} to @code{"lpr"}. Then Emacs will use
|
||||
@code{lpr} for printing, as on other systems. (If the name of the
|
||||
program isn't @code{lpr}, set @code{lpr-command} to specify where to
|
||||
find it.) The variable @code{lpr-switches} has its standard meaning
|
||||
when @code{lpr-command} is not @code{""}. If the variable
|
||||
@code{printer-name} has a string value, it is used as the value for the
|
||||
@code{-P} option to @code{lpr}, as on Unix.
|
||||
|
||||
@findex ps-print-buffer @r{(MS-DOS)}
|
||||
@findex ps-spool-buffer @r{(MS-DOS)}
|
||||
@vindex ps-printer-name @r{(MS-DOS)}
|
||||
@vindex ps-lpr-command @r{(MS-DOS)}
|
||||
@vindex ps-lpr-switches @r{(MS-DOS)}
|
||||
A parallel set of variables, @code{ps-lpr-command},
|
||||
@code{ps-lpr-switches}, and @code{ps-printer-name} (@pxref{PostScript
|
||||
Variables}), defines how PostScript files should be printed. These
|
||||
variables are used in the same way as the corresponding variables
|
||||
described above for non-PostScript printing. Thus, the value of
|
||||
@code{ps-printer-name} is used as the name of the device (or file) to
|
||||
which PostScript output is sent, just as @code{printer-name} is used
|
||||
for non-PostScript printing. (There are two distinct sets of
|
||||
variables in case you have two printers attached to two different
|
||||
ports, and only one of them is a PostScript printer.)
|
||||
|
||||
The default value of the variable @code{ps-lpr-command} is @code{""},
|
||||
which causes PostScript output to be sent to the printer port specified
|
||||
by @code{ps-printer-name}, but @code{ps-lpr-command} can also be set to
|
||||
the name of a program which will accept PostScript files. Thus, if you
|
||||
have a non-PostScript printer, you can set this variable to the name of
|
||||
a PostScript interpreter program (such as Ghostscript). Any switches
|
||||
that need to be passed to the interpreter program are specified using
|
||||
@code{ps-lpr-switches}. (If the value of @code{ps-printer-name} is a
|
||||
string, it will be added to the list of switches as the value for the
|
||||
@code{-P} option. This is probably only useful if you are using
|
||||
@code{lpr}, so when using an interpreter typically you would set
|
||||
@code{ps-printer-name} to something other than a string so it is
|
||||
ignored.)
|
||||
|
||||
For example, to use Ghostscript for printing on the system's default
|
||||
printer, put this in your @file{.emacs} file:
|
||||
|
||||
@example
|
||||
(setq ps-printer-name t)
|
||||
(setq ps-lpr-command "D:/gs6.01/bin/gswin32c.exe")
|
||||
(setq ps-lpr-switches '("-q" "-dNOPAUSE" "-dBATCH"
|
||||
"-sDEVICE=mswinpr2"
|
||||
"-sPAPERSIZE=a4"))
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
(This assumes that Ghostscript is installed in the
|
||||
@file{D:/gs6.01} directory.)
|
||||
|
||||
@node Windows Misc
|
||||
@section Miscellaneous Windows-specific features
|
||||
|
||||
This section describes miscellaneous Windows-specific features.
|
||||
|
||||
@vindex w32-use-visible-system-caret
|
||||
@cindex screen reader software, MS-Windows
|
||||
The variable @code{w32-use-visible-system-caret} is a flag that
|
||||
determines whether to make the system caret visible. The default is
|
||||
@code{nil}, which means Emacs draws its own cursor to indicate the
|
||||
position of point. A non-@code{nil} value means Emacs will indicate
|
||||
point location by the system caret; this facilitates use of screen
|
||||
reader software. When this variable is non-@code{nil}, other
|
||||
variables affecting the cursor display have no effect.
|
||||
|
||||
@iftex
|
||||
@inforef{Windows Misc, , emacs}, for information about additional
|
||||
Windows-specific variables in this category.
|
||||
@end iftex
|
||||
|
||||
@ifnottex
|
||||
@vindex w32-grab-focus-on-raise
|
||||
@cindex frame focus policy, MS-Windows
|
||||
The variable @code{w32-grab-focus-on-raise}, if set to a
|
||||
non-@code{nil} value causes a frame to grab focus when it is raised.
|
||||
The default is @code{t}, which fits well with the Windows default
|
||||
click-to-focus policy.
|
||||
|
||||
@vindex w32-list-proportional-fonts
|
||||
The variable @code{w32-list-proportional-fonts} controls whether
|
||||
proportional fonts are included in the font selection dialog. If its
|
||||
value is non-@code{nil}, these fonts will be included. The default is
|
||||
@code{nil}.
|
||||
@end ifnottex
|
||||
|
||||
@ifnottex
|
||||
@include msdog-xtra.texi
|
||||
@end ifnottex
|
||||
|
||||
@ignore
|
||||
arch-tag: f39d2590-5dcc-4318-88d9-0eb73ca10fa2
|
||||
@end ignore
|
1535
man/mule.texi
1535
man/mule.texi
File diff suppressed because it is too large
Load diff
|
@ -1,290 +0,0 @@
|
|||
\input texinfo @c -*-texinfo-*-
|
||||
@comment %**start of header
|
||||
@setfilename ../info/newsticker
|
||||
@set VERSION 1.9
|
||||
@set UPDATED November 2005
|
||||
@settitle Newsticker @value{VERSION}
|
||||
@syncodeindex vr cp
|
||||
@syncodeindex fn cp
|
||||
@syncodeindex pg cp
|
||||
@comment %**end of header
|
||||
|
||||
@copying
|
||||
This manual is for Newsticker (version @value{VERSION}, @value{UPDATED}).
|
||||
|
||||
@noindent
|
||||
Copyright @copyright{} 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
|
||||
and with the Back-Cover Texts as in (a) below. A copy of the license
|
||||
is included in the section entitled ``GNU Free Documentation License''
|
||||
in the Emacs manual.
|
||||
|
||||
(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
|
||||
this GNU Manual, like GNU software. Copies published by the Free
|
||||
Software Foundation raise funds for GNU development.''
|
||||
|
||||
This document is part of a collection distributed under the GNU Free
|
||||
Documentation License. If you want to distribute this document
|
||||
separately from the collection, you can do so by adding a copy of the
|
||||
license to the document, as described in section 6 of the license.
|
||||
@end quotation
|
||||
@end copying
|
||||
|
||||
@dircategory Emacs
|
||||
@direntry
|
||||
* Newsticker: (newsticker). A Newsticker for Emacs.
|
||||
@end direntry
|
||||
|
||||
@titlepage
|
||||
@title Newsticker -- a Newsticker for Emacs
|
||||
@subtitle for version @value{VERSION}, @value{UPDATED}
|
||||
@author Ulf Jasper
|
||||
@author @email{ulf.jasper@@web.de}
|
||||
@author @uref{http://de.geocities.com/ulf_jasper}
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
@insertcopying
|
||||
@end titlepage
|
||||
|
||||
@contents
|
||||
|
||||
@ifnottex
|
||||
@node Top
|
||||
@top Newsticker
|
||||
@end ifnottex
|
||||
|
||||
@menu
|
||||
* Overview:: General description of newsticker.
|
||||
* Requirements:: Requirements for using newsticker.
|
||||
* Installation:: Installing newsticker on your system.
|
||||
* Usage:: Basic newsticker instructions.
|
||||
* Configuration:: Customizable newsticker settings.
|
||||
* Remarks:: Remarks about newsticker.
|
||||
* GNU Free Documentation License:: The license for this documentation.
|
||||
* Index:: Variable, function, and concept index.
|
||||
@end menu
|
||||
|
||||
@node Overview
|
||||
@chapter Overview
|
||||
|
||||
Newsticker provides a newsticker for Emacs. A newsticker is a thing
|
||||
that asynchronously retrieves headlines from a list of news sites,
|
||||
prepares these headlines for reading, and allows for loading the
|
||||
corresponding articles in a web browser.
|
||||
|
||||
|
||||
Headlines consist of a title and (possibly) a small description. They
|
||||
are contained in "RSS" (RDF Site Summary) or "Atom" files. Newsticker
|
||||
should work with the following RSS formats:
|
||||
|
||||
@itemize
|
||||
@item RSS 0.91 (see @uref{http://backend.userland.com/rss091} or
|
||||
@uref{http://my.netscape.com/publish/formats/rss-spec-0.91.html}),
|
||||
@item RSS 0.92 (see @uref{http://backend.userland.com/rss092}),
|
||||
@item RSS 1.0 (see @uref{http://purl.org/rss/1.0/spec}
|
||||
@item RSS 2.0 (see @uref{http://blogs.law.harvard.edu/tech/rss}),
|
||||
@end itemize
|
||||
@itemize
|
||||
as well as the following Atom formats:
|
||||
@item Atom 0.3
|
||||
@item Atom 1.0 (see
|
||||
@uref{http://www.ietf.org/internet-drafts/draft-ietf-atompub-format-11.txt}).
|
||||
@end itemize
|
||||
|
||||
That makes Newsticker.el an "Atom aggregator, "RSS reader", or "RSS
|
||||
aggregator".
|
||||
|
||||
Newsticker provides several commands for reading headlines, navigating
|
||||
through them, marking them as read/unread, hiding old headlines etc.
|
||||
Headlines can be displayed as plain text or as rendered HTML.
|
||||
|
||||
Headlines can be displayed in the echo area, either scrolling like
|
||||
messages in a stock-quote ticker, or just changing.
|
||||
|
||||
Newsticker allows for automatic processing of headlines by providing
|
||||
hooks and (sample) functions for automatically downloading images and
|
||||
enclosed files (as delivered by podcasts, e.g.).
|
||||
|
||||
@ifhtml
|
||||
Here are screen shots of the @uref{newsticker-1.7.png, version 1.7
|
||||
(current version)} and some older screen shots:
|
||||
@uref{newsticker-1.6.png, version 1.6},
|
||||
@uref{newsticker-1.5.png, version 1.5},
|
||||
@uref{newsticker-1.4.png, version 1.4}
|
||||
@uref{newsticker-1.3.png, version 1.3},
|
||||
@uref{newsticker-1.0.png, version 1.0}.
|
||||
@end ifhtml
|
||||
|
||||
@node Requirements
|
||||
@chapter Requirements
|
||||
|
||||
Newsticker can be used with
|
||||
@uref{http://www.gnu.org/software/emacs/emacs.html, GNU Emacs} version
|
||||
21.1 or later as well as @uref{http://www.xemacs.org, XEmacs}. It
|
||||
requires an XML-parser (@file{xml.el}) which is part of GNU Emacs. If
|
||||
you are using XEmacs you want to get the @file{net-utils} package
|
||||
which contains @file{xml.el} for XEmacs.
|
||||
|
||||
Newsticker requires a program which can retrieve files via http and
|
||||
prints them to stdout. By default Newsticker will use
|
||||
@uref{http://www.gnu.org/software/wget/wget.html, wget} for this task.
|
||||
|
||||
|
||||
@node Installation
|
||||
@chapter Installation
|
||||
|
||||
As Newsticker is part of GNU Emacs there is no need to perform any
|
||||
installation steps in order to use Newsticker.
|
||||
|
||||
However, if you are using imenu, which allows for navigating with the
|
||||
help of a menu, you should add the following to your Emacs startup file
|
||||
(@file{~/.emacs}).
|
||||
|
||||
@lisp
|
||||
(add-hook 'newsticker-mode-hook 'imenu-add-menubar-index)
|
||||
@end lisp
|
||||
|
||||
That's it.
|
||||
|
||||
@node Usage
|
||||
@chapter Usage
|
||||
|
||||
@findex newsticker-show-news
|
||||
The command @code{newsticker-show-news} will display all available
|
||||
headlines in a special buffer, called @samp{*newsticker*}. It will
|
||||
also start the asynchronous download of headlines. The modeline in
|
||||
the @samp{*newsticker*} buffer informs whenever new headlines have
|
||||
arrived. Clicking mouse-button 2 or pressing RET in this buffer on a
|
||||
headline will call @code{browse-url} to load the corresponding news
|
||||
story in your favourite web browser.
|
||||
|
||||
@findex newsticker-start-ticker
|
||||
@findex newsticker-stop-ticker
|
||||
The scrolling, or flashing of headlines in the echo area, can be
|
||||
started with the command @code{newsticker-start-ticker}. It can be
|
||||
stopped with @code{newsticker-stop-ticker}.
|
||||
|
||||
@findex newsticker-start
|
||||
@findex newsticker-stop
|
||||
If you just want to start the periodic download of headlines use the
|
||||
command @code{newsticker-start}. Calling @code{newsticker-stop} will
|
||||
stop the periodic download, but will call
|
||||
@code{newsticker-stop-ticker} as well.
|
||||
|
||||
@node Configuration
|
||||
@chapter Configuration
|
||||
|
||||
All Newsticker options are customizable, i.e. they can be changed with
|
||||
Emacs customization methods: Call the command
|
||||
@code{customize-group} and enter @samp{newsticker} for the customization
|
||||
group.
|
||||
|
||||
All Newsticker options have reasonable default values, so that in most
|
||||
cases it is not necessary to customize settings before starting Newsticker
|
||||
for the first time.
|
||||
|
||||
Newsticker options are organized in the following groups.
|
||||
|
||||
@itemize
|
||||
|
||||
@item
|
||||
@code{newsticker-feed} contains options that define which news
|
||||
feeds are retrieved and how this is done.
|
||||
|
||||
@itemize
|
||||
@item
|
||||
@vindex newsticker-url-list
|
||||
@code{newsticker-url-list} defines the list of headlines which are
|
||||
retrieved.
|
||||
@item
|
||||
@vindex newsticker-retrieval-interval
|
||||
@code{newsticker-retrieval-interval} defines how often headlines
|
||||
are retrieved.
|
||||
@end itemize
|
||||
|
||||
@item
|
||||
@code{newsticker-headline-processing} contains options that define
|
||||
how the retrieved headlines are processed.
|
||||
|
||||
@itemize
|
||||
@item
|
||||
@vindex newsticker-keep-obsolete-items
|
||||
@code{newsticker-keep-obsolete-items} decides whether unread
|
||||
headlines that have been removed from the feed are kept in the
|
||||
Newsticker cache.
|
||||
@end itemize
|
||||
|
||||
@item
|
||||
@code{newsticker-layout} contains options that define how the
|
||||
buffer for reading news headlines is formatted.
|
||||
|
||||
@itemize
|
||||
@item
|
||||
@vindex newsticker-heading-format
|
||||
@code{newsticker-item-format} defines how the title of a headline
|
||||
is formatted.
|
||||
@end itemize
|
||||
|
||||
@item
|
||||
@code{newsticker-ticker} contains options that define how headlines
|
||||
are shown in the echo area.
|
||||
|
||||
@itemize
|
||||
@item
|
||||
@vindex newsticker-display-interval
|
||||
@vindex newsticker-scroll-smoothly
|
||||
@code{newsticker-display-interval} and
|
||||
@code{newsticker-scroll-smoothly} define how headlines are shown in
|
||||
the echo area.
|
||||
@end itemize
|
||||
|
||||
@item
|
||||
@code{newsticker-hooks} contains options for hooking other Emacs
|
||||
commands to newsticker functions.
|
||||
@itemize
|
||||
@item
|
||||
@vindex newsticker-new-item-functions
|
||||
@code{newsticker-new-item-functions} allows for automatic
|
||||
processing of headlines. See `newsticker-download-images', and
|
||||
`newsticker-download-enclosures' for sample functions.
|
||||
@end itemize
|
||||
|
||||
@item
|
||||
@code{newsticker-miscellaneous} contains other Newsticker options.
|
||||
|
||||
@end itemize
|
||||
|
||||
Please have a look at the customization buffers for the complete list
|
||||
of options.
|
||||
|
||||
@node Remarks
|
||||
@chapter Remarks
|
||||
|
||||
This newsticker is designed do its job silently in the background
|
||||
without disturbing you. However, it is probably impossible to prevent
|
||||
such a tool from slightly attenuating your Editor's responsiveness
|
||||
every once in a while.
|
||||
|
||||
Byte-compiling newsticker.el is recommended.
|
||||
|
||||
@node GNU Free Documentation License
|
||||
@appendix GNU Free Documentation License
|
||||
@include doclicense.texi
|
||||
|
||||
@node Index
|
||||
@unnumbered Index
|
||||
|
||||
@printindex cp
|
||||
|
||||
@bye
|
||||
|
||||
|
||||
|
||||
@ignore
|
||||
arch-tag: 7a4de539-117c-4658-b799-0b9e3d0ccec0
|
||||
@end ignore
|
7931
man/org.texi
7931
man/org.texi
File diff suppressed because it is too large
Load diff
1443
man/pcl-cvs.texi
1443
man/pcl-cvs.texi
File diff suppressed because it is too large
Load diff
498
man/pgg.texi
498
man/pgg.texi
|
@ -1,498 +0,0 @@
|
|||
\input texinfo @c -*-texinfo-*-
|
||||
|
||||
@setfilename ../info/pgg
|
||||
|
||||
@set VERSION 0.1
|
||||
|
||||
|
||||
@copying
|
||||
This file describes PGG, an Emacs interface to various PGP implementations.
|
||||
|
||||
Copyright @copyright{} 2001, 2003, 2004, 2005, 2006, 2007 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||
Texts. A copy of the license is included in the section entitled ``GNU
|
||||
Free Documentation License.''
|
||||
@end quotation
|
||||
@end copying
|
||||
|
||||
@dircategory Emacs
|
||||
@direntry
|
||||
* PGG: (pgg). Emacs interface to various PGP implementations.
|
||||
@end direntry
|
||||
|
||||
@settitle PGG @value{VERSION}
|
||||
|
||||
|
||||
@titlepage
|
||||
@title PGG
|
||||
|
||||
@author by Daiki Ueno
|
||||
@page
|
||||
|
||||
@vskip 0pt plus 1filll
|
||||
@insertcopying
|
||||
@end titlepage
|
||||
@page
|
||||
|
||||
@node Top
|
||||
@top PGG
|
||||
This manual describes PGG. PGG is an interface library between Emacs
|
||||
and various tools for secure communication. PGG also provides a simple
|
||||
user interface to encrypt, decrypt, sign, and verify MIME messages.
|
||||
|
||||
@menu
|
||||
* Overview:: What PGG is.
|
||||
* Prerequisites:: Complicated stuff you may have to do.
|
||||
* How to use:: Getting started quickly.
|
||||
* Architecture::
|
||||
* Parsing OpenPGP packets::
|
||||
* GNU Free Documentation License:: The license for this documentation.
|
||||
* Function Index::
|
||||
* Variable Index::
|
||||
@end menu
|
||||
|
||||
@node Overview
|
||||
@chapter Overview
|
||||
|
||||
PGG is an interface library between Emacs and various tools for secure
|
||||
communication. Even though Mailcrypt has similar feature, it does not
|
||||
deal with detached PGP messages, normally used in PGP/MIME
|
||||
infrastructure. This was the main reason why I wrote the new library.
|
||||
|
||||
PGP/MIME is an application of MIME Object Security Services (RFC1848).
|
||||
The standard is documented in RFC2015.
|
||||
|
||||
@node Prerequisites
|
||||
@chapter Prerequisites
|
||||
|
||||
PGG requires at least one implementation of privacy guard system.
|
||||
This document assumes that you have already obtained and installed them
|
||||
and that you are familiar with its basic functions.
|
||||
|
||||
By default, PGG uses GnuPG. If you are new to such a system, I
|
||||
recommend that you should look over the GNU Privacy Handbook (GPH)
|
||||
which is available at @uref{http://www.gnupg.org/documentation/}.
|
||||
|
||||
When using GnuPG, we recommend the use of the @code{gpg-agent}
|
||||
program, which is distributed with versions 2.0 and later of GnuPG.
|
||||
This is a daemon to manage private keys independently from any
|
||||
protocol, and provides the most secure way to input and cache your
|
||||
passphrases (@pxref{Caching passphrase}). By default, PGG will
|
||||
attempt to use @code{gpg-agent} if it is running. @xref{Invoking
|
||||
GPG-AGENT,,,gnupg,Using the GNU Privacy Guard}.
|
||||
|
||||
PGG also supports Pretty Good Privacy version 2 or version 5.
|
||||
|
||||
@node How to use
|
||||
@chapter How to use
|
||||
|
||||
The toplevel interface of this library is quite simple, and only
|
||||
intended to use with public-key cryptographic operation.
|
||||
|
||||
To use PGG, evaluate following expression at the beginning of your
|
||||
application program.
|
||||
|
||||
@lisp
|
||||
(require 'pgg)
|
||||
@end lisp
|
||||
|
||||
If you want to check existence of pgg.el at runtime, instead you can
|
||||
list autoload setting for desired functions as follows.
|
||||
|
||||
@lisp
|
||||
(autoload 'pgg-encrypt-region "pgg"
|
||||
"Encrypt the current region." t)
|
||||
(autoload 'pgg-encrypt-symmetric-region "pgg"
|
||||
"Encrypt the current region with symmetric algorithm." t)
|
||||
(autoload 'pgg-decrypt-region "pgg"
|
||||
"Decrypt the current region." t)
|
||||
(autoload 'pgg-sign-region "pgg"
|
||||
"Sign the current region." t)
|
||||
(autoload 'pgg-verify-region "pgg"
|
||||
"Verify the current region." t)
|
||||
(autoload 'pgg-insert-key "pgg"
|
||||
"Insert the ASCII armored public key." t)
|
||||
(autoload 'pgg-snarf-keys-region "pgg"
|
||||
"Import public keys in the current region." t)
|
||||
@end lisp
|
||||
|
||||
@menu
|
||||
* User Commands::
|
||||
* Selecting an implementation::
|
||||
* Caching passphrase::
|
||||
* Default user identity::
|
||||
@end menu
|
||||
|
||||
@node User Commands
|
||||
@section User Commands
|
||||
|
||||
At this time you can use some cryptographic commands. The behavior of
|
||||
these commands relies on a fashion of invocation because they are also
|
||||
intended to be used as library functions. In case you don't have the
|
||||
signer's public key, for example, the function @code{pgg-verify-region}
|
||||
fails immediately, but if the function had been called interactively, it
|
||||
would ask you to retrieve the signer's public key from the server.
|
||||
|
||||
@deffn Command pgg-encrypt-region start end recipients &optional sign passphrase
|
||||
Encrypt the current region between @var{start} and @var{end} for
|
||||
@var{recipients}. When the function were called interactively, you
|
||||
would be asked about the recipients.
|
||||
|
||||
If encryption is successful, it replaces the current region contents (in
|
||||
the accessible portion) with the resulting data.
|
||||
|
||||
If optional argument @var{sign} is non-@code{nil}, the function is
|
||||
request to do a combined sign and encrypt. This currently is
|
||||
confirmed to work with GnuPG, but might not work with PGP or PGP5.
|
||||
|
||||
If optional @var{passphrase} is @code{nil}, the passphrase will be
|
||||
obtained from the passphrase cache or user.
|
||||
@end deffn
|
||||
|
||||
@deffn Command pgg-encrypt-symmetric-region &optional start end passphrase
|
||||
Encrypt the current region between @var{start} and @var{end} using a
|
||||
symmetric cipher. After invocation you are asked for a passphrase.
|
||||
|
||||
If optional @var{passphrase} is @code{nil}, the passphrase will be
|
||||
obtained from the passphrase cache or user.
|
||||
|
||||
symmetric-cipher encryption is currently only implemented for GnuPG.
|
||||
@end deffn
|
||||
|
||||
@deffn Command pgg-decrypt-region start end &optional passphrase
|
||||
Decrypt the current region between @var{start} and @var{end}. If
|
||||
decryption is successful, it replaces the current region contents (in
|
||||
the accessible portion) with the resulting data.
|
||||
|
||||
If optional @var{passphrase} is @code{nil}, the passphrase will be
|
||||
obtained from the passphrase cache or user.
|
||||
@end deffn
|
||||
|
||||
@deffn Command pgg-sign-region start end &optional cleartext passphrase
|
||||
Make the signature from text between @var{start} and @var{end}. If the
|
||||
optional third argument @var{cleartext} is non-@code{nil}, or the
|
||||
function is called interactively, it does not create a detached
|
||||
signature. In such a case, it replaces the current region contents (in
|
||||
the accessible portion) with the resulting data.
|
||||
|
||||
If optional @var{passphrase} is @code{nil}, the passphrase will be
|
||||
obtained from the passphrase cache or user.
|
||||
@end deffn
|
||||
|
||||
@deffn Command pgg-verify-region start end &optional signature fetch
|
||||
Verify the current region between @var{start} and @var{end}. If the
|
||||
optional third argument @var{signature} is non-@code{nil}, it is treated
|
||||
as the detached signature file of the current region.
|
||||
|
||||
If the optional 4th argument @var{fetch} is non-@code{nil}, or the
|
||||
function is called interactively, we attempt to fetch the signer's
|
||||
public key from the key server.
|
||||
@end deffn
|
||||
|
||||
@deffn Command pgg-insert-key
|
||||
Retrieve the user's public key and insert it as ASCII-armored format.
|
||||
@end deffn
|
||||
|
||||
@deffn Command pgg-snarf-keys-region start end
|
||||
Collect public keys in the current region between @var{start} and
|
||||
@var{end}, and add them into the user's keyring.
|
||||
@end deffn
|
||||
|
||||
@node Selecting an implementation
|
||||
@section Selecting an implementation
|
||||
|
||||
Since PGP has a long history and there are a number of PGP
|
||||
implementations available today, the function which each one has differs
|
||||
considerably. For example, if you are using GnuPG, you know you can
|
||||
select cipher algorithm from 3DES, CAST5, BLOWFISH, and so on, but on
|
||||
the other hand the version 2 of PGP only supports IDEA.
|
||||
|
||||
Which implementation is used is controlled by the @code{pgg-scheme}
|
||||
variable. If it is @code{nil} (the default), the value of the
|
||||
@code{pgg-default-scheme} variable will be used instead.
|
||||
|
||||
@defvar pgg-scheme
|
||||
Force specify the scheme of PGP implementation. The value can be set to
|
||||
@code{gpg}, @code{pgp}, and @code{pgp5}. The default is @code{nil}.
|
||||
@end defvar
|
||||
|
||||
@defvar pgg-default-scheme
|
||||
The default scheme of PGP implementation. The value should be one of
|
||||
@code{gpg}, @code{pgp}, and @code{pgp5}. The default is @code{gpg}.
|
||||
@end defvar
|
||||
|
||||
@node Caching passphrase
|
||||
@section Caching passphrase
|
||||
|
||||
When using GnuPG (gpg) as the PGP scheme, we recommend using a program
|
||||
called @code{gpg-agent} for entering and caching
|
||||
passphrases@footnote{Actually, @code{gpg-agent} does not cache
|
||||
passphrases but private keys. On the other hand, from a user's point
|
||||
of view, this technical difference isn't visible.}.
|
||||
|
||||
@defvar pgg-gpg-use-agent
|
||||
If non-@code{nil}, attempt to use @code{gpg-agent} whenever possible.
|
||||
The default is @code{t}. If @code{gpg-agent} is not running, or GnuPG
|
||||
is not the current PGP scheme, PGG's own passphrase-caching mechanism
|
||||
is used (see below).
|
||||
@end defvar
|
||||
|
||||
To use @code{gpg-agent} with PGG, you must first ensure that
|
||||
@code{gpg-agent} is running. For example, if you are running in the X
|
||||
Window System, you can do this by putting the following line in your
|
||||
@file{.xsession} file:
|
||||
|
||||
@smallexample
|
||||
eval "$(gpg-agent --daemon)"
|
||||
@end smallexample
|
||||
|
||||
For more details on invoking @code{gpg-agent}, @xref{Invoking
|
||||
GPG-AGENT,,,gnupg,Using the GNU Privacy Guard}.
|
||||
|
||||
Whenever you perform a PGG operation that requires a GnuPG passphrase,
|
||||
GnuPG will contact @code{gpg-agent}, which prompts you for the
|
||||
passphrase. Furthermore, @code{gpg-agent} ``caches'' the result, so
|
||||
that subsequent uses will not require you to enter the passphrase
|
||||
again. (This cache usually expires after a certain time has passed;
|
||||
you can change this using the @code{--default-cache-ttl} option when
|
||||
invoking @code{gpg-agent}.)
|
||||
|
||||
If you are running in a X Window System environment, @code{gpg-agent}
|
||||
prompts for a passphrase by opening a graphical window. However, if
|
||||
you are running Emacs on a text terminal, @code{gpg-agent} has trouble
|
||||
receiving input from the terminal, since it is being sent to Emacs.
|
||||
One workaround for this problem is to run @code{gpg-agent} on a
|
||||
different terminal from Emacs, with the @code{--keep-tty} option; this
|
||||
tells @code{gpg-agent} use its own terminal to prompt for passphrases.
|
||||
|
||||
When @code{gpg-agent} is not being used, PGG prompts for a passphrase
|
||||
through Emacs. It also has its own passphrase caching mechanism,
|
||||
which is controlled by the variable @code{pgg-cache-passphrase} (see
|
||||
below).
|
||||
|
||||
There is a security risk in handling passphrases through PGG rather
|
||||
than @code{gpg-agent}. When you enter your passphrase into an Emacs
|
||||
prompt, it is temporarily stored as a cleartext string in the memory
|
||||
of the Emacs executable. If the executable memory is swapped to disk,
|
||||
the root user can, in theory, extract the passphrase from the
|
||||
swapfile. Furthermore, the swapfile containing the cleartext
|
||||
passphrase might remain on the disk after the system is discarded or
|
||||
stolen. @code{gpg-agent} avoids this problem by using certain tricks,
|
||||
such as memory locking, which have not been implemented in Emacs.
|
||||
|
||||
@defvar pgg-cache-passphrase
|
||||
If non-@code{nil}, store passphrases. The default value of this
|
||||
variable is @code{t}. If you are worried about security issues,
|
||||
however, you could stop the caching of passphrases by setting this
|
||||
variable to @code{nil}.
|
||||
@end defvar
|
||||
|
||||
@defvar pgg-passphrase-cache-expiry
|
||||
Elapsed time for expiration in seconds.
|
||||
@end defvar
|
||||
|
||||
If your passphrase contains non-ASCII characters, you might need to
|
||||
specify the coding system to be used to encode your passphrases, since
|
||||
GnuPG treats them as a byte sequence, not as a character sequence.
|
||||
|
||||
@defvar pgg-passphrase-coding-system
|
||||
Coding system used to encode passphrase.
|
||||
@end defvar
|
||||
|
||||
@node Default user identity
|
||||
@section Default user identity
|
||||
|
||||
The PGP implementation is usually able to select the proper key to use
|
||||
for signing and decryption, but if you have more than one key, you may
|
||||
need to specify the key id to use.
|
||||
|
||||
@defvar pgg-default-user-id
|
||||
User ID of your default identity. It defaults to the value returned
|
||||
by @samp{(user-login-name)}. You can customize this variable.
|
||||
@end defvar
|
||||
|
||||
@defvar pgg-gpg-user-id
|
||||
User ID of the GnuPG default identity. It defaults to @samp{nil}.
|
||||
This overrides @samp{pgg-default-user-id}. You can customize this
|
||||
variable.
|
||||
@end defvar
|
||||
|
||||
@defvar pgg-pgp-user-id
|
||||
User ID of the PGP 2.x/6.x default identity. It defaults to
|
||||
@samp{nil}. This overrides @samp{pgg-default-user-id}. You can
|
||||
customize this variable.
|
||||
@end defvar
|
||||
|
||||
@defvar pgg-pgp5-user-id
|
||||
User ID of the PGP 5.x default identity. It defaults to @samp{nil}.
|
||||
This overrides @samp{pgg-default-user-id}. You can customize this
|
||||
variable.
|
||||
@end defvar
|
||||
|
||||
@node Architecture
|
||||
@chapter Architecture
|
||||
|
||||
PGG introduces the notion of a "scheme of PGP implementation" (used
|
||||
interchangeably with "scheme" in this document). This term refers to a
|
||||
singleton object wrapped with the luna object system.
|
||||
|
||||
Since PGG was designed for accessing and developing PGP functionality,
|
||||
the architecture had to be designed not just for interoperability but
|
||||
also for extensiblity. In this chapter we explore the architecture
|
||||
while finding out how to write the PGG backend.
|
||||
|
||||
@menu
|
||||
* Initializing::
|
||||
* Backend methods::
|
||||
* Getting output::
|
||||
@end menu
|
||||
|
||||
@node Initializing
|
||||
@section Initializing
|
||||
|
||||
A scheme must be initialized before it is used.
|
||||
It had better guarantee to keep only one instance of a scheme.
|
||||
|
||||
The following code is snipped out of @file{pgg-gpg.el}. Once an
|
||||
instance of @code{pgg-gpg} scheme is initialized, it's stored to the
|
||||
variable @code{pgg-scheme-gpg-instance} and will be reused from now on.
|
||||
|
||||
@lisp
|
||||
(defvar pgg-scheme-gpg-instance nil)
|
||||
|
||||
(defun pgg-make-scheme-gpg ()
|
||||
(or pgg-scheme-gpg-instance
|
||||
(setq pgg-scheme-gpg-instance
|
||||
(luna-make-entity 'pgg-scheme-gpg))))
|
||||
@end lisp
|
||||
|
||||
The name of the function must follow the
|
||||
regulation---@code{pgg-make-scheme-} follows the backend name.
|
||||
|
||||
@node Backend methods
|
||||
@section Backend methods
|
||||
|
||||
In each backend, these methods must be present. The output of these
|
||||
methods is stored in special buffers (@ref{Getting output}), so that
|
||||
these methods must tell the status of the execution.
|
||||
|
||||
@deffn Method pgg-scheme-lookup-key scheme string &optional type
|
||||
Return keys associated with @var{string}. If the optional third
|
||||
argument @var{type} is non-@code{nil}, it searches from the secret
|
||||
keyrings.
|
||||
@end deffn
|
||||
|
||||
@deffn Method pgg-scheme-encrypt-region scheme start end recipients &optional sign passphrase
|
||||
Encrypt the current region between @var{start} and @var{end} for
|
||||
@var{recipients}. If @var{sign} is non-@code{nil}, do a combined sign
|
||||
and encrypt. If encryption is successful, it returns @code{t},
|
||||
otherwise @code{nil}.
|
||||
@end deffn
|
||||
|
||||
@deffn Method pgg-scheme-encrypt-symmetric-region scheme start end &optional passphrase
|
||||
Encrypt the current region between @var{start} and @var{end} using a
|
||||
symmetric cipher and a passphrases. If encryption is successful, it
|
||||
returns @code{t}, otherwise @code{nil}. This function is currently only
|
||||
implemented for GnuPG.
|
||||
@end deffn
|
||||
|
||||
@deffn Method pgg-scheme-decrypt-region scheme start end &optional passphrase
|
||||
Decrypt the current region between @var{start} and @var{end}. If
|
||||
decryption is successful, it returns @code{t}, otherwise @code{nil}.
|
||||
@end deffn
|
||||
|
||||
@deffn Method pgg-scheme-sign-region scheme start end &optional cleartext passphrase
|
||||
Make the signature from text between @var{start} and @var{end}. If the
|
||||
optional third argument @var{cleartext} is non-@code{nil}, it does not
|
||||
create a detached signature. If signing is successful, it returns
|
||||
@code{t}, otherwise @code{nil}.
|
||||
@end deffn
|
||||
|
||||
@deffn Method pgg-scheme-verify-region scheme start end &optional signature
|
||||
Verify the current region between @var{start} and @var{end}. If the
|
||||
optional third argument @var{signature} is non-@code{nil}, it is treated
|
||||
as the detached signature of the current region. If the signature is
|
||||
successfully verified, it returns @code{t}, otherwise @code{nil}.
|
||||
@end deffn
|
||||
|
||||
@deffn Method pgg-scheme-insert-key scheme
|
||||
Retrieve the user's public key and insert it as ASCII-armored format.
|
||||
On success, it returns @code{t}, otherwise @code{nil}.
|
||||
@end deffn
|
||||
|
||||
@deffn Method pgg-scheme-snarf-keys-region scheme start end
|
||||
Collect public keys in the current region between @var{start} and
|
||||
@var{end}, and add them into the user's keyring.
|
||||
On success, it returns @code{t}, otherwise @code{nil}.
|
||||
@end deffn
|
||||
|
||||
@node Getting output
|
||||
@section Getting output
|
||||
|
||||
The output of the backend methods (@ref{Backend methods}) is stored in
|
||||
special buffers, so that these methods must tell the status of the
|
||||
execution.
|
||||
|
||||
@defvar pgg-errors-buffer
|
||||
The standard error output of the execution of the PGP command is stored
|
||||
here.
|
||||
@end defvar
|
||||
|
||||
@defvar pgg-output-buffer
|
||||
The standard output of the execution of the PGP command is stored here.
|
||||
@end defvar
|
||||
|
||||
@defvar pgg-status-buffer
|
||||
The rest of status information of the execution of the PGP command is
|
||||
stored here.
|
||||
@end defvar
|
||||
|
||||
@node Parsing OpenPGP packets
|
||||
@chapter Parsing OpenPGP packets
|
||||
|
||||
The format of OpenPGP messages is maintained in order to publish all
|
||||
necessary information needed to develop interoperable applications.
|
||||
The standard is documented in RFC 2440.
|
||||
|
||||
PGG has its own parser for the OpenPGP packets.
|
||||
|
||||
@defun pgg-parse-armor string
|
||||
List the sequence of packets in @var{string}.
|
||||
@end defun
|
||||
|
||||
@defun pgg-parse-armor-region start end
|
||||
List the sequence of packets in the current region between @var{start}
|
||||
and @var{end}.
|
||||
@end defun
|
||||
|
||||
@defvar pgg-ignore-packet-checksum
|
||||
If non-@code{nil}, don't check the checksum of the packets.
|
||||
@end defvar
|
||||
|
||||
@node GNU Free Documentation License
|
||||
@appendix GNU Free Documentation License
|
||||
@include doclicense.texi
|
||||
|
||||
@node Function Index
|
||||
@unnumbered Function Index
|
||||
@printindex fn
|
||||
|
||||
@node Variable Index
|
||||
@unnumbered Variable Index
|
||||
@printindex vr
|
||||
|
||||
@summarycontents
|
||||
@contents
|
||||
@bye
|
||||
|
||||
@c End:
|
||||
|
||||
@ignore
|
||||
arch-tag: 0c205838-34b9-41a5-b9d7-49ae57ccac85
|
||||
@end ignore
|
|
@ -1,291 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@c
|
||||
@c This file is included either in emacs-xtra.texi (when producing the
|
||||
@c printed version) or in the main Emacs manual (for the on-line version).
|
||||
@node Picture Mode
|
||||
@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 particularly 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}.
|
||||
Additional extensions to Picture mode can be found in
|
||||
@file{artist.el}.
|
||||
|
||||
@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
|
||||
@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
|
||||
@iftex
|
||||
(@pxref{Minor Modes,,, emacs, the Emacs Manual}.)
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Minor Modes}.)
|
||||
@end ifnottex
|
||||
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
|
||||
In Picture mode, the commands that normally delete or kill text,
|
||||
instead erase text (replacing it with spaces). @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 another line with the same
|
||||
contents below the current line.
|
||||
|
||||
@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
|
||||
@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 <
|
||||
@itemx C-c @key{LEFT}
|
||||
Move left after insertion (@code{picture-movement-left}).
|
||||
@item C-c >
|
||||
@itemx C-c @key{RIGHT}
|
||||
Move right after insertion (@code{picture-movement-right}).
|
||||
@item C-c ^
|
||||
@itemx C-c @key{UP}
|
||||
Move up after insertion (@code{picture-movement-up}).
|
||||
@item C-c .
|
||||
@itemx C-c @key{DOWN}
|
||||
Move down after insertion (@code{picture-movement-down}).
|
||||
@item C-c `
|
||||
@itemx C-c @key{HOME}
|
||||
Move up and left (``northwest'') after insertion (@code{picture-movement-nw}).
|
||||
@item C-c '
|
||||
@itemx C-c @key{PAGEUP}
|
||||
Move up and right (``northeast'') after insertion
|
||||
(@code{picture-movement-ne}).
|
||||
@item C-c /
|
||||
@itemx C-c @key{END}
|
||||
Move down and left (``southwest'') after insertion
|
||||
@*(@code{picture-movement-sw}).
|
||||
@item C-c \
|
||||
@itemx C-c @key{PAGEDOWN}
|
||||
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
|
||||
@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}.
|
||||
|
||||
@node Rectangles in 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.
|
||||
@iftex
|
||||
@xref{Rectangles,,, emacs, the Emacs Manual}.
|
||||
@end iftex
|
||||
@ifnottex
|
||||
@xref{Rectangles}.
|
||||
@end ifnottex
|
||||
|
||||
@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 that they overwrite 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.
|
||||
|
||||
@ignore
|
||||
arch-tag: 10e423ad-d896-42f2-a7e8-7018adeaf8c2
|
||||
@end ignore
|
1773
man/programs.texi
1773
man/programs.texi
File diff suppressed because it is too large
Load diff
768
man/rcirc.texi
768
man/rcirc.texi
|
@ -1,768 +0,0 @@
|
|||
\input texinfo
|
||||
@c %**start of header
|
||||
@setfilename ../info/rcirc
|
||||
@settitle rcirc Manual
|
||||
@c %**end of header
|
||||
|
||||
@copying
|
||||
Copyright @copyright{} 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
|
||||
and with the Back-Cover Texts as in (a) below. A copy of the license is
|
||||
included in the section entitled ``GNU Free Documentation License'' in
|
||||
the Emacs manual.
|
||||
|
||||
(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
|
||||
this GNU Manual, like GNU software. Copies published by the Free
|
||||
Software Foundation raise funds for GNU development.''
|
||||
|
||||
This document is part of a collection distributed under the GNU Free
|
||||
Documentation License. If you want to distribute this document
|
||||
separately from the collection, you can do so by adding a copy of the
|
||||
license to the document, as described in section 6 of the license.
|
||||
@end quotation
|
||||
@end copying
|
||||
|
||||
@dircategory Emacs
|
||||
@direntry
|
||||
* Rcirc: (rcirc). Internet Relay Chat (IRC) client.
|
||||
@end direntry
|
||||
|
||||
@titlepage
|
||||
@title rcirc Manual
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
@insertcopying
|
||||
@end titlepage
|
||||
|
||||
@ifnottex
|
||||
@node Top, Basics, (dir), (dir)
|
||||
@top rcirc Manual
|
||||
@end ifnottex
|
||||
|
||||
@code{rcirc} is an Emacs IRC client.
|
||||
|
||||
IRC (Internet Relay Chat) is a multi-user chat protocol. Users
|
||||
communicate with each other in real-time. Communication occurs both in
|
||||
topic channels which are collections of many users, or privately, with
|
||||
just one other user.
|
||||
|
||||
@menu
|
||||
* Basics::
|
||||
* Reference::
|
||||
* Hacking and Tweaking::
|
||||
* GNU Free Documentation License::
|
||||
* Key Index::
|
||||
* Variable Index::
|
||||
* Index::
|
||||
|
||||
@detailmenu
|
||||
--- The Detailed Node Listing ---
|
||||
|
||||
Basics
|
||||
|
||||
* Internet Relay Chat::
|
||||
* Getting started with rcirc::
|
||||
|
||||
Reference
|
||||
|
||||
* rcirc commands::
|
||||
* Useful IRC commands::
|
||||
* Configuration::
|
||||
|
||||
Hacking and Tweaking
|
||||
|
||||
* Skipping /away messages using handlers::
|
||||
* Using fly spell mode::
|
||||
* Scrolling conservatively::
|
||||
* Changing the time stamp format::
|
||||
* Defining a new command::
|
||||
* Reconnecting after you have lost the connection::
|
||||
|
||||
@end detailmenu
|
||||
@end menu
|
||||
|
||||
@node Basics, Reference, Top, Top
|
||||
@chapter Basics
|
||||
|
||||
This chapter contains a brief introduction to IRC (Internet Relay Chat),
|
||||
and a quick tutorial on @code{rcirc}.
|
||||
|
||||
@menu
|
||||
* Internet Relay Chat::
|
||||
* Getting started with rcirc::
|
||||
@end menu
|
||||
|
||||
@node Internet Relay Chat, Getting started with rcirc, Basics, Basics
|
||||
@section Internet Relay Chat
|
||||
@cindex internet relay chat
|
||||
@cindex irc
|
||||
|
||||
@cindex channel
|
||||
@dfn{Internet Relay Chat} (IRC) is a form of instant communication over the
|
||||
Internet. It is mainly designed for group (many-to-many) communication
|
||||
in discussion forums called channels, but also allows one-to-one
|
||||
communication.
|
||||
|
||||
@cindex instant messaging, comparison
|
||||
@cindex server
|
||||
@cindex network
|
||||
Contrary to most Instant Messenger (IM) systems, users usually don't
|
||||
connect to a central server. Instead, users connect to a random server
|
||||
in a network, and the servers share information between them.
|
||||
|
||||
Here's a typical example:
|
||||
|
||||
@cindex redirection to random servers
|
||||
When you connect to the Freenode network
|
||||
(@code{http://freenode.net/}), you point your IRC client at the
|
||||
server @code{irc.freenode.net}. That server will redirect your client
|
||||
to a random server on the network, such as @code{zelazny.freenode.net}.
|
||||
|
||||
@cindex channel name
|
||||
@cindex # starts a channel name
|
||||
Once you're connected, you can send messages to all other users
|
||||
connected to the same network, and you can join all channels on the same
|
||||
network. You might join the @code{#emacs} and the @code{#rcirc}
|
||||
channels, for example. (Typically, channel names begin with a hash
|
||||
character.)
|
||||
|
||||
Once you have joined a channel, anything you type will be broadcast to
|
||||
all the other users on the same channel.
|
||||
|
||||
@cindex addressing other people
|
||||
@cindex other people, addressing them
|
||||
@cindex talk to other people
|
||||
If you want to address someone specifically, for example as an answer to
|
||||
a question, it is customary to prefix the message with the nick followed
|
||||
by a colon, like this:
|
||||
|
||||
@example
|
||||
deego: fsbot rules!
|
||||
@end example
|
||||
|
||||
@cindex nick completion
|
||||
@cindex completion of nicks
|
||||
@kindex TAB
|
||||
Since this is so common, you can use @key{TAB} to do nick completion.
|
||||
|
||||
@node Getting started with rcirc, , Internet Relay Chat, Basics
|
||||
@section Getting started with rcirc
|
||||
@cindex getting started
|
||||
@cindex connecting to a server
|
||||
|
||||
@cindex irc command
|
||||
Use the command @kbd{M-x irc} to connect using the defaults.
|
||||
@xref{Configuration}, if you want to change the defaults.
|
||||
|
||||
Use @kbd{C-u M-x irc} if you don't want to use the defaults, eg. if you
|
||||
want to connect to a different network, or connect to the same network
|
||||
using a different nick. This will prompt you for four things:
|
||||
|
||||
@table @asis
|
||||
@cindex server, connecting
|
||||
@cindex Freenode network
|
||||
@item IRC server
|
||||
What server do you want to connect to? All the servers in a particular
|
||||
network are equivalent. Some networks use a round-robin system where a
|
||||
single server redirects new connections to a random server in the
|
||||
network. @code{irc.freenode.net} is such a server for the Freenode
|
||||
network. Freenode provides the network ``for the Free and Open Source
|
||||
Software communities, for not-for-profit organisations and for related
|
||||
communities and organizations.''
|
||||
|
||||
@cindex port, connecting
|
||||
@cindex 6667, default IRC port
|
||||
@item IRC port
|
||||
All network connections require a port. Just as web servers and clients
|
||||
use port 80 per default, IRC uses port 6667 per default. You rarely
|
||||
have to use a different port.
|
||||
|
||||
@cindex nick, connecting
|
||||
@cindex changing nick
|
||||
@cindex name changes
|
||||
@item IRC nick
|
||||
@vindex user-login-name
|
||||
Every users needs a handle on-line. You will automatically be assigned
|
||||
a slightly different nick if your chosen nick is already in use. If
|
||||
your @code{user-login-name} is @code{alex}, and this nick is already
|
||||
in use, you might for example get assigned the nick @code{alex`}.
|
||||
|
||||
@cindex channels, connecting
|
||||
@cindex initial channels
|
||||
@cindex startup channels
|
||||
@item Channels
|
||||
A space separated list of channels you want to join when connecting.
|
||||
You don't need to join any channels, if you just want to have one-to-one
|
||||
conversations with friends on the same network. If you're new to the
|
||||
Freenode network, join @code{#emacs}, the channel about all things
|
||||
Emacs, or join @code{#rcirc}, the channel about @code{rcirc}.
|
||||
@end table
|
||||
|
||||
@cindex server buffer
|
||||
When you have answered these questions, @code{rcirc} will create a server
|
||||
buffer, which will be named something like @code{*irc.freenode.net*},
|
||||
and a channel buffer for each of the channels you wanted to join.
|
||||
|
||||
@kindex RET
|
||||
@cindex talking
|
||||
@cindex communicating
|
||||
To talk in a channel, just type in what you want to say in a channel
|
||||
buffer, and press @key{RET}.
|
||||
|
||||
@kindex C-c C-c
|
||||
@cindex multiline messages
|
||||
@cindex messages, multiple lines
|
||||
@cindex pasting multiple lines
|
||||
@cindex edit message before sending
|
||||
If you want to paste multiple lines, such as source code, you can use
|
||||
@kbd{C-c C-c} to edit your message in a separate buffer. Use @kbd{C-c
|
||||
C-c} to finish editing. You still need to press @key{RET} to send it,
|
||||
though. Generally, IRC users don't like people pasting more than around
|
||||
four lines of code, so use with care.
|
||||
|
||||
@node Reference, Hacking and Tweaking, Basics, Top
|
||||
@chapter Reference
|
||||
@cindex reference
|
||||
|
||||
This is the reference section of the manual. It is not complete. For
|
||||
complete listings of @code{rcirc} features, use Emacs built-in
|
||||
documentation.
|
||||
|
||||
@menu
|
||||
* rcirc commands::
|
||||
* Useful IRC commands::
|
||||
* Configuration::
|
||||
@end menu
|
||||
|
||||
@node rcirc commands, Useful IRC commands, Reference, Reference
|
||||
@section rcirc commands
|
||||
@cindex rcirc commands
|
||||
@cindex commands
|
||||
|
||||
@kindex C-h m
|
||||
This is a list of commands that you may use in @code{rcirc}. It is not
|
||||
complete. For a complete listing, press @kbd{C-h m} in an @code{rcirc}
|
||||
buffer.
|
||||
|
||||
In addition to using regular Emacs key bindings, you can call them by
|
||||
typing them into an @code{rcirc} buffer.
|
||||
|
||||
@cindex call commands
|
||||
@cindex typing commands
|
||||
@cindex commands
|
||||
For instance, instead of using the command @kbd{C-c C-j} to join a new
|
||||
channel, you may type this in an @code{rcirc} buffer, and press @key{RET}:
|
||||
|
||||
@example
|
||||
/join #emacs
|
||||
@end example
|
||||
|
||||
@cindex / starts a command
|
||||
@cindex messages starting with a slash disappear
|
||||
@cindex disappearing messages if starting with a slash
|
||||
@cindex slash hides message
|
||||
This is why you cannot start a message with a slash. You will have to
|
||||
precede the command with a space, or rewrite your message in order to
|
||||
send it to a channel.
|
||||
|
||||
@cindex multiple words as parameters
|
||||
@cindex string delimiters
|
||||
@cindex quotes
|
||||
@cindex double-quotes
|
||||
Many commands take parameters. IRC commands usually ignore string
|
||||
delimiters. Neither quote nor double-quote have special meanings in
|
||||
IRC.
|
||||
|
||||
@example
|
||||
/nick "alex schroeder"
|
||||
@end example
|
||||
|
||||
This will try to change your nick to @code{"alex}. Usually this will
|
||||
fail because the double quote character is not a legal character for
|
||||
nicks.
|
||||
|
||||
@cindex case insensitive commands
|
||||
These commands are case insensitive.
|
||||
|
||||
@cindex new command
|
||||
@cindex unknown command
|
||||
@cindex command unknown
|
||||
If a command isn't known by @code{rcirc}, it will simply be sent along to the
|
||||
server. There is a list of some useful commands like that in the next
|
||||
section.
|
||||
|
||||
@table @kbd
|
||||
@item C-c C-j
|
||||
@kindex C-c C-j
|
||||
@cindex /join
|
||||
@cindex join channels
|
||||
@cindex other channels
|
||||
@cindex rooms, joining
|
||||
@cindex discussion, joining
|
||||
This joins a channel such as @code{#rcirc} or @code{#emacs}. On most
|
||||
networks, anybody can create new channels. If you want to talk with
|
||||
some friends, for example, all you have to do is agree on a valid
|
||||
channel name and join that channel. (Also @code{/join #emacs}.)
|
||||
|
||||
@item C-c C-p
|
||||
@kindex C-c C-p
|
||||
@cindex /part
|
||||
@cindex part a channel
|
||||
@cindex leave a channel
|
||||
@cindex disconnect from a channel
|
||||
@cindex stop talking on a channel
|
||||
@cindex kill channel buffer
|
||||
This leaves the current channel. You can optionally provide a reason
|
||||
for parting. When you kill a channel buffer, you automatically part the
|
||||
corresponding channel. (Also @code{/part you are too weird!}.)
|
||||
|
||||
@item C-c C-r
|
||||
@kindex C-c C-r
|
||||
@cindex /nick
|
||||
@cindex change name
|
||||
@cindex nick changing
|
||||
@cindex rename yourself
|
||||
@cindex other name
|
||||
This changes your nick to some other name. Your nick must be unique
|
||||
across the network. Most networks don't allow too many nick changes in
|
||||
quick succession, and have restrictions on the valid characters in nick
|
||||
names. (Also @code{/nick alex-test})
|
||||
|
||||
@item C-c C-w
|
||||
@kindex C-c C-w
|
||||
@cindex /whois
|
||||
@cindex who are these people
|
||||
@cindex identifying people
|
||||
@cindex channels other people are on
|
||||
@cindex what channels people are on
|
||||
Gives you some basic information about a nick. This often includes what
|
||||
other channels people are on. (Also @code{/whois fsbot}.)
|
||||
|
||||
@item C-c C-q
|
||||
@kindex C-c C-q
|
||||
@cindex /query
|
||||
@cindex starting a private conversation
|
||||
@cindex one-to-one conversation
|
||||
@cindex talk privately
|
||||
@cindex private conversation
|
||||
@cindex contact one person only
|
||||
@cindex query a person
|
||||
Starts a one-to-one conversation with another person on the same
|
||||
network. A new buffer will be created for this conversation. It works
|
||||
like a channel with only two members. (Also @code{/query fsbot}.)
|
||||
|
||||
@item C-c @key{RET}
|
||||
@kindex C-c RET
|
||||
@cindex /msg
|
||||
@cindex single message
|
||||
@cindex message sending
|
||||
This sends a single message to a nick. Like with @kbd{C-c C-q}, a new
|
||||
buffer is created, where the response from the other party will show
|
||||
up. (Also @code{/msg nickserv identify secret}.)
|
||||
|
||||
@item C-c C-x
|
||||
@kindex C-c C-x
|
||||
@cindex /quit
|
||||
@cindex quit
|
||||
@cindex disconnect
|
||||
@cindex kill connection
|
||||
@cindex connection end
|
||||
@cindex part all channels
|
||||
@cindex end connection
|
||||
@cindex server buffer killing
|
||||
@cindex reason for quitting
|
||||
This disconnects from the server and parts all channels. You can
|
||||
optionally provide a reason for quitting. When you kill the server
|
||||
buffer, you automatically quit the server and part all channels. (Also
|
||||
@code{/quit ZZZzzz...}.)
|
||||
@end table
|
||||
|
||||
Some commands may not have a key binding, but only be available as typed
|
||||
commands, such as:
|
||||
|
||||
@table @code
|
||||
@item /ignore
|
||||
@cindex /ignore
|
||||
@cindex ignoring other people
|
||||
@cindex trolls, ignoring
|
||||
@cindex hide some posts
|
||||
@cindex idiots online
|
||||
This command toggles the ignore status of a nick, if you provide one.
|
||||
If you don't provide a nick, the command lists all the nicks you are
|
||||
ignoring. All messages by ignored nicks are---you guessed it---ignored.
|
||||
Since only ``operators'' can kick people from channels, the
|
||||
ignore command is often the only way to deal with some of the more
|
||||
obnoxious fellows online. Example: @code{/ignore xah}.
|
||||
@end table
|
||||
|
||||
@node Useful IRC commands, Configuration, rcirc commands, Reference
|
||||
@section Useful IRC commands
|
||||
@cindex irc commands
|
||||
@cindex commands
|
||||
|
||||
As mentioned, if a command isn't known by @code{rcirc}, it will simply be sent
|
||||
along to the server. Some such commands are available on nearly all IRC
|
||||
servers, such as:
|
||||
|
||||
@table @code
|
||||
@item /away
|
||||
@cindex /away
|
||||
@cindex away status
|
||||
@cindex pause status
|
||||
@cindex unavailable status
|
||||
@cindex set away status
|
||||
This sets your status as ``being away'' if you provide a reason, or sets
|
||||
your status as ``being back'' if you do not. People can use the
|
||||
@kbd{C-c C-w} command to check your status. Example: @code{/away food}.
|
||||
@end table
|
||||
|
||||
@cindex irc resources
|
||||
@cindex help about irc
|
||||
Typical IRC servers implement many more commands. You can read more
|
||||
about the fantastic world of IRC online at
|
||||
@uref{http://www.irchelp.org/, the Internet Relay Chat (IRC) help
|
||||
archive}.
|
||||
|
||||
@node Configuration, , Useful IRC commands, Reference
|
||||
@section Configuration
|
||||
@cindex configuring rcirc
|
||||
|
||||
These are some variables you can change to configure @code{rcirc} to your
|
||||
liking.
|
||||
|
||||
@table @code
|
||||
@item rcirc-default-server
|
||||
@vindex rcirc-default-server
|
||||
the default server to connect to.
|
||||
|
||||
@item rcirc-default-port
|
||||
@vindex rcirc-default-port
|
||||
the default port to connect to.
|
||||
|
||||
@item rcirc-default-nick
|
||||
@vindex rcirc-default-nick
|
||||
the default nick to use.
|
||||
@end table
|
||||
|
||||
@example
|
||||
(setq rcirc-default-server "irc.mozilla.org"
|
||||
rcirc-default-port 6666
|
||||
rcirc-default-nick "alx")
|
||||
@end example
|
||||
|
||||
@vindex rcirc-default-user-full-name
|
||||
@cindex full name
|
||||
@cindex real name
|
||||
@cindex surname
|
||||
@code{rcirc-default-user-full-name} is used to set your ``real name'' on
|
||||
IRC. It defaults to @code{user-full-name}. If you want to hide your
|
||||
full name, you might want to set it to some pseudonym.
|
||||
|
||||
@example
|
||||
(setq rcirc-default-user-full-name "Curious Minds Want To Know")
|
||||
@end example
|
||||
|
||||
@vindex rcirc-startup-channels-alist
|
||||
@cindex channels, configuration
|
||||
@cindex initial channels, configuration
|
||||
@cindex startup channels, configuration
|
||||
@code{rcirc-startup-channels-alist} is the alist of channels to join
|
||||
when connecting to a particular network. An alist is a list of lists.
|
||||
Each sublist starts with a regular expression that is compared to the
|
||||
server address you're connecting to. The remaining sublist items are
|
||||
the channels to join.
|
||||
|
||||
@example
|
||||
(setq rcirc-startup-channels-alist
|
||||
'(("\\.freenode\\.net$" "#emacs" "#rcirc" "#wiki")))
|
||||
@end example
|
||||
|
||||
Note the subtle problem, here --- IRC clients connect to servers, and
|
||||
there is no way of knowing which servers belong to a particular network.
|
||||
In the example above we're exploiting a naming convention used by within
|
||||
the Freenode network --- all servers within the network have a host in
|
||||
the @code{freenode.net} domain.
|
||||
|
||||
@vindex rcirc-authinfo
|
||||
@cindex authentification
|
||||
@cindex identification
|
||||
@cindex nickserv
|
||||
@cindex login
|
||||
@code{rcirc-authinfo} is an alist used to automatically identify
|
||||
yourself on networks. Each sublist starts with a regular expression
|
||||
that is compared to the server address you're connecting to. The second
|
||||
element in the list is a symbol representing the method to use, followed
|
||||
by the arguments this method requires.
|
||||
|
||||
Here is an example to illustrate how you would set it:
|
||||
|
||||
@example
|
||||
(setq rcirc-authinfo
|
||||
'(("freenode" nickserv "bob" "p455w0rd")
|
||||
("freenode" chanserv "bob" "#bobland" "passwd99")
|
||||
("bitlbee" bitlbee "robert" "sekrit")))
|
||||
@end example
|
||||
|
||||
And here are the valid method symbols and the arguments they require:
|
||||
|
||||
@table @code
|
||||
@item nickserv
|
||||
@cindex nickserv authentification
|
||||
Use this symbol if you need to identify yourself as follows when
|
||||
connecting to a network: @code{/msg nickserv identify secret}. The
|
||||
necessary arguments are the nickname you want to use this for, and the
|
||||
password to use.
|
||||
|
||||
Before you can use this method, you will have to register your nick and
|
||||
pick a password for it. Contact @code{nickserv} and check out the
|
||||
details. (Using @code{/msg nickserv help}, for example.)
|
||||
|
||||
@item chanserv
|
||||
@cindex chanserv authentification
|
||||
Use this symbol if you need to identify yourself as follows if you want
|
||||
to join a particular channel: @code{/msg chanserv identify #underground
|
||||
secret}. The necessary arguments are the nickname and channel you want
|
||||
to use this for, and the password to use.
|
||||
|
||||
Before you can use this method, a channel contact must tell you about
|
||||
the password to use. Contact @code{chanserv} and check out the details.
|
||||
(Using @code{/msg chanserv help}, for example.)
|
||||
|
||||
@item bitlbee
|
||||
@cindex bitlbee authentification
|
||||
Use this symbol if you need to identify yourself in the Bitlbee channel
|
||||
as follows: @code{identify secret}. The necessary arguments are the
|
||||
nickname you want to use this for, and the password to use.
|
||||
|
||||
@cindex gateway to other IM services
|
||||
@cindex instant messaging, other services
|
||||
@cindex Jabber
|
||||
@cindex AIM
|
||||
@cindex ICQ
|
||||
@cindex MSN
|
||||
@cindex Yahoo!
|
||||
Bitlbee acts like an IRC server, but in fact it is a gateway to a lot of
|
||||
other instant messaging services. You can either install Bitlbee
|
||||
locally or use a public Bitlbee server. There, you need to create an
|
||||
account with a password. This is the nick and password you need to
|
||||
provide for the bitlbee authentification method.
|
||||
|
||||
Later, you will tell Bitlbee about your accounts and passwords on all
|
||||
the other instant messaging services, and Bitlbee will log you in. All
|
||||
@code{rcirc} needs to know, is the login to your Bitlbee account. Don't
|
||||
confuse the Bitlbee account with all the other accounts.
|
||||
@end table
|
||||
|
||||
@kindex C-c C-SPC
|
||||
@vindex rcirc-track-minor-mode
|
||||
@cindex switching channels
|
||||
@cindex tracking activity
|
||||
@cindex active channel
|
||||
@cindex abbreviated channel names
|
||||
@cindex modeline tracks activity
|
||||
Most people want a notification when something is said on a channel they
|
||||
have joined, particularly if they have been addressed directly. There
|
||||
is a global minor mode that will do this kind of tracking for you. All
|
||||
you need to do is switch it on using @kbd{M-x rcirc-track-minor-mode}.
|
||||
To make this permanent, add the following to your init file:
|
||||
|
||||
@example
|
||||
(rcirc-track-minor-mode 1)
|
||||
@end example
|
||||
|
||||
When other people say things in buffers that are currently buried (no
|
||||
window is showing them), the mode line will now show you the abbreviated
|
||||
channel or nick name. Use @kbd{C-c C-@key{SPC}} to switch to these
|
||||
buffers.
|
||||
|
||||
@vindex rcirc-mode-hook
|
||||
If you prefer not to load @code{rcirc} immediately, you can delay the
|
||||
activation of this mode:
|
||||
|
||||
@example
|
||||
(add-hook 'rcirc-mode-hook
|
||||
(lambda ()
|
||||
(rcirc-track-minor-mode 1)))
|
||||
@end example
|
||||
|
||||
@node Hacking and Tweaking, GNU Free Documentation License, Reference, Top
|
||||
@chapter Hacking and Tweaking
|
||||
@cindex hacking and tweaking
|
||||
|
||||
Here are some examples of stuff you can do to configure @code{rcirc}.
|
||||
|
||||
@menu
|
||||
* Skipping /away messages using handlers::
|
||||
* Using fly spell mode::
|
||||
* Scrolling conservatively::
|
||||
* Changing the time stamp format::
|
||||
* Defining a new command::
|
||||
* Reconnecting after you have lost the connection::
|
||||
@end menu
|
||||
|
||||
@node Skipping /away messages using handlers, Using fly spell mode, Hacking and Tweaking, Hacking and Tweaking
|
||||
@section Skipping @code{/away} messages using handlers
|
||||
@cindex /away messages
|
||||
|
||||
@cindex handlers
|
||||
@cindex status codes
|
||||
The IRC protocol specifies how certain events are signaled from server
|
||||
to client. These events have numbers and are dealt with using so-called
|
||||
handlers. You can override existing handlers by exploiting the naming
|
||||
convention adopted for @code{rcirc}.
|
||||
|
||||
Here's how to stop @code{rcirc} from printing @code{/away} messages.
|
||||
Since @code{rcirc} doesn't define a 301 handler, you don't need to
|
||||
require @code{rcirc} before defining the handler:
|
||||
|
||||
@example
|
||||
(defun rcirc-handler-301 (process cmd sender args)
|
||||
"/away message handler.")
|
||||
@end example
|
||||
|
||||
@node Using fly spell mode, Scrolling conservatively, Skipping /away messages using handlers, Hacking and Tweaking
|
||||
@section Using fly spell mode
|
||||
@cindex fly spell
|
||||
@cindex spelling
|
||||
@cindex spell-checking as you type
|
||||
@cindex automatic spelling
|
||||
@vindex rcirc-mode-hook
|
||||
|
||||
The following code activates Fly Spell Mode
|
||||
for @code{rcirc} buffers:
|
||||
|
||||
@example
|
||||
(add-hook 'rcirc-mode-hook (lambda ()
|
||||
(flyspell-mode 1)))
|
||||
@end example
|
||||
|
||||
@xref{Spelling, , Flyspell mode, emacs, The GNU Emacs Manual},
|
||||
for details.
|
||||
|
||||
@node Scrolling conservatively, Changing the time stamp format, Using fly spell mode, Hacking and Tweaking
|
||||
@section Scrolling conservatively
|
||||
@cindex input line
|
||||
@cindex scrolling
|
||||
@vindex scroll-conservatively
|
||||
@vindex rcirc-mode-hook
|
||||
|
||||
IRC buffers are constantly growing. If you want to see as much as
|
||||
possible at all times, you would want the prompt at the bottom of the
|
||||
window when possible. The following snippet uses a local value for
|
||||
@code{scroll-conservatively} to achieve this:
|
||||
|
||||
@example
|
||||
(add-hook 'rcirc-mode-hook
|
||||
(lambda ()
|
||||
(set (make-local-variable 'scroll-conservatively)
|
||||
8192)))
|
||||
@end example
|
||||
|
||||
@xref{Scrolling, , Scrolling conservatively, emacs, The GNU Emacs
|
||||
Manual}, for details.
|
||||
|
||||
@node Changing the time stamp format, Defining a new command, Scrolling conservatively, Hacking and Tweaking
|
||||
@section Changing the time stamp format
|
||||
@cindex time stamp
|
||||
@cindex date time
|
||||
@cindex format time stamp
|
||||
@vindex rcirc-time-format
|
||||
|
||||
@code{rcirc-time-format} is the format used for the time stamp. Here's
|
||||
how to include the date in the time stamp:
|
||||
|
||||
@example
|
||||
(setq rcirc-time-format "%Y-%m-%d %H:%M ")
|
||||
@end example
|
||||
|
||||
@node Defining a new command, Reconnecting after you have lost the connection, Changing the time stamp format, Hacking and Tweaking
|
||||
@section Defining a new command
|
||||
@cindex defining commands
|
||||
@cindex commands, defining
|
||||
@cindex new commands, defining
|
||||
|
||||
Here's a simple new command, @code{/sv}. With it, you can boast about
|
||||
your IRC client. It shows how you can use @code{defun-rcirc-command} to
|
||||
define new commands.
|
||||
|
||||
We're waiting for the definition of this command until @code{rcirc} is loaded
|
||||
because @code{defun-rcirc-command} is not yet available, and without
|
||||
@code{rcirc} loaded, the command wouldn't do us much good anyway.
|
||||
|
||||
@smallexample
|
||||
(eval-after-load 'rcirc
|
||||
'(defun-rcirc-command sv (arg)
|
||||
"Boast about rcirc."
|
||||
(interactive "i")
|
||||
(rcirc-send-message process target
|
||||
(concat "I use " rcirc-id-string))))
|
||||
@end smallexample
|
||||
|
||||
@node Reconnecting after you have lost the connection, , Defining a new command, Hacking and Tweaking
|
||||
@section Reconnecting after you have lost the connection
|
||||
@cindex reconnecting
|
||||
@cindex disconnecting servers, reconnecting
|
||||
|
||||
If you're chatting from a laptop, then you might be familiar with this
|
||||
problem: When your laptop falls asleep and wakes up later, your IRC
|
||||
client doesn't realise that it has been disconnected. It takes several
|
||||
minutes until the client decides that the connection has in fact been
|
||||
lost. The simple solution is to use @kbd{M-x rcirc}. The problem is
|
||||
that this opens an @emph{additional} connection, so you'll have two
|
||||
copies of every channel buffer --- one dead and one live.
|
||||
|
||||
The real answer, therefore, is a @code{/reconnect} command:
|
||||
|
||||
@smallexample
|
||||
(eval-after-load 'rcirc
|
||||
'(defun-rcirc-command reconnect (arg)
|
||||
"Reconnect the server process."
|
||||
(interactive "i")
|
||||
(unless process
|
||||
(error "There's no process for this target"))
|
||||
(let* ((server (car (process-contact process)))
|
||||
(port (process-contact process :service))
|
||||
(nick (rcirc-nick process))
|
||||
channels query-buffers)
|
||||
(dolist (buf (buffer-list))
|
||||
(with-current-buffer buf
|
||||
(when (eq process (rcirc-buffer-process))
|
||||
(remove-hook 'change-major-mode-hook
|
||||
'rcirc-change-major-mode-hook)
|
||||
(if (rcirc-channel-p rcirc-target)
|
||||
(setq channels (cons rcirc-target channels))
|
||||
(setq query-buffers (cons buf query-buffers))))))
|
||||
(delete-process process)
|
||||
(rcirc-connect server port nick
|
||||
rcirc-default-user-name
|
||||
rcirc-default-user-full-name
|
||||
channels))))
|
||||
@end smallexample
|
||||
|
||||
@node GNU Free Documentation License, Key Index, Hacking and Tweaking, Top
|
||||
@appendix GNU Free Documentation License
|
||||
@include doclicense.texi
|
||||
|
||||
|
||||
@node Key Index, Variable Index, GNU Free Documentation License, Top
|
||||
@unnumbered Key Index
|
||||
@printindex ky
|
||||
|
||||
@node Variable Index, Index, Key Index, Top
|
||||
@unnumbered Variable Index
|
||||
@printindex vr
|
||||
|
||||
@node Index, , Variable Index, Top
|
||||
@unnumbered Index
|
||||
@printindex cp
|
||||
|
||||
@bye
|
||||
|
||||
@ignore
|
||||
arch-tag: 2589e562-3843-4ffc-8c2f-477cbad57c01
|
||||
@end ignore
|
5898
man/reftex.texi
5898
man/reftex.texi
File diff suppressed because it is too large
Load diff
330
man/regs.texi
330
man/regs.texi
|
@ -1,330 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2001, 2002,
|
||||
@c 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Registers, Display, CUA Bindings, Top
|
||||
@chapter Registers
|
||||
@cindex registers
|
||||
|
||||
Emacs @dfn{registers} are compartments where you can save text,
|
||||
rectangles, positions, and other things 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 consists of a single character. A
|
||||
register can store a number, 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
|
||||
|
||||
@dfn{Bookmarks} record files and positions in them, so you can
|
||||
return to those positions when you look at the file again.
|
||||
Bookmarks are similar enough in spirit to registers that they
|
||||
seem to belong in this chapter.
|
||||
|
||||
@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.
|
||||
* Numbers: RegNumbers. Numbers in registers.
|
||||
* Files: RegFiles. File names in registers.
|
||||
* Bookmarks:: Bookmarks are like registers, but persistent.
|
||||
@end menu
|
||||
|
||||
@node RegPos
|
||||
@section Saving Positions in Registers
|
||||
@cindex saving position in a register
|
||||
|
||||
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
|
||||
hold 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
|
||||
@cindex saving text in a register
|
||||
|
||||
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}).
|
||||
@item M-x append-to-register @key{RET} @var{r}
|
||||
Append region to text in register @var{r}.
|
||||
@item M-x prepend-to-register @key{RET} @var{r}
|
||||
Prepend region to text in register @var{r}.
|
||||
@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}. @kbd{C-u C-x r s @var{r}}, the same
|
||||
command with a numeric argument, deletes the text from the buffer as
|
||||
well; you can think of this as ``moving'' the region text into the register.
|
||||
|
||||
@findex append-to-register
|
||||
@findex prepend-to-register
|
||||
@kbd{M-x append-to-register @key{RET} @var{r}} appends the copy of
|
||||
the text in the region to the text already stored in the register
|
||||
named @var{r}. If invoked with a numeric argument, it deletes the
|
||||
region after appending it to the register. The command
|
||||
@code{prepend-to-register} is similar, except that it @emph{prepends}
|
||||
the region text to the text in the register, rather than
|
||||
@emph{appending} it.
|
||||
|
||||
@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
|
||||
@cindex saving rectangle in a register
|
||||
|
||||
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
|
||||
@cindex saving window configuration in a register
|
||||
|
||||
@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
|
||||
@cindex saving number in a register
|
||||
|
||||
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{r}
|
||||
@kindex C-x r n
|
||||
@findex number-to-register
|
||||
Store @var{number} into register @var{r} (@code{number-to-register}).
|
||||
@item C-u @var{number} C-x r + @var{r}
|
||||
@kindex C-x r +
|
||||
@findex increment-register
|
||||
Increment the number in register @var{r} by @var{number}
|
||||
(@code{increment-register}).
|
||||
@item C-x r i @var{r}
|
||||
Insert the number from register @var{r} into the buffer.
|
||||
@end table
|
||||
|
||||
@kbd{C-x r i} is the same command used to insert any other sort of
|
||||
register contents into the buffer. @kbd{C-x r +} with no numeric
|
||||
argument increments the register value by 1; @kbd{C-x r n} with no
|
||||
numeric argument stores zero in the register.
|
||||
|
||||
@node RegFiles
|
||||
@section Keeping File Names in Registers
|
||||
@cindex saving file name in a register
|
||||
|
||||
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 the bookmark 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
|
||||
|
||||
@ignore
|
||||
arch-tag: b00af991-ebc3-4b3a-8e82-a3ac81ff2e64
|
||||
@end ignore
|
1430
man/rmail.texi
1430
man/rmail.texi
File diff suppressed because it is too large
Load diff
2533
man/sc.texi
2533
man/sc.texi
File diff suppressed because it is too large
Load diff
359
man/screen.texi
359
man/screen.texi
|
@ -1,359 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2001, 2002,
|
||||
@c 2003, 2004, 2005, 2006, 2007 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
|
||||
|
||||
On a text-only terminal, the Emacs display occupies the whole
|
||||
screen. On a graphical display, such as on GNU/Linux using the X
|
||||
Window System, Emacs creates its own windows to use. We use the term
|
||||
@dfn{frame} to mean the entire text-only screen or an entire
|
||||
system-level 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 main central area of the frame, all except
|
||||
for the top and bottom and sides, displays the text you are editing.
|
||||
This area is called @dfn{the window}. At the top there is normally a
|
||||
@dfn{menu bar} where you can access a series of menus; then there may
|
||||
be a @dfn{tool bar}, a row of icons that perform editing commands if
|
||||
you click on them. Below this, the window begins, often with a
|
||||
@dfn{scroll bar} on one side. Below the window comes the last line of
|
||||
the frame, a special @dfn{echo area} or @dfn{minibuffer window}, where
|
||||
prompts appear and you enter information when Emacs asks for it. See
|
||||
following sections for more information about these special lines.
|
||||
|
||||
You can subdivide the window horizontally or vertically to make
|
||||
multiple text windows, each of which can independently display some
|
||||
file or text (@pxref{Windows}). In this manual, the word ``window''
|
||||
refers to the initial large window if not subdivided, or any one of
|
||||
the multiple windows you have subdivided it into.
|
||||
|
||||
At any time, one window is the @dfn{selected window}. On graphical
|
||||
displays, the selected window normally shows a more prominent cursor
|
||||
(usually solid and blinking) while other windows show a weaker cursor
|
||||
(such as a hollow box). Text terminals have just one cursor, so it
|
||||
always appears in the selected window.
|
||||
|
||||
Most Emacs commands implicitly apply to the text in the selected
|
||||
window; the text in unselected windows is mostly visible for
|
||||
reference. However, mouse commands generally operate on whatever
|
||||
window you click them in, whether selected or not. If you use
|
||||
multiple frames on a graphical display, 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 different color and/or a ``3D''
|
||||
box if the terminal supports them; its contents normally 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 active 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 (normally the left button).
|
||||
|
||||
While the cursor appears to be @emph{on} 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.
|
||||
|
||||
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 its point location in case you display
|
||||
it again later. When Emacs displays multiple windows, each window has
|
||||
its own point location. If the same buffer appears in more than one
|
||||
window, each window has its own point position in that buffer, and (when
|
||||
possible) its own cursor.
|
||||
|
||||
A text-only terminal has just one cursor, in the selected window.
|
||||
The other windows do not show a cursor, even though they do have their
|
||||
own position of point. When Emacs updates the screen on a text-only
|
||||
terminal, it has to put the cursor temporarily at the place the output
|
||||
goes. This doesn't mean point is there, though. Once display
|
||||
updating finishes, Emacs puts the cursor where point is.
|
||||
|
||||
On graphical displays, Emacs shows a cursor in each window; the
|
||||
selected window's cursor is solid and blinking, and the other cursors
|
||||
are just hollow. Thus, the most prominent cursor always shows you the
|
||||
selected window, on all kinds of terminals.
|
||||
|
||||
@xref{Cursor Display}, for customizable variables that control display
|
||||
of the cursor or cursors.
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
various purposes.
|
||||
|
||||
@dfn{Echoing} means displaying the characters that you type. At the
|
||||
command line, 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 Custom}).
|
||||
|
||||
@cindex error message in the echo area
|
||||
If a command cannot do its job, it may display an @dfn{error
|
||||
message} in the echo area. Error messages are accompanied by beeping
|
||||
or by flashing the screen. The error also discards any input you have
|
||||
typed ahead.
|
||||
|
||||
Some commands display 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 show you a message giving you specific information---for example,
|
||||
@kbd{C-x =} (hold down @key{CTRL} and type @kbd{x}, then let go of
|
||||
@key{CTRL} and type @kbd{=}) displays 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. They may also indicate progress with
|
||||
percentages.
|
||||
|
||||
@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, adding lines at the end deletes lines
|
||||
from the beginning, to keep the size constant. @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
|
||||
where you can input 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. The mode line starts and ends with
|
||||
dashes. When there is only one text window, the mode line appears
|
||||
right above the echo area; it is the next-to-last line in the frame.
|
||||
On a text-only terminal, the mode line is in inverse video if the
|
||||
terminal supports that; on a graphics display, the mode line has a 3D
|
||||
box appearance to help it stand out. The mode line of the selected
|
||||
window is highlighted if possible; see @ref{Optional Mode Line}, for
|
||||
more information.
|
||||
|
||||
Normally, the mode line looks like this:
|
||||
|
||||
@example
|
||||
-@var{cs}:@var{ch}@var{R}-@var{fr} @var{buf} @var{pos} @var{line} (@var{major} @var{minor})------
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
This gives information about the window and the buffer it displays: 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{R} is @samp{@@} if the default-directory for the current buffer
|
||||
is on a remote machine, or a hyphen otherwise.
|
||||
|
||||
@var{fr} gives the selected frame name (@pxref{Frames}). It appears
|
||||
only on text-only terminals. The initial frame's name is @samp{F1}.
|
||||
|
||||
@var{buf} is the name of the window's @dfn{buffer}. Usually this is
|
||||
the same as the name of a file you are editing. @xref{Buffers}.
|
||||
|
||||
The buffer displayed in the selected window (the window with the
|
||||
cursor) is the @dfn{current buffer}, where editing happens. When a
|
||||
command's effect applies to ``the buffer,'' we mean it does those
|
||||
things to the current buffer.
|
||||
|
||||
@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.
|
||||
With Size Indication mode, you can display the size of the buffer as
|
||||
well. @xref{Optional Mode Line}.
|
||||
|
||||
@var{line} is @samp{L} followed by the current line number of point.
|
||||
This is present when Line Number mode is enabled (it normally is).
|
||||
You can display the current column number too, by turning on Column
|
||||
Number mode. It is not enabled by default because it is somewhat
|
||||
slower. @xref{Optional Mode Line}.
|
||||
|
||||
@var{major} is the name of the @dfn{major mode} in effect in the
|
||||
buffer. A buffer can only be in one major mode at a time. 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
|
||||
them.
|
||||
|
||||
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 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
|
||||
|
||||
@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.
|
||||
|
||||
On a text-only terminal, @var{cs} includes two additional characters
|
||||
which describe the coding system for keyboard input and the coding
|
||||
system for terminal output. They come right before the coding system
|
||||
used for the file you are editing.
|
||||
|
||||
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 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} changes to another string in some cases.
|
||||
Emacs uses newline characters 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 for files that use newline
|
||||
as the line separator.
|
||||
|
||||
@xref{Optional Mode Line}, to add other handy information to the
|
||||
mode line, such as the size of the buffer, the current column number
|
||||
of point, and whether new mail for you has arrived.
|
||||
|
||||
The mode line is mouse-sensitive; when you move the mouse across
|
||||
various parts of it, Emacs displays help text to say what a click in
|
||||
that place will do. @xref{Mode Line Mouse}.
|
||||
|
||||
@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 common operations. There's no need to list them
|
||||
here, as you can more easily see them yourself.
|
||||
|
||||
@kindex M-`
|
||||
@kindex F10
|
||||
@findex tmm-menubar
|
||||
@findex menu-bar-open
|
||||
On a graphical display, you can use the mouse to choose a command
|
||||
from the menu bar. A right-arrow at the end of the menu item means it
|
||||
leads to a subsidiary menu; @samp{...} at the end means that the
|
||||
command invoked will read arguments (further input from you) before it
|
||||
actually does anything.
|
||||
|
||||
You can also invoke the first menu bar item by pressing @key{F10} (to run
|
||||
the command @code{menu-bar-open}). You can then navigate the menus with
|
||||
the arrow keys. You select an item by pressing @key{RET} and cancel menu
|
||||
navigation with @key{ESC}.
|
||||
|
||||
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 lets you select a menu item with the
|
||||
keyboard. A provisional choice appears in the echo area. You can use
|
||||
the up and down arrow keys to move through the menu to different
|
||||
items, and then you can type @key{RET} to select the item.
|
||||
|
||||
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; one such binding is shown in parentheses after the item itself.
|
||||
|
||||
@ignore
|
||||
arch-tag: 104ba40e-d972-4866-a542-a98be94bdf2f
|
||||
@end ignore
|
1361
man/search.texi
1361
man/search.texi
File diff suppressed because it is too large
Load diff
724
man/sending.texi
724
man/sending.texi
|
@ -1,724 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001, 2002,
|
||||
@c 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Sending Mail
|
||||
@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 remains 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.
|
||||
|
||||
@vindex mail-default-directory
|
||||
The variable @code{mail-default-directory} controls the default
|
||||
directory for mail buffers, and also says where to put their auto-save
|
||||
files.
|
||||
|
||||
@ignore
|
||||
@c Commented out because it is not user-oriented;
|
||||
@c it doesn't say how to do some job. -- rms.
|
||||
@cindex directory servers
|
||||
@cindex LDAP
|
||||
@cindex PH/QI
|
||||
@cindex names and addresses
|
||||
There is an interface to directory servers using various protocols such
|
||||
as LDAP or the CCSO white pages directory system (PH/QI), described in a
|
||||
separate manual. It may be useful for looking up names and addresses.
|
||||
@xref{Top,,EUDC, eudc, EUDC Manual}.
|
||||
@end ignore
|
||||
|
||||
@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.
|
||||
* Amuse: Mail Amusements. Distracting the NSA; adding fortune messages.
|
||||
* Methods: 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.
|
||||
|
||||
In the mail buffer, you can insert and edit header fields using
|
||||
ordinary editing commands. Mail mode provides a commands to help you
|
||||
edit some header fields, and some are preinitialized in the buffer
|
||||
automatically when appropriate.
|
||||
|
||||
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
|
||||
@cindex copy of every outgoing message
|
||||
To send a blind carbon copy of every outgoing message to yourself, set
|
||||
the variable @code{mail-self-blind} to @code{t}. To send a blind carbon
|
||||
copy of every message to some other @var{address}, set the variable
|
||||
@code{mail-default-headers} to @code{"Bcc: @var{address}\n"}.
|
||||
|
||||
@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. To specify
|
||||
more than one file, use several @samp{FCC} fields, with one file
|
||||
name in each field.
|
||||
|
||||
@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 @env{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 @env{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 the 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}, and @samp{BCC} 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. These fields 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:
|
||||
|
||||
@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
|
||||
|
||||
@vindex mail-default-headers
|
||||
You can direct Emacs to insert certain default headers into the
|
||||
outgoing message by setting the variable @code{mail-default-headers}
|
||||
to a string. Then @code{C-x m} inserts this string into the message
|
||||
headers. If the default header fields are not appropriate for a
|
||||
particular message, edit them as appropriate before sending the
|
||||
message.
|
||||
|
||||
@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
|
||||
|
||||
@noindent
|
||||
Addresses specified in this way should use doublequotes around an
|
||||
entire address when the address contains spaces. But you need not
|
||||
include doublequotes around parts of the address, such as the person's
|
||||
full name. Emacs puts them in if they are needed. For example,
|
||||
|
||||
@example
|
||||
alias chief-torturer "George W. Bush <bush@@whitehouse.gov>"
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
is correct in @samp{.mailrc}. Emacs will insert the address as
|
||||
@samp{"George W. Bush" <bush@@whitehouse.gov>}.
|
||||
|
||||
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-mode-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-mode-hook
|
||||
(lambda ()
|
||||
(define-key
|
||||
mail-mode-map [remap next-line] 'mail-abbrev-next-line)
|
||||
(define-key
|
||||
mail-mode-map [remap end-of-buffer] 'mail-abbrev-end-of-buffer)))
|
||||
@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. This is a useful thing to do if
|
||||
you have saved the text of a draft message 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. Also, you
|
||||
don't get a warning if you try to send the same message twice.
|
||||
|
||||
@c This is indexed in mule.texi, node "Recognize Coding".
|
||||
@c @vindex sendmail-coding-system
|
||||
When you send a message that contains non-@acronym{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} (@pxref{Recognize Coding}).
|
||||
|
||||
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.
|
||||
|
||||
@cindex SMTP
|
||||
@cindex Feedmail
|
||||
@cindex Sendmail
|
||||
@vindex send-mail-function
|
||||
The variable @code{send-mail-function} controls how the default mail
|
||||
user agent sends mail. It should be set to a function. The default
|
||||
is @code{sendmail-send-it}, which delivers mail using the Sendmail
|
||||
installation on the local host. To send mail through a SMTP server,
|
||||
set it to @code{smtpmail-send-it} and set up the Emacs SMTP library
|
||||
(@pxref{Top,,Emacs SMTP Library, smtpmail, Sending mail via SMTP}). A
|
||||
third option is @code{feedmail-send-it}, see the commentary section of
|
||||
the @file{feedmail.el} package for more information.
|
||||
|
||||
@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}). (If your window
|
||||
manager defines @kbd{M-@key{TAB}} to switch windows, you can type
|
||||
@kbd{@key{ESC} @key{TAB}} or @kbd{C-M-i}.)
|
||||
|
||||
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; see the customization
|
||||
group @samp{mailalias} to see the variables for customizing this
|
||||
feature (@pxref{Customization Groups}).
|
||||
|
||||
If you type @kbd{M-@key{TAB}} in the body of the message,
|
||||
@code{mail-complete} 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
|
||||
Perform 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}; after that, 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. Note that this is not a MIME
|
||||
attachment.
|
||||
|
||||
@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 inserts the default contents of the buffer.
|
||||
After these default contents are inserted, @code{mail-setup-hook} runs.
|
||||
|
||||
@node Mail Amusements
|
||||
@section Mail Amusements
|
||||
|
||||
@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@footnote{The US National Security Agency.} 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.
|
||||
|
||||
@findex fortune-to-signature
|
||||
@cindex fortune cookies
|
||||
You can use the @code{fortune} program to put a ``fortune cookie''
|
||||
message into outgoing mail. To do this, add
|
||||
@code{fortune-to-signature} to @code{mail-setup-hook}:
|
||||
|
||||
@example
|
||||
(add-hook 'mail-setup-hook 'fortune-to-signature)
|
||||
@end example
|
||||
|
||||
@node Mail Methods
|
||||
@section Mail-Composition Methods
|
||||
@cindex mail-composition methods
|
||||
|
||||
@cindex MH mail interface
|
||||
@cindex Message mode for sending mail
|
||||
In this chapter we have described 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.
|
||||
@xref{Top,,MH-E,mh-e, The Emacs Interface to MH}. @xref{Top,,Message,message,
|
||||
Message 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, as do various other Emacs commands
|
||||
and facilities that send mail.
|
||||
|
||||
@vindex mail-user-agent
|
||||
To specify your mail-composition method, customize the variable
|
||||
@code{mail-user-agent}. Currently legitimate values include
|
||||
@code{sendmail-user-agent} (Mail mode), @code{mh-e-user-agent},
|
||||
@code{message-user-agent} and @code{gnus-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; the other methods use a different format of text in a different
|
||||
buffer, and their commands are different as well.
|
||||
|
||||
@ignore
|
||||
arch-tag: d8a3dfc3-5d87-45c5-a7f2-69871b8e4fd6
|
||||
@end ignore
|
982
man/ses.texi
982
man/ses.texi
|
@ -1,982 +0,0 @@
|
|||
\input texinfo @c -*-texinfo-*-
|
||||
@c %**start of header
|
||||
@setfilename ../info/ses
|
||||
@settitle SES: Simple Emacs Spreadsheet
|
||||
@setchapternewpage off
|
||||
@syncodeindex fn cp
|
||||
@syncodeindex vr cp
|
||||
@syncodeindex ky cp
|
||||
@c %**end of header
|
||||
|
||||
@copying
|
||||
This file documents SES: the Simple Emacs Spreadsheet.
|
||||
|
||||
Copyright @copyright{} 2002, 2003, 2004, 2005, 2006, 2007
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with the Front-Cover texts being ``A GNU
|
||||
Manual,'' and with the Back-Cover Texts as in (a) below. A copy of the
|
||||
license is included in the section entitled ``GNU Free Documentation
|
||||
License'' in the Emacs manual.
|
||||
|
||||
(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
|
||||
this GNU Manual, like GNU software. Copies published by the Free
|
||||
Software Foundation raise funds for GNU development.''
|
||||
|
||||
This document is part of a collection distributed under the GNU Free
|
||||
Documentation License. If you want to distribute this document
|
||||
separately from the collection, you can do so by adding a copy of the
|
||||
license to the document, as described in section 6 of the license.
|
||||
@end quotation
|
||||
@end copying
|
||||
|
||||
@dircategory Emacs
|
||||
@direntry
|
||||
* SES: (ses). Simple Emacs Spreadsheet
|
||||
@end direntry
|
||||
|
||||
@finalout
|
||||
|
||||
@titlepage
|
||||
@title SES
|
||||
@subtitle Simple Emacs Spreadsheet
|
||||
@author Jonathan A. Yavner
|
||||
@author @email{jyavner@@member.fsf.org}
|
||||
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
@insertcopying
|
||||
@end titlepage
|
||||
|
||||
@contents
|
||||
|
||||
@c ===================================================================
|
||||
|
||||
@ifnottex
|
||||
@node Top, Sales Pitch, (dir), (dir)
|
||||
@comment node-name, next, previous, up
|
||||
@top SES: Simple Emacs Spreadsheet
|
||||
|
||||
@display
|
||||
SES is a major mode for GNU Emacs to edit spreadsheet files, which
|
||||
contain a rectangular grid of cells. The cells' values are specified
|
||||
by formulas that can refer to the values of other cells.
|
||||
@end display
|
||||
@end ifnottex
|
||||
|
||||
To report bugs, send email to @email{jyavner@@member.fsf.org}.
|
||||
|
||||
@menu
|
||||
* Sales Pitch:: Why use SES?
|
||||
* The Basics:: Basic spreadsheet commands
|
||||
* Advanced Features:: Want to know more?
|
||||
* For Gurus:: Want to know @emph{even more}?
|
||||
* Index:: Concept, Function and Variable Index
|
||||
* Acknowledgements:: Acknowledgements
|
||||
* GNU Free Documentation License:: The license for this documentation.
|
||||
@end menu
|
||||
|
||||
@c ===================================================================
|
||||
|
||||
@node Sales Pitch, The Basics, Top, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Sales Pitch
|
||||
@cindex features
|
||||
|
||||
@itemize @bullet
|
||||
@item Create and edit simple spreadsheets with a minimum of fuss.
|
||||
@item Full undo/redo/autosave.
|
||||
@item Immune to viruses in spreadsheet files.
|
||||
@item Cell formulas are straight Emacs Lisp.
|
||||
@item Printer functions for control of cell appearance.
|
||||
@item Intuitive keystroke commands: C-o = insert row, M-o = insert column, etc.
|
||||
@item ``Spillover'' of lengthy cell values into following blank cells.
|
||||
@item Header line shows column letters or a selected row.
|
||||
@item Completing-read for entering symbols as cell values.
|
||||
@item Cut, copy, and paste can transfer formulas and printer functions.
|
||||
@item Import and export of tab-separated values or tab-separated formulas.
|
||||
@item Plaintext, easily-hacked file format.
|
||||
@end itemize
|
||||
|
||||
@c ===================================================================
|
||||
|
||||
@node The Basics, Advanced Features, Sales Pitch, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter The Basics
|
||||
@cindex basic commands
|
||||
@findex ses-jump
|
||||
@findex ses-mark-row
|
||||
@findex ses-mark-column
|
||||
@findex ses-mark-whole-buffer
|
||||
@findex set-mark-command
|
||||
@findex keyboard-quit
|
||||
|
||||
A @dfn{cell identifier} is a symbol with a column letter and a row
|
||||
number. Cell B7 is the 2nd column of the 7th row. For very wide
|
||||
spreadsheets, there are two column letters: cell AB7 is the 28th
|
||||
column of the 7th row.
|
||||
|
||||
@table @kbd
|
||||
@item j
|
||||
Moves point to cell, specified by identifier (@code{ses-jump}).
|
||||
@end table
|
||||
|
||||
Point is always at the left edge of a cell, or at the empty endline.
|
||||
When mark is inactive, the current cell is underlined. When mark is
|
||||
active, the range is the highlighted rectangle of cells (SES always
|
||||
uses transient mark mode). Drag the mouse from A1 to A3 to create the
|
||||
range A1-A2. Many SES commands operate only on single cells, not
|
||||
ranges.
|
||||
|
||||
@table @kbd
|
||||
@item C-SPC
|
||||
@itemx C-@@
|
||||
Set mark at point (@code{set-mark-command}).
|
||||
|
||||
@item C-g
|
||||
Turn off the mark (@code{keyboard-quit}).
|
||||
|
||||
@item M-h
|
||||
Highlight current row (@code{ses-mark-row}).
|
||||
|
||||
@item S-M-h
|
||||
Highlight current column (@code{ses-mark-column}).
|
||||
|
||||
@item C-x h
|
||||
Highlight all cells (@code{mark-whole-buffer}).
|
||||
@end table
|
||||
|
||||
@menu
|
||||
* Formulas::
|
||||
* Resizing::
|
||||
* Printer functions::
|
||||
* Clearing cells::
|
||||
* Copy/cut/paste::
|
||||
* Customizing SES::
|
||||
@end menu
|
||||
|
||||
@node Formulas, Resizing, The Basics, The Basics
|
||||
@section Cell formulas
|
||||
@cindex formulas
|
||||
@cindex formulas, entering
|
||||
@findex ses-read-cell
|
||||
@findex ses-read-symbol
|
||||
@findex ses-edit-cell
|
||||
@findex ses-recalculate-cell
|
||||
@findex ses-recalculate-all
|
||||
|
||||
To enter a number into the current cell, just start typing:
|
||||
|
||||
@table @kbd
|
||||
@item 0..9
|
||||
Self-insert a digit (@code{ses-read-cell}).
|
||||
|
||||
@item -
|
||||
Self-insert a negative number (@code{ses-read-cell}).
|
||||
|
||||
@item .
|
||||
Self-insert a fractional number (@code{ses-read-cell}).
|
||||
|
||||
@item "
|
||||
Self-insert a quoted string. The ending double-quote
|
||||
is inserted for you (@code{ses-read-cell}).
|
||||
|
||||
@item (
|
||||
Self-insert an expression. The right-parenthesis is inserted for you
|
||||
(@code{ses-read-cell}). To access another cell's value, just use its
|
||||
identifier in your expression. Whenever the other cell is changed,
|
||||
this cell's formula will be reevaluated. While typing in the
|
||||
expression, you can use @kbd{M-@key{TAB}} to complete symbol names.
|
||||
|
||||
@item ' @r{(apostrophe)}
|
||||
Enter a symbol (ses-read-symbol). SES remembers all symbols that have
|
||||
been used as formulas, so you can type just the beginning of a symbol
|
||||
and use @kbd{@key{SPC}}, @kbd{@key{TAB}}, and @kbd{?} to complete it.
|
||||
@end table
|
||||
|
||||
To enter something else (e.g., a vector), begin with a digit, then
|
||||
erase the digit and type whatever you want.
|
||||
|
||||
@table @kbd
|
||||
@item RET
|
||||
Edit the existing formula in the current cell (@code{ses-edit-cell}).
|
||||
|
||||
@item C-c C-c
|
||||
Force recalculation of the current cell or range (@code{ses-recalculate-cell}).
|
||||
|
||||
@item C-c C-l
|
||||
Recalculate the entire spreadsheet (@code{ses-recalculate-all}).
|
||||
@end table
|
||||
|
||||
@node Resizing, Printer functions, Formulas, The Basics
|
||||
@section Resizing the spreadsheet
|
||||
@cindex resizing spreadsheets
|
||||
@findex ses-insert-row
|
||||
@findex ses-insert-column
|
||||
@findex ses-delete-row
|
||||
@findex ses-delete-column
|
||||
@findex ses-set-column-width
|
||||
@findex ses-forward-or-insert
|
||||
@findex ses-append-row-jump-first-column
|
||||
|
||||
|
||||
Basic commands:
|
||||
|
||||
@table @kbd
|
||||
@item C-o
|
||||
(@code{ses-insert-row})
|
||||
|
||||
@item M-o
|
||||
(@code{ses-insert-column})
|
||||
|
||||
@item C-k
|
||||
(@code{ses-delete-row})
|
||||
|
||||
@item M-k
|
||||
(@code{ses-delete-column})
|
||||
|
||||
@item w
|
||||
(@code{ses-set-column-width})
|
||||
|
||||
@item TAB
|
||||
Moves point to the next rightward cell, or inserts a new column if
|
||||
already at last cell on line, or inserts a new row if at endline
|
||||
(@code{ses-forward-or-insert}).
|
||||
|
||||
@item C-j
|
||||
Linefeed inserts below the current row and moves to column A
|
||||
(@code{ses-append-row-jump-first-column}).
|
||||
@end table
|
||||
|
||||
Resizing the spreadsheet (unless you're just changing a column width)
|
||||
relocates all the cell-references in formulas so they still refer to
|
||||
the same cells. If a formula mentioned B1 and you insert a new first
|
||||
row, the formula will now mention B2.
|
||||
|
||||
If you delete a cell that a formula refers to, the cell-symbol is
|
||||
deleted from the formula, so @code{(+ A1 B1 C1)} after deleting the third
|
||||
column becomes @code{(+ A1 B1)}. In case this is not what you wanted:
|
||||
|
||||
@table @kbd
|
||||
@item C-_
|
||||
@itemx C-x u
|
||||
Undo previous action (@code{(undo)}).
|
||||
@end table
|
||||
|
||||
|
||||
@node Printer functions, Clearing cells, Resizing, The Basics
|
||||
@section Printer functions
|
||||
@cindex printer functions
|
||||
@findex ses-read-cell-printer
|
||||
@findex ses-read-column-printer
|
||||
@findex ses-read-default-printer
|
||||
@findex ses-center
|
||||
@findex ses-center-span
|
||||
@findex ses-dashfill
|
||||
@findex ses-dashfill-span
|
||||
@findex ses-tildefill-span
|
||||
|
||||
|
||||
Printer functions convert binary cell values into the print forms that
|
||||
Emacs will display on the screen.
|
||||
|
||||
A printer can be a format string, like @samp{"$%.2f"}. The result
|
||||
string is right-aligned within the print cell. To get left-alignment,
|
||||
use parentheses: @samp{("$%.2f")}. A printer can also be a
|
||||
one-argument function (a symbol or a lambda), whose result is a string
|
||||
(right-aligned) or list of one string (left-aligned). While typing in
|
||||
a lambda, you can use @kbd{M-@key{TAB}} to complete the names of symbols.
|
||||
|
||||
Each cell has a printer. If @code{nil}, the column-printer for the cell's
|
||||
column is used. If that is also @code{nil}, the default-printer for the
|
||||
spreadsheet is used.
|
||||
|
||||
@table @kbd
|
||||
@item p
|
||||
Enter a printer for current cell or range (@code{ses-read-cell-printer}).
|
||||
|
||||
@item M-p
|
||||
Enter a printer for the current column (@code{ses-read-column-printer}).
|
||||
|
||||
@item C-c C-p
|
||||
Enter the default printer for the spreadsheet
|
||||
(@code{ses-read-default-printer}).
|
||||
@end table
|
||||
|
||||
The @code{ses-read-@r{XXX}-printer} commands have their own minibuffer
|
||||
history, which is preloaded with the set of all printers used in this
|
||||
spreadsheet, plus the standard printers.
|
||||
|
||||
The standard printers are suitable only for cells, not columns or
|
||||
default, because they format the value using the column-printer (or
|
||||
default-printer if @code{nil}) and then center the result:
|
||||
|
||||
@table @code
|
||||
@item ses-center
|
||||
Just centering.
|
||||
|
||||
@item ses-center-span
|
||||
Centering with spill-over to following blank cells.
|
||||
|
||||
@item ses-dashfill
|
||||
Centering using dashes (-) instead of spaces.
|
||||
|
||||
@item ses-dashfill-span
|
||||
Centering with dashes and spill-over.
|
||||
|
||||
@item ses-tildefill-span
|
||||
Centering with tildes (~) and spill-over.
|
||||
@end table
|
||||
|
||||
|
||||
@node Clearing cells, Copy/cut/paste, Printer functions, The Basics
|
||||
@section Clearing cells
|
||||
@cindex clearing commands
|
||||
@findex ses-clear-cell-backward
|
||||
@findex ses-clear-cell-forward
|
||||
|
||||
These commands set both formula and printer to @code{nil}:
|
||||
|
||||
@table @kbd
|
||||
@item DEL
|
||||
Clear cell and move left (@code{ses-clear-cell-backward}).
|
||||
|
||||
@item C-d
|
||||
Clear cell and move right (@code{ses-clear-cell-forward}).
|
||||
@end table
|
||||
|
||||
|
||||
@node Copy/cut/paste, Customizing SES, Clearing cells, The Basics
|
||||
@section Copy, cut, and paste
|
||||
@cindex copy
|
||||
@cindex cut
|
||||
@cindex paste
|
||||
@findex kill-ring-save
|
||||
@findex mouse-set-region
|
||||
@findex mouse-set-secondary
|
||||
@findex ses-kill-override
|
||||
@findex yank
|
||||
@findex clipboard-yank
|
||||
@findex mouse-yank-at-click
|
||||
@findex mouse-yank-at-secondary
|
||||
@findex ses-yank-pop
|
||||
|
||||
The copy functions work on rectangular regions of cells. You can paste the
|
||||
copies into non-SES buffers to export the print text.
|
||||
|
||||
@table @kbd
|
||||
@item M-w
|
||||
@itemx [copy]
|
||||
@itemx [C-insert]
|
||||
Copy the highlighted cells to kill ring and primary clipboard
|
||||
(@code{kill-ring-save}).
|
||||
|
||||
@item [drag-mouse-1]
|
||||
Mark a region and copy it to kill ring and primary clipboard
|
||||
(@code{mouse-set-region}).
|
||||
|
||||
@item [M-drag-mouse-1]
|
||||
Mark a region and copy it to kill ring and secondary clipboard
|
||||
(@code{mouse-set-secondary}).
|
||||
|
||||
@item C-w
|
||||
@itemx [cut]
|
||||
@itemx [S-delete]
|
||||
The cut functions do not actually delete rows or columns---they copy
|
||||
and then clear (@code{ses-kill-override}).
|
||||
|
||||
@item C-y
|
||||
@itemx [S-insert]
|
||||
Paste from kill ring (@code{yank}). The paste functions behave
|
||||
differently depending on the format of the text being inserted:
|
||||
@itemize @bullet
|
||||
@item
|
||||
When pasting cells that were cut from a SES buffer, the print text is
|
||||
ignored and only the attached formula and printer are inserted; cell
|
||||
references in the formula are relocated unless you use @kbd{C-u}.
|
||||
@item
|
||||
The pasted text overwrites a rectangle of cells whose top left corner
|
||||
is the current cell. If part of the rectangle is beyond the edges of
|
||||
the spreadsheet, you must confirm the increase in spreadsheet size.
|
||||
@item
|
||||
Non-SES text is usually inserted as a replacement formula for the
|
||||
current cell. If the formula would be a symbol, it's treated as a
|
||||
string unless you use @kbd{C-u}. Pasted formulas with syntax errors
|
||||
are always treated as strings.
|
||||
@end itemize
|
||||
|
||||
@item [paste]
|
||||
Paste from primary clipboard or kill ring (@code{clipboard-yank}).
|
||||
|
||||
@item [mouse-2]
|
||||
Set point and paste from primary clipboard (@code{mouse-yank-at-click}).
|
||||
|
||||
@item [M-mouse-2]
|
||||
Set point and paste from secondary clipboard (@code{mouse-yank-secondary}).
|
||||
|
||||
@item M-y
|
||||
Immediately after a paste, you can replace the text with a preceding
|
||||
element from the kill ring (@code{ses-yank-pop}). Unlike the standard
|
||||
Emacs yank-pop, the SES version uses @code{undo} to delete the old
|
||||
yank. This doesn't make any difference?
|
||||
@end table
|
||||
|
||||
@node Customizing SES, , Copy/cut/paste, The Basics
|
||||
@section Customizing SES
|
||||
@cindex customizing
|
||||
@vindex enable-local-eval
|
||||
@vindex ses-mode-hook
|
||||
@vindex safe-functions
|
||||
@vindex enable-local-eval
|
||||
|
||||
|
||||
By default, a newly-created spreadsheet has 1 row and 1 column. The
|
||||
column width is 7 and the default printer is @samp{"%.7g"}. Each of these
|
||||
can be customized. Look in group ``ses''.
|
||||
|
||||
After entering a cell value, point normally moves right to the next
|
||||
cell. You can customize @code{ses-after-entry-functions} to move left or
|
||||
up or down. For diagonal movement, select two functions from the
|
||||
list.
|
||||
|
||||
@code{ses-mode-hook} is a normal mode hook (list of functions to
|
||||
execute when starting SES mode for a buffer).
|
||||
|
||||
The variable @code{safe-functions} is a list of possibly-unsafe
|
||||
functions to be treated as safe when analysing formulas and printers.
|
||||
@xref{Virus protection}. Before customizing @code{safe-functions},
|
||||
think about how much you trust the person who's suggesting this
|
||||
change. The value @code{t} turns off all anti-virus protection. A
|
||||
list-of-functions value might enable a ``gee whiz'' spreadsheet, but it
|
||||
also creates trapdoors in your anti-virus armor. In order for virus
|
||||
protection to work, you must always press @kbd{n} when presented with
|
||||
a virus warning, unless you understand what the questionable code is
|
||||
trying to do. Do not listen to those who tell you to customize
|
||||
@code{enable-local-eval}---this variable is for people who don't wear
|
||||
safety belts!
|
||||
|
||||
|
||||
@c ===================================================================
|
||||
|
||||
@node Advanced Features, For Gurus, The Basics, Top
|
||||
@chapter Advanced Features
|
||||
@cindex advanced features
|
||||
@findex ses-read-header-row
|
||||
|
||||
|
||||
@table @kbd
|
||||
@item C-c M-C-h
|
||||
(@code{ses-set-header-row}). The header line at the top of the SES
|
||||
window normally shows the column letter for each column. You can set
|
||||
it to show a copy of some row, such as a row of column titles, so that
|
||||
row will always be visible. Default is to set the current row as the
|
||||
header; use C-u to prompt for header row. Set the header to row 0 to
|
||||
show column letters again.
|
||||
@item [header-line mouse-3]
|
||||
Pops up a menu to set the current row as the header, or revert to
|
||||
column letters.
|
||||
@end table
|
||||
|
||||
@menu
|
||||
* The print area::
|
||||
* Ranges in formulas::
|
||||
* Sorting by column::
|
||||
* Standard formula functions::
|
||||
* More on cell printing::
|
||||
* Import and export::
|
||||
* Virus protection::
|
||||
* Spreadsheets with details and summary::
|
||||
@end menu
|
||||
|
||||
@node The print area, Ranges in formulas, Advanced Features, Advanced Features
|
||||
@section The print area
|
||||
@cindex print area
|
||||
@findex widen
|
||||
@findex ses-renarrow-buffer
|
||||
@findex ses-reprint-all
|
||||
|
||||
A SES file consists of a print area and a data area. Normally the
|
||||
buffer is narrowed to show only the print area. The print area is
|
||||
read-only except for special SES commands; it contains cell values
|
||||
formatted by printer functions. The data area records the formula and
|
||||
printer functions, etc.
|
||||
|
||||
@table @kbd
|
||||
@item C-x n w
|
||||
Show print and data areas (@code{widen}).
|
||||
|
||||
@item C-c C-n
|
||||
Show only print area (@code{ses-renarrow-buffer}).
|
||||
|
||||
@item S-C-l
|
||||
@itemx M-C-l
|
||||
Recreate print area by reevaluating printer functions for all cells
|
||||
(@code{ses-reprint-all}).
|
||||
@end table
|
||||
|
||||
@node Ranges in formulas, Sorting by column, The print area, Advanced Features
|
||||
@section Ranges in formulas
|
||||
@cindex ranges
|
||||
@findex ses-insert-range-click
|
||||
@findex ses-insert-range
|
||||
@findex ses-insert-ses-range-click
|
||||
@findex ses-insert-ses-range
|
||||
@vindex from
|
||||
@vindex to
|
||||
|
||||
A formula like
|
||||
@lisp
|
||||
(+ A1 A2 A3)
|
||||
@end lisp
|
||||
is the sum of three specific cells. If you insert a new second row,
|
||||
the formula becomes
|
||||
@lisp
|
||||
(+ A1 A3 A4)
|
||||
@end lisp
|
||||
and the new row is not included in the sum.
|
||||
|
||||
The macro @code{(ses-range @var{from} @var{to})} evaluates to a list of
|
||||
the values in a rectangle of cells. If your formula is
|
||||
@lisp
|
||||
(apply '+ (ses-range A1 A3))
|
||||
@end lisp
|
||||
and you insert a new second row, it becomes
|
||||
@lisp
|
||||
(apply '+ (ses-range A1 A4))
|
||||
@end lisp
|
||||
and the new row is included in the sum.
|
||||
|
||||
While entering or editing a formula in the minibuffer, you can select
|
||||
a range in the spreadsheet (using mouse or keyboard), then paste a
|
||||
representation of that range into your formula. Suppose you select
|
||||
A1-C1:
|
||||
|
||||
@table @kbd
|
||||
@item [S-mouse-3]
|
||||
Inserts "A1 B1 C1" @code{(ses-insert-range-click})
|
||||
|
||||
@item C-c C-r
|
||||
Keyboard version (@code{ses-insert-range}).
|
||||
|
||||
@item [C-S-mouse-3]
|
||||
Inserts "(ses-range A1 C1)" (@code{ses-insert-ses-range-click}).
|
||||
|
||||
@item C-c C-s
|
||||
Keyboard version (@code{ses-insert-ses-range}).
|
||||
@end table
|
||||
|
||||
If you delete the @var{from} or @var{to} cell for a range, the nearest
|
||||
still-existing cell is used instead. If you delete the entire range,
|
||||
the formula relocator will delete the ses-range from the formula.
|
||||
|
||||
If you insert a new row just beyond the end of a one-column range, or
|
||||
a new column just beyond a one-row range, the new cell is included in
|
||||
the range. New cells inserted just before a range are not included.
|
||||
|
||||
|
||||
@node Sorting by column, Standard formula functions, Ranges in formulas, Advanced Features
|
||||
@section Sorting by column
|
||||
@cindex sorting
|
||||
@findex ses-sort-column
|
||||
@findex ses-sort-column-click
|
||||
|
||||
@table @kbd
|
||||
@item C-c M-C-s
|
||||
Sort the cells of a range using one of the columns
|
||||
(@code{ses-sort-column}). The rows (or partial rows if the range
|
||||
doesn't include all columns) are rearranged so the chosen column will
|
||||
be in order.
|
||||
|
||||
@item [header-line mouse-2]
|
||||
The easiest way to sort is to click mouse-2 on the chosen column's header row
|
||||
(@code{ses-sort-column-click}).
|
||||
@end table
|
||||
|
||||
The sort comparison uses @code{string<}, which works well for
|
||||
right-justified numbers and left-justified strings.
|
||||
|
||||
With prefix arg, sort is in descending order.
|
||||
|
||||
Rows are moved one at a time, with relocation of formulas. This works
|
||||
well if formulas refer to other cells in their row, not so well for
|
||||
formulas that refer to other rows in the range or to cells outside the
|
||||
range.
|
||||
|
||||
|
||||
@node Standard formula functions, More on cell printing, Sorting by column, Advanced Features
|
||||
@section Standard formula functions
|
||||
@cindex standard formula functions
|
||||
@cindex *skip*
|
||||
@cindex *error*
|
||||
@findex ses-delete-blanks
|
||||
@findex ses-average
|
||||
@findex ses+
|
||||
|
||||
Oftentimes you want a calculation to exclude the blank cells. Here
|
||||
are some useful functions to call from your formulas:
|
||||
|
||||
@table @code
|
||||
@item (ses-delete-blanks &rest @var{args})
|
||||
Returns a list from which all blank cells (value is either @code{nil} or
|
||||
'*skip*) have been deleted.
|
||||
|
||||
@item (ses+ &rest @var{args})
|
||||
Sum of non-blank arguments.
|
||||
|
||||
@item (ses-average @var{list})
|
||||
Average of non-blank elements in @var{list}. Here the list is passed
|
||||
as a single argument, since you'll probably use it with @code{ses-range}.
|
||||
@end table
|
||||
|
||||
@node More on cell printing, Import and export, Standard formula functions, Advanced Features
|
||||
@section More on cell printing
|
||||
@cindex cell printing, more
|
||||
@findex ses-truncate-cell
|
||||
@findex ses-recalculate-cell
|
||||
|
||||
Special cell values:
|
||||
@itemize
|
||||
@item nil prints the same as "", but allows previous cell to spill over.
|
||||
@item '*skip* replaces nil when the previous cell actually does spill over;
|
||||
nothing is printed for it.
|
||||
@item '*error* indicates that the formula signaled an error instead of
|
||||
producing a value: the print cell is filled with hash marks (#).
|
||||
@end itemize
|
||||
|
||||
If the result from the printer function is too wide for the cell and
|
||||
the following cell is @code{nil}, the result will spill over into the
|
||||
following cell. Very wide results can spill over several cells. If
|
||||
the result is too wide for the available space (up to the end of the
|
||||
row or the next non-@code{nil} cell), the result is truncated if the cell's
|
||||
value is a string, or replaced with hash marks otherwise.
|
||||
|
||||
SES could get confused by printer results that contain newlines or
|
||||
tabs, so these are replaced with question marks.
|
||||
|
||||
@table @kbd
|
||||
@item C-c C-t
|
||||
Confine a cell to its own column (@code{ses-truncate-cell}). This
|
||||
allows you to move point to a rightward cell that would otherwise be
|
||||
covered by a spill-over. If you don't change the rightward cell, the
|
||||
confined cell will spill over again the next time it is reprinted.
|
||||
|
||||
@item C-c C-c
|
||||
When applied to a single cell, this command displays in the echo area any
|
||||
formula error or printer error that occurred during
|
||||
recalculation/reprinting (@code{ses-recalculate-cell}).
|
||||
@end table
|
||||
|
||||
When a printer function signals an error, the default printer
|
||||
@samp{"%s"} is substituted. This is useful when your column printer
|
||||
is numeric-only and you use a string as a cell value.
|
||||
|
||||
|
||||
@node Import and export, Virus protection, More on cell printing, Advanced Features
|
||||
@section Import and export
|
||||
@cindex import and export
|
||||
@cindex export, and import
|
||||
@findex ses-export-tsv
|
||||
@findex ses-export-tsf
|
||||
|
||||
@table @kbd
|
||||
@item x t
|
||||
Export a range of cells as tab-separated values (@code{ses-export-tsv}).
|
||||
@item x T
|
||||
Export a range of cells as tab-separated formulas (@code{ses-export-tsf}).
|
||||
@end table
|
||||
|
||||
The exported text goes to the kill ring --- you can paste it into
|
||||
another buffer. Columns are separated by tabs, rows by newlines.
|
||||
|
||||
To import text, use any of the yank commands where the text to paste
|
||||
contains tabs and/or newlines. Imported formulas are not relocated.
|
||||
|
||||
@node Virus protection, Spreadsheets with details and summary, Import and export, Advanced Features
|
||||
@section Virus protection
|
||||
@cindex virus protection
|
||||
|
||||
Whenever a formula or printer is read from a file or is pasted into
|
||||
the spreadsheet, it receives a ``needs safety check'' marking. Later,
|
||||
when the formula or printer is evaluated for the first time, it is
|
||||
checked for safety using the @code{unsafep} predicate; if found to be
|
||||
``possibly unsafe'', the questionable formula or printer is displayed
|
||||
and you must press Y to approve it or N to use a substitute. The
|
||||
substitute always signals an error.
|
||||
|
||||
Formulas or printers that you type in are checked immediately for
|
||||
safety. If found to be possibly unsafe and you press N to disapprove,
|
||||
the action is canceled and the old formula or printer will remain.
|
||||
|
||||
Besides viruses (which try to copy themselves to other files),
|
||||
@code{unsafep} can also detect all other kinds of Trojan horses, such as
|
||||
spreadsheets that delete files, send email, flood Web sites, alter
|
||||
your Emacs settings, etc.
|
||||
|
||||
Generally, spreadsheet formulas and printers are simple things that
|
||||
don't need to do any fancy computing, so all potentially-dangerous
|
||||
parts of the Emacs Lisp environment can be excluded without cramping
|
||||
your style as a formula-writer. See the documentation in @file{unsafep.el}
|
||||
for more info on how Lisp forms are classified as safe or unsafe.
|
||||
|
||||
@node Spreadsheets with details and summary, , Virus protection, Advanced Features
|
||||
@section Spreadsheets with details and summary
|
||||
@cindex details and summary
|
||||
@cindex summary, and details
|
||||
|
||||
A common organization for spreadsheets is to have a bunch of ``detail''
|
||||
rows, each perhaps describing a transaction, and then a set of
|
||||
``summary'' rows that each show reduced data for some subset of the
|
||||
details. SES supports this organization via the @code{ses-select}
|
||||
function.
|
||||
|
||||
@table @code
|
||||
@item (ses-select @var{fromrange} @var{test} @var{torange})
|
||||
Returns a subset of @var{torange}. For each member in @var{fromrange}
|
||||
that is equal to @var{test}, the corresponding member of @var{torange}
|
||||
is included in the result.
|
||||
@end table
|
||||
|
||||
Example of use:
|
||||
@lisp
|
||||
(ses-average (ses-select (ses-range A1 A5) 'Smith (ses-range B1 B5)))
|
||||
@end lisp
|
||||
This computes the average of the B column values for those rows whose
|
||||
A column value is the symbol 'Smith.
|
||||
|
||||
Arguably one could specify only @var{fromrange} plus
|
||||
@var{to-row-offset} and @var{to-column-offset}. The @var{torange} is
|
||||
stated explicitly to ensure that the formula will be recalculated if
|
||||
any cell in either range is changed.
|
||||
|
||||
File @file{etc/ses-example.el} in the Emacs distribution is an example of a
|
||||
details-and-summary spreadsheet.
|
||||
|
||||
|
||||
@c ===================================================================
|
||||
|
||||
@node For Gurus, Index, Advanced Features, Top
|
||||
@chapter For Gurus
|
||||
@cindex advanced features
|
||||
|
||||
@menu
|
||||
* Deferred updates::
|
||||
* Nonrelocatable references::
|
||||
* The data area::
|
||||
* Buffer-local variables in spreadsheets::
|
||||
* Uses of defadvice in SES::
|
||||
@end menu
|
||||
|
||||
@node Deferred updates, Nonrelocatable references, For Gurus, For Gurus
|
||||
@section Deferred updates
|
||||
@cindex deferred updates
|
||||
@cindex updates, deferred
|
||||
@vindex run-with-idle-timer
|
||||
|
||||
To save time by avoiding redundant computations, cells that need
|
||||
recalculation due to changes in other cells are added to a set. At
|
||||
the end of the command, each cell in the set is recalculated once.
|
||||
This can create a new set of cells that need recalculation. The
|
||||
process is repeated until either the set is empty or it stops changing
|
||||
(due to circular references among the cells). In extreme cases, you
|
||||
might see progress messages of the form ``Recalculating... (@var{nnn}
|
||||
cells left)''. If you interrupt the calculation using @kbd{C-g}, the
|
||||
spreadsheet will be left in an inconsistent state, so use @kbd{C-_} or
|
||||
@kbd{C-c C-l} to fix it.
|
||||
|
||||
To save even more time by avoiding redundant writes, cells that have
|
||||
changes are added to a set instead of being written immediately to the
|
||||
data area. Each cell in the set is written once, at the end of the
|
||||
command. If you change vast quantities of cells, you might see a
|
||||
progress message of the form ``Writing... (@var{nnn} cells left)''.
|
||||
These deferred cell-writes cannot be interrupted by @kbd{C-g}, so
|
||||
you'll just have to wait.
|
||||
|
||||
SES uses @code{run-with-idle-timer} to move the cell underline when
|
||||
Emacs will be scrolling the buffer after the end of a command, and
|
||||
also to narrow and underline after @kbd{C-x C-v}. This is visible as
|
||||
a momentary glitch after C-x C-v and certain scrolling commands. You
|
||||
can type ahead without worrying about the glitch.
|
||||
|
||||
|
||||
@node Nonrelocatable references, The data area, Deferred updates, For Gurus
|
||||
@section Nonrelocatable references
|
||||
@cindex nonrelocatable references
|
||||
@cindex references, nonrelocatable
|
||||
|
||||
@kbd{C-y} relocates all cell-references in a pasted formula, while
|
||||
@kbd{C-u C-y} relocates none of the cell-references. What about mixed
|
||||
cases?
|
||||
|
||||
You can use
|
||||
@lisp
|
||||
(symbol-value 'B3)
|
||||
@end lisp
|
||||
to make an @dfn{absolute reference}. The formula relocator skips over
|
||||
quoted things, so this will not be relocated when pasted or when
|
||||
rows/columns are inserted/deleted. However, B3 will not be recorded
|
||||
as a dependency of this cell, so this cell will not be updated
|
||||
automatically when B3 is changed.
|
||||
|
||||
The variables @code{row} and @code{col} are dynamically bound while a
|
||||
cell formula is being evaluated. You can use
|
||||
@lisp
|
||||
(ses-cell-value row 0)
|
||||
@end lisp
|
||||
to get the value from the leftmost column in the current row. This
|
||||
kind of dependency is also not recorded.
|
||||
|
||||
|
||||
@node The data area, Buffer-local variables in spreadsheets, Nonrelocatable references, For Gurus
|
||||
@section The data area
|
||||
@cindex data area
|
||||
@findex ses-reconstruct-all
|
||||
|
||||
Begins with an 014 character, followed by sets of cell-definition
|
||||
macros for each row, followed by column-widths, column-printers,
|
||||
default-printer, and header-row. Then there's the global parameters
|
||||
(file-format ID, numrows, numcols) and the local variables (specifying
|
||||
SES mode for the buffer, etc.)
|
||||
|
||||
When a SES file is loaded, first the numrows and numcols values are
|
||||
loaded, then the entire data area is @code{eval}ed, and finally the local
|
||||
variables are processed.
|
||||
|
||||
You can edit the data area, but don't insert or delete any newlines
|
||||
except in the local-variables part, since SES locates things by
|
||||
counting newlines. Use @kbd{C-x C-e} at the end of a line to install
|
||||
your edits into the spreadsheet data structures (this does not update
|
||||
the print area, use e.g. @kbd{C-c C-l} for that).
|
||||
|
||||
The data area is maintained as an image of spreadsheet data
|
||||
structures that area stored in buffer-local variables. If the data
|
||||
area gets messed up, you can try reconstructing the data area from the
|
||||
data structures:
|
||||
|
||||
@table @kbd
|
||||
@item C-c M-C-l
|
||||
(@code{ses-reconstruct-all}).
|
||||
@end table
|
||||
|
||||
|
||||
@node Buffer-local variables in spreadsheets, Uses of defadvice in SES, The data area, For Gurus
|
||||
@section Buffer-local variables in spreadsheets
|
||||
@cindex buffer-local variables
|
||||
@cindex variables, buffer-local
|
||||
|
||||
You can add additional local variables to the list at the bottom of
|
||||
the data area, such as hidden constants you want to refer to in your
|
||||
formulas.
|
||||
|
||||
You can override the variable @code{symbolic-formulas} to be a list of
|
||||
symbols (as parenthesized strings) to show as completions for the '
|
||||
command. This initial completions list is used instead of the actual
|
||||
set of symbols-as-formulas in the spreadsheet.
|
||||
|
||||
For examples of these, see file @file{etc/ses-example.ses}.
|
||||
|
||||
If (for some reason) you want your formulas or printers to save data
|
||||
into variables, you must declare these variables as buffer-locals in
|
||||
order to avoid a virus warning.
|
||||
|
||||
You can define functions by making them values for the fake local
|
||||
variable @code{eval}. Such functions can then be used in your
|
||||
formulas and printers, but usually each @code{eval} is presented to
|
||||
the user during file loading as a potential virus --- this can get
|
||||
annoying.
|
||||
|
||||
You can define functions in your @file{.emacs} file. Other people can
|
||||
still read the print area of your spreadsheet, but they won't be able
|
||||
to recalculate or reprint anything that depends on your functions. To
|
||||
avoid virus warnings, each function used in a formula needs
|
||||
@lisp
|
||||
(put 'your-function-name 'safe-function t)
|
||||
@end lisp
|
||||
|
||||
@node Uses of defadvice in SES, , Buffer-local variables in spreadsheets, For Gurus
|
||||
@section Uses of defadvice in SES
|
||||
@cindex defadvice
|
||||
@cindex undo-more
|
||||
@cindex copy-region-as-kill
|
||||
@cindex yank
|
||||
|
||||
@table @code
|
||||
@item undo-more
|
||||
Defines a new undo element format (@var{fun} . @var{args}), which
|
||||
means ``undo by applying @var{fun} to @var{args}''. For spreadsheet
|
||||
buffers, it allows undos in the data area even though that's outside
|
||||
the narrowing.
|
||||
|
||||
@item copy-region-as-kill
|
||||
When copying from the print area of a spreadsheet, treat the region as
|
||||
a rectangle and attach each cell's formula and printer as 'ses
|
||||
properties.
|
||||
|
||||
@item yank
|
||||
When yanking into the print area of a spreadsheet, first try to yank
|
||||
as cells (if the yank text has 'ses properties), then as tab-separated
|
||||
formulas, then (if all else fails) as a single formula for the current
|
||||
cell.
|
||||
@end table
|
||||
|
||||
@c ===================================================================
|
||||
@node Index, Acknowledgements, For Gurus, Top
|
||||
@unnumbered Index
|
||||
|
||||
@printindex cp
|
||||
|
||||
@c ===================================================================
|
||||
|
||||
@node Acknowledgements, GNU Free Documentation License, Index, Top
|
||||
@chapter Acknowledgements
|
||||
|
||||
Coding by:
|
||||
@quotation
|
||||
Jonathan Yavner @email{jyavner@@member.fsf.org}@*
|
||||
Stefan Monnier @email{monnier@@gnu.org}
|
||||
@end quotation
|
||||
|
||||
@noindent
|
||||
Texinfo manual by:
|
||||
@quotation
|
||||
Jonathan Yavner @email{jyavner@@member.fsf.org}@*
|
||||
Brad Collins <brad@@chenla.org>
|
||||
@end quotation
|
||||
|
||||
@noindent
|
||||
Ideas from:
|
||||
@quotation
|
||||
Christoph Conrad @email{christoph.conrad@@gmx.de}@*
|
||||
CyberBob @email{cyberbob@@redneck.gacracker.org}@*
|
||||
Syver Enstad @email{syver-en@@online.no}@*
|
||||
Ami Fischman @email{fischman@@zion.bpnetworks.com}@*
|
||||
Thomas Gehrlein @email{Thomas.Gehrlein@@t-online.de}@*
|
||||
Chris F.A. Johnson @email{c.f.a.johnson@@rogers.com}@*
|
||||
Yusong Li @email{lyusong@@hotmail.com}@*
|
||||
Juri Linkov @email{juri@@jurta.org}@*
|
||||
Harald Maier @email{maierh@@myself.com}@*
|
||||
Alan Nash @email{anash@@san.rr.com}@*
|
||||
François Pinard @email{pinard@@iro.umontreal.ca}@*
|
||||
Pedro Pinto @email{ppinto@@cs.cmu.edu}@*
|
||||
Stefan Reichör @email{xsteve@@riic.at}@*
|
||||
Oliver Scholz @email{epameinondas@@gmx.de}@*
|
||||
Richard M. Stallman @email{rms@@gnu.org}@*
|
||||
Luc Teirlinck @email{teirllm@@dms.auburn.edu}@*
|
||||
J. Otto Tennant @email{jotto@@pobox.com}@*
|
||||
Jean-Philippe Theberge @email{jphil@@acs.pagesjaunes.fr}
|
||||
@end quotation
|
||||
|
||||
@c ===================================================================
|
||||
|
||||
@node GNU Free Documentation License, , Acknowledgements, Top
|
||||
@appendix GNU Free Documentation License
|
||||
@include doclicense.texi
|
||||
|
||||
@bye
|
||||
|
||||
@ignore
|
||||
arch-tag: 10a4ee1c-7ef4-4c06-8b7a-f975e39f0dec
|
||||
@end ignore
|
369
man/sieve.texi
369
man/sieve.texi
|
@ -1,369 +0,0 @@
|
|||
\input texinfo @c -*-texinfo-*-
|
||||
|
||||
@setfilename ../info/sieve
|
||||
@settitle Emacs Sieve Manual
|
||||
@synindex fn cp
|
||||
@synindex vr cp
|
||||
@synindex pg cp
|
||||
|
||||
@copying
|
||||
This file documents the Emacs Sieve package, for server-side mail filtering.
|
||||
|
||||
Copyright @copyright{} 2001, 2002, 2003, 2004, 2005, 2006, 2007
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with the Front-Cover texts being ``A GNU
|
||||
Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
|
||||
license is included in the section entitled ``GNU Free Documentation
|
||||
License'' in the Emacs manual.
|
||||
|
||||
(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
|
||||
this GNU Manual, like GNU software. Copies published by the Free
|
||||
Software Foundation raise funds for GNU development.''
|
||||
|
||||
This document is part of a collection distributed under the GNU Free
|
||||
Documentation License. If you want to distribute this document
|
||||
separately from the collection, you can do so by adding a copy of the
|
||||
license to the document, as described in section 6 of the license.
|
||||
@end quotation
|
||||
@end copying
|
||||
|
||||
@dircategory Emacs
|
||||
@direntry
|
||||
* Sieve: (sieve). Managing Sieve scripts in Emacs.
|
||||
@end direntry
|
||||
@iftex
|
||||
@finalout
|
||||
@end iftex
|
||||
@setchapternewpage odd
|
||||
|
||||
@titlepage
|
||||
@title Emacs Sieve Manual
|
||||
|
||||
@author by Simon Josefsson
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
@insertcopying
|
||||
@end titlepage
|
||||
|
||||
|
||||
@node Top
|
||||
@top Sieve Support for Emacs
|
||||
|
||||
This manual documents the Emacs Sieve package.
|
||||
|
||||
It is intended as a users manual for Sieve Mode and Manage Sieve, and
|
||||
as a reference manual for the @samp{sieve-manage} protocol Emacs Lisp
|
||||
API.
|
||||
|
||||
Sieve is a language for server-side filtering of mail. The language
|
||||
is documented in RFC 3028. This manual does not attempt to document
|
||||
the language, so keep RFC 3028 around.
|
||||
|
||||
A good online Sieve resources is @uref{http://www.cyrusoft.com/sieve/}.
|
||||
|
||||
@menu
|
||||
* Installation:: Getting ready to use the package.
|
||||
* Sieve Mode:: Editing Sieve scripts.
|
||||
* Managing Sieve:: Managing Sieve scripts on a remote server.
|
||||
* Examples :: A few Sieve code snippets.
|
||||
* Manage Sieve API :: Interfacing to the Manage Sieve Protocol API.
|
||||
* Standards:: A summary of RFCs and working documents used.
|
||||
* GNU Free Documentation License:: The license for this documentation.
|
||||
* Index:: Function and variable index.
|
||||
@end menu
|
||||
|
||||
|
||||
@node Installation
|
||||
@chapter Installation
|
||||
@cindex Install
|
||||
@cindex Setup
|
||||
|
||||
The Sieve package should come with your Emacs version, and should be
|
||||
ready for use directly.
|
||||
|
||||
However, to manually set up the package you can put the following
|
||||
commands in your @code{~/.emacs}:
|
||||
|
||||
@lisp
|
||||
(autoload 'sieve-mode "sieve-mode")
|
||||
@end lisp
|
||||
@lisp
|
||||
(setq auto-mode-alist (cons '("\\.s\\(v\\|iv\\|ieve\\)\\'" . sieve-mode)
|
||||
auto-mode-alist))
|
||||
@end lisp
|
||||
|
||||
|
||||
@node Sieve Mode
|
||||
@chapter Sieve Mode
|
||||
|
||||
Sieve mode provides syntax-based indentation, font-locking support and
|
||||
other handy functions to make editing Sieve scripts easier.
|
||||
|
||||
Use @samp{M-x sieve-mode} to switch to this major mode. This command
|
||||
runs the hook @code{sieve-mode-hook}.
|
||||
|
||||
@vindex sieve-mode-map
|
||||
@vindex sieve-mode-syntax-table
|
||||
Sieve mode is derived from @code{c-mode}, and is very similar except
|
||||
for the syntax of comments. The keymap (@code{sieve-mode-map}) is
|
||||
inherited from @code{c-mode}, as are the variables for customizing
|
||||
indentation. Sieve mode has its own abbrev table
|
||||
(@code{sieve-mode-abbrev-table}) and syntax table
|
||||
(@code{sieve-mode-syntax-table}).
|
||||
|
||||
In addition to the editing utility functions, Sieve mode also contains
|
||||
bindings to manage Sieve scripts remotely. @xref{Managing Sieve}.
|
||||
|
||||
@table @kbd
|
||||
|
||||
@item C-c RET
|
||||
@kindex C-c RET
|
||||
@findex sieve-manage
|
||||
@cindex manage remote sieve script
|
||||
Open a connection to a remote server using the Managesieve protocol.
|
||||
|
||||
@item C-c C-l
|
||||
@kindex C-c C-l
|
||||
@findex sieve-upload
|
||||
@cindex upload sieve script
|
||||
Upload the Sieve script to the currently open server.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@node Managing Sieve
|
||||
@chapter Managing Sieve
|
||||
|
||||
Manage Sieve is a special mode used to display Sieve scripts available
|
||||
on a remote server. It can be invoked with @kbd{M-x sieve-manage
|
||||
RET}, which queries the user for a server and if necessary, user
|
||||
credentials to use.
|
||||
|
||||
When a server has been successfully contacted, the Manage Sieve buffer
|
||||
looks something like:
|
||||
|
||||
@example
|
||||
Server : mailserver:2000
|
||||
|
||||
2 scripts on server, press RET on a script name edits it, or
|
||||
press RET on <new script> to create a new script.
|
||||
<new script>
|
||||
ACTIVE .sieve
|
||||
template.siv
|
||||
@end example
|
||||
|
||||
One of the scripts are highlighted, and standard point navigation
|
||||
commands (@kbd{<up>}, @kbd{<down>} etc) can be used to navigate the
|
||||
list.
|
||||
|
||||
The following commands are available in the Manage Sieve buffer:
|
||||
|
||||
@table @kbd
|
||||
|
||||
@item m
|
||||
@kindex m
|
||||
@findex sieve-activate
|
||||
Activates the currently highlighted script.
|
||||
|
||||
@item u
|
||||
@kindex u
|
||||
@findex sieve-deactivate
|
||||
Deactivates the currently highlighted script.
|
||||
|
||||
@item C-M-?
|
||||
@kindex C-M-?
|
||||
@findex sieve-deactivate-all
|
||||
Deactivates all scripts.
|
||||
|
||||
@item r
|
||||
@kindex r
|
||||
@findex sieve-remove
|
||||
Remove currently highlighted script.
|
||||
|
||||
@item RET
|
||||
@item mouse-2
|
||||
@item f
|
||||
@kindex RET
|
||||
@kindex mouse-2
|
||||
@kindex f
|
||||
@findex sieve-edit-script
|
||||
Bury the server buffer and download the currently highlighted script
|
||||
into a new buffer for editing in Sieve mode (@pxref{Sieve Mode}).
|
||||
|
||||
@item o
|
||||
@kindex o
|
||||
@findex sieve-edit-script-other-window
|
||||
Create a new buffer in another window containing the currently
|
||||
highlighted script for editing in Sieve mode (@pxref{Sieve Mode}).
|
||||
|
||||
@item q
|
||||
@kindex q
|
||||
@findex sieve-bury-buffer
|
||||
Bury the Manage Sieve buffer without closing the connection.
|
||||
|
||||
@item ?
|
||||
@item h
|
||||
@kindex ?
|
||||
@kindex h
|
||||
@findex sieve-help
|
||||
Displays help in the minibuffer.
|
||||
|
||||
@end table
|
||||
|
||||
@node Examples
|
||||
@chapter Examples
|
||||
|
||||
If you are not familiar with Sieve, this chapter contains a few simple
|
||||
code snippets that you can cut'n'paste and modify at will, until you
|
||||
feel more comfortable with the Sieve language to write the rules from
|
||||
scratch.
|
||||
|
||||
The following complete Sieve script places all messages with a matching
|
||||
@samp{Sender:} header into the given mailbox. Many mailing lists uses
|
||||
this format. The first line makes sure your Sieve server understands
|
||||
the @code{fileinto} command.
|
||||
|
||||
@example
|
||||
require "fileinto";
|
||||
|
||||
if address "sender" "owner-w3-beta@@xemacs.org" @{
|
||||
fileinto "INBOX.w3-beta";
|
||||
@}
|
||||
@end example
|
||||
|
||||
A few mailing lists do not use the @samp{Sender:} header, but does
|
||||
contain some unique identifier in some other header. The following is
|
||||
not a complete script, it assumes that @code{fileinto} has already been
|
||||
required.
|
||||
|
||||
@example
|
||||
if header :contains "Delivered-To" "auc-tex@@sunsite.dk" @{
|
||||
fileinto "INBOX.auc-tex";
|
||||
@}
|
||||
@end example
|
||||
|
||||
At last, we have the hopeless mailing lists that does not have any
|
||||
unique identifier and you are forced to match on the @samp{To:} and
|
||||
@samp{Cc} headers. As before, this snippet assumes that @code{fileinto}
|
||||
has been required.
|
||||
|
||||
@example
|
||||
if address ["to", "cc"] "kerberos@@mit.edu" @{
|
||||
fileinto "INBOX.kerberos";
|
||||
@}
|
||||
@end example
|
||||
|
||||
@node Manage Sieve API
|
||||
@chapter Manage Sieve API
|
||||
|
||||
The @file{sieve-manage.el} library contains low-level functionality
|
||||
for talking to a server with the @sc{managesieve} protocol.
|
||||
|
||||
A number of user-visible variables exist, which all can be customized
|
||||
in the @code{sieve} group (@kbd{M-x customize-group RET sieve RET}):
|
||||
|
||||
@table @code
|
||||
|
||||
@item sieve-manage-default-user
|
||||
@vindex sieve-manage-default-user
|
||||
Sets the default username.
|
||||
|
||||
@item sieve-manage-default-port
|
||||
@vindex sieve-manage-default-port
|
||||
Sets the default port to use, the suggested port number is @code{2000}.
|
||||
|
||||
@item sieve-manage-log
|
||||
@vindex sieve-manage-log
|
||||
If non-@code{nil}, should be a string naming a buffer where a protocol trace
|
||||
is dumped (for debugging purposes).
|
||||
|
||||
@end table
|
||||
|
||||
The API functions include:
|
||||
|
||||
@table @code
|
||||
|
||||
@item sieve-manage-open
|
||||
@findex sieve-manage-open
|
||||
Open connection to managesieve server, returning a buffer to be used
|
||||
by all other API functions.
|
||||
|
||||
@item sieve-manage-opened
|
||||
@findex sieve-manage-opened
|
||||
Check if a server is open or not.
|
||||
|
||||
@item sieve-manage-close
|
||||
@findex sieve-manage-close
|
||||
Close a server connection.
|
||||
|
||||
@item sieve-manage-authenticate
|
||||
@findex sieve-manage-authenticate
|
||||
Authenticate to the server.
|
||||
|
||||
@item sieve-manage-capability
|
||||
@findex sieve-manage-capability
|
||||
Return a list of capabilities the server supports.
|
||||
|
||||
@item sieve-manage-listscripts
|
||||
@findex sieve-manage-listscripts
|
||||
List scripts on the server.
|
||||
|
||||
@item sieve-manage-havespace
|
||||
@findex sieve-manage-havespace
|
||||
Return non-@code{nil} if the server has room for a script of given
|
||||
size.
|
||||
|
||||
@item sieve-manage-getscript
|
||||
@findex sieve-manage-getscript
|
||||
Download script from server.
|
||||
|
||||
@item sieve-manage-putscript
|
||||
@findex sieve-manage-putscript
|
||||
Upload script to server.
|
||||
|
||||
@item sieve-manage-setactive
|
||||
@findex sieve-manage-setactive
|
||||
Indicate which script on the server should be active.
|
||||
|
||||
@end table
|
||||
|
||||
@node Standards
|
||||
@chapter Standards
|
||||
|
||||
The Emacs Sieve package implements all or parts of a small but
|
||||
hopefully growing number of RFCs and drafts documents. This chapter
|
||||
lists the relevant ones. They can all be fetched from
|
||||
@uref{http://quimby.gnus.org/notes/}.
|
||||
|
||||
@table @dfn
|
||||
|
||||
@item RFC3028
|
||||
Sieve: A Mail Filtering Language.
|
||||
|
||||
@item draft-martin-managesieve-03
|
||||
A Protocol for Remotely Managing Sieve Scripts
|
||||
|
||||
@end table
|
||||
|
||||
@node GNU Free Documentation License
|
||||
@appendix GNU Free Documentation License
|
||||
@include doclicense.texi
|
||||
|
||||
@node Index
|
||||
@unnumbered Index
|
||||
@printindex cp
|
||||
|
||||
@summarycontents
|
||||
@contents
|
||||
@bye
|
||||
|
||||
@c End:
|
||||
|
||||
@ignore
|
||||
arch-tag: 6e3ad0af-2eaf-4f35-a081-d40f4a683ec3
|
||||
@end ignore
|
|
@ -1,427 +0,0 @@
|
|||
\input texinfo @c -*-texinfo-*-
|
||||
@setfilename ../info/smtpmail
|
||||
@settitle Emacs SMTP Library
|
||||
@syncodeindex vr fn
|
||||
@copying
|
||||
Copyright @copyright{} 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
|
||||
and with the Back-Cover Texts as in (a) below. A copy of the license
|
||||
is included in the section entitled ``GNU Free Documentation License''
|
||||
in the Emacs manual.
|
||||
|
||||
(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
|
||||
this GNU Manual, like GNU software. Copies published by the Free
|
||||
Software Foundation raise funds for GNU development.''
|
||||
|
||||
This document is part of a collection distributed under the GNU Free
|
||||
Documentation License. If you want to distribute this document
|
||||
separately from the collection, you can do so by adding a copy of the
|
||||
license to the document, as described in section 6 of the license.
|
||||
@end quotation
|
||||
@end copying
|
||||
|
||||
@dircategory Emacs
|
||||
@direntry
|
||||
* SMTP: (smtpmail). Emacs library for sending mail via SMTP.
|
||||
@end direntry
|
||||
|
||||
@titlepage
|
||||
@title{Emacs SMTP Library}
|
||||
@subtitle{An Emacs package for sending mail via SMTP}
|
||||
@author{Simon Josefsson, Alex Schroeder}
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
@insertcopying
|
||||
@end titlepage
|
||||
|
||||
@contents
|
||||
|
||||
@ifnottex
|
||||
@node Top
|
||||
@top Emacs SMTP Library
|
||||
|
||||
@insertcopying
|
||||
@end ifnottex
|
||||
|
||||
@menu
|
||||
* How Mail Works:: Brief introduction to mail concepts.
|
||||
* Emacs Speaks SMTP:: How to use the SMTP library in Emacs.
|
||||
* Authentication:: Authenticating yourself to the server.
|
||||
* Queued delivery:: Sending mail without an internet connection.
|
||||
* Server workarounds:: Mail servers with special requirements.
|
||||
* Debugging:: Tracking down problems.
|
||||
* GNU Free Documentation License:: The license for this documentation.
|
||||
|
||||
Indices
|
||||
|
||||
* Index:: Index over variables and functions.
|
||||
@end menu
|
||||
|
||||
@node How Mail Works
|
||||
@chapter How Mail Works
|
||||
|
||||
@cindex SMTP
|
||||
@cindex MTA
|
||||
On the internet, mail is sent from mail host to mail host using the
|
||||
simple mail transfer protocol (SMTP). To send and receive mail, you
|
||||
must get it from and send it to a mail host. Every mail host runs a
|
||||
mail transfer agent (MTA) such as Exim that accepts mails and passes
|
||||
them on. The communication between a mail host and other clients does
|
||||
not necessarily involve SMTP, however. Here is short overview of what
|
||||
is involved.
|
||||
|
||||
@cindex MUA
|
||||
The mail program --- also called a mail user agent (MUA) ---
|
||||
usually sends outgoing mail to a mail host. When your computer is
|
||||
permanently connected to the internet, it might even be a mail host
|
||||
itself. In this case, the MUA will pipe mail to the
|
||||
@file{/usr/lib/sendmail} application. It will take care of your mail
|
||||
and pass it on to the next mail host.
|
||||
|
||||
@cindex ISP
|
||||
When you are only connected to the internet from time to time, your
|
||||
internet service provider (ISP) has probably told you which mail host
|
||||
to use. You must configure your MUA to use that mail host. Since you
|
||||
are reading this manual, you probably want to configure Emacs to use
|
||||
SMTP to send mail to that mail host. More on that in the next
|
||||
section.
|
||||
|
||||
@cindex MDA
|
||||
Things are different when reading mail. The mail host responsible
|
||||
for your mail keeps it in a file somewhere. The messages get into the
|
||||
file by way of a mail delivery agent (MDA) such as procmail. These
|
||||
delivery agents often allow you to filter and munge your mails before
|
||||
you get to see it. When your computer is that mail host, this file is
|
||||
called a spool, and sometimes located in the directory
|
||||
@file{/var/spool/mail/}. All your MUA has to do is read mail from the
|
||||
spool, then.
|
||||
|
||||
@cindex POP3
|
||||
@cindex IMAP
|
||||
When your computer is not always connected to the internet, you
|
||||
must get the mail from the remote mail host using a protocol such as
|
||||
POP3 or IMAP. POP3 essentially downloads all your mail from the mail
|
||||
host to your computer. The mail is stored in some file on your
|
||||
computer, and again, all your MUA has to do is read mail from the
|
||||
spool.
|
||||
|
||||
When you read mail from various machines, downloading mail from the
|
||||
mail host to your current machine is not convenient. In that case,
|
||||
you will probably want to use the IMAP protocol. Your mail is kept on
|
||||
the mail host, and you can read it while you are connected via IMAP to
|
||||
the mail host.
|
||||
|
||||
@cindex Webmail
|
||||
So how does reading mail via the web work, you ask. In that case,
|
||||
the web interface just allows you to remote-control a MUA on the web
|
||||
host. Whether the web host is also a mail host, and how all the
|
||||
pieces interact is completely irrelevant. You usually cannot use
|
||||
Emacs to read mail via the web, unless you use software that parses
|
||||
the ever-changing HTML of the web interface.
|
||||
|
||||
@node Emacs Speaks SMTP
|
||||
@chapter Emacs Speaks SMTP
|
||||
|
||||
Emacs includes a package for sending your mail to a SMTP server and
|
||||
have it take care of delivering it to the final destination, rather
|
||||
than letting the MTA on your local system take care of it. This can
|
||||
be useful if you don't have a MTA set up on your host, or if your
|
||||
machine is often disconnected from the internet.
|
||||
|
||||
Sending mail via SMTP requires configuring your mail user agent
|
||||
(@pxref{Mail Methods,,,emacs}) to use the SMTP library. How to do
|
||||
this should be described for each mail user agent; for the default
|
||||
mail user agent the variable @code{send-mail-function} (@pxref{Mail
|
||||
Sending,,,emacs}) is used; for the Message and Gnus user agents the
|
||||
variable @code{message-send-mail-function} (@pxref{Mail
|
||||
Variables,,,message}) is used.
|
||||
|
||||
@example
|
||||
;; If you use the default mail user agent.
|
||||
(setq send-mail-function 'smtpmail-send-it)
|
||||
;; If you use Message or Gnus.
|
||||
(setq message-send-mail-function 'smtpmail-send-it)
|
||||
@end example
|
||||
|
||||
Before using SMTP you must find out the hostname of the SMTP server
|
||||
to use. Your system administrator should provide you with this
|
||||
information, but often it is the same as the server you receive mail
|
||||
from.
|
||||
|
||||
@table @code
|
||||
@item smtpmail-smtp-server
|
||||
@vindex smtpmail-smtp-server
|
||||
@vindex SMTPSERVER
|
||||
The variable @code{smtpmail-smtp-server} controls the hostname of
|
||||
the server to use. It is a string with an IP address or hostname. It
|
||||
defaults to the contents of the @env{SMTPSERVER} environment
|
||||
variable, or, if empty, the contents of
|
||||
@code{smtpmail-default-smtp-server}.
|
||||
|
||||
@item smtpmail-default-smtp-server
|
||||
@vindex smtpmail-default-smtp-server
|
||||
The variable @code{smtpmail-default-smtp-server} controls the
|
||||
default hostname of the server to use. It is a string with an IP
|
||||
address or hostname. It must be set before the SMTP library is
|
||||
loaded. It has no effect if set after the SMTP library has been
|
||||
loaded, or if @code{smtpmail-smtp-server} is defined. It is usually
|
||||
set by system administrators in a site wide initialization file.
|
||||
@end table
|
||||
|
||||
The following example illustrates what you could put in
|
||||
@file{~/.emacs} to set the SMTP server name.
|
||||
|
||||
@example
|
||||
;; Send mail using SMTP via mail.example.org.
|
||||
(setq smtpmail-smtp-server "mail.example.org")
|
||||
@end example
|
||||
|
||||
@cindex Mail Submission
|
||||
SMTP is normally used on the registered ``smtp'' TCP service port 25.
|
||||
Some environments use SMTP in ``Mail Submission'' mode, which uses
|
||||
port 587. Using other ports is not uncommon, either for security by
|
||||
obscurity purposes, port forwarding, or otherwise.
|
||||
|
||||
@table @code
|
||||
@item smtpmail-smtp-service
|
||||
@vindex smtpmail-smtp-service
|
||||
The variable @code{smtpmail-smtp-service} controls the port on the
|
||||
server to contact. It is either a string, in which case it will be
|
||||
translated into an integer using system calls, or an integer.
|
||||
@end table
|
||||
|
||||
The following example illustrates what you could put in
|
||||
@file{~/.emacs} to set the SMTP service port.
|
||||
|
||||
@example
|
||||
;; Send mail using SMTP on the mail submission port 587.
|
||||
(setq smtpmail-smtp-service 587)
|
||||
@end example
|
||||
|
||||
@node Authentication
|
||||
@chapter Authentication
|
||||
|
||||
@cindex SASL
|
||||
@cindex CRAM-MD5
|
||||
@cindex LOGIN
|
||||
@cindex STARTTLS
|
||||
@cindex TLS
|
||||
@cindex SSL
|
||||
Many environments require SMTP clients to authenticate themselves
|
||||
before they are allowed to route mail via a server. The two following
|
||||
variables contains the authentication information needed for this.
|
||||
|
||||
The first variable, @code{smtpmail-auth-credentials}, instructs the
|
||||
SMTP library to use a SASL authentication step, currently only the
|
||||
CRAM-MD5 and LOGIN mechanisms are supported and will be selected in
|
||||
that order if the server support both.
|
||||
|
||||
The second variable, @code{smtpmail-starttls-credentials}, instructs
|
||||
the SMTP library to connect to the server using STARTTLS. This means
|
||||
the protocol exchange may be integrity protected and confidential by
|
||||
using the Transport Layer Security (TLS) protocol, and optionally also
|
||||
authentication of the client and server.
|
||||
|
||||
TLS is a security protocol that is also known as SSL, although
|
||||
strictly speaking, SSL is an older variant of TLS. TLS is backwards
|
||||
compatible with SSL. In most mundane situations, the two terms are
|
||||
equivalent.
|
||||
|
||||
The TLS feature uses the elisp package @file{starttls.el} (see it for
|
||||
more information on customization), which in turn require that at
|
||||
least one of the following external tools are installed:
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
The GNUTLS command line tool @samp{gnutls-cli}, you can get it from
|
||||
@url{http://www.gnu.org/software/gnutls/}. This is the recommended
|
||||
tool, mainly because it can verify the server certificates.
|
||||
|
||||
@item
|
||||
The @samp{starttls} external program, you can get it from
|
||||
@file{starttls-*.tar.gz} from @uref{ftp://ftp.opaopa.org/pub/elisp/}.
|
||||
@end enumerate
|
||||
|
||||
It is not uncommon to use both these mechanisms, e.g., to use STARTTLS
|
||||
to achieve integrity and confidentiality and then use SASL for client
|
||||
authentication.
|
||||
|
||||
@table @code
|
||||
@item smtpmail-auth-credentials
|
||||
@vindex smtpmail-auth-credentials
|
||||
The variable @code{smtpmail-auth-credentials} contains a list of
|
||||
hostname, port, username and password tuples. When the SMTP library
|
||||
connects to a host on a certain port, this variable is searched to
|
||||
find a matching entry for that hostname and port. If an entry is
|
||||
found, the authentication process is invoked and the credentials are
|
||||
used.
|
||||
|
||||
The hostname field follows the same format as
|
||||
@code{smtpmail-smtp-server} (i.e., a string) and the port field the
|
||||
same format as @code{smtpmail-smtp-service} (i.e., a string or an
|
||||
integer). The username and password fields, which either can be
|
||||
@code{nil} to indicate that the user is prompted for the value
|
||||
interactively, should be strings with the username and password,
|
||||
respectively, information that is normally provided by system
|
||||
administrators.
|
||||
|
||||
@item smtpmail-starttls-credentials
|
||||
@vindex smtpmail-starttls-credentials
|
||||
The variable @code{smtpmail-starttls-credentials} contains a list of
|
||||
tuples with hostname, port, name of file containing client key, and
|
||||
name of file containing client certificate. The processing is similar
|
||||
to the previous variable. The client key and certificate may be
|
||||
@code{nil} if you do not wish to use client authentication.
|
||||
@end table
|
||||
|
||||
The following example illustrates what you could put in
|
||||
@file{~/.emacs} to enable both SASL authentication and STARTTLS. The
|
||||
server name (@code{smtpmail-smtp-server}) is @var{hostname}, the
|
||||
server port (@code{smtpmail-smtp-service}) is @var{port}, and the
|
||||
username and password are @var{username} and @var{password}
|
||||
respectively.
|
||||
|
||||
@example
|
||||
;; Authenticate using this username and password against my server.
|
||||
(setq smtpmail-auth-credentials
|
||||
'(("@var{hostname}" "@var{port}" "@var{username}" "@var{password}")))
|
||||
|
||||
;; Note that if @var{port} is an integer, you must not quote it as a
|
||||
;; string. Normally @var{port} should be the integer 25, and the example
|
||||
;; become:
|
||||
(setq smtpmail-auth-credentials
|
||||
'(("@var{hostname}" 25 "@var{username}" "@var{password}")))
|
||||
|
||||
;; Use STARTTLS without authentication against the server.
|
||||
(setq smtpmail-starttls-credentials
|
||||
'(("@var{hostname}" "@var{port}" nil nil)))
|
||||
@end example
|
||||
|
||||
@node Queued delivery
|
||||
@chapter Queued delivery
|
||||
|
||||
@cindex Dialup connection
|
||||
If you connect to the internet via a dialup connection, or for some
|
||||
other reason don't have permanent internet connection, sending mail
|
||||
will fail when you are not connected. The SMTP library implements
|
||||
queued delivery, and the following variable control its behavior.
|
||||
|
||||
@table @code
|
||||
@item smtpmail-queue-mail
|
||||
@vindex smtpmail-queue-mail
|
||||
The variable @code{smtpmail-queue-mail} controls whether a simple
|
||||
off line mail sender is active. This variable is a boolean, and
|
||||
defaults to @code{nil} (disabled). If this is non-@code{nil}, mail is
|
||||
not sent immediately but rather queued in the directory
|
||||
@code{smtpmail-queue-dir} and can be later sent manually by invoking
|
||||
@code{smtpmail-send-queued-mail} (typically when you connect to the
|
||||
internet).
|
||||
|
||||
@item smtpmail-queue-dir
|
||||
@vindex smtpmail-queue-dir
|
||||
The variable @code{smtpmail-queue-dir} specifies the name of the
|
||||
directory to hold queued messages. It defaults to
|
||||
@file{~/Mail/queued-mail/}.
|
||||
@end table
|
||||
|
||||
@findex smtpmail-send-queued-mail
|
||||
The function @code{smtpmail-send-queued-mail} can be used to send
|
||||
any queued mail when @code{smtpmail-queue-mail} is enabled. It is
|
||||
typically invoked interactively with @kbd{M-x
|
||||
smtpmail-send-queued-mail RET} when you are connected to the internet.
|
||||
|
||||
@node Server workarounds
|
||||
@chapter Server workarounds
|
||||
|
||||
Some SMTP servers have special requirements. The following variables
|
||||
implement support for common requirements.
|
||||
|
||||
@table @code
|
||||
|
||||
@item smtpmail-local-domain
|
||||
@vindex smtpmail-local-domain
|
||||
The variable @code{smtpmail-local-domain} controls the hostname sent
|
||||
in the first @code{EHLO} or @code{HELO} command sent to the server.
|
||||
It should only be set if the @code{system-name} function returns a
|
||||
name that isn't accepted by the server. Do not set this variable
|
||||
unless your server complains.
|
||||
|
||||
@item smtpmail-sendto-domain
|
||||
@vindex smtpmail-sendto-domain
|
||||
The variable @code{smtpmail-sendto-domain} makes the SMTP library
|
||||
add @samp{@@} and the specified value to recipients specified in the
|
||||
message when they are sent using the @code{RCPT TO} command. Some
|
||||
configurations of sendmail requires this behavior. Don't bother to
|
||||
set this unless you have get an error like:
|
||||
|
||||
@example
|
||||
Sending failed; SMTP protocol error
|
||||
@end example
|
||||
|
||||
when sending mail, and the debug buffer (@pxref{Debugging})) contains
|
||||
an error such as:
|
||||
|
||||
@example
|
||||
RCPT TO: @var{someone}
|
||||
501 @var{someone}: recipient address must contain a domain
|
||||
@end example
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@node Debugging
|
||||
@chapter Debugging
|
||||
|
||||
Sometimes delivery fails, often with the generic error message
|
||||
@samp{Sending failed; SMTP protocol error}. Enabling one or both of
|
||||
the following variables and inspecting a trace buffer will often give
|
||||
clues to the reason for the error.
|
||||
|
||||
@table @code
|
||||
|
||||
@item smtpmail-debug-info
|
||||
@vindex smtpmail-debug-info
|
||||
The variable @code{smtpmail-debug-info} controls whether to print
|
||||
the SMTP protocol exchange in the minibuffer, and retain the entire
|
||||
exchange in a buffer @samp{*trace of SMTP session to @var{server}*},
|
||||
where @var{server} is the name of the mail server to which you send
|
||||
mail.
|
||||
|
||||
@item smtpmail-debug-verb
|
||||
@vindex smtpmail-debug-verb
|
||||
The variable @code{smtpmail-debug-verb} controls whether to send the
|
||||
@code{VERB} token to the server. The @code{VERB} server instructs the
|
||||
server to be more verbose, and often also to attempt final delivery
|
||||
while your SMTP session is still running. It is usually only useful
|
||||
together with @code{smtpmail-debug-info}. Note that this may cause
|
||||
mail delivery to take considerable time if the final destination
|
||||
cannot accept mail.
|
||||
|
||||
@end table
|
||||
|
||||
@node GNU Free Documentation License
|
||||
@chapter GNU Free Documentation License
|
||||
@include doclicense.texi
|
||||
|
||||
@node Index
|
||||
@chapter Index
|
||||
|
||||
@section Concept Index
|
||||
|
||||
@printindex cp
|
||||
|
||||
@section Function and Variable Index
|
||||
|
||||
@printindex fn
|
||||
|
||||
@contents
|
||||
@bye
|
||||
|
||||
@ignore
|
||||
arch-tag: 6316abdf-b366-4562-87a2-f37e8f894b6f
|
||||
@end ignore
|
1261
man/speedbar.texi
1261
man/speedbar.texi
File diff suppressed because it is too large
Load diff
8662
man/texinfo.tex
8662
man/texinfo.tex
File diff suppressed because it is too large
Load diff
2901
man/text.texi
2901
man/text.texi
File diff suppressed because it is too large
Load diff
3297
man/tramp.texi
3297
man/tramp.texi
File diff suppressed because it is too large
Load diff
|
@ -1,62 +0,0 @@
|
|||
@c -*-texinfo-*-
|
||||
@c texi/trampver.texi. Generated from trampver.texi.in by configure.
|
||||
|
||||
@c In the Tramp CVS, the version number is auto-frobbed from
|
||||
@c configure.ac, so you should edit that file and run
|
||||
@c "autoconf && ./configure" to change the version number.
|
||||
@set trampver 2.1.11-pre
|
||||
|
||||
@c Other flags from configuration
|
||||
@set instprefix /usr/local
|
||||
@set lispdir /usr/local/share/emacs/site-lisp
|
||||
@set infodir /usr/local/info
|
||||
|
||||
@c Formatting of the tramp program name consistent.
|
||||
@set tramp @sc{tramp}
|
||||
|
||||
@c Whether or not describe gateway methods.
|
||||
@ifclear noemacsgw
|
||||
@set emacsgw
|
||||
@end ifclear
|
||||
|
||||
@c Some flags which make the text independent on the (X)Emacs flavor.
|
||||
@c "emacs" resp "xemacs" are set in the Makefile. Default is "emacs".
|
||||
@ifclear emacs
|
||||
@ifclear xemacs
|
||||
@set emacs
|
||||
@end ifclear
|
||||
@end ifclear
|
||||
|
||||
@c Emacs values.
|
||||
@ifset emacs
|
||||
@set emacsname GNU Emacs
|
||||
@set emacsdir emacs
|
||||
@set ftppackagename Ange-FTP
|
||||
@set prefix /
|
||||
@set prefixhop
|
||||
@set postfix :
|
||||
@set postfixhop :
|
||||
@set emacsothername XEmacs
|
||||
@set emacsotherdir xemacs
|
||||
@set emacsotherfilename tramp-xemacs.html
|
||||
@set japanesemanual tramp_ja-emacs.html
|
||||
@end ifset
|
||||
|
||||
@c XEmacs counterparts.
|
||||
@ifset xemacs
|
||||
@set emacsname XEmacs
|
||||
@set emacsdir xemacs
|
||||
@set ftppackagename EFS
|
||||
@set prefix /[
|
||||
@set prefixhop [
|
||||
@set postfix ]
|
||||
@set postfixhop /
|
||||
@set emacsothername GNU Emacs
|
||||
@set emacsotherdir emacs
|
||||
@set emacsotherfilename tramp-emacs.html
|
||||
@set japanesemanual tramp_ja-xemacs.html
|
||||
@end ifset
|
||||
|
||||
@ignore
|
||||
arch-tag: e0fe322c-e06b-46eb-bb5b-d091b521f41c
|
||||
@end ignore
|
1066
man/trouble.texi
1066
man/trouble.texi
File diff suppressed because it is too large
Load diff
1202
man/url.texi
1202
man/url.texi
File diff suppressed because it is too large
Load diff
|
@ -1,32 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@c
|
||||
@c This file is included in emacs-xtra.texi when producing the printed
|
||||
@c version.
|
||||
@iftex
|
||||
@node Advanced VC Usage
|
||||
@section Advanced VC Usage
|
||||
|
||||
Commonly used features of Emacs' version control (VC) support are
|
||||
described in the main Emacs manual (@pxref{Version Control,,,emacs,
|
||||
the Emacs Manual}). This chapter describes more advanced VC usage.
|
||||
|
||||
@menu
|
||||
* VC Dired Mode:: Listing files managed by version control.
|
||||
* VC Dired Commands:: Commands to use in a VC Dired buffer.
|
||||
* Remote Repositories:: Efficient access to remote CVS servers.
|
||||
* Snapshots:: Sets of file versions treated as a unit.
|
||||
* Miscellaneous VC:: Various other commands and features of VC.
|
||||
* Customizing VC:: Variables that change VC's behavior.
|
||||
@end menu
|
||||
@end iftex
|
||||
|
||||
@iftex
|
||||
@include vc1-xtra.texi
|
||||
@include vc2-xtra.texi
|
||||
@end iftex
|
||||
|
||||
@ignore
|
||||
arch-tag: 11a18d0e-1baf-49da-8e38-f61195ae4dc3
|
||||
@end ignore
|
|
@ -1,151 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@c
|
||||
@c This file is included either in vc-xtra.texi (when producing the
|
||||
@c printed version) or in the main Emacs manual (for the on-line version).
|
||||
@node VC Dired Mode
|
||||
@subsection Dired under VC
|
||||
|
||||
@cindex PCL-CVS
|
||||
@pindex cvs
|
||||
@cindex CVS Dired Mode
|
||||
The VC Dired Mode described here works with all the version control
|
||||
systems that VC supports. Another more powerful facility, designed
|
||||
specifically for CVS, is called PCL-CVS. @xref{Top, , About PCL-CVS,
|
||||
pcl-cvs, PCL-CVS --- The Emacs Front-End to CVS}.
|
||||
|
||||
@kindex C-x v d
|
||||
@findex vc-directory
|
||||
When you are working on a large program, it is often useful to find
|
||||
out which files have changed within an entire directory tree, or to view
|
||||
the status of all files under version control at once, and to perform
|
||||
version control operations on collections of files. You can use the
|
||||
command @kbd{C-x v d} (@code{vc-directory}) to make a directory listing
|
||||
that includes only files relevant for version control.
|
||||
|
||||
@vindex vc-dired-terse-display
|
||||
@kbd{C-x v d} creates a buffer which uses VC Dired Mode. This looks
|
||||
much like an ordinary Dired buffer
|
||||
@iftex
|
||||
(@pxref{Dired,,,emacs, the Emacs Manual});
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Dired});
|
||||
@end ifnottex
|
||||
however, normally it shows only the noteworthy files (those locked or
|
||||
not up-to-date). This is called @dfn{terse display}. If you set the
|
||||
variable @code{vc-dired-terse-display} to @code{nil}, then VC Dired
|
||||
shows all relevant files---those managed under version control, plus
|
||||
all subdirectories (@dfn{full display}). The command @kbd{v t} in a
|
||||
VC Dired buffer toggles between terse display and full display
|
||||
(@pxref{VC Dired Commands}).
|
||||
|
||||
@vindex vc-dired-recurse
|
||||
By default, VC Dired produces a recursive listing of noteworthy or
|
||||
relevant files at or below the given directory. You can change this by
|
||||
setting the variable @code{vc-dired-recurse} to @code{nil}; then VC
|
||||
Dired shows only the files in the given directory.
|
||||
|
||||
The line for an individual file shows the version control state in the
|
||||
place of the hard link count, owner, group, and size of the file. If
|
||||
the file is unmodified, in sync with the master file, the version
|
||||
control state shown is blank. Otherwise it consists of text in
|
||||
parentheses. Under RCS and SCCS, the name of the user locking the file
|
||||
is shown; under CVS, an abbreviated version of the @samp{cvs status}
|
||||
output is used. Here is an example using RCS:
|
||||
|
||||
@smallexample
|
||||
@group
|
||||
/home/jim/project:
|
||||
|
||||
-rw-r--r-- (jim) Apr 2 23:39 file1
|
||||
-r--r--r-- Apr 5 20:21 file2
|
||||
@end group
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
The files @samp{file1} and @samp{file2} are under version control,
|
||||
@samp{file1} is locked by user jim, and @samp{file2} is unlocked.
|
||||
|
||||
Here is an example using CVS:
|
||||
|
||||
@smallexample
|
||||
@group
|
||||
/home/joe/develop:
|
||||
|
||||
-rw-r--r-- (modified) Aug 2 1997 file1.c
|
||||
-rw-r--r-- Apr 4 20:09 file2.c
|
||||
-rw-r--r-- (merge) Sep 13 1996 file3.c
|
||||
@end group
|
||||
@end smallexample
|
||||
|
||||
Here @samp{file1.c} is modified with respect to the repository, and
|
||||
@samp{file2.c} is not. @samp{file3.c} is modified, but other changes
|
||||
have also been checked in to the repository---you need to merge them
|
||||
with the work file before you can check it in.
|
||||
|
||||
@vindex vc-stay-local
|
||||
@vindex vc-cvs-stay-local
|
||||
In the above, if the repository were on a remote machine, VC would
|
||||
only contact it when the variable @code{vc-stay-local} (or
|
||||
@code{vc-cvs-stay-local}) is nil (@pxref{CVS Options}). This is
|
||||
because access to the repository may be slow, or you may be working
|
||||
offline and not have access to the repository at all. As a
|
||||
consequence, VC would not be able to tell you that @samp{file3.c} is
|
||||
in the ``merge'' state; you would learn that only when you try to
|
||||
check-in your modified copy of the file, or use a command such as
|
||||
@kbd{C-x v m}.
|
||||
|
||||
In practice, this is not a problem because CVS handles this case
|
||||
consistently whenever it arises. In VC, you'll simply get prompted to
|
||||
merge the remote changes into your work file first. The benefits of
|
||||
less network communication usually outweigh the disadvantage of not
|
||||
seeing remote changes immediately.
|
||||
|
||||
@vindex vc-directory-exclusion-list
|
||||
When VC Dired displays subdirectories (in the ``full'' display mode),
|
||||
it omits some that should never contain any files under version control.
|
||||
By default, this includes Version Control subdirectories such as
|
||||
@samp{RCS} and @samp{CVS}; you can customize this by setting the
|
||||
variable @code{vc-directory-exclusion-list}.
|
||||
|
||||
You can fine-tune VC Dired's format by typing @kbd{C-u C-x v d}---as in
|
||||
ordinary Dired, that allows you to specify additional switches for the
|
||||
@samp{ls} command.
|
||||
|
||||
@node VC Dired Commands
|
||||
@subsection VC Dired Commands
|
||||
|
||||
All the usual Dired commands work normally in VC Dired mode, except
|
||||
for @kbd{v}, which is redefined as the version control prefix. You can
|
||||
invoke VC commands such as @code{vc-diff} and @code{vc-print-log} by
|
||||
typing @kbd{v =}, or @kbd{v l}, and so on. Most of these commands apply
|
||||
to the file name on the current line.
|
||||
|
||||
The command @kbd{v v} (@code{vc-next-action}) operates on all the
|
||||
marked files, so that you can lock or check in several files at once.
|
||||
If it operates on more than one file, it handles each file according to
|
||||
its current state; thus, it might lock one file, but check in another
|
||||
file. This could be confusing; it is up to you to avoid confusing
|
||||
behavior by marking a set of files that are in a similar state. If no
|
||||
files are marked, @kbd{v v} operates on the file in the current line.
|
||||
|
||||
If any files call for check-in, @kbd{v v} reads a single log entry,
|
||||
then uses it for all the files being checked in. This is convenient for
|
||||
registering or checking in several files at once, as part of the same
|
||||
change.
|
||||
|
||||
@findex vc-dired-toggle-terse-mode
|
||||
@findex vc-dired-mark-locked
|
||||
You can toggle between terse display (only locked files, or files not
|
||||
up-to-date) and full display at any time by typing @kbd{v t}
|
||||
(@code{vc-dired-toggle-terse-mode}). There is also a special command
|
||||
@kbd{* l} (@code{vc-dired-mark-locked}), which marks all files currently
|
||||
locked (or, with CVS, all files not up-to-date). Thus, typing @kbd{* l
|
||||
t k} is another way to delete from the buffer all files except those
|
||||
currently locked.
|
||||
|
||||
@ignore
|
||||
arch-tag: 8e8c2a01-ad41-4e61-a89a-60131ad67263
|
||||
@end ignore
|
|
@ -1,789 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@c
|
||||
@c This file is included either in vc-xtra.texi (when producing the
|
||||
@c printed version) or in the main Emacs manual (for the on-line version).
|
||||
@node Remote Repositories
|
||||
@subsection Remote Repositories
|
||||
@cindex remote repositories (CVS)
|
||||
|
||||
A common way of using CVS is to set up a central CVS repository on
|
||||
some Internet host, then have each developer check out a personal
|
||||
working copy of the files on his local machine. Committing changes to
|
||||
the repository, and picking up changes from other users into one's own
|
||||
working area, then works by direct interactions with the CVS server.
|
||||
|
||||
One difficulty is that access to the CVS server is often slow, and
|
||||
that developers might need to work off-line as well. VC is designed
|
||||
to reduce the amount of network interaction necessary.
|
||||
|
||||
@menu
|
||||
* Version Backups:: Keeping local copies of repository versions.
|
||||
* Local Version Control:: Using another version system for local editing.
|
||||
@end menu
|
||||
|
||||
@node Version Backups
|
||||
@subsubsection Version Backups
|
||||
@cindex version backups
|
||||
|
||||
@cindex automatic version backups
|
||||
When VC sees that the CVS repository for a file is on a remote
|
||||
machine, it automatically makes local backups of unmodified versions
|
||||
of the file---@dfn{automatic version backups}. This means that you
|
||||
can compare the file to the repository version (@kbd{C-x v =}), or
|
||||
revert to that version (@kbd{C-x v u}), without any network
|
||||
interactions.
|
||||
|
||||
The local copy of the unmodified file is called a @dfn{version
|
||||
backup} to indicate that it corresponds exactly to a version that is
|
||||
stored in the repository. Note that version backups are not the same
|
||||
as ordinary Emacs backup files
|
||||
@iftex
|
||||
(@pxref{Backup,,,emacs, the Emacs Manual}).
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Backup}).
|
||||
@end ifnottex
|
||||
But they follow a similar naming convention.
|
||||
|
||||
For a file that comes from a remote CVS repository, VC makes a
|
||||
version backup whenever you save the first changes to the file, and
|
||||
removes it after you have committed your modified version to the
|
||||
repository. You can disable the making of automatic version backups by
|
||||
setting @code{vc-cvs-stay-local} to @code{nil} (@pxref{CVS Options}).
|
||||
|
||||
@cindex manual version backups
|
||||
The name of the automatic version backup for version @var{version}
|
||||
of file @var{file} is @code{@var{file}.~@var{version}.~}. This is
|
||||
almost the same as the name used by @kbd{C-x v ~}
|
||||
@iftex
|
||||
(@pxref{Old Versions,,,emacs, the Emacs Manual}),
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Old Versions}),
|
||||
@end ifnottex
|
||||
the only difference being the additional dot (@samp{.}) after the
|
||||
version number. This similarity is intentional, because both kinds of
|
||||
files store the same kind of information. The file made by @kbd{C-x v
|
||||
~} acts as a @dfn{manual version backup}.
|
||||
|
||||
All the VC commands that operate on old versions of a file can use
|
||||
both kinds of version backups. For instance, @kbd{C-x v ~} uses
|
||||
either an automatic or a manual version backup, if possible, to get
|
||||
the contents of the version you request. Likewise, @kbd{C-x v =} and
|
||||
@kbd{C-x v u} use either an automatic or a manual version backup, if
|
||||
one of them exists, to get the contents of a version to compare or
|
||||
revert to. If you changed a file outside of Emacs, so that no
|
||||
automatic version backup was created for the previous text, you can
|
||||
create a manual backup of that version using @kbd{C-x v ~}, and thus
|
||||
obtain the benefit of the local copy for Emacs commands.
|
||||
|
||||
The only difference in Emacs's handling of manual and automatic
|
||||
version backups, once they exist, is that Emacs deletes automatic
|
||||
version backups when you commit to the repository. By contrast,
|
||||
manual version backups remain until you delete them.
|
||||
|
||||
@node Local Version Control
|
||||
@subsubsection Local Version Control
|
||||
@cindex local version control
|
||||
@cindex local back end (version control)
|
||||
|
||||
When you make many changes to a file that comes from a remote
|
||||
repository, it can be convenient to have version control on your local
|
||||
machine as well. You can then record intermediate versions, revert to
|
||||
a previous state, etc., before you actually commit your changes to the
|
||||
remote server.
|
||||
|
||||
VC lets you do this by putting a file under a second, local version
|
||||
control system, so that the file is effectively registered in two
|
||||
systems at the same time. For the description here, we will assume
|
||||
that the remote system is CVS, and you use RCS locally, although the
|
||||
mechanism works with any combination of version control systems
|
||||
(@dfn{back ends}).
|
||||
|
||||
To make it work with other back ends, you must make sure that the
|
||||
``more local'' back end comes before the ``more remote'' back end in
|
||||
the setting of @code{vc-handled-backends} (@pxref{Customizing VC}). By
|
||||
default, this variable is set up so that you can use remote CVS and
|
||||
local RCS as described here.
|
||||
|
||||
To start using local RCS for a file that comes from a remote CVS
|
||||
server, you must @emph{register the file in RCS}, by typing @kbd{C-u
|
||||
C-x v v rcs @key{RET}}. (In other words, use @code{vc-next-action} with a
|
||||
prefix argument, and specify RCS as the back end.)
|
||||
|
||||
You can do this at any time; it does not matter whether you have
|
||||
already modified the file with respect to the version in the CVS
|
||||
repository. If possible, VC tries to make the RCS master start with
|
||||
the unmodified repository version, then checks in any local changes
|
||||
as a new version. This works if you have not made any changes yet, or
|
||||
if the unmodified repository version exists locally as a version
|
||||
backup (@pxref{Version Backups}). If the unmodified version is not
|
||||
available locally, the RCS master starts with the modified version;
|
||||
the only drawback to this is that you cannot compare your changes
|
||||
locally to what is stored in the repository.
|
||||
|
||||
The version number of the RCS master is derived from the current CVS
|
||||
version, starting a branch from it. For example, if the current CVS
|
||||
version is 1.23, the local RCS branch will be 1.23.1. Version 1.23 in
|
||||
the RCS master will be identical to version 1.23 under CVS; your first
|
||||
changes are checked in as 1.23.1.1. (If the unmodified file is not
|
||||
available locally, VC will check in the modified file twice, both as
|
||||
1.23 and 1.23.1.1, to make the revision numbers consistent.)
|
||||
|
||||
If you do not use locking under CVS (the default), locking is also
|
||||
disabled for RCS, so that editing under RCS works exactly as under
|
||||
CVS.
|
||||
|
||||
When you are done with local editing, you can commit the final version
|
||||
back to the CVS repository by typing @kbd{C-u C-x v v cvs @key{RET}}.
|
||||
This initializes the log entry buffer
|
||||
@iftex
|
||||
(@pxref{Log Buffer,,,emacs, the Emacs Manual})
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Log Buffer})
|
||||
@end ifnottex
|
||||
to contain all the log entries you have recorded in the RCS master;
|
||||
you can edit them as you wish, and then commit in CVS by typing
|
||||
@kbd{C-c C-c}. If the commit is successful, VC removes the RCS
|
||||
master, so that the file is once again registered under CVS only.
|
||||
(The RCS master is not actually deleted, just renamed by appending
|
||||
@samp{~} to the name, so that you can refer to it later if you wish.)
|
||||
|
||||
While using local RCS, you can pick up recent changes from the CVS
|
||||
repository into your local file, or commit some of your changes back
|
||||
to CVS, without terminating local RCS version control. To do this,
|
||||
switch to the CVS back end temporarily, with the @kbd{C-x v b} command:
|
||||
|
||||
@table @kbd
|
||||
@item C-x v b
|
||||
Switch to another back end that the current file is registered
|
||||
under (@code{vc-switch-backend}).
|
||||
|
||||
@item C-u C-x v b @var{backend} @key{RET}
|
||||
Switch to @var{backend} for the current file.
|
||||
@end table
|
||||
|
||||
@kindex C-x v b
|
||||
@findex vc-switch-backend
|
||||
@kbd{C-x v b} does not change the buffer contents, or any files; it
|
||||
only changes VC's perspective on how to handle the file. Any
|
||||
subsequent VC commands for that file will operate on the back end that
|
||||
is currently selected.
|
||||
|
||||
If the current file is registered in more than one back end, typing
|
||||
@kbd{C-x v b} ``cycles'' through all of these back ends. With a
|
||||
prefix argument, it asks for the back end to use in the minibuffer.
|
||||
|
||||
Thus, if you are using local RCS, and you want to pick up some recent
|
||||
changes in the file from remote CVS, first visit the file, then type
|
||||
@kbd{C-x v b} to switch to CVS, and finally use @kbd{C-x v m
|
||||
@key{RET}} to merge the news
|
||||
@iftex
|
||||
(@pxref{Merging,,,emacs, the Emacs Manual}).
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Merging}).
|
||||
@end ifnottex
|
||||
You can then switch back to RCS by typing @kbd{C-x v b} again, and
|
||||
continue to edit locally.
|
||||
|
||||
But if you do this, the revision numbers in the RCS master no longer
|
||||
correspond to those of CVS. Technically, this is not a problem, but
|
||||
it can become difficult to keep track of what is in the CVS repository
|
||||
and what is not. So we suggest that you return from time to time to
|
||||
CVS-only operation, by committing your local changes back to the
|
||||
repository using @kbd{C-u C-x v v cvs @key{RET}}.
|
||||
|
||||
@node Snapshots
|
||||
@subsection Snapshots
|
||||
@cindex snapshots and version control
|
||||
|
||||
A @dfn{snapshot} is a named set of file versions (one for each
|
||||
registered file) that you can treat as a unit. One important kind of
|
||||
snapshot is a @dfn{release}, a (theoretically) stable version of the
|
||||
system that is ready for distribution to users.
|
||||
|
||||
@menu
|
||||
* Making Snapshots:: The snapshot facilities.
|
||||
* Snapshot Caveats:: Things to be careful of when using snapshots.
|
||||
@end menu
|
||||
|
||||
@node Making Snapshots
|
||||
@subsubsection Making and Using Snapshots
|
||||
|
||||
There are two basic commands for snapshots; one makes a
|
||||
snapshot with a given name, the other retrieves a named snapshot.
|
||||
|
||||
@table @code
|
||||
@kindex C-x v s
|
||||
@findex vc-create-snapshot
|
||||
@item C-x v s @var{name} @key{RET}
|
||||
Define the last saved versions of every registered file in or under the
|
||||
current directory as a snapshot named @var{name}
|
||||
(@code{vc-create-snapshot}).
|
||||
|
||||
@kindex C-x v r
|
||||
@findex vc-retrieve-snapshot
|
||||
@item C-x v r @var{name} @key{RET}
|
||||
For all registered files at or below the current directory level, select
|
||||
whatever versions correspond to the snapshot @var{name}
|
||||
(@code{vc-retrieve-snapshot}).
|
||||
|
||||
This command reports an error if any files are locked at or below the
|
||||
current directory, without changing anything; this is to avoid
|
||||
overwriting work in progress.
|
||||
@end table
|
||||
|
||||
A snapshot uses a very small amount of resources---just enough to record
|
||||
the list of file names and which version belongs to the snapshot. Thus,
|
||||
you need not hesitate to create snapshots whenever they are useful.
|
||||
|
||||
You can give a snapshot name as an argument to @kbd{C-x v =} or
|
||||
@kbd{C-x v ~}
|
||||
@iftex
|
||||
(@pxref{Old Versions,,,emacs, the Emacs Manual}).
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Old Versions}).
|
||||
@end ifnottex
|
||||
Thus, you can use it to compare a snapshot against the current files,
|
||||
or two snapshots against each other, or a snapshot against a named
|
||||
version.
|
||||
|
||||
@node Snapshot Caveats
|
||||
@subsubsection Snapshot Caveats
|
||||
|
||||
@cindex named configurations (RCS)
|
||||
VC's snapshot facilities are modeled on RCS's named-configuration
|
||||
support. They use RCS's native facilities for this, so
|
||||
snapshots made using RCS through VC are visible even when you bypass VC.
|
||||
|
||||
With CVS, Meta-CVS, and Subversion, VC also uses the native
|
||||
mechanism provided by that back end to make snapshots and retrieve them
|
||||
(@dfn{tags} for CVS and Meta-CVS, @dfn{copies} for Subversion).
|
||||
|
||||
@c worded verbosely to avoid overfull hbox.
|
||||
For SCCS, VC implements snapshots itself. The files it uses contain
|
||||
name/file/version-number triples. These snapshots are visible only
|
||||
through VC.
|
||||
|
||||
There is no support for VC snapshots using GNU Arch yet.
|
||||
|
||||
A snapshot is a set of checked-in versions. So make sure that all the
|
||||
files are checked in and not locked when you make a snapshot.
|
||||
|
||||
File renaming and deletion can create some difficulties with snapshots.
|
||||
This is not a VC-specific problem, but a general design issue in version
|
||||
control systems that no one has solved very well yet.
|
||||
|
||||
If you rename a registered file, you need to rename its master along
|
||||
with it (the command @code{vc-rename-file} does this automatically). If
|
||||
you are using SCCS, you must also update the records of the snapshot, to
|
||||
mention the file by its new name (@code{vc-rename-file} does this,
|
||||
too). An old snapshot that refers to a master file that no longer
|
||||
exists under the recorded name is invalid; VC can no longer retrieve
|
||||
it. It would be beyond the scope of this manual to explain enough about
|
||||
RCS and SCCS to explain how to update the snapshots by hand.
|
||||
|
||||
Using @code{vc-rename-file} makes the snapshot remain valid for
|
||||
retrieval, but it does not solve all problems. For example, some of the
|
||||
files in your program probably refer to others by name. At the very
|
||||
least, the makefile probably mentions the file that you renamed. If you
|
||||
retrieve an old snapshot, the renamed file is retrieved under its new
|
||||
name, which is not the name that the makefile expects. So the program
|
||||
won't really work as retrieved.
|
||||
|
||||
@node Miscellaneous VC
|
||||
@subsection Miscellaneous Commands and Features of VC
|
||||
|
||||
This section explains the less-frequently-used features of VC.
|
||||
|
||||
@menu
|
||||
* Change Logs and VC:: Generating a change log file from log entries.
|
||||
* Renaming and VC:: A command to rename both the source and master
|
||||
file correctly.
|
||||
* Version Headers:: Inserting version control headers into working files.
|
||||
@end menu
|
||||
|
||||
@node Change Logs and VC
|
||||
@subsubsection Change Logs and VC
|
||||
|
||||
If you use RCS or CVS for a program and also maintain a change log
|
||||
file for it
|
||||
@iftex
|
||||
(@pxref{Change Log,,,emacs, the Emacs Manual}),
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Change Log}),
|
||||
@end ifnottex
|
||||
you can generate change log entries automatically from the version
|
||||
control log entries:
|
||||
|
||||
@table @kbd
|
||||
@item C-x v a
|
||||
@kindex C-x v a
|
||||
@findex vc-update-change-log
|
||||
Visit the current directory's change log file and, for registered files
|
||||
in that directory, create new entries for versions checked in since the
|
||||
most recent entry in the change log file.
|
||||
(@code{vc-update-change-log}).
|
||||
|
||||
This command works with RCS or CVS only, not with any of the other
|
||||
back ends.
|
||||
|
||||
@item C-u C-x v a
|
||||
As above, but only find entries for the current buffer's file.
|
||||
|
||||
@item M-1 C-x v a
|
||||
As above, but find entries for all the currently visited files that are
|
||||
maintained with version control. This works only with RCS, and it puts
|
||||
all entries in the log for the default directory, which may not be
|
||||
appropriate.
|
||||
@end table
|
||||
|
||||
For example, suppose the first line of @file{ChangeLog} is dated
|
||||
1999-04-10, and that the only check-in since then was by Nathaniel
|
||||
Bowditch to @file{rcs2log} on 1999-05-22 with log text @samp{Ignore log
|
||||
messages that start with `#'.}. Then @kbd{C-x v a} visits
|
||||
@file{ChangeLog} and inserts text like this:
|
||||
|
||||
@iftex
|
||||
@medbreak
|
||||
@end iftex
|
||||
@smallexample
|
||||
@group
|
||||
1999-05-22 Nathaniel Bowditch <nat@@apn.org>
|
||||
|
||||
* rcs2log: Ignore log messages that start with `#'.
|
||||
@end group
|
||||
@end smallexample
|
||||
@iftex
|
||||
@medbreak
|
||||
@end iftex
|
||||
|
||||
@noindent
|
||||
You can then edit the new change log entry further as you wish.
|
||||
|
||||
Some of the new change log entries may duplicate what's already in
|
||||
ChangeLog. You will have to remove these duplicates by hand.
|
||||
|
||||
Normally, the log entry for file @file{foo} is displayed as @samp{*
|
||||
foo: @var{text of log entry}}. The @samp{:} after @file{foo} is omitted
|
||||
if the text of the log entry starts with @w{@samp{(@var{functionname}):
|
||||
}}. For example, if the log entry for @file{vc.el} is
|
||||
@samp{(vc-do-command): Check call-process status.}, then the text in
|
||||
@file{ChangeLog} looks like this:
|
||||
|
||||
@iftex
|
||||
@medbreak
|
||||
@end iftex
|
||||
@smallexample
|
||||
@group
|
||||
1999-05-06 Nathaniel Bowditch <nat@@apn.org>
|
||||
|
||||
* vc.el (vc-do-command): Check call-process status.
|
||||
@end group
|
||||
@end smallexample
|
||||
@iftex
|
||||
@medbreak
|
||||
@end iftex
|
||||
|
||||
When @kbd{C-x v a} adds several change log entries at once, it groups
|
||||
related log entries together if they all are checked in by the same
|
||||
author at nearly the same time. If the log entries for several such
|
||||
files all have the same text, it coalesces them into a single entry.
|
||||
For example, suppose the most recent check-ins have the following log
|
||||
entries:
|
||||
|
||||
@flushleft
|
||||
@bullet{} For @file{vc.texinfo}: @samp{Fix expansion typos.}
|
||||
@bullet{} For @file{vc.el}: @samp{Don't call expand-file-name.}
|
||||
@bullet{} For @file{vc-hooks.el}: @samp{Don't call expand-file-name.}
|
||||
@end flushleft
|
||||
|
||||
@noindent
|
||||
They appear like this in @file{ChangeLog}:
|
||||
|
||||
@iftex
|
||||
@medbreak
|
||||
@end iftex
|
||||
@smallexample
|
||||
@group
|
||||
1999-04-01 Nathaniel Bowditch <nat@@apn.org>
|
||||
|
||||
* vc.texinfo: Fix expansion typos.
|
||||
|
||||
* vc.el, vc-hooks.el: Don't call expand-file-name.
|
||||
@end group
|
||||
@end smallexample
|
||||
@iftex
|
||||
@medbreak
|
||||
@end iftex
|
||||
|
||||
Normally, @kbd{C-x v a} separates log entries by a blank line, but you
|
||||
can mark several related log entries to be clumped together (without an
|
||||
intervening blank line) by starting the text of each related log entry
|
||||
with a label of the form @w{@samp{@{@var{clumpname}@} }}. The label
|
||||
itself is not copied to @file{ChangeLog}. For example, suppose the log
|
||||
entries are:
|
||||
|
||||
@flushleft
|
||||
@bullet{} For @file{vc.texinfo}: @samp{@{expand@} Fix expansion typos.}
|
||||
@bullet{} For @file{vc.el}: @samp{@{expand@} Don't call expand-file-name.}
|
||||
@bullet{} For @file{vc-hooks.el}: @samp{@{expand@} Don't call expand-file-name.}
|
||||
@end flushleft
|
||||
|
||||
@noindent
|
||||
Then the text in @file{ChangeLog} looks like this:
|
||||
|
||||
@iftex
|
||||
@medbreak
|
||||
@end iftex
|
||||
@smallexample
|
||||
@group
|
||||
1999-04-01 Nathaniel Bowditch <nat@@apn.org>
|
||||
|
||||
* vc.texinfo: Fix expansion typos.
|
||||
* vc.el, vc-hooks.el: Don't call expand-file-name.
|
||||
@end group
|
||||
@end smallexample
|
||||
@iftex
|
||||
@medbreak
|
||||
@end iftex
|
||||
|
||||
A log entry whose text begins with @samp{#} is not copied to
|
||||
@file{ChangeLog}. For example, if you merely fix some misspellings in
|
||||
comments, you can log the change with an entry beginning with @samp{#}
|
||||
to avoid putting such trivia into @file{ChangeLog}.
|
||||
|
||||
@node Renaming and VC
|
||||
@subsubsection Renaming VC Work Files and Master Files
|
||||
|
||||
@findex vc-rename-file
|
||||
When you rename a registered file, you must also rename its master
|
||||
file correspondingly to get proper results. Use @code{vc-rename-file}
|
||||
to rename the source file as you specify, and rename its master file
|
||||
accordingly. It also updates any snapshots (@pxref{Snapshots}) that
|
||||
mention the file, so that they use the new name; despite this, the
|
||||
snapshot thus modified may not completely work (@pxref{Snapshot
|
||||
Caveats}).
|
||||
|
||||
Some back ends do not provide an explicit rename operation to their
|
||||
repositories. After issuing @code{vc-rename-file}, use @kbd{C-x v v}
|
||||
on the original and renamed buffers and provide the necessary edit
|
||||
log.
|
||||
|
||||
You cannot use @code{vc-rename-file} on a file that is locked by
|
||||
someone else.
|
||||
|
||||
@node Version Headers
|
||||
@subsubsection Inserting Version Control Headers
|
||||
|
||||
Sometimes it is convenient to put version identification strings
|
||||
directly into working files. Certain special strings called
|
||||
@dfn{version headers} are replaced in each successive version by the
|
||||
number of that version, the name of the user who created it, and other
|
||||
relevant information. All of the back ends that VC supports have such
|
||||
a mechanism, except GNU Arch.
|
||||
|
||||
VC does not normally use the information contained in these headers.
|
||||
The exception is RCS---with RCS, version headers are sometimes more
|
||||
reliable than the master file to determine which version of the file
|
||||
you are editing. Note that in a multi-branch environment, version
|
||||
headers are necessary to make VC behave correctly
|
||||
@iftex
|
||||
(@pxref{Multi-User Branching,,,emacs, the Emacs Manual}).
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Multi-User Branching}).
|
||||
@end ifnottex
|
||||
|
||||
Searching for RCS version headers is controlled by the variable
|
||||
@code{vc-consult-headers}. If it is non-@code{nil} (the default),
|
||||
Emacs searches for headers to determine the version number you are
|
||||
editing. Setting it to @code{nil} disables this feature.
|
||||
|
||||
Note that although CVS uses the same kind of version headers as RCS
|
||||
does, VC never searches for these headers if you are using CVS,
|
||||
regardless of the above setting.
|
||||
|
||||
@kindex C-x v h
|
||||
@findex vc-insert-headers
|
||||
You can use the @kbd{C-x v h} command (@code{vc-insert-headers}) to
|
||||
insert a suitable header string.
|
||||
|
||||
@table @kbd
|
||||
@item C-x v h
|
||||
Insert headers in a file for use with your version-control system.
|
||||
@end table
|
||||
|
||||
@vindex vc-@var{backend}-header
|
||||
The default header string is @samp{@w{$}Id$} for RCS and
|
||||
@samp{@w{%}W%} for SCCS. You can specify other headers to insert by
|
||||
setting the variables @code{vc-@var{backend}-header} where
|
||||
@var{backend} is @code{rcs} or @code{sccs}.
|
||||
|
||||
Instead of a single string, you can specify a list of strings; then
|
||||
each string in the list is inserted as a separate header on a line of
|
||||
its own.
|
||||
|
||||
It may be necessary to use apparently-superfluous backslashes when
|
||||
writing the strings that you put in this variable. For instance, you
|
||||
might write @code{"$Id\$"} rather than @code{"$Id@w{$}"}. The extra
|
||||
backslash prevents the string constant from being interpreted as a
|
||||
header, if the Emacs Lisp file containing it is maintained with
|
||||
version control.
|
||||
|
||||
@vindex vc-comment-alist
|
||||
Each header is inserted surrounded by tabs, inside comment delimiters,
|
||||
on a new line at point. Normally the ordinary comment
|
||||
start and comment end strings of the current mode are used, but for
|
||||
certain modes, there are special comment delimiters for this purpose;
|
||||
the variable @code{vc-comment-alist} specifies them. Each element of
|
||||
this list has the form @code{(@var{mode} @var{starter} @var{ender})}.
|
||||
|
||||
@vindex vc-static-header-alist
|
||||
The variable @code{vc-static-header-alist} specifies further strings
|
||||
to add based on the name of the buffer. Its value should be a list of
|
||||
elements of the form @code{(@var{regexp} . @var{format})}. Whenever
|
||||
@var{regexp} matches the buffer name, @var{format} is inserted as part
|
||||
of the header. A header line is inserted for each element that matches
|
||||
the buffer name, and for each string specified by
|
||||
@code{vc-@var{backend}-header}. The header line is made by processing the
|
||||
string from @code{vc-@var{backend}-header} with the format taken from the
|
||||
element. The default value for @code{vc-static-header-alist} is as follows:
|
||||
|
||||
@example
|
||||
@group
|
||||
(("\\.c$" .
|
||||
"\n#ifndef lint\nstatic char vcid[] = \"\%s\";\n\
|
||||
#endif /* lint */\n"))
|
||||
@end group
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
It specifies insertion of text of this form:
|
||||
|
||||
@example
|
||||
@group
|
||||
|
||||
#ifndef lint
|
||||
static char vcid[] = "@var{string}";
|
||||
#endif /* lint */
|
||||
@end group
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
Note that the text above starts with a blank line.
|
||||
|
||||
If you use more than one version header in a file, put them close
|
||||
together in the file. The mechanism in @code{revert-buffer} that
|
||||
preserves markers may not handle markers positioned between two version
|
||||
headers.
|
||||
|
||||
@node Customizing VC
|
||||
@subsection Customizing VC
|
||||
|
||||
@vindex vc-handled-backends
|
||||
The variable @code{vc-handled-backends} determines which version
|
||||
control systems VC should handle. The default value is @code{(RCS CVS
|
||||
SVN SCCS BZR GIT HG Arch MCVS)}, so it contains all the version systems
|
||||
that are currently supported. If you want VC to ignore one or more of
|
||||
these systems, exclude its name from the list. To disable VC entirely,
|
||||
set this variable to @code{nil}.
|
||||
|
||||
The order of systems in the list is significant: when you visit a file
|
||||
registered in more than one system (@pxref{Local Version Control}), VC
|
||||
uses the system that comes first in @code{vc-handled-backends} by
|
||||
default. The order is also significant when you register a file for
|
||||
the first time, see
|
||||
@iftex
|
||||
@ref{Registering,,,emacs, the Emacs Manual},
|
||||
@end iftex
|
||||
@ifnottex
|
||||
@ref{Registering},
|
||||
@end ifnottex
|
||||
for details.
|
||||
|
||||
@menu
|
||||
* General VC Options:: Options that apply to multiple back ends.
|
||||
* RCS and SCCS:: Options for RCS and SCCS.
|
||||
* CVS Options:: Options for CVS.
|
||||
@end menu
|
||||
|
||||
@node General VC Options
|
||||
@subsubsection General Options
|
||||
|
||||
@vindex vc-make-backup-files
|
||||
Emacs normally does not save backup files for source files that are
|
||||
maintained with version control. If you want to make backup files even
|
||||
for files that use version control, set the variable
|
||||
@code{vc-make-backup-files} to a non-@code{nil} value.
|
||||
|
||||
@vindex vc-keep-workfiles
|
||||
Normally the work file exists all the time, whether it is locked or
|
||||
not. If you set @code{vc-keep-workfiles} to @code{nil}, then checking
|
||||
in a new version with @kbd{C-x v v} deletes the work file; but any
|
||||
attempt to visit the file with Emacs creates it again. (With CVS, work
|
||||
files are always kept.)
|
||||
|
||||
@vindex vc-follow-symlinks
|
||||
Editing a version-controlled file through a symbolic link can be
|
||||
dangerous. It bypasses the version control system---you can edit the
|
||||
file without locking it, and fail to check your changes in. Also,
|
||||
your changes might overwrite those of another user. To protect against
|
||||
this, VC checks each symbolic link that you visit, to see if it points
|
||||
to a file under version control.
|
||||
|
||||
The variable @code{vc-follow-symlinks} controls what to do when a
|
||||
symbolic link points to a version-controlled file. If it is @code{nil},
|
||||
VC only displays a warning message. If it is @code{t}, VC automatically
|
||||
follows the link, and visits the real file instead, telling you about
|
||||
this in the echo area. If the value is @code{ask} (the default), VC
|
||||
asks you each time whether to follow the link.
|
||||
|
||||
@vindex vc-suppress-confirm
|
||||
If @code{vc-suppress-confirm} is non-@code{nil}, then @kbd{C-x v v}
|
||||
and @kbd{C-x v i} can save the current buffer without asking, and
|
||||
@kbd{C-x v u} also operates without asking for confirmation. (This
|
||||
variable does not affect @kbd{C-x v c}; that operation is so drastic
|
||||
that it should always ask for confirmation.)
|
||||
|
||||
@vindex vc-command-messages
|
||||
VC mode does much of its work by running the shell commands for RCS,
|
||||
CVS and SCCS. If @code{vc-command-messages} is non-@code{nil}, VC
|
||||
displays messages to indicate which shell commands it runs, and
|
||||
additional messages when the commands finish.
|
||||
|
||||
@vindex vc-path
|
||||
You can specify additional directories to search for version control
|
||||
programs by setting the variable @code{vc-path}. These directories
|
||||
are searched before the usual search path. It is rarely necessary to
|
||||
set this variable, because VC normally finds the proper files
|
||||
automatically.
|
||||
|
||||
@node RCS and SCCS
|
||||
@subsubsection Options for RCS and SCCS
|
||||
|
||||
@cindex non-strict locking (RCS)
|
||||
@cindex locking, non-strict (RCS)
|
||||
By default, RCS uses locking to coordinate the activities of several
|
||||
users, but there is a mode called @dfn{non-strict locking} in which
|
||||
you can check-in changes without locking the file first. Use
|
||||
@samp{rcs -U} to switch to non-strict locking for a particular file,
|
||||
see the @code{rcs} manual page for details.
|
||||
|
||||
When deducing the version control state of an RCS file, VC first
|
||||
looks for an RCS version header string in the file (@pxref{Version
|
||||
Headers}). If there is no header string, VC normally looks at the
|
||||
file permissions of the work file; this is fast. But there might be
|
||||
situations when the file permissions cannot be trusted. In this case
|
||||
the master file has to be consulted, which is rather expensive. Also
|
||||
the master file can only tell you @emph{if} there's any lock on the
|
||||
file, but not whether your work file really contains that locked
|
||||
version.
|
||||
|
||||
@vindex vc-consult-headers
|
||||
You can tell VC not to use version headers to determine the file
|
||||
status by setting @code{vc-consult-headers} to @code{nil}. VC then
|
||||
always uses the file permissions (if it is supposed to trust them), or
|
||||
else checks the master file.
|
||||
|
||||
@vindex vc-mistrust-permissions
|
||||
You can specify the criterion for whether to trust the file
|
||||
permissions by setting the variable @code{vc-mistrust-permissions}.
|
||||
Its value can be @code{t} (always mistrust the file permissions and
|
||||
check the master file), @code{nil} (always trust the file
|
||||
permissions), or a function of one argument which makes the decision.
|
||||
The argument is the directory name of the @file{RCS} subdirectory. A
|
||||
non-@code{nil} value from the function says to mistrust the file
|
||||
permissions. If you find that the file permissions of work files are
|
||||
changed erroneously, set @code{vc-mistrust-permissions} to @code{t}.
|
||||
Then VC always checks the master file to determine the file's status.
|
||||
|
||||
VC determines the version control state of files under SCCS much as
|
||||
with RCS. It does not consider SCCS version headers, though. Thus,
|
||||
the variable @code{vc-mistrust-permissions} affects SCCS use, but
|
||||
@code{vc-consult-headers} does not.
|
||||
|
||||
@node CVS Options
|
||||
@subsubsection Options specific for CVS
|
||||
|
||||
@cindex locking (CVS)
|
||||
By default, CVS does not use locking to coordinate the activities of
|
||||
several users; anyone can change a work file at any time. However,
|
||||
there are ways to restrict this, resulting in behavior that resembles
|
||||
locking.
|
||||
|
||||
@cindex CVSREAD environment variable (CVS)
|
||||
For one thing, you can set the @env{CVSREAD} environment variable
|
||||
(the value you use makes no difference). If this variable is defined,
|
||||
CVS makes your work files read-only by default. In Emacs, you must
|
||||
type @kbd{C-x v v} to make the file writable, so that editing works
|
||||
in fact similar as if locking was used. Note however, that no actual
|
||||
locking is performed, so several users can make their files writable
|
||||
at the same time. When setting @env{CVSREAD} for the first time, make
|
||||
sure to check out all your modules anew, so that the file protections
|
||||
are set correctly.
|
||||
|
||||
@cindex cvs watch feature
|
||||
@cindex watching files (CVS)
|
||||
Another way to achieve something similar to locking is to use the
|
||||
@dfn{watch} feature of CVS. If a file is being watched, CVS makes it
|
||||
read-only by default, and you must also use @kbd{C-x v v} in Emacs to
|
||||
make it writable. VC calls @code{cvs edit} to make the file writable,
|
||||
and CVS takes care to notify other developers of the fact that you
|
||||
intend to change the file. See the CVS documentation for details on
|
||||
using the watch feature.
|
||||
|
||||
@vindex vc-stay-local
|
||||
@vindex vc-cvs-stay-local
|
||||
@cindex remote repositories (CVS)
|
||||
When a file's repository is on a remote machine, VC tries to keep
|
||||
network interactions to a minimum. This is controlled by the variable
|
||||
@code{vc-cvs-stay-local}. There is another variable,
|
||||
@code{vc-stay-local}, which enables the feature also for other back
|
||||
ends that support it, including CVS. In the following, we will talk
|
||||
only about @code{vc-cvs-stay-local}, but everything applies to
|
||||
@code{vc-stay-local} as well.
|
||||
|
||||
If @code{vc-cvs-stay-local} is @code{t} (the default), then VC uses
|
||||
only the entry in the local CVS subdirectory to determine the file's
|
||||
state (and possibly information returned by previous CVS commands).
|
||||
One consequence of this is that when you have modified a file, and
|
||||
somebody else has already checked in other changes to the file, you
|
||||
are not notified of it until you actually try to commit. (But you can
|
||||
try to pick up any recent changes from the repository first, using
|
||||
@kbd{C-x v m @key{RET}},
|
||||
@iftex
|
||||
@pxref{Merging,,,emacs, the Emacs Manual}).
|
||||
@end iftex
|
||||
@ifnottex
|
||||
@pxref{Merging}).
|
||||
@end ifnottex
|
||||
|
||||
When @code{vc-cvs-stay-local} is @code{t}, VC also makes local
|
||||
version backups, so that simple diff and revert operations are
|
||||
completely local (@pxref{Version Backups}).
|
||||
|
||||
On the other hand, if you set @code{vc-cvs-stay-local} to @code{nil},
|
||||
then VC queries the remote repository @emph{before} it decides what to
|
||||
do in @code{vc-next-action} (@kbd{C-x v v}), just as it does for local
|
||||
repositories. It also does not make any version backups.
|
||||
|
||||
You can also set @code{vc-cvs-stay-local} to a regular expression
|
||||
that is matched against the repository host name; VC then stays local
|
||||
only for repositories from hosts that match the pattern.
|
||||
|
||||
@vindex vc-cvs-global-switches
|
||||
You can specify additional command line options to pass to all CVS
|
||||
operations in the variable @code{vc-cvs-global-switches}. These
|
||||
switches are inserted immediately after the @code{cvs} command, before
|
||||
the name of the operation to invoke.
|
||||
|
||||
@ignore
|
||||
arch-tag: 140b8629-4339-4b5e-9e50-72453e51615e
|
||||
@end ignore
|
1958
man/vip.texi
1958
man/vip.texi
File diff suppressed because it is too large
Load diff
4579
man/viper.texi
4579
man/viper.texi
File diff suppressed because it is too large
Load diff
1855
man/widget.texi
1855
man/widget.texi
File diff suppressed because it is too large
Load diff
387
man/windows.texi
387
man/windows.texi
|
@ -1,387 +0,0 @@
|
|||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,
|
||||
@c 2002, 2003, 2004, 2005, 2006, 2007 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.
|
||||
* Window Convenience:: Convenience functions for window handling.
|
||||
@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 these
|
||||
windows can show different parts of the buffer, because each window
|
||||
has its own value of point.
|
||||
|
||||
@cindex selected window
|
||||
At any time, one Emacs window 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. On text-only terminals, there is no
|
||||
way to show where those locations are, since the terminal has only one
|
||||
cursor. On a graphical display, the location of point in a
|
||||
non-selected window is indicated by a hollow box; the cursor in the
|
||||
selected window is blinking or solid.
|
||||
|
||||
Commands to move point affect the value of point for the selected Emacs
|
||||
window only. They do not change the value of point in other Emacs
|
||||
windows, even those showing the same buffer. The same is true for commands
|
||||
such as @kbd{C-x b} to switch buffers 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. The selected window's mode line appears in a
|
||||
different color. @xref{Mode Line}, for full details on the mode line.
|
||||
|
||||
@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. If you are not using
|
||||
scrollbars, a vertical line separates the two windows.
|
||||
You can customize its color with the face @code{vertical-border}.
|
||||
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, so
|
||||
if the variable @code{truncate-partial-width-windows} is
|
||||
non-@code{nil}, that forces 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{Line Truncation}.
|
||||
|
||||
Horizontal scrolling is often used in side-by-side windows.
|
||||
@xref{Horizontal Scrolling}.
|
||||
|
||||
@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 scrolling the text currently visible on the screen, by putting
|
||||
point in each window at a position already visible in the window. It
|
||||
also selects whichever window contains the screen line that the cursor
|
||||
was previously on. Some users prefer that 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.
|
||||
|
||||
@vindex mouse-autoselect-window
|
||||
If you set @code{mouse-autoselect-window} to a non-@code{nil} value,
|
||||
moving the mouse into a different window selects that window. This
|
||||
feature is off by default.
|
||||
|
||||
@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}).
|
||||
@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.
|
||||
|
||||
@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 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 its peers. 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.
|
||||
|
||||
Mouse clicks on the mode line provide another way to change window
|
||||
heights and to delete windows. @xref{Mode Line Mouse}.
|
||||
|
||||
@node Window Convenience
|
||||
@section Window Handling Convenience Features and Customization
|
||||
|
||||
@findex winner-mode
|
||||
@cindex Winner mode
|
||||
@cindex mode, Winner
|
||||
@cindex undoing window configuration changes
|
||||
@cindex window configuration changes, undoing
|
||||
@kbd{M-x winner-mode} is a global minor mode that records the
|
||||
changes in the window configuration (i.e. how the frames are
|
||||
partitioned into windows), so that you can ``undo'' them. To undo,
|
||||
use @kbd{C-c left} (@code{winner-undo}). If you change your mind
|
||||
while undoing, you can redo the changes you had undone using @kbd{C-c
|
||||
right} (@code{M-x winner-redo}). Another way to enable Winner mode is
|
||||
by customizing the variable @code{winner-mode}.
|
||||
|
||||
@cindex Windmove package
|
||||
@cindex directional window selection
|
||||
@findex windmove-right
|
||||
@findex windmove-default-keybindings
|
||||
The Windmove commands move directionally between neighboring windows in
|
||||
a frame. @kbd{M-x windmove-right} selects the window immediately to the
|
||||
right of the currently selected one, and similarly for the ``left,'' ``up,''
|
||||
and ``down'' counterparts. @kbd{M-x windmove-default-keybindings} binds
|
||||
these commands to @kbd{S-right} etc. (Not all terminals support shifted
|
||||
arrow keys, however.)
|
||||
|
||||
Follow minor mode (@kbd{M-x follow-mode}) synchronizes several
|
||||
windows on the same buffer so that they always display adjacent
|
||||
sections of that buffer. @xref{Follow Mode}.
|
||||
|
||||
@vindex scroll-all-mode
|
||||
@cindex scrolling windows together
|
||||
@cindex Scroll-all mode
|
||||
@cindex mode, Scroll-all
|
||||
@kbd{M-x scroll-all-mode} provides commands to scroll all visible
|
||||
windows together. You can also turn it on by customizing the variable
|
||||
@code{scroll-all-mode}. The commands provided are @kbd{M-x
|
||||
scroll-all-scroll-down-all}, @kbd{M-x scroll-all-page-down-all} and
|
||||
their corresponding ``up'' equivalents. To make this mode useful,
|
||||
you should bind these commands to appropriate keys.
|
||||
|
||||
@ignore
|
||||
arch-tag: 8bea7453-d4b1-49b1-9bf4-cfe4383e1113
|
||||
@end ignore
|
1439
man/woman.texi
1439
man/woman.texi
File diff suppressed because it is too large
Load diff
1216
man/xresources.texi
1216
man/xresources.texi
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue