1 This is ../info/xemacs.info, produced by makeinfo version 4.6 from
4 INFO-DIR-SECTION XEmacs Editor
6 * XEmacs: (xemacs). XEmacs Editor.
9 This file documents the XEmacs editor.
11 Copyright (C) 1985, 1986, 1988 Richard M. Stallman. Copyright (C)
12 1991, 1992, 1993, 1994 Lucid, Inc. Copyright (C) 1993, 1994 Sun
13 Microsystems, Inc. Copyright (C) 1995 Amdahl Corporation.
15 Permission is granted to make and distribute verbatim copies of this
16 manual provided the copyright notice and this permission notice are
17 preserved on all copies.
19 Permission is granted to copy and distribute modified versions of
20 this manual under the conditions for verbatim copying, provided also
21 that the sections entitled "The GNU Manifesto", "Distribution" and "GNU
22 General Public License" are included exactly as in the original, and
23 provided that the entire resulting derived work is distributed under the
24 terms of a permission notice identical to this one.
26 Permission is granted to copy and distribute translations of this
27 manual into another language, under the above conditions for modified
28 versions, except that the sections entitled "The GNU Manifesto",
29 "Distribution" and "GNU General Public License" may be included in a
30 translation approved by the author instead of in the original English.
33 File: xemacs.info, Node: Lisp Interaction, Next: External Lisp, Prev: Lisp Debug, Up: Running
35 Lisp Interaction Buffers
36 ========================
38 The buffer `*scratch*', which is selected when Emacs starts up, is
39 provided for evaluating Lisp expressions interactively inside Emacs.
40 Both the expressions you evaluate and their output goes in the buffer.
42 The `*scratch*' buffer's major mode is Lisp Interaction mode, which
43 is the same as Emacs-Lisp mode except for one command, <LFD>. In
44 Emacs-Lisp mode, <LFD> is an indentation command. In Lisp Interaction
45 mode, <LFD> is bound to `eval-print-last-sexp'. This function reads
46 the Lisp expression before point, evaluates it, and inserts the value
47 in printed representation before point.
49 The way to use the `*scratch*' buffer is to insert Lisp expressions
50 at the end, ending each one with <LFD> so that it will be evaluated.
51 The result is a complete typescript of the expressions you have
52 evaluated and their values.
54 The rationale for this feature is that Emacs must have a buffer when
55 it starts up, but that buffer is not useful for editing files since a
56 new buffer is made for every file that you visit. The Lisp interpreter
57 typescript is the most useful thing I can think of for the initial
58 buffer to do. `M-x lisp-interaction-mode' will put any buffer in Lisp
62 File: xemacs.info, Node: External Lisp, Prev: Lisp Interaction, Up: Running
64 Running an External Lisp
65 ========================
67 Emacs has facilities for running programs in other Lisp systems. You
68 can run a Lisp process as an inferior of Emacs, and pass expressions to
69 it to be evaluated. You can also pass changed function definitions
70 directly from the Emacs buffers in which you edit the Lisp programs to
71 the inferior Lisp process.
73 To run an inferior Lisp process, type `M-x run-lisp'. This runs the
74 program named `lisp', the same program you would run by typing `lisp'
75 as a shell command, with both input and output going through an Emacs
76 buffer named `*lisp*'. In other words, any "terminal output" from Lisp
77 will go into the buffer, advancing point, and any "terminal input" for
78 Lisp comes from text in the buffer. To give input to Lisp, go to the
79 end of the buffer and type the input, terminated by <RET>. The
80 `*lisp*' buffer is in Inferior Lisp mode, which has all the special
81 characteristics of Lisp mode and Shell mode (*note Shell Mode::).
83 Use Lisp mode to run the source files of programs in external Lisps.
84 You can select this mode with `M-x lisp-mode'. It is used automatically
85 for files whose names end in `.l' or `.lisp', as most Lisp systems
88 When you edit a function in a Lisp program you are running, the
89 easiest way to send the changed definition to the inferior Lisp process
90 is the key `C-M-x'. In Lisp mode, this key runs the function
91 `lisp-send-defun', which finds the defun around or following point and
92 sends it as input to the Lisp process. (Emacs can send input to any
93 inferior process regardless of what buffer is current.)
95 Contrast the meanings of `C-M-x' in Lisp mode (for editing programs
96 to be run in another Lisp system) and Emacs-Lisp mode (for editing Lisp
97 programs to be run in Emacs): in both modes it has the effect of
98 installing the function definition that point is in, but the way of
99 doing so is different according to where the relevant Lisp environment
100 is found. *Note Lisp Modes::.
103 File: xemacs.info, Node: Packages, Next: Basic, Prev: Startup Paths, Up: Top
108 The XEmacs 21 distribution comes only with a very basic set of built-in
109 modes and packages. Most of the packages that were part of the
110 distribution of earlier versions of XEmacs are now available
111 separately. The installer as well as the user can choose which
112 packages to install; the actual installation process is easy. This
113 gives an installer the ability to tailor an XEmacs installation for
114 local needs with safe removal of unnecessary code.
118 * Package Terminology:: Understanding different kinds of packages.
119 * Installing Packages:: How to install packages.
120 * Building Packages:: Building packages from CVS sources.
121 * Local.rules File:: This is an important file that you must create.
122 * Available Packages:: A brief directory of packaged LISP.
125 File: xemacs.info, Node: Package Terminology, Next: Installing Packages, Up: Packages
133 There are two main flavors of packages.
135 * Regular Packages A regular package is one in which multiple files
136 are involved and one may not in general safely remove any of them.
138 * Single-File Packages A single-file package is an aggregate
139 collection of thematically related but otherwise independent lisp
140 files. These files are bundled together for download convenience
141 and individual files may be deleted at will without any loss of
142 functionality. However, we would recommend that you follow this
143 rule of thumb: "When in doubt, don't delete".
145 Package Distributions
146 ---------------------
148 XEmacs Lisp packages are distributed in two ways, depending on the
149 intended use. Binary Packages are for installers and end-users that can
150 be installed directly into an XEmacs package directory. Source Packages
151 are for developers and include all files necessary for rebuilding
152 bytecompiled lisp and creating tarballs for distribution.
157 Binary packages may be installed directly into an XEmacs package
163 Source packages contain all of the Package author's (where appropriate
164 in regular packages) source code plus all of the files necessary to
165 build distribution tarballs (Unix Tar format files, gzipped for space
168 Currently, source packages are only available via CVS. See
169 <http://cvs.xemacs.org/> for details.
172 File: xemacs.info, Node: Installing Packages, Next: Building Packages, Prev: Package Terminology, Up: Packages
180 When you first download XEmacs 21, you will usually first grab the
181 "core distribution", a file called `xemacs-21.x.x.tar.gz'. (Replace the
182 21.x.x by the current version number.) The core distribution contains
183 the sources of XEmacs and a minimal set of Emacs Lisp files, which are
184 in the subdirectory named `lisp'. This subdirectory used to contain
185 all Emacs Lisp files distributed with XEmacs. Now, to conserve disk
186 space, most non-essential packages were made optional.
188 Choosing the Packages You Need
189 ------------------------------
191 The *Note Available Packages:: can currently be found in the same ftp
192 directory where you grabbed the core distribution from, and are located
193 in the subdirectory `packages'. Package file names follow the naming
194 convention `<package-name>-<version>-pkg.tar.gz'.
196 If you have EFS *Note (EFS)::, packages can be installed over the
197 network. Alternatively, if you have copies of the packages locally,
198 you can install packages from a local disk or CDROM.
200 The file `etc/PACKAGES' in the core distribution contains a list of
201 the *Note Available Packages:: at the time of the XEmacs release.
203 You can also get a list of available packages, and whether or not
204 they are installed, using the visual package browser and installer.
205 You can access it via the menus:
207 Tools -> Packages -> List and Install
209 Or, you can get to it via the keyboard:
211 `M-x pui-list-packages'
213 Hint to system administrators of multi-user systems: it might be a
214 good idea to install all packages and not interfere with the wishes of
217 If you can't find which package provides the feature you require, try
218 using the `package-get-package-provider' function. Eg., if you know
219 that you need `thingatpt', type:
221 `M-x package-get-package-provider RET thingatpt'
223 which will return something like `(fsf-compat "1.08")'. You can the
224 use one of the methods above for installing the package you want.
226 XEmacs and Installing Packages
227 ------------------------------
229 There are three main ways to install packages:
233 * Automatically:: Using the package tools from XEmacs.
234 * Manually:: Using individual package tarballs.
235 * Sumo:: All at once, using the 'Sumo Tarball'.
236 * Which Packages:: Which packages to install.
237 * Removing Packages:: Removing packages.
239 But regardless of the method you use to install packages, they can
240 only be used by XEmacs after a restart unless the package in question
241 has not been previously installed.
244 File: xemacs.info, Node: Automatically, Next: Manually, Up: Installing Packages
246 Automatic Package Installation:
247 ===============================
249 XEmacs comes with some tools to make the periodic updating and
250 installing easier. It will notice if new packages or versions are
251 available and will fetch them from the FTP site.
253 Unfortunately this requires that a few packages are already in place.
254 You will have to install them by hand as above or use a SUMO tarball.
255 This requirement will hopefully go away in the future. The packages you
258 efs - To fetch the files from the FTP site or mirrors.
259 xemacs-base - Needed by efs.
263 mailcrypt - To do PGP verification of the `package-index'
266 After installing these by hand, fire up XEmacs and follow these
269 1. Choose a download site. via menu: Tools -> Packages -> Set
270 Download Site via keyb: `M-x customize-variable RET
271 package-get-remote RET' (put in the details of remote host and
274 If the package tarballs _AND_ the package-index file are in a
275 local directory, you can: `M-x pui-set-local-package-get-directory
278 2. Obtain a list of packages and display the list in a buffer named
279 `*Packages*'. menu: Tools -> Packages -> List & Install keyb:
280 `M-x pui-list-packages RET'
282 XEmacs will now connect to the remote site and download the latest
285 The visual package browser will then display a list of all
286 packages. Help information will be displayed at the very bottom
287 of the buffer; you may have to scroll down to see it. You can
288 also press `?' to get the same help. From this buffer, you can
289 tell the package status by the character in the first column:
292 The package has not been installed.
295 The package has been installed, but a newer version is
296 available. The current version is out-of-date.
299 The package has been marked for installation/update.
301 If there is no character in the first column, the package has been
302 installed and is up to date.
304 From here, you can select or unselect packages for installation
305 using the <RET> key, the `Mouse-2' button or selecting "Select"
306 from the Popup `Mouse-3' Menu. Once you've finished selecting the
307 packages, you can press the `x' key (or use the menu) to actually
308 install the packages. Note that you will have to restart XEmacs
309 for XEmacs to recognize any new packages.
318 Toggle between selecting and unselecting a package for
322 Install selected packages.
325 View, in the minibuffer, additional information about the
326 package, such as the package date (not the build date) and
327 the package author. Moving the mouse over a package name
328 will also do the same thing.
331 Toggle between verbose and non-verbose package display.
334 Refresh the package display.
337 Kill the package buffer.
339 Moving the mouse over a package will also cause additional
340 information about the package to be displayed in the minibuffer.
341 If you have balloon-help enabled a balloon-help frame will pop up
342 and display additional package information also.
344 3. Choose the packages you wish to install. mouse: Click button 2 on
345 the package name. keyb: `RET' on the package name
347 4. Make sure you have everything you need. menu: Packages -> Add
350 XEmacs will now search for packages that are required by the ones
351 that you have chosen to install and offer to select those packages
354 For novices and gurus alike, this step can save your bacon. It's
355 easy to forget to install a critical package.
357 5. Download and install the packages. menu: Packages ->
358 Install/Remove Selected keyb: `x'
360 You can also install packages using a semi-manual interface:
362 M-x package-get-all <return>
364 Enter the name of the package (e.g., `prog-modes'), and XEmacs will
365 search for the latest version and install it and any packages that it
368 Keeping Packages Up To Date:
369 ============================
371 Once you have the packages you want installed (using any of the above
372 methods) you'll want to keep them up to date. You can do this easily
375 Tools -> Packages -> Set Download Site
376 Tools -> Packages -> Update Installed Packages
379 File: xemacs.info, Node: Manually, Next: Sumo, Prev: Automatically, Up: Installing Packages
381 Manual Package Installation:
382 ============================
384 Fetch the packages from the FTP site, CD-ROM whatever. The filenames
385 have the form `name-<version>-pkg.tar.gz' and are gzipped tar files. For
386 a fresh install it is sufficient to untar the file at the top of the
389 Note: If you are upgrading packages already installed, it's best to
390 remove the old package first *Note Removing Packages::.
392 For example if we are installing the `xemacs-base' package (version
395 mkdir $prefix/lib/xemacs/xemacs-packages RET # if it does not exist yet
396 cd $prefix/lib/xemacs/xemacs-packages RET
397 gunzip -c /path/to/xemacs-base-1.48-pkg.tar.gz | tar xvf - RET
399 Or if you have GNU tar, the last step can be:
401 tar zxvf /path/to/xemacs-base-1.48-pkg.tar.gz RET
403 For MULE related packages, it is best to untar into the mule-packages
404 hierarchy, i.e. for the `mule-base' package, version 1.37:
406 mkdir $prefix/lib/xemacs/mule-packages RET # if it does not exist yet
407 cd $prefix/lib/xemacs/mule-packages RET
408 gunzip -c /path/to/mule-base-1.37-pkg.tar.gz | tar xvf - RET
410 Or if you have GNU tar, the last step can be:
412 tar zxvf /path/to/mule-base-1.37-pkg.tar.gz RET
415 File: xemacs.info, Node: Sumo, Next: Which Packages, Prev: Manually, Up: Installing Packages
417 Installing the Sumo Packages:
418 =============================
420 Those with little time, cheap connections and plenty of disk space can
421 install all the packages at once using the sumo tarballs. Download the
422 file: `xemacs-sumo.tar.gz'
424 For an XEmacs compiled with Mule you also need:
425 `xemacs-mule-sumo.tar.gz'
427 N.B. They are called 'Sumo Tarballs' for good reason. They are
428 currently about 19MB and 4.5MB (gzipped) respectively.
432 `cd $prefix/lib/xemacs ; gunzip -c <tarballname> | tar xvf - RET'
434 Or, if you have GNU tar:
436 `cd $prefix/lib/xemacs ; tar zxvf /path/to/<tarballname> RET'
438 As the Sumo tarballs are not regenerated as often as the individual
439 packages, it is recommended that you use the automatic package tools
440 afterwards to pick up any recent updates.
443 File: xemacs.info, Node: Which Packages, Next: Removing Packages, Prev: Sumo, Up: Installing Packages
445 Which Packages to Install:
446 ==========================
448 This is difficult to say. When in doubt install a package. If you
449 administrate a big site it might be a good idea to just install
450 everything. A good minimal set of packages for XEmacs-latin1 would be
452 xemacs-base, xemacs-devel, c-support, cc-mode, debug, dired, efs,
453 edit-utils, fsf-compat, mail-lib, net-utils, os-utils, prog-modes,
454 text-modes, time, mailcrypt
456 If you are using the XEmacs package tools, don't forget to do:
458 Packages -> Add Required
460 To make sure you have everything that the packages you have chosen to
463 See also *Note Available Packages:: for further descriptions of the
467 File: xemacs.info, Node: Removing Packages, Prev: Which Packages, Up: Installing Packages
472 Because the exact files and their locations contained in a package may
473 change it is recommended to remove a package first before installing a
474 new version. In order to facilitate removal each package contains an
475 `pgkinfo/MANIFEST.pkgname' file which list all the files belonging to
478 No need to panic, you don't have to go through the
479 `pkinfo/MANIFEST.pkgname' and manually delete the files. Instead, use
480 `M-x package-get-delete-package RET'.
482 Note that the interactive package tools included with XEmacs already
486 File: xemacs.info, Node: Building Packages, Next: Local.rules File, Prev: Installing Packages, Up: Packages
491 Currently, source packages are only available via anonymous CVS. See
492 <http://cvs.xemacs.org/> for details of checking out the
493 `xemacs-packages' module.
495 Prerequisites for Building Source Packages
496 ------------------------------------------
501 (or a BSD compatible install program).
504 (3.75 or later preferred).
507 (4.2 from GNU texinfo 4.2 or later required).
515 `A properly configured `Local.rules' file.'
516 *Note Local.rules File::.
517 And of course, XEmacs 21.0 or higher.
519 What You Can Do With Source Packages
520 ------------------------------------
522 The packages CVS sources are most useful for creating XEmacs package
523 tarballs for installation into your own XEmacs installations or for
524 distributing to others.
526 For a list and description of the different `Makefile' targets,
527 *Note Makefile Targets: (lispref)Makefile Targets.
530 File: xemacs.info, Node: Local.rules File, Next: Available Packages, Prev: Building Packages, Up: Packages
532 The Local.rules File:
533 =====================
535 This file is used when building and installing packages from source. In
536 the top level of the CVS module, `packages', contains the file,
537 `Local.rules.template'. Simply copy that to `Local.rules' and edit it
540 For a complete discussion of the `Local.rules' file, *Note
541 Local.rules File: (lispref)Local.rules File.
544 File: xemacs.info, Node: Available Packages, Prev: Local.rules File, Up: Packages
549 This section lists the Lisp packages that are currently available from
550 xemacs.org and it's mirrors. If a particular package that you are
551 looking for isn't here, please send a message to the XEmacs Beta list
552 <xemacs-beta@xemacs.org>.
554 This data is up to date as of June 27, 2003.
559 A very broad selection of elisp packages.
562 Support for Sparcworks.
565 Ada language support.
568 A Portable Emacs Library. Used by XEmacs MIME support.
571 Basic TeX/LaTeX support.
574 The Big Brother Data Base: a rolodex-like database program.
577 Build XEmacs using custom widgets.
580 Basic single-file add-ons for editing C code.
586 Calendar and diary support.
589 C, C++ and Java language support.
592 Support for the Clearcase version control system.
595 "Fortune cookie"-style messages. Includes Spook (suspicious
596 phrases) and Yow (Zippy quotes).
599 Crisp/Brief emulation.
602 GUD, gdb, dbx debugging support.
605 Interface to RFC2229 dictionary servers.
608 The DIRectory EDitor is for manipulating, and running commands on
609 files in a directory.
612 DocBook editing support.
615 Crypto functionality in Emacs Lisp.
621 Interface over patch.
624 Single file lisp packages for various XEmacs goodies. Load this
625 and weed out the junk you don't want.
628 DEC EDIT/EDT emulation.
631 Treat files on remote systems the same as local files.
634 Enhanced Implementation of Emacs Interpreted Objects.
637 Portable Emacs Lisp utilities library.
640 Another interface over patch.
643 Command shell implemented entirely in Emacs Lisp.
646 ESS: Emacs Speaks Statistics.
652 Emacs Unified Directory Client (LDAP, PH).
655 Footnoting in mail message editing modes.
658 Forms editing support (obsolete, use the built-in Widget instead).
661 Fortran language support.
664 Provide a WM icon based on major mode.
667 GNU Emacs compatibility files.
670 Tetris, Sokoban, and Snake.
673 General documentation. Presently, empty.
679 The Gnus Newsreader and Mailreader.
682 Haskell language support.
688 Advanced replacement for buffer-menu.
691 Editing and Shell mode for the Interactive Data Language.
694 Enhanced front-end for Grep.
697 Front-end for interacting with Inferior Lisp (external lisps).
700 Spell-checking with ispell.
703 Java language and development support.
706 IRC (Internet Relay Chat) client for Emacs.
709 Fundamental lisp files for providing email support.
712 Support for messaging encryption with PGP.
715 Messaging in an Emacs World; a MIME-based email program.
718 Front end support for MH.
721 Elisp implementation of the game 'Minehunt'.
724 Other amusements and diversions.
727 Support for Multiple Major Modes within a single buffer.
730 Miscellaneous Networking Utilities. This is a single-file package
731 and files may be deleted at will.
734 Objective Caml editing support.
737 Miscellaneous single-file O/S utilities, for printing, archiving,
738 compression, remote shells, etc.
741 PC style interface emulation.
747 Provides programmatic completion.
750 Perl language support.
753 Emacs interface to various PGP implementations.
756 Miscellaneous single-file lisp files for various programming
760 Print buffers to PostScript printers.
763 Validated HTML/SGML editing.
766 A collection of DTDs for psgml. Note that this package is
767 deprecated and will be removed in the future, most likely Q2/2003.
768 Instead of using this, you should install needed DTDs yourself.
771 Python language support.
774 Emacs support for LaTeX cross-references, citations.
777 An obsolete Emacs mailer. If you do not already use it don't
781 Ruby language support.
784 Simple Authentication and Security Layer (SASL) library.
787 Front-end support for Inferior Scheme.
793 SGML/Linuxdoc-SGML editing.
796 Support for editing shell scripts.
799 Manage Sieve email filtering scripts.
805 Standard ML editing support.
808 XEmacs Sun sound files.
811 XEmacs Microsoft sound files.
814 Provides a separate frame with convenient references.
817 Mouse enhancement utility.
820 An Emacs citation tool. Useful with all Emacs Mailers and
824 XEmacs TeXinfo support.
827 Various single file lisp packages for editing text files.
830 Single-file TeX support.
833 Display time & date on the modeline.
836 Emacs MIME support. Not needed for Gnus >= 5.8.0
839 Support for building with Tooltalk.
842 DEC EDIT/TPU support.
845 Remote shell-based file editing. This is similar to EFS or
846 Ange-FTP, but works with rsh/ssh and rcp/scp.
849 Version Control for Free systems.
852 Version Control for ClearCase. This package will shortly be
853 replaced with clearcase.el
859 A Unix process browsing tool.
862 VI emulation support.
871 Semi WYSIWYG for LaTeX, HTML, etc, using additional fonts.
874 Fundamental XEmacs support. Install this unless you wish a totally
878 XEmacs Lisp developer support. This package contains utilities for
879 supporting Lisp development. It is a single-file package so it
886 A minor mode for (X)Emacs which allows running an XSLT processor
895 MULti-lingual Enhancement. Support for world scripts such as Latin,
896 Arabic, Cyrillic, Chinese, Japanese, Greek, Hebrew etc. To use these
897 packages your XEmacs must be compiled with Mule support.
900 Lisp Interface to EDICT, Kanji Dictionary.
903 Wnn (4.2 and 6) support. SJ3 support. Must be installed prior to
907 Unify character sets in a buffer. When characters belong to
908 disjoint character sets, this attempts to translate the characters
909 so that they belong to one character set. If the buffer coding
910 system is not sufficient, this suggests different coding systems.
913 Quail. Used for everything other than English and Japanese.
916 Used for localized menubars (French and Japanese) and localized
917 splash screens (Japanese).
920 Dictionary support. (This isn't an English dictionary program)
923 Basic Mule support. Must be installed prior to building with Mule.
926 Extended coding systems (including Unicode) for XEmacs.
929 Another Japanese Language Input Method. Can be used without a
930 separate process running as a dictionary server.
933 File: xemacs.info, Node: Abbrevs, Next: Picture, Prev: Running, Up: Top
938 An "abbrev" is a word which "expands" into some different text.
939 Abbrevs are defined by the user to expand in specific ways. For
940 example, you might define `foo' as an abbrev expanding to `find outer
941 otter'. With this abbrev defined, you would be able to get `find outer
942 otter ' into the buffer by typing `f o o <SPC>'.
944 Abbrevs expand only when Abbrev mode (a minor mode) is enabled.
945 Disabling Abbrev mode does not cause abbrev definitions to be discarded,
946 but they do not expand until Abbrev mode is enabled again. The command
947 `M-x abbrev-mode' toggles Abbrev mode; with a numeric argument, it
948 turns Abbrev mode on if the argument is positive, off otherwise. *Note
949 Minor Modes::. `abbrev-mode' is also a variable; Abbrev mode is on
950 when the variable is non-`nil'. The variable `abbrev-mode'
951 automatically becomes local to the current buffer when it is set.
953 Abbrev definitions can be "mode-specific"--active only in one major
954 mode. Abbrevs can also have "global" definitions that are active in
955 all major modes. The same abbrev can have a global definition and
956 various mode-specific definitions for different major modes. A
957 mode-specific definition for the current major mode overrides a global
960 You can define Abbrevs interactively during an editing session. You
961 can also save lists of abbrev definitions in files and reload them in
962 later sessions. Some users keep extensive lists of abbrevs that they
963 load in every session.
965 A second kind of abbreviation facility is called the "dynamic
966 expansion". Dynamic abbrev expansion happens only when you give an
967 explicit command and the result of the expansion depends only on the
968 current contents of the buffer. *Note Dynamic Abbrevs::.
972 * Defining Abbrevs:: Defining an abbrev, so it will expand when typed.
973 * Expanding Abbrevs:: Controlling expansion: prefixes, canceling expansion.
974 * Editing Abbrevs:: Viewing or editing the entire list of defined abbrevs.
975 * Saving Abbrevs:: Saving the entire list of abbrevs for another session.
976 * Dynamic Abbrevs:: Abbreviations for words already in the buffer.
979 File: xemacs.info, Node: Defining Abbrevs, Next: Expanding Abbrevs, Prev: Abbrevs, Up: Abbrevs
985 Define an abbrev to expand into some text before point
986 (`add-global-abbrev').
989 Similar, but define an abbrev available only in the current major
990 mode (`add-mode-abbrev').
993 Define a word in the buffer as an abbrev
994 (`inverse-add-global-abbrev').
997 Define a word in the buffer as a mode-specific abbrev
998 (`inverse-add-mode-abbrev').
1000 `M-x kill-all-abbrevs'
1001 After this command, no abbrev definitions remain in effect.
1003 The usual way to define an abbrev is to enter the text you want the
1004 abbrev to expand to, position point after it, and type `C-x a g'
1005 (`add-global-abbrev'). This reads the abbrev itself using the
1006 minibuffer, and then defines it as an abbrev for one or more words
1007 before point. Use a numeric argument to say how many words before point
1008 should be taken as the expansion. For example, to define the abbrev
1009 `foo' as in the example above, insert the text `find outer otter', then
1011 `C-u 3 C-x a g f o o <RET>'.
1013 An argument of zero to `C-x a g' means to use the contents of the
1014 region as the expansion of the abbrev being defined.
1016 The command `C-x a l' (`add-mode-abbrev') is similar, but defines a
1017 mode-specific abbrev. Mode-specific abbrevs are active only in a
1018 particular major mode. `C-x a l' defines an abbrev for the major mode
1019 in effect at the time `C-x a l' is typed. The arguments work the same
1020 way they do for `C-x a g'.
1022 If the text of an abbrev you want is already in the buffer instead of
1023 the expansion, use command `C-x a i g' (`inverse-add-global-abbrev')
1024 instead of `C-x a g', or use `C-x a i l' (`inverse-add-mode-abbrev')
1025 instead of `C-x a l'. These commands are called "inverse" because they
1026 invert the meaning of the argument found in the buffer and the argument
1027 read using the minibuffer.
1029 To change the definition of an abbrev, just add the new definition.
1030 You will be asked to confirm if the abbrev has a prior definition. To
1031 remove an abbrev definition, give a negative argument to `C-x a g' or
1032 `C-x a l'. You must choose the command to specify whether to kill a
1033 global definition or a mode-specific definition for the current mode,
1034 since those two definitions are independent for one abbrev.
1036 `M-x kill-all-abbrevs' removes all existing abbrev definitions.
1039 File: xemacs.info, Node: Expanding Abbrevs, Next: Editing Abbrevs, Prev: Defining Abbrevs, Up: Abbrevs
1041 Controlling Abbrev Expansion
1042 ============================
1044 An abbrev expands whenever it is in a buffer just before point and you
1045 type a self-inserting punctuation character (<SPC>, comma, etc.). Most
1046 often an abbrev is used by inserting the abbrev followed by punctuation.
1048 Abbrev expansion preserves case; thus, `foo' expands into `find
1049 outer otter', `Foo' into `Find outer otter', and `FOO' into `FIND OUTER
1050 OTTER' or `Find Outer Otter' according to the variable
1051 `abbrev-all-caps' (a non-`nil' value chooses the first of the two
1054 Two commands are available to control abbrev expansion:
1057 Separate a prefix from a following abbrev to be expanded
1058 (`abbrev-prefix-mark').
1061 Expand the abbrev before point (`expand-abbrev'). This is
1062 effective even when Abbrev mode is not enabled.
1064 `M-x unexpand-abbrev'
1065 Undo last abbrev expansion.
1067 `M-x expand-region-abbrevs'
1068 Expand some or all abbrevs found in the region.
1070 You may wish to expand an abbrev with a prefix attached. For
1071 example, if `cnst' expands into `construction', you may want to use it
1072 to enter `reconstruction'. It does not work to type `recnst', because
1073 that is not necessarily a defined abbrev. Instead, you can use the
1074 command `M-'' (`abbrev-prefix-mark') between the prefix `re' and the
1075 abbrev `cnst'. First, insert `re'. Then type `M-''; this inserts a
1076 minus sign in the buffer to indicate that it has done its work. Then
1077 insert the abbrev `cnst'. The buffer now contains `re-cnst'. Now
1078 insert a punctuation character to expand the abbrev `cnst' into
1079 `construction'. The minus sign is deleted at this point by `M-''. The
1080 resulting text is the desired `reconstruction'.
1082 If you actually want the text of the abbrev in the buffer, rather
1083 than its expansion, insert the following punctuation with `C-q'. Thus,
1084 `foo C-q -' leaves `foo-' in the buffer.
1086 If you expand an abbrev by mistake, you can undo the expansion
1087 (replace the expansion by the original abbrev text) with `M-x
1088 unexpand-abbrev'. You can also use `C-_' (`undo') to undo the
1089 expansion; but that will first undo the insertion of the punctuation
1092 `M-x expand-region-abbrevs' searches through the region for defined
1093 abbrevs, and offers to replace each one it finds with its expansion.
1094 This command is useful if you have typed text using abbrevs but forgot
1095 to turn on Abbrev mode first. It may also be useful together with a
1096 special set of abbrev definitions for making several global
1097 replacements at once. The command is effective even if Abbrev mode is
1101 File: xemacs.info, Node: Editing Abbrevs, Next: Saving Abbrevs, Prev: Expanding Abbrevs, Up: Abbrevs
1103 Examining and Editing Abbrevs
1104 =============================
1107 Print a list of all abbrev definitions.
1110 Edit a list of abbrevs; you can add, alter, or remove definitions.
1112 The output from `M-x list-abbrevs' looks like this:
1114 (lisp-mode-abbrev-table)
1116 (global-abbrev-table)
1117 "dfn" 0 "definition"
1119 (Some blank lines of no semantic significance, and some other abbrev
1120 tables, have been omitted.)
1122 A line containing a name in parentheses is the header for abbrevs in
1123 a particular abbrev table; `global-abbrev-table' contains all the global
1124 abbrevs, and the other abbrev tables that are named after major modes
1125 contain the mode-specific abbrevs.
1127 Within each abbrev table, each non-blank line defines one abbrev.
1128 The word at the beginning is the abbrev. The number that appears is
1129 the number of times the abbrev has been expanded. Emacs keeps track of
1130 this to help you see which abbrevs you actually use, in case you want
1131 to eliminate those that you don't use often. The string at the end of
1132 the line is the expansion.
1134 `M-x edit-abbrevs' allows you to add, change or kill abbrev
1135 definitions by editing a list of them in an Emacs buffer. The list has
1136 the format described above. The buffer of abbrevs is called
1137 `*Abbrevs*', and is in Edit-Abbrevs mode. This mode redefines the key
1138 `C-c C-c' to install the abbrev definitions as specified in the buffer.
1139 The `edit-abbrevs-redefine' command does this. Any abbrevs not
1140 described in the buffer are eliminated when this is done.
1142 `edit-abbrevs' is actually the same as `list-abbrevs', except that
1143 it selects the buffer `*Abbrevs*' whereas `list-abbrevs' merely
1144 displays it in another window.
1147 File: xemacs.info, Node: Saving Abbrevs, Next: Dynamic Abbrevs, Prev: Editing Abbrevs, Up: Abbrevs
1152 These commands allow you to keep abbrev definitions between editing
1155 `M-x write-abbrev-file'
1156 Write a file describing all defined abbrevs.
1158 `M-x read-abbrev-file'
1159 Read such an abbrev file and define abbrevs as specified there.
1161 `M-x quietly-read-abbrev-file'
1162 Similar, but do not display a message about what is going on.
1164 `M-x define-abbrevs'
1165 Define abbrevs from buffer.
1167 `M-x insert-abbrevs'
1168 Insert all abbrevs and their expansions into the buffer.
1170 Use `M-x write-abbrev-file' to save abbrev definitions for use in a
1171 later session. The command reads a file name using the minibuffer and
1172 writes a description of all current abbrev definitions into the
1173 specified file. The text stored in the file looks like the output of
1176 `M-x read-abbrev-file' prompts for a file name using the minibuffer
1177 and reads the specified file, defining abbrevs according to its
1178 contents. `M-x quietly-read-abbrev-file' is the same but does not
1179 display a message in the echo area; it is actually useful primarily in
1180 the init file. *Note Init File::. If you give an empty argument to
1181 either of these functions, the file name Emacs uses is the value of the
1182 variable `abbrev-file-name', which is by default `"~/.abbrev_defs"'.
1184 Emacs offers to save abbrevs automatically if you have changed any of
1185 them, whenever it offers to save all files (for `C-x s' or `C-x C-c').
1186 Set the variable `save-abbrevs' to `nil' to inhibit this feature.
1188 The commands `M-x insert-abbrevs' and `M-x define-abbrevs' are
1189 similar to the previous commands but work on text in an Emacs buffer.
1190 `M-x insert-abbrevs' inserts text into the current buffer before point,
1191 describing all current abbrev definitions; `M-x define-abbrevs' parses
1192 the entire current buffer and defines abbrevs accordingly.
1195 File: xemacs.info, Node: Dynamic Abbrevs, Prev: Saving Abbrevs, Up: Abbrevs
1197 Dynamic Abbrev Expansion
1198 ========================
1200 The abbrev facility described above operates automatically as you insert
1201 text, but all abbrevs must be defined explicitly. By contrast,
1202 "dynamic abbrevs" allow the meanings of abbrevs to be determined
1203 automatically from the contents of the buffer, but dynamic abbrev
1204 expansion happens only when you request it explicitly.
1207 Expand the word in the buffer before point as a "dynamic abbrev",
1208 by searching in the buffer for words starting with that
1209 abbreviation (`dabbrev-expand').
1211 For example, if the buffer contains `does this follow ' and you type
1212 `f o M-/', the effect is to insert `follow' because that is the last
1213 word in the buffer that starts with `fo'. A numeric argument to `M-/'
1214 says to take the second, third, etc. distinct expansion found looking
1215 backward from point. Repeating `M-/' searches for an alternative
1216 expansion by looking farther back. After the entire buffer before
1217 point has been considered, the buffer after point is searched.
1219 Dynamic abbrev expansion is completely independent of Abbrev mode;
1220 the expansion of a word with `M-/' is completely independent of whether
1221 it has a definition as an ordinary abbrev.
1224 File: xemacs.info, Node: Picture, Next: Sending Mail, Prev: Abbrevs, Up: Top
1229 If you want to create a picture made out of text characters (for
1230 example, a picture of the division of a register into fields, as a
1231 comment in a program), use the command `edit-picture' to enter Picture
1234 In Picture mode, editing is based on the "quarter-plane" model of
1235 text. In this model, the text characters lie studded on an area that
1236 stretches infinitely far to the right and downward. The concept of the
1237 end of a line does not exist in this model; the most you can say is
1238 where the last non-blank character on the line is found.
1240 Of course, Emacs really always considers text as a sequence of
1241 characters, and lines really do have ends. But in Picture mode most
1242 frequently-used keys are rebound to commands that simulate the
1243 quarter-plane model of text. They do this by inserting spaces or by
1244 converting tabs to spaces.
1246 Most of the basic editing commands of Emacs are redefined by Picture
1247 mode to do essentially the same thing but in a quarter-plane way. In
1248 addition, Picture mode defines various keys starting with the `C-c'
1249 prefix to run special picture editing commands.
1251 One of these keys, `C-c C-c', is pretty important. Often a picture
1252 is part of a larger file that is usually edited in some other major
1253 mode. `M-x edit-picture' records the name of the previous major mode.
1254 You can then use the `C-c C-c' command (`picture-mode-exit') to restore
1255 that mode. `C-c C-c' also deletes spaces from the ends of lines,
1256 unless you give it a numeric argument.
1258 The commands used in Picture mode all work in other modes (provided
1259 the `picture' library is loaded), but are only bound to keys in
1260 Picture mode. Note that the descriptions below talk of moving "one
1261 column" and so on, but all the picture mode commands handle numeric
1262 arguments as their normal equivalents do.
1264 Turning on Picture mode calls the value of the variable
1265 `picture-mode-hook' as a function, with no arguments, if that value
1266 exists and is non-`nil'.
1270 * Basic Picture:: Basic concepts and simple commands of Picture Mode.
1271 * Insert in Picture:: Controlling direction of cursor motion
1272 after "self-inserting" characters.
1273 * Tabs in Picture:: Various features for tab stops and indentation.
1274 * Rectangles in Picture:: Clearing and superimposing rectangles.
1277 File: xemacs.info, Node: Basic Picture, Next: Insert in Picture, Prev: Picture, Up: Picture
1279 Basic Editing in Picture Mode
1280 =============================
1282 Most keys do the same thing in Picture mode that they usually do, but do
1283 it in a quarter-plane style. For example, `C-f' is rebound to run
1284 `picture-forward-column', which moves point one column to the right, by
1285 inserting a space if necessary, so that the actual end of the line
1286 makes no difference. `C-b' is rebound to run
1287 `picture-backward-column', which always moves point left one column,
1288 converting a tab to multiple spaces if necessary. `C-n' and `C-p' are
1289 rebound to run `picture-move-down' and `picture-move-up', which can
1290 either insert spaces or convert tabs as necessary to make sure that
1291 point stays in exactly the same column. `C-e' runs
1292 `picture-end-of-line', which moves to after the last non-blank
1293 character on the line. There was no need to change `C-a', as the choice
1294 of screen model does not affect beginnings of lines.
1296 Insertion of text is adapted to the quarter-plane screen model
1297 through the use of Overwrite mode (*note Minor Modes::).
1298 Self-inserting characters replace existing text, column by column,
1299 rather than pushing existing text to the right. <RET> runs
1300 `picture-newline', which just moves to the beginning of the following
1301 line so that new text will replace that line.
1303 Text is erased instead of deleted and killed. <DEL>
1304 (`picture-backward-clear-column') replaces the preceding character with
1305 a space rather than removing it. `C-d' (`picture-clear-column') does
1306 the same in a forward direction. `C-k' (`picture-clear-line') really
1307 kills the contents of lines, but never removes the newlines from a
1310 To do actual insertion, you must use special commands. `C-o'
1311 (`picture-open-line') creates a blank line, but does so after the
1312 current line; it never splits a line. `C-M-o', `split-line', makes
1313 sense in Picture mode, so it remains unchanged. <LFD>
1314 (`picture-duplicate-line') inserts another line with the same contents
1315 below the current line.
1317 To actually delete parts of the picture, use `C-w', or with `C-c
1318 C-d' (which is defined as `delete-char', as `C-d' is in other modes),
1319 or with one of the picture rectangle commands (*note Rectangles in
1323 File: xemacs.info, Node: Insert in Picture, Next: Tabs in Picture, Prev: Basic Picture, Up: Picture
1325 Controlling Motion After Insert
1326 ===============================
1328 Since "self-inserting" characters just overwrite and move point in
1329 Picture mode, there is no essential restriction on how point should be
1330 moved. Normally point moves right, but you can specify any of the eight
1331 orthogonal or diagonal directions for motion after a "self-inserting"
1332 character. This is useful for drawing lines in the buffer.
1335 Move left after insertion (`picture-movement-left').
1338 Move right after insertion (`picture-movement-right').
1341 Move up after insertion (`picture-movement-up').
1344 Move down after insertion (`picture-movement-down').
1347 Move up and left ("northwest") after insertion
1348 (`picture-movement-nw').
1351 Move up and right ("northeast") after insertion
1352 (`picture-movement-ne').
1355 Move down and left ("southwest") after insertion
1356 (`picture-movement-sw').
1359 Move down and right ("southeast") after insertion
1360 (`picture-movement-se').
1362 Two motion commands move based on the current Picture insertion
1363 direction. The command `C-c C-f' (`picture-motion') moves in the same
1364 direction as motion after "insertion" currently does, while `C-c C-b'
1365 (`picture-motion-reverse') moves in the opposite direction.
1368 File: xemacs.info, Node: Tabs in Picture, Next: Rectangles in Picture, Prev: Insert in Picture, Up: Picture
1373 Two kinds of tab-like action are provided in Picture mode.
1374 Context-based tabbing is done with `M-<TAB>' (`picture-tab-search').
1375 With no argument, it moves to a point underneath the next "interesting"
1376 character that follows whitespace in the previous non-blank line.
1377 "Next" here means "appearing at a horizontal position greater than the
1378 one point starts out at". With an argument, as in `C-u M-<TAB>', the
1379 command moves to the next such interesting character in the current
1380 line. `M-<TAB>' does not change the text; it only moves point.
1381 "Interesting" characters are defined by the variable
1382 `picture-tab-chars', which contains a string of characters considered
1383 interesting. Its default value is `"!-~"'.
1385 <TAB> itself runs `picture-tab', which operates based on the current
1386 tab stop settings; it is the Picture mode equivalent of
1387 `tab-to-tab-stop'. Without arguments it just moves point, but with a
1388 numeric argument it clears the text that it moves over.
1390 The context-based and tab-stop-based forms of tabbing are brought
1391 together by the command `C-c <TAB>' (`picture-set-tab-stops'.) This
1392 command sets the tab stops to the positions which `M-<TAB>' would
1393 consider significant in the current line. If you use this command with
1394 <TAB>, you can get the effect of context-based tabbing. But `M-<TAB>'
1395 is more convenient in the cases where it is sufficient.
1398 File: xemacs.info, Node: Rectangles in Picture, Prev: Tabs in Picture, Up: Picture
1400 Picture Mode Rectangle Commands
1401 ===============================
1403 Picture mode defines commands for working on rectangular pieces of the
1404 text in ways that fit with the quarter-plane model. The standard
1405 rectangle commands may also be useful (*note Rectangles::).
1408 Clear out the region-rectangle (`picture-clear-rectangle'). With
1412 Similar but save rectangle contents in register R first
1413 (`picture-clear-rectangle-to-register').
1416 Copy last killed rectangle into the buffer by overwriting, with
1417 upper left corner at point (`picture-yank-rectangle'). With
1418 argument, insert instead.
1421 Similar, but use the rectangle in register R
1422 (`picture-yank-rectangle-from-register').
1424 The picture rectangle commands `C-c C-k' (`picture-clear-rectangle')
1425 and `C-c C-w' (`picture-clear-rectangle-to-register') differ from the
1426 standard rectangle commands in that they normally clear the rectangle
1427 instead of deleting it; this is analogous with the way `C-d' is changed
1430 However, deletion of rectangles can be useful in Picture mode, so
1431 these commands delete the rectangle if given a numeric argument.
1433 The Picture mode commands for yanking rectangles differ from the
1434 standard ones in overwriting instead of inserting. This is the same
1435 way that Picture mode insertion of other text is different from other
1436 modes. `C-c C-y' (`picture-yank-rectangle') inserts (by overwriting)
1437 the rectangle that was most recently killed, while `C-c C-x'
1438 (`picture-yank-rectangle-from-register') does for the rectangle found
1439 in a specified register.
1441 Since most region commands in Picture mode operate on rectangles,
1442 when you select a region of text with the mouse in Picture mode, it is
1443 highlighted as a rectangle.
1446 File: xemacs.info, Node: Sending Mail, Next: Reading Mail, Prev: Picture, Up: Top
1451 To send a message in Emacs, start by typing the command (`C-x m') to
1452 select and initialize the `*mail*' buffer. You can then edit the text
1453 and headers of the message in the mail buffer, and type the command
1454 (`C-c C-c') to send the message.
1457 Begin composing a message to send (`mail').
1460 Likewise, but display the message in another window
1461 (`mail-other-window').
1464 In Mail mode, send the message and switch to another buffer
1465 (`mail-send-and-exit').
1467 The command `C-x m' (`mail') selects a buffer named `*mail*' and
1468 initializes it with the skeleton of an outgoing message. `C-x 4 m'
1469 (`mail-other-window') selects the `*mail*' buffer in a different
1470 window, leaving the previous current buffer visible.
1472 Because the buffer for mail composition is an ordinary Emacs buffer,
1473 you can switch to other buffers while in the middle of composing mail,
1474 and switch back later (or never). If you use the `C-x m' command again
1475 when you have been composing another message but have not sent it, a
1476 new mail buffer will be created; in this way, you can compose multiple
1477 messages at once. You can switch back to and complete an unsent
1478 message by using the normal buffer selection mechanisms.
1480 `C-u C-x m' is another way to switch back to a message in progress:
1481 it will search for an existing, unsent mail message buffer and select
1486 * Format: Mail Format. Format of the mail being composed.
1487 * Headers: Mail Headers. Details of allowed mail header fields.
1488 * Mode: Mail Mode. Special commands for editing mail being composed.
1491 File: xemacs.info, Node: Mail Format, Next: Mail Headers, Prev: Sending Mail, Up: Sending Mail
1493 The Format of the Mail Buffer
1494 =============================
1496 In addition to the "text" or contents, a message has "header fields",
1497 which say who sent it, when, to whom, why, and so on. Some header
1498 fields, such as the date and sender, are created automatically after the
1499 message is sent. Others, such as the recipient names, must be
1500 specified by you in order to send the message properly.
1502 Mail mode provides a few commands to help you edit some header
1503 fields, and some are preinitialized in the buffer automatically at
1504 times. You can insert or edit any header fields using ordinary editing
1507 The line in the buffer that says:
1509 --text follows this line--
1511 is a special delimiter that separates the headers you have specified
1512 from the text. Whatever follows this line is the text of the message;
1513 the headers precede it. The delimiter line itself does not appear in
1514 the message actually sent. The text used for the delimiter line is
1515 controlled by the variable `mail-header-separator'.
1517 Here is an example of what the headers and text in the `*mail*'
1518 buffer might look like.
1522 Subject: The XEmacs User's Manual
1523 --Text follows this line--
1524 Please ignore this message.
1527 File: xemacs.info, Node: Mail Headers, Next: Mail Mode, Prev: Mail Format, Up: Sending Mail
1532 There are several header fields you can use in the `*mail*' buffer.
1533 Each header field starts with a field name at the beginning of a line,
1534 terminated by a colon. It does not matter whether you use upper or
1535 lower case in the field name. After the colon and optional whitespace
1536 comes the contents of the field.
1539 This field contains the mailing addresses of the message.
1542 The contents of the `Subject' field should be a piece of text that
1543 says what the message is about. Subject fields are useful because
1544 most mail-reading programs can provide a summary of messages,
1545 listing the subject of each message but not its text.
1548 This field contains additional mailing addresses to send the
1549 message to, but whose readers should not regard the message as
1553 This field contains additional mailing addresses to send the
1554 message to, but which should not appear in the header of the
1555 message actually sent.
1558 This field contains the name of one file (in Unix mail file
1559 format) to which a copy of the message should be appended when the
1563 Use the `From' field to say who you are, when the account you are
1564 using to send the mail is not your own. The contents of the
1565 `From' field should be a valid mailing address, since replies will
1569 Use the `Reply-To' field to direct replies to a different address,
1570 not your own. `From' and `Reply-To' have the same effect on where
1571 replies go, but they convey a different meaning to the person who
1575 This field contains a piece of text describing a message you are
1576 replying to. Some mail systems can use the information to
1577 correlate related pieces of mail. This field is normally filled
1578 in by your mail handling package when you are replying to a
1579 message and you never need to think about it.
1581 The `To', `CC', `BCC' and `FCC' fields can appear any number of times,
1582 to specify many places to send the message.
1584 The `To', `CC', and `BCC', fields can have continuation lines. All the
1585 lines starting with whitespace, following the line on which the field
1586 starts, are considered part of the field. For example,
1588 To: foo@here, this@there,
1589 me@gnu.cambridge.mass.usa.earth.spiral3281
1591 If you have a `~/.mailrc' file, Emacs scans it for mail aliases the
1592 first time you try to send mail in an Emacs session. Emacs expands
1593 aliases found in the `To', `CC', and `BCC' fields where appropriate.
1594 You can set the variable `mail-abbrev-mailrc-file' to the name of the
1595 file with mail aliases. If `nil', `~/.mailrc' is used.
1597 Your `.mailrc' file ensures that word-abbrevs are defined for each
1598 of your mail aliases when point is in a `To', `CC', `BCC', or `From'
1599 field. The aliases are defined in your `.mailrc' file or in a file
1600 specified by the MAILRC environment variable if it exists. Your mail
1601 aliases expand any time you type a word-delimiter at the end of an
1604 In this version of Emacs, what you see is what you get: in contrast
1605 to some other versions, no abbreviations are expanded after you have
1606 sent the mail. This means you don't suffer the annoyance of having the
1607 system do things behind your back--if the system rewrites an address
1608 you typed, you know it immediately, instead of after the mail has been
1609 sent and it's too late to do anything about it. For example, you will
1610 never again be in trouble because you forgot to delete an old alias
1611 from your `.mailrc' and a new local user is given a userid which
1612 conflicts with one of your aliases.
1614 Your mail alias abbrevs are in effect only when point is in an
1615 appropriate header field. The mail aliases will not expand in the body
1616 of the message, or in other header fields. The default mode-specific
1617 abbrev table `mail-mode-abbrev-table' is used instead if defined. That
1618 means if you have been using mail-mode specific abbrevs, this code will
1619 not adversely affect you. You can control which header fields the
1620 abbrevs are used in by changing the variable `mail-abbrev-mode-regexp'.
1622 If auto-fill mode is on, abbrevs wrap at commas instead of at word
1623 boundaries, and header continuation lines will be properly indented.
1625 You can also insert a mail alias with
1626 `mail-interactive-insert-alias'. This function, which is bound to `C-c
1627 C-a', prompts you for an alias (with completion) and inserts its
1630 In this version of Emacs, it is possible to have lines like the
1631 following in your `.mailrc' file:
1633 alias someone "John Doe <doe@quux.com>"
1635 That is, if you want an address to have embedded spaces, simply
1636 surround it with double-quotes. The quotes are necessary because the
1637 format of the `.mailrc' file uses spaces as address delimiters.
1639 Aliases in the `.mailrc' file may be nested. For example, assume you
1640 define aliases like:
1641 alias group1 fred ethel
1642 alias group2 larry curly moe
1643 alias everybody group1 group2
1645 When you now type `everybody' on the `To' line, it will expand to:
1646 fred, ethyl, larry, curly, moe
1648 Aliases may contain forward references; the alias of `everybody' in
1649 the example above can precede the aliases of `group1' and `group2'.
1651 In this version of Emacs, you can use the `source' `.mailrc' command
1652 for reading aliases from some other file as well.
1654 Aliases may contain hyphens, as in `"alias foo-bar foo@bar"', even
1655 though word-abbrevs normally cannot contain hyphens.
1657 To read in the contents of another `.mailrc'-type file from Emacs,
1658 use the command `M-x merge-mail-aliases'. The `rebuild-mail-aliases'
1659 command is similar, but deletes existing aliases first.
1661 If you want multiple addresses separated by a string other than `,'
1662 (a comma), then set the variable `mail-alias-separator-string' to it.
1663 This has to be a comma bracketed by whitespace if you want any kind of
1664 reasonable behavior.
1666 If the variable `mail-archive-file-name' is non-`nil', it should be
1667 a string naming a file. Each time you start to edit a message to send,
1668 an `FCC' field is entered for that file. Unless you remove the `FCC'
1669 field, every message is written into that file when it is sent.
1672 File: xemacs.info, Node: Mail Mode, Prev: Mail Headers, Up: Sending Mail
1677 The major mode used in the `*mail*' buffer is Mail mode. Mail mode is
1678 similar to Text mode, but several commands are provided on the `C-c'
1679 prefix. These commands all deal specifically with editing or sending
1683 Send the message, and leave the `*mail*' buffer selected
1687 Send the message, and select some other buffer
1688 (`mail-send-and-exit').
1691 Move to the `To' header field, creating one if there is none
1695 Move to the `Subject' header field, creating one if there is none
1699 Move to the `CC' header field, creating one if there is none
1703 Insert the file `~/.signature' at the end of the message text
1707 Yank the selected message (`mail-yank-original').
1710 Fill all paragraphs of yanked old messages, each individually
1711 (`mail-fill-yanked-message').
1714 Pops up a menu of useful mail-mode commands.
1716 There are two ways to send a message. `C-c C-c'
1717 (`mail-send-and-exit') is the usual way to send the message. It sends
1718 the message and then deletes the window (if there is another window) or
1719 switches to another buffer. It puts the `*mail*' buffer at the lowest
1720 priority for automatic reselection, since you are finished with using
1721 it. `C-c C-s' (`mail-send') sends the message and marks the `*mail*'
1722 buffer unmodified, but leaves that buffer selected so that you can
1723 modify the message (perhaps with new recipients) and send it again.
1725 Mail mode provides some other special commands that are useful for
1726 editing the headers and text of the message before you send it. There
1727 are three commands defined to move point to particular header fields,
1728 all based on the prefix `C-c C-f' (`C-f' is for "field"). They are
1729 `C-c C-f C-t' (`mail-to') to move to the `To' field, `C-c C-f C-s'
1730 (`mail-subject') for the `Subject' field, and `C-c C-f C-c' (`mail-cc')
1731 for the `CC' field. These fields have special motion commands because
1732 they are edited most frequently.
1734 `C-c C-w' (`mail-signature') adds a standard piece of text at the
1735 end of the message to say more about who you are. The text comes from
1736 the file `.signature' in your home directory.
1738 When you use an Rmail command to send mail from the Rmail mail
1739 reader, you can use `C-c C-y' `mail-yank-original' inside the `*mail*'
1740 buffer to insert the text of the message you are replying to. Normally
1741 Rmail indents each line of that message four spaces and eliminates most
1742 header fields. A numeric argument specifies the number of spaces to
1743 indent. An argument of just `C-u' says not to indent at all and not to
1744 eliminate anything. `C-c C-y' always uses the current message from the
1745 `RMAIL' buffer, so you can insert several old messages by selecting one
1746 in `RMAIL', switching to `*mail*' and yanking it, then switching back
1747 to `RMAIL' to select another.
1749 After using `C-c C-y', you can use the command `C-c C-q'
1750 (`mail-fill-yanked-message') to fill the paragraphs of the yanked old
1751 message or messages. One use of `C-c C-q' fills all such paragraphs,
1752 each one separately.
1754 Clicking the right mouse button in a mail buffer pops up a menu of
1755 the above commands, for easy access.
1757 Turning on Mail mode (which `C-x m' does automatically) calls the
1758 value of `text-mode-hook', if it is not void or `nil', and then calls
1759 the value of `mail-mode-hook' if that is not void or `nil'.
1762 File: xemacs.info, Node: Reading Mail, Next: Calendar/Diary, Prev: Sending Mail, Up: Top
1767 XEmacs provides several mail-reading packages. Each one comes with its
1768 own manual, which is included in each package.
1770 The recommended mail-reading package for new users is VM. VM works
1771 with standard Unix-mail-format folders and was designed as a replacement
1772 for the older Rmail.
1774 XEmacs also provides a sophisticated and comfortable front-end to the
1775 MH mail-processing system, called `MH-E'. Unlike in other mail
1776 programs, folders in MH are stored as file-system directories, with
1777 each message occupying one (numbered) file. This facilitates working
1778 with mail using shell commands, and many other features of MH are also
1779 designed to integrate well with the shell and with shell scripts. Keep
1780 in mind, however, that in order to use MH-E you must have the MH
1781 mail-processing system installed on your computer.
1783 The "Everything including the kitchen sink" package `Gnus' is also
1784 available as an XEmacs package. Gnus also handles Usenet articles as
1787 `MEW' (Messaging in the Emacs World) is another mail-reading package
1788 available for XEmacs.
1790 Finally, XEmacs provides the Rmail package. Rmail is (currently)
1791 the only mail reading package distributed with FSF GNU Emacs, and is
1792 powerful in its own right. However, it stores mail folders in a
1793 special format called `Babyl', that is incompatible with all other
1794 frequently-used mail programs. A utility program is provided for
1795 converting Babyl folders to standard Unix-mail format; however, unless
1796 you already have mail in Babyl-format folders, you should consider
1797 using Gnus, VM, or MH-E instead.
1800 File: xemacs.info, Node: Calendar/Diary, Next: Sorting, Prev: Reading Mail, Up: Top
1802 Calendar Mode and the Diary
1803 ===========================
1805 Emacs provides the functions of a desk calendar, with a diary of
1806 planned or past events. To enter the calendar, type `M-x calendar';
1807 this displays a three-month calendar centered on the current month, with
1808 point on the current date. With a numeric argument, as in `C-u M-x
1809 calendar', it prompts you for the month and year to be the center of the
1810 three-month calendar. The calendar uses its own buffer, whose major
1811 mode is Calendar mode.
1813 `Button2' in the calendar brings up a menu of operations on a
1814 particular date; `Buttons3' brings up a menu of commonly used calendar
1815 features that are independent of any particular date. To exit the
1816 calendar, type `q'. *Note Customizing the Calendar and Diary:
1817 (lispref)Calendar, for customization information about the calendar and
1822 * Calendar Motion:: Moving through the calendar; selecting a date.
1823 * Scroll Calendar:: Bringing earlier or later months onto the screen.
1824 * Mark and Region:: Remembering dates, the mark ring.
1825 * General Calendar:: Exiting or recomputing the calendar.
1826 * LaTeX Calendar:: Print a calendar using LaTeX.
1827 * Holidays:: Displaying dates of holidays.
1828 * Sunrise/Sunset:: Displaying local times of sunrise and sunset.
1829 * Lunar Phases:: Displaying phases of the moon.
1830 * Other Calendars:: Converting dates to other calendar systems.
1831 * Diary:: Displaying events from your diary.
1832 * Calendar Customization:: Altering the behavior of the features above.
1835 File: xemacs.info, Node: Calendar Motion, Next: Scroll Calendar, Prev: Calendar/Diary, Up: Calendar/Diary
1837 Movement in the Calendar
1838 ------------------------
1840 Calendar mode lets you move through the calendar in logical units of
1841 time such as days, weeks, months, and years. If you move outside the
1842 three months originally displayed, the calendar display "scrolls"
1843 automatically through time to make the selected date visible. Moving to
1844 a date lets you view its holidays or diary entries, or convert it to
1845 other calendars; moving longer time periods is also useful simply to
1846 scroll the calendar.
1850 * Calendar Unit Motion:: Moving by days, weeks, months, and years.
1851 * Move to Beginning or End:: Moving to start/end of weeks, months, and years.
1852 * Specified Dates:: Moving to the current date or another
1856 File: xemacs.info, Node: Calendar Unit Motion, Next: Move to Beginning or End, Prev: Calendar Motion, Up: Calendar Motion
1858 Motion by Integral Days, Weeks, Months, Years
1859 .............................................
1861 The commands for movement in the calendar buffer parallel the commands
1862 for movement in text. You can move forward and backward by days,
1863 weeks, months, and years.
1866 Move point one day forward (`calendar-forward-day').
1869 Move point one day backward (`calendar-backward-day').
1872 Move point one week forward (`calendar-forward-week').
1875 Move point one week backward (`calendar-backward-week').
1878 Move point one month forward (`calendar-forward-month').
1881 Move point one month backward (`calendar-backward-month').
1884 Move point one year forward (`calendar-forward-year').
1887 Move point one year backward (`calendar-backward-year').
1889 The day and week commands are natural analogues of the usual Emacs
1890 commands for moving by characters and by lines. Just as `C-n' usually
1891 moves to the same column in the following line, in Calendar mode it
1892 moves to the same day in the following week. And `C-p' moves to the
1893 same day in the previous week.
1895 The arrow keys are equivalent to `C-f', `C-b', `C-n' and `C-p', just
1896 as they normally are in other modes.
1898 The commands for motion by months and years work like those for
1899 weeks, but move a larger distance. The month commands `M-}' and `M-{'
1900 move forward or backward by an entire month's time. The year commands
1901 `C-x ]' and `C-x [' move forward or backward a whole year.
1903 The easiest way to remember these commands is to consider months and
1904 years analogous to paragraphs and pages of text, respectively. But the
1905 commands themselves are not quite analogous. The ordinary Emacs
1906 paragraph commands move to the beginning or end of a paragraph, whereas
1907 these month and year commands move by an entire month or an entire
1908 year, which usually involves skipping across the end of a month or year.
1910 All these commands accept a numeric argument as a repeat count. For
1911 convenience, the digit keys and the minus sign specify numeric
1912 arguments in Calendar mode even without the Meta modifier. For example,
1913 `100 C-f' moves point 100 days forward from its present location.
1916 File: xemacs.info, Node: Move to Beginning or End, Next: Specified Dates, Prev: Calendar Unit Motion, Up: Calendar Motion
1918 Beginning or End of Week, Month or Year
1919 .......................................
1921 A week (or month, or year) is not just a quantity of days; we think of
1922 weeks (months, years) as starting on particular dates. So Calendar mode
1923 provides commands to move to the beginning or end of a week, month or
1927 Move point to start of week (`calendar-beginning-of-week').
1930 Move point to end of week (`calendar-end-of-week').
1933 Move point to start of month (`calendar-beginning-of-month').
1936 Move point to end of month (`calendar-end-of-month').
1939 Move point to start of year (`calendar-beginning-of-year').
1942 Move point to end of year (`calendar-end-of-year').
1944 These commands also take numeric arguments as repeat counts, with the
1945 repeat count indicating how many weeks, months, or years to move
1946 backward or forward.
1948 By default, weeks begin on Sunday. To make them begin on Monday
1949 instead, set the variable `calendar-week-start-day' to 1.
1952 File: xemacs.info, Node: Specified Dates, Prev: Move to Beginning or End, Up: Calendar Motion
1957 Calendar mode provides commands for moving to a particular date
1958 specified in various ways.
1961 Move point to specified date (`calendar-goto-date').
1964 Center calendar around specified month (`calendar-other-month').
1967 Move point to today's date (`calendar-goto-today').
1969 `g d' (`calendar-goto-date') prompts for a year, a month, and a day
1970 of the month, and then moves to that date. Because the calendar
1971 includes all dates from the beginning of the current era, you must type
1972 the year in its entirety; that is, type `1990', not `90'.
1974 `o' (`calendar-other-month') prompts for a month and year, then
1975 centers the three-month calendar around that month.
1977 You can return to today's date with `.' (`calendar-goto-today').
1980 File: xemacs.info, Node: Scroll Calendar, Next: Mark and Region, Prev: Calendar Motion, Up: Calendar/Diary
1982 Scrolling the Calendar through Time
1983 -----------------------------------
1985 The calendar display scrolls automatically through time when you move
1986 out of the visible portion. You can also scroll it manually. Imagine
1987 that the calendar window contains a long strip of paper with the months
1988 on it. Scrolling it means moving the strip so that new months become
1989 visible in the window.
1992 Scroll calendar one month forward (`scroll-calendar-left').
1995 Scroll calendar one month backward (`scroll-calendar-right').
1999 Scroll calendar three months forward
2000 (`scroll-calendar-left-three-months').
2004 Scroll calendar three months backward
2005 (`scroll-calendar-right-three-months').
2007 The most basic calendar scroll commands scroll by one month at a
2008 time. This means that there are two months of overlap between the
2009 display before the command and the display after. `C-x <' scrolls the
2010 calendar contents one month to the left; that is, it moves the display
2011 forward in time. `C-x >' scrolls the contents to the right, which
2012 moves backwards in time.
2014 The commands `C-v' and `M-v' scroll the calendar by an entire
2015 "screenful"--three months--in analogy with the usual meaning of these
2016 commands. `C-v' makes later dates visible and `M-v' makes earlier
2017 dates visible. These commands take a numeric argument as a repeat
2018 count; in particular, since `C-u' multiplies the next command by four,
2019 typing `C-u C-v' scrolls the calendar forward by a year and typing `C-u
2020 M-v' scrolls the calendar backward by a year.
2022 The function keys <NEXT> and <PRIOR> are equivalent to `C-v' and
2023 `M-v', just as they are in other modes.
2026 File: xemacs.info, Node: Mark and Region, Next: General Calendar, Prev: Scroll Calendar, Up: Calendar/Diary
2028 The Mark and the Region
2029 -----------------------
2031 The concept of the mark applies to the calendar just as to any other
2032 buffer, but it marks a _date_, not a _position_ in the buffer. The
2033 region consists of the days between the mark and point (including the
2034 starting and stopping dates).
2037 Set the mark to today's date (`calendar-set-mark').
2043 Interchange mark and point (`calendar-exchange-point-and-mark').
2046 Display the number of days in the current region
2047 (`calendar-count-days-region').
2049 You set the mark in the calendar, as in any other buffer, by using
2050 `C-@' or `C-SPC' (`calendar-set-mark'). You return to the marked date
2051 with the command `C-x C-x' (`calendar-exchange-point-and-mark') which
2052 puts the mark where point was and point where mark was. The calendar
2053 is scrolled as necessary, if the marked date was not visible on the
2054 screen. This does not change the extent of the region.
2056 To determine the number of days in the region, type `M-='
2057 (`calendar-count-days-region'). The numbers of days printed is
2058 _inclusive_; that is, it includes the days specified by mark and point.
2060 The main use of the mark in the calendar is to remember dates that
2061 you may want to go back to. To make this feature more useful, the mark
2062 ring (*note Mark Ring::) operates exactly as in other buffers: Emacs
2063 remembers 16 previous locations of the mark. To return to a marked
2064 date, type `C-u C-SPC' (or `C-u C-@'); this is the command
2065 `calendar-set-mark' given a numeric argument. It moves point to where
2066 the mark was, restores the mark from the ring of former marks, and
2067 stores the previous point at the end of the mark ring. So, repeated
2068 use of this command moves point through all the old marks on the ring,
2072 File: xemacs.info, Node: General Calendar, Next: LaTeX Calendar, Prev: Mark and Region, Up: Calendar/Diary
2074 Miscellaneous Calendar Commands
2075 -------------------------------
2078 Display day-in-year (`calendar-print-day-of-year').
2081 Briefly describe calendar commands (`describe-calendar-mode').
2084 Regenerate the calendar window (`redraw-calendar').
2087 Scroll the next window (`scroll-other-window').
2090 Exit from calendar (`exit-calendar').
2092 If you want to know how many days have elapsed since the start of
2093 the year, or the number of days remaining in the year, type the `p d'
2094 command (`calendar-print-day-of-year'). This displays both of those
2095 numbers in the echo area.
2097 To display a brief description of the calendar commands, type `?'
2098 (`describe-calendar-mode'). For a fuller description, type `C-h m'.
2100 You can use `SPC' (`scroll-other-window') to scroll the other
2101 window. This is handy when you display a list of holidays or diary
2102 entries in another window.
2104 If the calendar window text gets corrupted, type `C-c C-l'
2105 (`redraw-calendar') to redraw it. (This can only happen if you use
2106 non-Calendar-mode editing commands.)
2108 In Calendar mode, you can use `SPC' (`scroll-other-window') to
2109 scroll the other window. This is handy when you display a list of
2110 holidays or diary entries in another window.
2112 To exit from the calendar, type `q' (`exit-calendar'). This buries
2113 all buffers related to the calendar, selecting other buffers. (If a
2114 frame contains a dedicated calendar window, exiting from the calendar
2115 iconifies that frame.)
2118 File: xemacs.info, Node: LaTeX Calendar, Next: Holidays, Prev: General Calendar, Up: Calendar/Diary
2123 The Calendar LaTeX commands produce a buffer of LaTeX code that prints
2124 as a calendar. Depending on the command you use, the printed calendar
2125 covers the day, week, month or year that point is in.
2128 Generate a one-month calendar (`cal-tex-cursor-month').
2131 Generate a sideways-printing one-month calendar
2132 (`cal-tex-cursor-month-landscape').
2135 Generate a one-day calendar (`cal-tex-cursor-day').
2138 Generate a one-page calendar for one week (`cal-tex-cursor-week').
2141 Generate a two-page calendar for one week (`cal-tex-cursor-week2').
2144 Generate an ISO-style calendar for one week
2145 (`cal-tex-cursor-week-iso').
2148 Generate a calendar for one Monday-starting week
2149 (`cal-tex-cursor-week-monday').
2152 Generate a Filofax-style two-weeks-at-a-glance calendar
2153 (`cal-tex-cursor-filofax-2week').
2156 Generate a Filofax-style one-week-at-a-glance calendar
2157 (`cal-tex-cursor-filofax-week').
2160 Generate a calendar for one year (`cal-tex-cursor-year').
2163 Generate a sideways-printing calendar for one year
2164 (`cal-tex-cursor-year-landscape').
2167 Generate a Filofax-style calendar for one year
2168 (`cal-tex-cursor-filofax-year').
2170 Some of these commands print the calendar sideways (in "landscape
2171 mode"), so it can be wider than it is long. Some of them use Filofax
2172 paper size (3.75in x 6.75in). All of these commands accept a prefix
2173 argument which specifies how many days, weeks, months or years to print
2174 (starting always with the selected one).
2176 If the variable `cal-tex-holidays' is non-`nil' (the default), then
2177 the printed calendars show the holidays in `calendar-holidays'. If the
2178 variable `cal-tex-diary' is non-`nil' (the default is `nil'), diary
2179 entries are included also (in weekly and monthly calendars only).
2182 File: xemacs.info, Node: Holidays, Next: Sunrise/Sunset, Prev: LaTeX Calendar, Up: Calendar/Diary
2187 The Emacs calendar knows about all major and many minor holidays, and
2191 Display holidays for the selected date
2192 (`calendar-cursor-holidays').
2195 Display any holidays for the date you click on.
2198 Mark holidays in the calendar window (`mark-calendar-holidays').
2201 Unmark calendar window (`calendar-unmark').
2204 List all holidays for the displayed three months in another window
2205 (`list-calendar-holidays').
2208 List all holidays for three months around today's date in another
2212 List holidays in another window for a specified range of years.
2214 To see if any holidays fall on a given date, position point on that
2215 date in the calendar window and use the `h' command. Alternatively,
2216 click on that date with `Button2' and then choose `Holidays' from the
2217 menu that appears. Either way, this displays the holidays for that
2218 date, in the echo area if they fit there, otherwise in a separate
2221 To view the distribution of holidays for all the dates shown in the
2222 calendar, use the `x' command. This displays the dates that are
2223 holidays in a different face (or places a `*' after these dates, if
2224 display with multiple faces is not available). The command applies both
2225 to the currently visible months and to other months that subsequently
2226 become visible by scrolling. To turn marking off and erase the current
2227 marks, type `u', which also erases any diary marks (*note Diary::).
2229 To get even more detailed information, use the `a' command, which
2230 displays a separate buffer containing a list of all holidays in the
2231 current three-month range. You can use <SPC> in the calendar window to
2234 The command `M-x holidays' displays the list of holidays for the
2235 current month and the preceding and succeeding months; this works even
2236 if you don't have a calendar window. If you want the list of holidays
2237 centered around a different month, use `C-u M-x holidays', which
2238 prompts for the month and year.
2240 The holidays known to Emacs include United States holidays and the
2241 major Christian, Jewish, and Islamic holidays; also the solstices and
2244 The command `M-x list-holidays' displays the list of holidays for a
2245 range of years. This function asks you for the starting and stopping
2246 years, and allows you to choose all the holidays or one of several
2247 categories of holidays. You can use this command even if you don't have
2250 The dates used by Emacs for holidays are based on _current
2251 practice_, not historical fact. Historically, for instance, the start
2252 of daylight savings time and even its existence have varied from year to
2253 year, but present United States law mandates that daylight savings time
2254 begins on the first Sunday in April. When the daylight savings rules
2255 are set up for the United States, Emacs always uses the present
2256 definition, even though it is wrong for some prior years.
2259 File: xemacs.info, Node: Sunrise/Sunset, Next: Lunar Phases, Prev: Holidays, Up: Calendar/Diary
2261 Times of Sunrise and Sunset
2262 ---------------------------
2264 Special calendar commands can tell you, to within a minute or two, the
2265 times of sunrise and sunset for any date.
2268 Display times of sunrise and sunset for the selected date
2269 (`calendar-sunrise-sunset').
2271 `Button2 Sunrise/Sunset'
2272 Display times of sunrise and sunset for the date you click on.
2274 `M-x sunrise-sunset'
2275 Display times of sunrise and sunset for today's date.
2277 `C-u M-x sunrise-sunset'
2278 Display times of sunrise and sunset for a specified date.
2280 Within the calendar, to display the _local times_ of sunrise and
2281 sunset in the echo area, move point to the date you want, and type `S'.
2282 Alternatively, click `Button2' on the date, then choose
2283 `Sunrise/Sunset' from the menu that appears. The command `M-x
2284 sunrise-sunset' is available outside the calendar to display this
2285 information for today's date or a specified date. To specify a date
2286 other than today, use `C-u M-x sunrise-sunset', which prompts for the
2287 year, month, and day.
2289 You can display the times of sunrise and sunset for any location and
2290 any date with `C-u C-u M-x sunrise-sunset'. This asks you for a
2291 longitude, latitude, number of minutes difference from Coordinated
2292 Universal Time, and date, and then tells you the times of sunrise and
2293 sunset for that location on that date.
2295 Because the times of sunrise and sunset depend on the location on
2296 earth, you need to tell Emacs your latitude, longitude, and location
2297 name before using these commands. Here is an example of what to set:
2299 (setq calendar-latitude 40.1)
2300 (setq calendar-longitude -88.2)
2301 (setq calendar-location-name "Urbana, IL")
2303 Use one decimal place in the values of `calendar-latitude' and
2304 `calendar-longitude'.
2306 Your time zone also affects the local time of sunrise and sunset.
2307 Emacs usually gets time zone information from the operating system, but
2308 if these values are not what you want (or if the operating system does
2309 not supply them), you must set them yourself. Here is an example:
2311 (setq calendar-time-zone -360)
2312 (setq calendar-standard-time-zone-name "CST")
2313 (setq calendar-daylight-time-zone-name "CDT")
2315 The value of `calendar-time-zone' is the number of minutes difference
2316 between your local standard time and Coordinated Universal Time
2317 (Greenwich time). The values of `calendar-standard-time-zone-name' and
2318 `calendar-daylight-time-zone-name' are the abbreviations used in your
2319 time zone. Emacs displays the times of sunrise and sunset _corrected
2320 for daylight savings time_. *Note Daylight Savings::, for how daylight
2321 savings time is determined.
2323 As a user, you might find it convenient to set the calendar location
2324 variables for your usual physical location in your init file. And when
2325 you install Emacs on a machine, you can create a `default.el' file
2326 which sets them properly for the typical location of most users of that
2327 machine. *Note Init File::.
2330 File: xemacs.info, Node: Lunar Phases, Next: Other Calendars, Prev: Sunrise/Sunset, Up: Calendar/Diary
2335 These calendar commands display the dates and times of the phases of
2336 the moon (new moon, first quarter, full moon, last quarter). This
2337 feature is useful for debugging problems that "depend on the phase of
2341 Display the dates and times for all the quarters of the moon for
2342 the three-month period shown (`calendar-phases-of-moon').
2344 `M-x phases-of-moon'
2345 Display dates and times of the quarters of the moon for three
2346 months around today's date.
2348 Within the calendar, use the `M' command to display a separate
2349 buffer of the phases of the moon for the current three-month range. The
2350 dates and times listed are accurate to within a few minutes.
2352 Outside the calendar, use the command `M-x phases-of-moon' to
2353 display the list of the phases of the moon for the current month and the
2354 preceding and succeeding months. For information about a different
2355 month, use `C-u M-x phases-of-moon', which prompts for the month and
2358 The dates and times given for the phases of the moon are given in
2359 local time (corrected for daylight savings, when appropriate); but if
2360 the variable `calendar-time-zone' is void, Coordinated Universal Time
2361 (the Greenwich time zone) is used. *Note Daylight Savings::.
2364 File: xemacs.info, Node: Other Calendars, Next: Calendar Systems, Prev: Lunar Phases, Up: Calendar/Diary
2366 Conversion To and From Other Calendars
2367 --------------------------------------
2369 The Emacs calendar displayed is _always_ the Gregorian calendar,
2370 sometimes called the "new style" calendar, which is used in most of the
2371 world today. However, this calendar did not exist before the sixteenth
2372 century and was not widely used before the eighteenth century; it did
2373 not fully displace the Julian calendar and gain universal acceptance
2374 until the early twentieth century. The Emacs calendar can display any
2375 month since January, year 1 of the current era, but the calendar
2376 displayed is the Gregorian, even for a date at which the Gregorian
2377 calendar did not exist.
2379 While Emacs cannot display other calendars, it can convert dates to
2380 and from several other calendars.
2384 * Calendar Systems:: The calendars Emacs understands
2385 (aside from Gregorian).
2386 * To Other Calendar:: Converting the selected date to various calendars.
2387 * From Other Calendar:: Moving to a date specified in another calendar.
2388 * Mayan Calendar:: Moving to a date specified in a Mayan calendar.
2390 If you are interested in these calendars, you can convert dates one
2391 at a time. Put point on the desired date of the Gregorian calendar and
2392 press the appropriate keys. The `p' is a mnemonic for "print" since
2393 Emacs "prints' the equivalent date in the echo area.
2396 File: xemacs.info, Node: Calendar Systems, Next: To Other Calendar, Prev: Other Calendars, Up: Other Calendars
2398 Supported Calendar Systems
2399 ==========================
2401 The ISO commercial calendar is used largely in Europe.
2403 The Julian calendar, named after Julius Caesar, was the one used in
2404 Europe throughout medieval times, and in many countries up until the
2407 Astronomers use a simple counting of days elapsed since noon, Monday,
2408 January 1, 4713 B.C. on the Julian calendar. The number of days elapsed
2409 is called the _Julian day number_ or the _Astronomical day number_.
2411 The Hebrew calendar is used by tradition in the Jewish religion. The
2412 Emacs calendar program uses the Hebrew calendar to determine the dates
2413 of Jewish holidays. Hebrew calendar dates begin and end at sunset.
2415 The Islamic calendar is used in many predominantly Islamic countries.
2416 Emacs uses it to determine the dates of Islamic holidays. There is no
2417 universal agreement in the Islamic world about the calendar; Emacs uses
2418 a widely accepted version, but the precise dates of Islamic holidays
2419 often depend on proclamation by religious authorities, not on
2420 calculations. As a consequence, the actual dates of observance can vary
2421 slightly from the dates computed by Emacs. Islamic calendar dates begin
2424 The French Revolutionary calendar was created by the Jacobins after
2425 the 1789 revolution, to represent a more secular and nature-based view
2426 of the annual cycle, and to install a 10-day week in a rationalization
2427 measure similar to the metric system. The French government officially
2428 abandoned this calendar at the end of 1805.
2430 The Maya of Central America used three separate, overlapping calendar
2431 systems, the _long count_, the _tzolkin_, and the _haab_. Emacs knows
2432 about all three of these calendars. Experts dispute the exact
2433 correlation between the Mayan calendar and our calendar; Emacs uses the
2434 Goodman-Martinez-Thompson correlation in its calculations.
2436 The Copts use a calendar based on the ancient Egyptian solar
2437 calendar. Their calendar consists of twelve 30-day months followed by
2438 an extra five-day period. Once every fourth year they add a leap day
2439 to this extra period to make it six days. The Ethiopic calendar is
2440 identical in structure, but has different year numbers and month names.
2442 The Persians use a solar calendar based on a design of Omar Khayyam.
2443 Their calendar consists of twelve months of which the first six have 31
2444 days, the next five have 30 days, and the last has 29 in ordinary years
2445 and 30 in leap years. Leap years occur in a complicated pattern every
2448 The Chinese calendar is a complicated system of lunar months arranged
2449 into solar years. The years go in cycles of sixty, each year containing
2450 either twelve months in an ordinary year or thirteen months in a leap
2451 year; each month has either 29 or 30 days. Years, ordinary months, and
2452 days are named by combining one of ten "celestial stems" with one of
2453 twelve "terrestrial branches" for a total of sixty names that are
2454 repeated in a cycle of sixty.
2457 File: xemacs.info, Node: To Other Calendar, Next: From Other Calendar, Prev: Calendar Systems, Up: Other Calendars
2459 Converting To Other Calendars
2460 =============================
2462 The following commands describe the selected date (the date at point)
2463 in various other calendar systems:
2465 `Button2 Other Calendars'
2466 Display the date that you click on, expressed in various other
2470 Display ISO commercial calendar equivalent for selected day
2471 (`calendar-print-iso-date').
2474 Display Julian date for selected day
2475 (`calendar-print-julian-date').
2478 Display astronomical (Julian) day number for selected day
2479 (`calendar-print-astro-day-number').
2482 Display Hebrew date for selected day
2483 (`calendar-print-hebrew-date').
2486 Display Islamic date for selected day
2487 (`calendar-print-islamic-date').
2490 Display French Revolutionary date for selected day
2491 (`calendar-print-french-date').
2494 Display Chinese date for selected day
2495 (`calendar-print-chinese-date').
2498 Display Coptic date for selected day
2499 (`calendar-print-coptic-date').
2502 Display Ethiopic date for selected day
2503 (`calendar-print-ethiopic-date').
2506 Display Persian date for selected day
2507 (`calendar-print-persian-date').
2510 Display Mayan date for selected day (`calendar-print-mayan-date').
2512 If you are using X, the easiest way to translate a date into other
2513 calendars is to click on it with `Button2', then choose `Other
2514 Calendars' from the menu that appears. This displays the equivalent
2515 forms of the date in all the calendars Emacs understands, in the form of
2516 a menu. (Choosing an alternative from this menu doesn't actually do
2517 anything--the menu is used only for display.)
2519 Put point on the desired date of the Gregorian calendar, then type
2520 the appropriate keys. The `p' is a mnemonic for "print" since Emacs
2521 "prints" the equivalent date in the echo area.
2524 File: xemacs.info, Node: From Other Calendar, Next: Mayan Calendar, Prev: To Other Calendar, Up: Other Calendars
2526 Converting From Other Calendars
2527 ===============================
2529 You can use the other supported calendars to specify a date to move to.
2530 This section describes the commands for doing this using calendars
2531 other than Mayan; for the Mayan calendar, see the following section.
2534 Move to a date specified in the ISO commercial calendar
2535 (`calendar-goto-iso-date').
2538 Move to a date specified in the Julian calendar
2539 (`calendar-goto-julian-date').
2542 Move to a date specified in astronomical (Julian) day number
2543 (`calendar-goto-astro-day-number').
2546 Move to a date specified in the Hebrew calendar
2547 (`calendar-goto-hebrew-date').
2550 Move to a date specified in the Islamic calendar
2551 (`calendar-goto-islamic-date').
2554 Move to a date specified in the French Revolutionary calendar
2555 (`calendar-goto-french-date').
2558 Move to a date specified in the Chinese calendar
2559 (`calendar-goto-chinese-date').
2562 Move to a date specified in the Persian calendar
2563 (`calendar-goto-persian-date').
2566 Move to a date specified in the Coptic calendar
2567 (`calendar-goto-coptic-date').
2570 Move to a date specified in the Ethiopic calendar
2571 (`calendar-goto-ethiopic-date').
2573 These commands ask you for a date on the other calendar, move point
2574 to the Gregorian calendar date equivalent to that date, and display the
2575 other calendar's date in the echo area. Emacs uses strict completion
2576 (*note Completion::) whenever it asks you to type a month name, so you
2577 don't have to worry about the spelling of Hebrew, Islamic, or French
2580 One common question concerning the Hebrew calendar is the computation
2581 of the anniversary of a date of death, called a "yahrzeit." The Emacs
2582 calendar includes a facility for such calculations. If you are in the
2583 calendar, the command `M-x list-yahrzeit-dates' asks you for a range of
2584 years and then displays a list of the yahrzeit dates for those years
2585 for the date given by point. If you are not in the calendar, this
2586 command first asks you for the date of death and the range of years,
2587 and then displays the list of yahrzeit dates.
2590 File: xemacs.info, Node: Mayan Calendar, Next: Diary, Prev: From Other Calendar, Up: Other Calendars
2592 Converting from the Mayan Calendar
2593 ----------------------------------
2595 Here are the commands to select dates based on the Mayan calendar:
2598 Move to a date specified by the long count calendar
2599 (`calendar-goto-mayan-long-count-date').
2602 Move to the next occurrence of a place in the tzolkin calendar
2603 (`calendar-next-tzolkin-date').
2606 Move to the previous occurrence of a place in the tzolkin calendar
2607 (`calendar-previous-tzolkin-date').
2610 Move to the next occurrence of a place in the haab calendar
2611 (`calendar-next-haab-date').
2614 Move to the previous occurrence of a place in the haab calendar
2615 (`calendar-previous-haab-date').
2618 Move to the next occurrence of a place in the calendar round
2619 (`calendar-next-calendar-round-date').
2622 Move to the previous occurrence of a place in the calendar round
2623 (`calendar-previous-calendar-round-date').
2625 To understand these commands, you need to understand the Mayan
2626 calendars. The "long count" is a counting of days with these units:
2628 1 kin = 1 day 1 uinal = 20 kin 1 tun = 18 uinal
2629 1 katun = 20 tun 1 baktun = 20 katun
2631 Thus, the long count date 12.16.11.16.6 means 12 baktun, 16 katun, 11
2632 tun, 16 uinal, and 6 kin. The Emacs calendar can handle Mayan long
2633 count dates as early as 7.17.18.13.1, but no earlier. When you use the
2634 `g m l' command, type the Mayan long count date with the baktun, katun,
2635 tun, uinal, and kin separated by periods.
2637 The Mayan tzolkin calendar is a cycle of 260 days formed by a pair of
2638 independent cycles of 13 and 20 days. Since this cycle repeats
2639 endlessly, Emacs provides commands to move backward and forward to the
2640 previous or next point in the cycle. Type `g m p t' to go to the
2641 previous tzolkin date; Emacs asks you for a tzolkin date and moves point
2642 to the previous occurrence of that date. Similarly, type `g m n t' to
2643 go to the next occurrence of a tzolkin date.
2645 The Mayan haab calendar is a cycle of 365 days arranged as 18 months
2646 of 20 days each, followed a 5-day monthless period. Like the tzolkin
2647 cycle, this cycle repeats endlessly, and there are commands to move
2648 backward and forward to the previous or next point in the cycle. Type
2649 `g m p h' to go to the previous haab date; Emacs asks you for a haab
2650 date and moves point to the previous occurrence of that date.
2651 Similarly, type `g m n h' to go to the next occurrence of a haab date.
2653 The Maya also used the combination of the tzolkin date and the haab
2654 date. This combination is a cycle of about 52 years called a _calendar
2655 round_. If you type `g m p c', Emacs asks you for both a haab and a
2656 tzolkin date and then moves point to the previous occurrence of that
2657 combination. Use `g m n c' to move point to the next occurrence of a
2658 combination. These commands signal an error if the haab/tzolkin date
2659 combination you have typed is impossible.
2661 Emacs uses strict completion (*note Completion::) whenever it asks
2662 you to type a Mayan name, so you don't have to worry about spelling.
2665 File: xemacs.info, Node: Diary, Next: Calendar Customization, Prev: Mayan Calendar, Up: Calendar/Diary
2670 The Emacs diary keeps track of appointments or other events on a daily
2671 basis, in conjunction with the calendar. To use the diary feature, you
2672 must first create a "diary file" containing a list of events and their
2673 dates. Then Emacs can automatically pick out and display the events
2674 for today, for the immediate future, or for any specified date.
2676 By default, Emacs uses `~/diary' as the diary file. This is the
2677 same file that the `calendar' utility uses. A sample `~/diary' file is:
2679 12/22/1988 Twentieth wedding anniversary!!
2680 &1/1. Happy New Year!
2681 10/22 Ruth's birthday.
2683 Tuesday--weekly meeting with grad students at 10am
2684 Supowit, Shen, Bitner, and Kapoor to attend.
2685 1/13/89 Friday the thirteenth!!
2686 &thu 4pm squash game with Lloyd.
2687 mar 16 Dad's birthday
2688 April 15, 1989 Income tax due.
2689 &* 15 time cards due.
2691 This example uses extra spaces to align the event descriptions of most
2692 of the entries. Such formatting is purely a matter of taste.
2694 Although you probably will start by creating a diary manually, Emacs
2695 provides a number of commands to let you view, add, and change diary
2696 entries. You can also share diary entries with other users (*note
2697 Included Diary Files::).
2701 * Diary Commands:: Viewing diary entries and associated calendar dates.
2702 * Format of Diary File:: Entering events in your diary.
2703 * Date Formats:: Various ways you can specify dates.
2704 * Adding to Diary:: Commands to create diary entries.
2705 * Special Diary Entries:: Anniversaries, blocks of dates, cyclic entries, etc.
2708 File: xemacs.info, Node: Diary Commands, Next: Format of Diary File, Prev: Diary, Up: Diary
2710 Commands Displaying Diary Entries
2711 ---------------------------------
2713 Once you have created a `~/diary' file, you can use the calendar to
2714 view it. You can also view today's events outside of Calendar mode.
2717 Display all diary entries for the selected date
2718 (`view-diary-entries').
2721 Display all diary entries for the date you click on.
2724 Display the entire diary file (`show-all-diary-entries').
2727 Mark all visible dates that have diary entries
2728 (`mark-diary-entries').
2731 Unmark the calendar window (`calendar-unmark').
2733 `M-x print-diary-entries'
2734 Print hard copy of the diary display as it appears.
2737 Display all diary entries for today's date.
2739 `M-x diary-mail-entries'
2740 Mail yourself email reminders about upcoming diary entries.
2742 Displaying the diary entries with `d' shows in a separate window the
2743 diary entries for the selected date in the calendar. The mode line of
2744 the new window shows the date of the diary entries and any holidays
2745 that fall on that date. If you specify a numeric argument with `d', it
2746 shows all the diary entries for that many successive days. Thus, `2 d'
2747 displays all the entries for the selected date and for the following
2750 Another way to display the diary entries for a date is to click
2751 `Button2' on the date, and then choose `Diary' from the menu that
2754 To get a broader view of which days are mentioned in the diary, use
2755 the `m' command. This displays the dates that have diary entries in a
2756 different face (or places a `+' after these dates, if display with
2757 multiple faces is not available). The command applies both to the
2758 currently visible months and to other months that subsequently become
2759 visible by scrolling. To turn marking off and erase the current marks,
2760 type `u', which also turns off holiday marks (*note Holidays::).
2762 To see the full diary file, rather than just some of the entries, use
2765 Display of selected diary entries uses the selective display feature
2766 to hide entries that don't apply.
2768 The diary buffer as you see it is an illusion, so simply printing the
2769 buffer does not print what you see on your screen. There is a special
2770 command to print hard copy of the diary buffer _as it appears_; this
2771 command is `M-x print-diary-entries'. It sends the data directly to
2772 the printer. You can customize it like `lpr-region' (*note Hardcopy::).
2774 The command `M-x diary' displays the diary entries for the current
2775 date, independently of the calendar display, and optionally for the next
2776 few days as well; the variable `number-of-diary-entries' specifies how
2777 many days to include (*note Customization::).
2779 If you put `(diary)' in your init file, this automatically displays
2780 a window with the day's diary entries, when you enter Emacs. *Note
2781 Init File::. The mode line of the displayed window shows the date and
2782 any holidays that fall on that date.
2784 Many users like to receive notice of events in their diary as email.
2785 To send such mail to yourself, use the command `M-x
2786 diary-mail-entries'. A prefix argument specifies how many days
2787 (starting with today) to check; otherwise, the variable
2788 `diary-mail-days' says how many days.
2791 File: xemacs.info, Node: Format of Diary File, Next: Date Formats, Prev: Diary Commands, Up: Diary
2796 Your "diary file" is a file that records events associated with
2797 particular dates. The name of the diary file is specified by the
2798 variable `diary-file'; `~/diary' is the default. The `calendar'
2799 utility program supports a subset of the format allowed by the Emacs
2800 diary facilities, so you can use that utility to view the diary file,
2801 with reasonable results aside from the entries it cannot understand.
2803 Each entry in the diary file describes one event and consists of one
2804 or more lines. An entry always begins with a date specification at the
2805 left margin. The rest of the entry is simply text to describe the
2806 event. If the entry has more than one line, then the lines after the
2807 first must begin with whitespace to indicate they continue a previous
2808 entry. Lines that do not begin with valid dates and do not continue a
2809 preceding entry are ignored.
2811 You can inhibit the marking of certain diary entries in the calendar
2812 window; to do this, insert an ampersand (`&') at the beginning of the
2813 entry, before the date. This has no effect on display of the entry in
2814 the diary window; it affects only marks on dates in the calendar
2815 window. Nonmarking entries are especially useful for generic entries
2816 that would otherwise mark many different dates.
2818 If the first line of a diary entry consists only of the date or day
2819 name with no following blanks or punctuation, then the diary window
2820 display doesn't include that line; only the continuation lines appear.
2821 For example, this entry:
2824 Bill B. visits Princeton today
2825 2pm Cognitive Studies Committee meeting
2826 2:30-5:30 Liz at Lawrenceville
2828 7:30pm Dinner at George's
2829 8:00-10:00pm concert
2831 appears in the diary window without the date line at the beginning.
2832 This style of entry looks neater when you display just a single day's
2833 entries, but can cause confusion if you ask for more than one day's
2836 You can edit the diary entries as they appear in the window, but it
2837 is important to remember that the buffer displayed contains the _entire_
2838 diary file, with portions of it concealed from view. This means, for
2839 instance, that the `C-f' (`forward-char') command can put point at what
2840 appears to be the end of the line, but what is in reality the middle of
2841 some concealed line.
2843 _Be careful when editing the diary entries!_ Inserting additional
2844 lines or adding/deleting characters in the middle of a visible line
2845 cannot cause problems, but editing at the end of a line may not do what
2846 you expect. Deleting a line may delete other invisible entries that
2847 follow it. Before editing the diary, it is best to display the entire
2848 file with `s' (`show-all-diary-entries').
2851 File: xemacs.info, Node: Date Formats, Next: Adding to Diary, Prev: Format of Diary File, Up: Diary
2856 Here are some sample diary entries, illustrating different ways of
2857 formatting a date. The examples all show dates in American order
2858 (month, day, year), but Calendar mode supports European order (day,
2859 month, year) as an option.
2861 4/20/93 Switch-over to new tabulation system
2862 apr. 25 Start tabulating annual results
2863 4/30 Results for April are due
2864 */25 Monthly cycle finishes
2865 Friday Don't leave without backing up files
2867 The first entry appears only once, on April 20, 1993. The second and
2868 third appear every year on the specified dates, and the fourth uses a
2869 wildcard (asterisk) for the month, so it appears on the 25th of every
2870 month. The final entry appears every week on Friday.
2872 You can use just numbers to express a date, as in `MONTH/DAY' or
2873 `MONTH/DAY/YEAR'. This must be followed by a nondigit. In the date
2874 itself, MONTH and DAY are numbers of one or two digits. The optional
2875 YEAR is also a number, and may be abbreviated to the last two digits;
2876 that is, you can use `11/12/1989' or `11/12/89'.
2878 Dates can also have the form `MONTHNAME DAY' or `MONTHNAME DAY,
2879 YEAR', where the month's name can be spelled in full or abbreviated to
2880 three characters (with or without a period). Case is not significant.
2882 A date may be "generic"; that is, partially unspecified. Then the
2883 entry applies to all dates that match the specification. If the date
2884 does not contain a year, it is generic and applies to any year.
2885 Alternatively, MONTH, DAY, or YEAR can be a `*'; this matches any
2886 month, day, or year, respectively. Thus, a diary entry `3/*/*' matches
2887 any day in March of any year; so does `march *'.
2889 If you prefer the European style of writing dates--in which the day
2890 comes before the month--type `M-x european-calendar' while in the
2891 calendar, or set the variable `european-calendar-style' to `t' _before_
2892 using any calendar or diary command. This mode interprets all dates in
2893 the diary in the European manner, and also uses European style for
2894 displaying diary dates. (Note that there is no comma after the
2895 MONTHNAME in the European style.) To go back to the (default) American
2896 style of writing dates, type `M-x american-calendar'.
2898 You can use the name of a day of the week as a generic date which
2899 applies to any date falling on that day of the week. You can abbreviate
2900 the day of the week to three letters (with or without a period) or spell
2901 it in full; case is not significant.
2904 File: xemacs.info, Node: Adding to Diary, Next: Special Diary Entries, Prev: Date Formats, Up: Diary
2906 Commands to Add to the Diary
2907 ----------------------------
2909 While in the calendar, there are several commands to create diary
2913 Add a diary entry for the selected date (`insert-diary-entry').
2916 Add a diary entry for the selected day of the week
2917 (`insert-weekly-diary-entry').
2920 Add a diary entry for the selected day of the month
2921 (`insert-monthly-diary-entry').
2924 Add a diary entry for the selected day of the year
2925 (`insert-yearly-diary-entry').
2927 You can make a diary entry for a specific date by selecting that date
2928 in the calendar window and typing the `i d' command. This command
2929 displays the end of your diary file in another window and inserts the
2930 date; you can then type the rest of the diary entry.
2932 If you want to make a diary entry that applies to a specific day of
2933 the week, select that day of the week (any occurrence will do) and type
2934 `i w'. This inserts the day-of-week as a generic date; you can then
2935 type the rest of the diary entry. You can make a monthly diary entry in
2936 the same fashion. Select the day of the month, use the `i m' command,
2937 and type rest of the entry. Similarly, you can insert a yearly diary
2938 entry with the `i y' command.
2940 All of the above commands make marking diary entries by default. To
2941 make a nonmarking diary entry, give a numeric argument to the command.
2942 For example, `C-u i w' makes a nonmarking weekly diary entry.
2944 When you modify the diary file, be sure to save the file before
2948 File: xemacs.info, Node: Special Diary Entries, Prev: Adding to Diary, Up: Diary
2950 Special Diary Entries
2951 ---------------------
2953 In addition to entries based on calendar dates, the diary file can
2954 contain "sexp entries" for regular events such as anniversaries. These
2955 entries are based on Lisp expressions (sexps) that Emacs evaluates as
2956 it scans the diary file. Instead of a date, a sexp entry contains `%%'
2957 followed by a Lisp expression which must begin and end with
2958 parentheses. The Lisp expression determines which dates the entry
2961 Calendar mode provides commands to insert certain commonly used sexp
2965 Add an anniversary diary entry for the selected date
2966 (`insert-anniversary-diary-entry').
2969 Add a block diary entry for the current region
2970 (`insert-block-diary-entry').
2973 Add a cyclic diary entry starting at the date
2974 (`insert-cyclic-diary-entry').
2976 If you want to make a diary entry that applies to the anniversary of
2977 a specific date, move point to that date and use the `i a' command.
2978 This displays the end of your diary file in another window and inserts
2979 the anniversary description; you can then type the rest of the diary
2980 entry. The entry looks like this:
2982 The effect of `i a' is to add a `diary-anniversary' sexp to your
2983 diary file. You can also add one manually, for instance:
2985 %%(diary-anniversary 10 31 1948) Arthur's birthday
2987 This entry applies to October 31 in any year after 1948; `10 31 1948'
2988 specifies the date. (If you are using the European calendar style, the
2989 month and day are interchanged.) The reason this expression requires a
2990 beginning year is that advanced diary functions can use it to calculate
2991 the number of elapsed years.
2993 A "block" diary entry applies to a specified range of consecutive
2994 dates. Here is a block diary entry that applies to all dates from June
2995 24, 1990 through July 10, 1990:
2997 %%(diary-block 6 24 1990 7 10 1990) Vacation
2999 The `6 24 1990' indicates the starting date and the `7 10 1990'
3000 indicates the stopping date. (Again, if you are using the European
3001 calendar style, the month and day are interchanged.)
3003 To insert a block entry, place point and the mark on the two dates
3004 that begin and end the range, and type `i b'. This command displays
3005 the end of your diary file in another window and inserts the block
3006 description; you can then type the diary entry.
3008 "Cyclic" diary entries repeat after a fixed interval of days. To
3009 create one, select the starting date and use the `i c' command. The
3010 command prompts for the length of interval, then inserts the entry,
3011 which looks like this:
3013 %%(diary-cyclic 50 3 1 1990) Renew medication
3015 This entry applies to March 1, 1990 and every 50th day following; `3 1
3016 1990' specifies the starting date. (If you are using the European
3017 calendar style, the month and day are interchanged.)
3019 All three of these commands make marking diary entries. To insert a
3020 nonmarking entry, give a numeric argument to the command. For example,
3021 `C-u i a' makes a nonmarking anniversary diary entry.
3023 Marking sexp diary entries in the calendar is _extremely_
3024 time-consuming, since every date visible in the calendar window must be
3025 individually checked. So it's a good idea to make sexp diary entries
3026 nonmarking (with `&') when possible.
3028 Another sophisticated kind of sexp entry, a "floating" diary entry,
3029 specifies a regularly occurring event by offsets specified in days,
3030 weeks, and months. It is comparable to a crontab entry interpreted by
3031 the `cron' utility. Here is a nonmarking, floating diary entry that
3032 applies to the last Thursday in November:
3034 &%%(diary-float 11 4 -1) American Thanksgiving
3036 The 11 specifies November (the eleventh month), the 4 specifies Thursday
3037 (the fourth day of the week, where Sunday is numbered zero), and the -1
3038 specifies "last" (1 would mean "first", 2 would mean "second", -2 would
3039 mean "second-to-last", and so on). The month can be a single month or
3040 a list of months. Thus you could change the 11 above to `'(1 2 3)' and
3041 have the entry apply to the last Thursday of January, February, and
3042 March. If the month is `t', the entry applies to all months of the
3045 The sexp feature of the diary allows you to specify diary entries
3046 based on any Emacs Lisp expression. You can use the library of built-in
3047 functions or you can write your own functions. The built-in functions
3048 include the ones shown in this section, plus a few others (*note Sexp
3051 The generality of sexps lets you specify any diary entry that you can
3052 describe algorithmically. Suppose you get paid on the 21st of the month
3053 if it is a weekday, and to the Friday before if the 21st is on a
3054 weekend. The diary entry
3056 &%%(let ((dayname (calendar-day-of-week date))
3057 (day (car (cdr date))))
3058 (or (and (= day 21) (memq dayname '(1 2 3 4 5)))
3059 (and (memq day '(19 20)) (= dayname 5)))
3060 ) Pay check deposited
3062 to just those dates. This example illustrates how the sexp can depend
3063 on the variable `date'; this variable is a list (MONTH DAY YEAR) that
3064 gives the Gregorian date for which the diary entries are being found.
3065 If the value of the sexp is `t', the entry applies to that date. If
3066 the sexp evaluates to `nil', the entry does _not_ apply to that date.
3069 File: xemacs.info, Node: Calendar Customization, Prev: Diary, Up: Calendar/Diary
3071 Customizing the Calendar and Diary
3072 ----------------------------------
3074 There are many customizations that you can use to make the calendar and
3075 diary suit your personal tastes.
3079 * Calendar Customizing:: Defaults you can set.
3080 * Holiday Customizing:: Defining your own holidays.
3081 * Date Display Format:: Changing the format.
3082 * Time Display Format:: Changing the format.
3083 * Daylight Savings:: Changing the default.
3084 * Diary Customizing:: Defaults you can set.
3085 * Hebrew/Islamic Entries:: How to obtain them.
3086 * Fancy Diary Display:: Enhancing the diary display, sorting entries.
3087 * Included Diary Files:: Sharing a common diary file.
3088 * Sexp Diary Entries:: Fancy things you can do.
3089 * Appt Customizing:: Customizing appointment reminders.
3092 File: xemacs.info, Node: Calendar Customizing, Next: Holiday Customizing, Up: Calendar Customization
3094 Customizing the Calendar
3095 ........................
3097 If you set the variable `view-diary-entries-initially' to `t', calling
3098 up the calendar automatically displays the diary entries for the
3099 current date as well. The diary dates appear only if the current date
3100 is visible. If you add both of the following lines to your init file:
3102 (setq view-diary-entries-initially t)
3105 this displays both the calendar and diary windows whenever you start
3106 Emacs. *Note Init File::.
3108 Similarly, if you set the variable
3109 `view-calendar-holidays-initially' to `t', entering the calendar
3110 automatically displays a list of holidays for the current three-month
3111 period. The holiday list appears in a separate window.
3113 You can set the variable `mark-diary-entries-in-calendar' to `t' in
3114 order to mark any dates with diary entries. This takes effect whenever
3115 the calendar window contents are recomputed. There are two ways of
3116 marking these dates: by changing the face (*note Faces::), if the
3117 display supports that, or by placing a plus sign (`+') beside the date
3120 Similarly, setting the variable `mark-holidays-in-calendar' to `t'
3121 marks holiday dates, either with a change of face or with an asterisk
3124 The variable `calendar-holiday-marker' specifies how to mark a date
3125 as being a holiday. Its value may be a character to insert next to the
3126 date, or a face name to use for displaying the date. Likewise, the
3127 variable `diary-entry-marker' specifies how to mark a date that has
3128 diary entries. The calendar creates faces named `holiday-face' and
3129 `diary-face' for these purposes; those symbols are the default values
3130 of these variables, when Emacs supports multiple faces on your terminal.
3132 The variable `calendar-load-hook' is a normal hook run when the
3133 calendar package is first loaded (before actually starting to display
3136 Starting the calendar runs the normal hook
3137 `initial-calendar-window-hook'. Recomputation of the calendar display
3138 does not run this hook. But if you leave the calendar with the `q'
3139 command and reenter it, the hook runs again.
3141 The variable `today-visible-calendar-hook' is a normal hook run
3142 after the calendar buffer has been prepared with the calendar when the
3143 current date is visible in the window. One use of this hook is to
3144 replace today's date with asterisks; to do that, use the hook function
3145 `calendar-star-date'.
3147 (add-hook 'today-visible-calendar-hook 'calendar-star-date)
3149 Another standard hook function marks the current date, either by
3150 changing its face or by adding an asterisk. Here's how to use it:
3152 (add-hook 'today-visible-calendar-hook 'calendar-mark-today)
3154 The variable `calendar-today-marker' specifies how to mark today's
3155 date. Its value should be a character to insert next to the date or a
3156 face name to use for displaying the date. A face named
3157 `calendar-today-face' is provided for this purpose; that symbol is the
3158 default for this variable when Emacs supports multiple faces on your
3161 A similar normal hook, `today-invisible-calendar-hook' is run if the
3162 current date is _not_ visible in the window.
3165 File: xemacs.info, Node: Holiday Customizing, Next: Date Display Format, Prev: Calendar Customizing, Up: Calendar Customization
3167 Customizing the Holidays
3168 ........................
3170 Emacs knows about holidays defined by entries on one of several lists.
3171 You can customize these lists of holidays to your own needs, adding or
3172 deleting holidays. The lists of holidays that Emacs uses are for
3173 general holidays (`general-holidays'), local holidays
3174 (`local-holidays'), Christian holidays (`christian-holidays'), Hebrew
3175 (Jewish) holidays (`hebrew-holidays'), Islamic (Moslem) holidays
3176 (`islamic-holidays'), and other holidays (`other-holidays').
3178 The general holidays are, by default, holidays common throughout the
3179 United States. To eliminate these holidays, set `general-holidays' to
3182 There are no default local holidays (but sites may supply some). You
3183 can set the variable `local-holidays' to any list of holidays, as
3186 By default, Emacs does not include all the holidays of the religions
3187 that it knows, only those commonly found in secular calendars. For a
3188 more extensive collection of religious holidays, you can set any (or
3189 all) of the variables `all-christian-calendar-holidays',
3190 `all-hebrew-calendar-holidays', or `all-islamic-calendar-holidays' to
3191 `t'. If you want to eliminate the religious holidays, set any or all
3192 of the corresponding variables `christian-holidays', `hebrew-holidays',
3193 and `islamic-holidays' to `nil'.
3195 You can set the variable `other-holidays' to any list of holidays.
3196 This list, normally empty, is intended for individual use.
3198 Each of the lists (`general-holidays', `local-holidays',
3199 `christian-holidays', `hebrew-holidays', `islamic-holidays', and
3200 `other-holidays') is a list of "holiday forms", each holiday form
3201 describing a holiday (or sometimes a list of holidays).
3203 Here is a table of the possible kinds of holiday form. Day numbers
3204 and month numbers count starting from 1, but "dayname" numbers count
3205 Sunday as 0. The element STRING is always the name of the holiday, as
3208 `(holiday-fixed MONTH DAY STRING)'
3209 A fixed date on the Gregorian calendar. MONTH and DAY are
3210 numbers, STRING is the name of the holiday.
3212 `(holiday-float MONTH DAYNAME K STRING)'
3213 The Kth DAYNAME in MONTH on the Gregorian calendar (DAYNAME=0 for
3214 Sunday, and so on); negative K means count back from the end of
3215 the month. STRING is the name of the holiday.
3217 `(holiday-hebrew MONTH DAY STRING)'
3218 A fixed date on the Hebrew calendar. MONTH and DAY are numbers,
3219 STRING is the name of the holiday.
3221 `(holiday-islamic MONTH DAY STRING)'
3222 A fixed date on the Islamic calendar. MONTH and DAY are numbers,
3223 STRING is the name of the holiday.
3225 `(holiday-julian MONTH DAY STRING)'
3226 A fixed date on the Julian calendar. MONTH and DAY are numbers,
3227 STRING is the name of the holiday.
3229 `(holiday-sexp SEXP STRING)'
3230 A date calculated by the Lisp expression SEXP. The expression
3231 should use the variable `year' to compute and return the date of a
3232 holiday, or `nil' if the holiday doesn't happen this year. The
3233 value of SEXP must represent the date as a list of the form
3234 `(MONTH DAY YEAR)'. STRING is the name of the holiday.
3236 `(if CONDITION HOLIDAY-FORM &optional HOLIDAY-FORM)'
3237 A holiday that happens only if CONDITION is true.
3240 A list of dates calculated by the function FUNCTION, called with
3243 For example, suppose you want to add Bastille Day, celebrated in
3244 France on July 14. You can do this by adding the following line to
3247 (setq other-holidays '((holiday-fixed 7 14 "Bastille Day")))
3251 The holiday form `(holiday-fixed 7 14 "Bastille Day")' specifies the
3252 fourteenth day of the seventh month (July).
3254 Many holidays occur on a specific day of the week, at a specific time
3255 of month. Here is a holiday form describing Hurricane Supplication Day,
3256 celebrated in the Virgin Islands on the fourth Monday in August:
3258 (holiday-float 8 1 4 "Hurricane Supplication Day")
3260 Here the 8 specifies August, the 1 specifies Monday (Sunday is 0,
3261 Tuesday is 2, and so on), and the 4 specifies the fourth occurrence in
3262 the month (1 specifies the first occurrence, 2 the second occurrence,
3263 -1 the last occurrence, -2 the second-to-last occurrence, and so on).
3265 You can specify holidays that occur on fixed days of the Hebrew,
3266 Islamic, and Julian calendars too. For example,
3268 (setq other-holidays
3269 '((holiday-hebrew 10 2 "Last day of Hanukkah")
3270 (holiday-islamic 3 12 "Mohammed's Birthday")
3271 (holiday-julian 4 2 "Jefferson's Birthday")))
3273 adds the last day of Hanukkah (since the Hebrew months are numbered with
3274 1 starting from Nisan), the Islamic feast celebrating Mohammed's
3275 birthday (since the Islamic months are numbered from 1 starting with
3276 Muharram), and Thomas Jefferson's birthday, which is 2 April 1743 on the
3279 To include a holiday conditionally, use either Emacs Lisp's `if' or
3280 the `holiday-sexp' form. For example, American presidential elections
3281 occur on the first Tuesday after the first Monday in November of years
3284 (holiday-sexp (if (= 0 (% year 4))
3285 (calendar-gregorian-from-absolute
3286 (1+ (calendar-dayname-on-or-before
3287 1 (+ 6 (calendar-absolute-from-gregorian
3288 (list 11 1 year))))))
3289 "US Presidential Election"))
3293 (if (= 0 (% displayed-year 4))
3295 (extract-calendar-day
3296 (calendar-gregorian-from-absolute
3297 (1+ (calendar-dayname-on-or-before
3298 1 (+ 6 (calendar-absolute-from-gregorian
3299 (list 11 1 displayed-year)))))))
3300 "US Presidential Election"))
3302 Some holidays just don't fit into any of these forms because special
3303 calculations are involved in their determination. In such cases you
3304 must write a Lisp function to do the calculation. To include eclipses,
3305 for example, add `(eclipses)' to `other-holidays' and write an Emacs
3306 Lisp function `eclipses' that returns a (possibly empty) list of the
3307 relevant Gregorian dates among the range visible in the calendar
3308 window, with descriptive strings, like this:
3310 (((6 27 1991) "Lunar Eclipse") ((7 11 1991) "Solar Eclipse") ... )
3313 File: xemacs.info, Node: Date Display Format, Next: Time Display Format, Prev: Holiday Customizing, Up: Calendar Customization
3318 You can customize the manner of displaying dates in the diary, in mode
3319 lines, and in messages by setting `calendar-date-display-form'. This
3320 variable holds a list of expressions that can involve the variables
3321 `month', `day', and `year', which are all numbers in string form, and
3322 `monthname' and `dayname', which are both alphabetic strings. In the
3323 American style, the default value of this list is as follows:
3325 ((if dayname (concat dayname ", ")) monthname " " day ", " year)
3327 while in the European style this value is the default:
3329 ((if dayname (concat dayname ", ")) day " " monthname " " year)
3331 + The ISO standard date representation is this:
3333 (year "-" month "-" day)
3335 This specifies a typical American format:
3337 (month "/" day "/" (substring year -2))
3340 File: xemacs.info, Node: Time Display Format, Next: Daylight Savings, Prev: Date Display Format, Up: Calendar Customization
3345 The calendar and diary by default display times of day in the
3346 conventional American style with the hours from 1 through 12, minutes,
3347 and either `am' or `pm'. If you prefer the European style, also known
3348 in the US as military, in which the hours go from 00 to 23, you can
3349 alter the variable `calendar-time-display-form'. This variable is a
3350 list of expressions that can involve the variables `12-hours',
3351 `24-hours', and `minutes', which are all numbers in string form, and
3352 `am-pm' and `time-zone', which are both alphabetic strings. The
3353 default value of `calendar-time-display-form' is as follows:
3355 (12-hours ":" minutes am-pm
3356 (if time-zone " (") time-zone (if time-zone ")"))
3358 Here is a value that provides European style times:
3360 (24-hours ":" minutes
3361 (if time-zone " (") time-zone (if time-zone ")"))
3363 gives military-style times like `21:07 (UT)' if time zone names are
3364 defined, and times like `21:07' if they are not.
3367 File: xemacs.info, Node: Daylight Savings, Next: Diary Customizing, Prev: Time Display Format, Up: Calendar Customization
3369 Daylight Savings Time
3370 .....................
3372 Emacs understands the difference between standard time and daylight
3373 savings time--the times given for sunrise, sunset, solstices,
3374 equinoxes, and the phases of the moon take that into account. The rules
3375 for daylight savings time vary from place to place and have also varied
3376 historically from year to year. To do the job properly, Emacs needs to
3377 know which rules to use.
3379 Some operating systems keep track of the rules that apply to the
3380 place where you are; on these systems, Emacs gets the information it
3381 needs from the system automatically. If some or all of this
3382 information is missing, Emacs fills in the gaps with the rules
3383 currently used in Cambridge, Massachusetts. If the resulting rules are
3384 not what you want, you can tell Emacs the rules to use by setting
3387 If the default choice of rules is not appropriate for your location,
3388 you can tell Emacs the rules to use by setting the variables
3389 `calendar-daylight-savings-starts' and
3390 `calendar-daylight-savings-ends'. Their values should be Lisp
3391 expressions that refer to the variable `year', and evaluate to the
3392 Gregorian date on which daylight savings time starts or (respectively)
3393 ends, in the form of a list `(MONTH DAY YEAR)'. The values should be
3394 `nil' if your area does not use daylight savings time.
3396 Emacs uses these expressions to determine the starting date of
3397 daylight savings time for the holiday list and for correcting times of
3398 day in the solar and lunar calculations.
3400 The values for Cambridge, Massachusetts are as follows:
3402 (calendar-nth-named-day 1 0 4 year)
3403 (calendar-nth-named-day -1 0 10 year)
3405 That is, the first 0th day (Sunday) of the fourth month (April) in the
3406 year specified by `year', and the last Sunday of the tenth month
3407 (October) of that year. If daylight savings time were changed to start
3408 on October 1, you would set `calendar-daylight-savings-starts' to this:
3412 For a more complex example, suppose daylight savings time begins on
3413 the first of Nisan on the Hebrew calendar. You should set
3414 `calendar-daylight-savings-starts' to this value:
3416 (calendar-gregorian-from-absolute
3417 (calendar-absolute-from-hebrew
3418 (list 1 1 (+ year 3760))))
3420 because Nisan is the first month in the Hebrew calendar and the Hebrew
3421 year differs from the Gregorian year by 3760 at Nisan.
3423 If there is no daylight savings time at your location, or if you want
3424 all times in standard time, set `calendar-daylight-savings-starts' and
3425 `calendar-daylight-savings-ends' to `nil'.
3427 The variable `calendar-daylight-time-offset' specifies the
3428 difference between daylight savings time and standard time, measured in
3429 minutes. The value for Cambridge, Massachusetts is 60.
3431 The two variables `calendar-daylight-savings-starts-time' and
3432 `calendar-daylight-savings-ends-time' specify the number of minutes
3433 after midnight local time when the transition to and from daylight
3434 savings time should occur. For Cambridge, Massachusetts both variables'
3438 File: xemacs.info, Node: Diary Customizing, Next: Hebrew/Islamic Entries, Prev: Daylight Savings, Up: Calendar Customization
3440 Customizing the Diary
3441 .....................
3443 Ordinarily, the mode line of the diary buffer window indicates any
3444 holidays that fall on the date of the diary entries. The process of
3445 checking for holidays can take several seconds, so including holiday
3446 information delays the display of the diary buffer noticeably. If you'd
3447 prefer to have a faster display of the diary buffer but without the
3448 holiday information, set the variable `holidays-in-diary-buffer' to
3451 The variable `number-of-diary-entries' controls the number of days
3452 of diary entries to be displayed at one time. It affects the initial
3453 display when `view-diary-entries-initially' is `t', as well as the
3454 command `M-x diary'. For example, the default value is 1, which says
3455 to display only the current day's diary entries. If the value is 2,
3456 both the current day's and the next day's entries are displayed. The
3457 value can also be a vector of seven elements: for example, if the value
3458 is `[0 2 2 2 2 4 1]' then no diary entries appear on Sunday, the
3459 current date's and the next day's diary entries appear Monday through
3460 Thursday, Friday through Monday's entries appear on Friday, while on
3461 Saturday only that day's entries appear.
3463 The variable `print-diary-entries-hook' is a normal hook run after
3464 preparation of a temporary buffer containing just the diary entries
3465 currently visible in the diary buffer. (The other, irrelevant diary
3466 entries are really absent from the temporary buffer; in the diary
3467 buffer, they are merely hidden.) The default value of this hook does
3468 the printing with the command `lpr-buffer'. If you want to use a
3469 different command to do the printing, just change the value of this
3470 hook. Other uses might include, for example, rearranging the lines into
3471 order by day and time.
3473 You can customize the form of dates in your diary file, if neither
3474 the standard American nor European styles suits your needs, by setting
3475 the variable `diary-date-forms'. This variable is a list of patterns
3476 for recognizing a date. Each date pattern is a list whose elements may
3477 be regular expressions (*note Regexps::) or the symbols `month', `day',
3478 `year', `monthname', and `dayname'. All these elements serve as
3479 patterns that match certain kinds of text in the diary file. In order
3480 for the date pattern, as a whole, to match, all of its elements must
3481 match consecutively.
3483 A regular expression in a date pattern matches in its usual fashion,
3484 using the standard syntax table altered so that `*' is a word
3487 The symbols `month', `day', `year', `monthname', and `dayname' match
3488 the month number, day number, year number, month name, and day name of
3489 the date being considered. The symbols that match numbers allow
3490 leading zeros; those that match names allow three-letter abbreviations
3491 and capitalization. All the symbols can match `*'; since `*' in a
3492 diary entry means "any day", "any month", and so on, it should match
3493 regardless of the date being considered.
3495 The default value of `diary-date-forms' in the American style is
3498 ((month "/" day "[^/0-9]")
3499 (month "/" day "/" year "[^0-9]")
3500 (monthname " *" day "[^,0-9]")
3501 (monthname " *" day ", *" year "[^0-9]")
3504 Emacs matches of the diary entries with the date forms is done with the
3505 standard syntax table from Fundamental mode (*note Syntax Tables:
3506 (lispref)Syntax Tables.), but with the `*' changed so that it is a word
3509 The date patterns in the list must be _mutually exclusive_ and must
3510 not match any portion of the diary entry itself, just the date and one
3511 character of whitespace. If, to be mutually exclusive, the pattern
3512 must match a portion of the diary entry text--beyond the whitespace
3513 that ends the date--then the first element of the date pattern _must_
3514 be `backup'. This causes the date recognizer to back up to the
3515 beginning of the current word of the diary entry, after finishing the
3516 match. Even if you use `backup', the date pattern must absolutely not
3517 match more than a portion of the first word of the diary entry. The
3518 default value of `diary-date-forms' in the European style is this list:
3520 ((day "/" month "[^/0-9]")
3521 (day "/" month "/" year "[^0-9]")
3522 (backup day " *" monthname "\\W+\\<[^*0-9]")
3523 (day " *" monthname " *" year "[^0-9]")
3526 Notice the use of `backup' in the third pattern, because it needs to
3527 match part of a word beyond the date itself to distinguish it from the
3531 File: xemacs.info, Node: Hebrew/Islamic Entries, Next: Fancy Diary Display, Prev: Diary Customizing, Up: Calendar Customization
3533 Hebrew- and Islamic-Date Diary Entries
3534 ......................................
3536 Your diary file can have entries based on Hebrew or Islamic dates, as
3537 well as entries based on the world-standard Gregorian calendar.
3538 However, because recognition of such entries is time-consuming and most
3539 people don't use them, you must explicitly enable their use. If you
3540 want the diary to recognize Hebrew-date diary entries, for example, you
3543 (add-hook 'nongregorian-diary-listing-hook 'list-hebrew-diary-entries)
3544 (add-hook 'nongregorian-diary-marking-hook 'mark-hebrew-diary-entries)
3546 If you want Islamic-date entries, do this:
3548 (add-hook 'nongregorian-diary-listing-hook 'list-islamic-diary-entries)
3549 (add-hook 'nongregorian-diary-marking-hook 'mark-islamic-diary-entries)
3551 Hebrew- and Islamic-date diary entries have the same formats as
3552 Gregorian-date diary entries, except that `H' precedes a Hebrew date
3553 and `I' precedes an Islamic date. Moreover, because the Hebrew and
3554 Islamic month names are not uniquely specified by the first three
3555 letters, you may not abbreviate them. For example, a diary entry for
3556 the Hebrew date Heshvan 25 could look like this:
3558 HHeshvan 25 Happy Hebrew birthday!
3560 and would appear in the diary for any date that corresponds to Heshvan
3561 25 on the Hebrew calendar. And here is Islamic-date diary entry that
3562 matches Dhu al-Qada 25:
3564 IDhu al-Qada 25 Happy Islamic birthday!
3566 and would appear in the diary for any date that corresponds to Dhu
3567 al-Qada 25 on the Islamic calendar.
3569 As with Gregorian-date diary entries, Hebrew- and Islamic-date
3570 entries are nonmarking if they are preceded with an ampersand (`&').
3572 Here is a table of commands used in the calendar to create diary
3573 entries that match the selected date and other dates that are similar
3574 in the Hebrew or Islamic calendar:
3577 Add a diary entry for the Hebrew date corresponding to the
3578 selected date (`insert-hebrew-diary-entry').
3581 Add a diary entry for the day of the Hebrew month corresponding to
3582 the selected date (`insert-monthly-hebrew-diary-entry'). This
3583 diary entry matches any date that has the same Hebrew
3584 day-within-month as the selected date.
3587 Add a diary entry for the day of the Hebrew year corresponding to
3588 the selected date (`insert-yearly-hebrew-diary-entry'). This diary
3589 entry matches any date which has the same Hebrew month and
3590 day-within-month as the selected date.
3593 Add a diary entry for the Islamic date corresponding to the
3594 selected date (`insert-islamic-diary-entry').
3597 Add a diary entry for the day of the Islamic month corresponding
3598 to the selected date (`insert-monthly-islamic-diary-entry').
3601 Add a diary entry for the day of the Islamic year corresponding to
3602 the selected date (`insert-yearly-islamic-diary-entry').
3604 These commands work much like the corresponding commands for ordinary
3605 diary entries: they apply to the date that point is on in the calendar
3606 window, and what they do is insert just the date portion of a diary
3607 entry at the end of your diary file. You must then insert the rest of
3611 File: xemacs.info, Node: Fancy Diary Display, Next: Included Diary Files, Prev: Hebrew/Islamic Entries, Up: Calendar Customization
3616 Diary display works by preparing the diary buffer and then running the
3617 hook `diary-display-hook'. The default value of this hook
3618 (`simple-diary-display') hides the irrelevant diary entries and then
3619 displays the buffer. However, if you specify the hook as follows,
3621 (add-hook 'diary-display-hook 'fancy-diary-display)
3623 this enables fancy diary display. It displays diary entries and
3624 holidays by copying them into a special buffer that exists only for the
3625 sake of display. Copying to a separate buffer provides an opportunity
3626 to change the displayed text to make it prettier--for example, to sort
3627 the entries by the dates they apply to.
3629 As with simple diary display, you can print a hard copy of the buffer
3630 with `print-diary-entries'. To print a hard copy of a day-by-day diary
3631 for a week by positioning point on Sunday of that week, type `7 d' and
3632 then do `M-x print-diary-entries'. As usual, the inclusion of the
3633 holidays slows down the display slightly; you can speed things up by
3634 setting the variable `holidays-in-diary-buffer' to `nil'.
3636 Ordinarily, the fancy diary buffer does not show days for which
3637 there are no diary entries, even if that day is a holiday. If you want
3638 such days to be shown in the fancy diary buffer, set the variable
3639 `diary-list-include-blanks' to `t'.
3641 If you use the fancy diary display, you can use the normal hook
3642 `list-diary-entries-hook' to sort each day's diary entries by their
3643 time of day. Add this line to your init file:
3645 (add-hook 'list-diary-entries-hook 'sort-diary-entries t)
3649 For each day, this sorts diary entries that begin with a recognizable
3650 time of day according to their times. Diary entries without times come
3651 first within each day.
3654 File: xemacs.info, Node: Included Diary Files, Next: Sexp Diary Entries, Prev: Fancy Diary Display, Up: Calendar Customization
3656 Included Diary Files
3657 ....................
3659 Fancy diary display also has the ability to process included diary
3660 files. This permits a group of people to share a diary file for events
3661 that apply to all of them. Lines in the diary file of this form:
3665 includes the diary entries from the file FILENAME in the fancy diary
3666 buffer. The include mechanism is recursive, so that included files can
3667 include other files, and so on; you must be careful not to have a cycle
3668 of inclusions, of course. Here is how to enable the include facility:
3670 (add-hook 'list-diary-entries-hook 'include-other-diary-files)
3671 (add-hook 'mark-diary-entries-hook 'mark-included-diary-files)
3673 The include mechanism works only with the fancy diary display,
3674 because ordinary diary display shows the entries directly from your
3678 File: xemacs.info, Node: Sexp Diary Entries, Next: Appt Customizing, Prev: Included Diary Files, Up: Calendar Customization
3680 Sexp Entries and the Fancy Diary Display
3681 ........................................
3683 Sexp diary entries allow you to do more than just have complicated
3684 conditions under which a diary entry applies. If you use the fancy
3685 diary display, sexp entries can generate the text of the entry depending
3686 on the date itself. For example, an anniversary diary entry can insert
3687 the number of years since the anniversary date into the text of the
3688 diary entry. Thus the `%d' in this dairy entry:
3690 %%(diary-anniversary 10 31 1948) Arthur's birthday (%d years old)
3692 gets replaced by the age, so on October 31, 1990 the entry appears in
3693 the fancy diary buffer like this:
3695 Arthur's birthday (42 years old)
3697 If the diary file instead contains this entry:
3699 %%(diary-anniversary 10 31 1948) Arthur's %d%s birthday
3701 the entry in the fancy diary buffer for October 31, 1990 appears like
3704 Arthur's 42nd birthday
3706 Similarly, cyclic diary entries can interpolate the number of
3707 repetitions that have occurred:
3709 %%(diary-cyclic 50 1 1 1990) Renew medication (%d%s time)
3713 Renew medication (5th time)
3715 in the fancy diary display on September 8, 1990.
3717 The generality of sexp diary entries lets you specify any diary entry
3718 that you can describe algorithmically. A sexp diary entry contains an
3719 expression that computes whether the entry applies to any given date.
3720 If its value is non-`nil', the entry applies to that date; otherwise,
3721 it does not. The expression can use the variable `date' to find the
3722 date being considered; its value is a list (MONTH DAY YEAR) that refers
3723 to the Gregorian calendar.
3725 Suppose you get paid on the 21st of the month if it is a weekday, and
3726 on the Friday before if the 21st is on a weekend. Here is how to write
3727 a sexp diary entry that matches those dates:
3729 &%%(let ((dayname (calendar-day-of-week date))
3730 (day (car (cdr date))))
3731 (or (and (= day 21) (memq dayname '(1 2 3 4 5)))
3732 (and (memq day '(19 20)) (= dayname 5)))
3733 ) Pay check deposited
3735 applies to just those dates. This example illustrates how the sexp can
3736 depend on the variable `date'; this variable is a list (MONTH DAY YEAR)
3737 that gives the Gregorian date for which the diary entries are being
3738 found. If the value of the expression is `t', the entry applies to
3739 that date. If the expression evaluates to `nil', the entry does _not_
3742 The following sexp diary entries take advantage of the ability (in
3743 the fancy diary display) to concoct diary entries whose text varies
3746 `%%(diary-sunrise-sunset)'
3747 Make a diary entry for the local times of today's sunrise and
3750 `%%(diary-phases-of-moon)'
3751 Make a diary entry for the phases (quarters) of the moon.
3753 `%%(diary-day-of-year)'
3754 Make a diary entry with today's day number in the current year and
3755 the number of days remaining in the current year.
3757 `%%(diary-iso-date)'
3758 Make a diary entry with today's equivalent ISO commercial date.
3760 `%%(diary-julian-date)'
3761 Make a diary entry with today's equivalent date on the Julian
3764 `%%(diary-astro-day-number)'
3765 Make a diary entry with today's equivalent astronomical (Julian)
3768 `%%(diary-hebrew-date)'
3769 Make a diary entry with today's equivalent date on the Hebrew
3772 `%%(diary-islamic-date)'
3773 Make a diary entry with today's equivalent date on the Islamic
3776 `%%(diary-french-date)'
3777 Make a diary entry with today's equivalent date on the French
3778 Revolutionary calendar.
3780 `%%(diary-mayan-date)'
3781 Make a diary entry with today's equivalent date on the Mayan
3784 Thus including the diary entry
3786 &%%(diary-hebrew-date)
3788 causes every day's diary display to contain the equivalent date on the
3789 Hebrew calendar, if you are using the fancy diary display. (With simple
3790 diary display, the line `&%%(diary-hebrew-date)' appears in the diary
3791 for any date, but does nothing particularly useful.)
3793 These functions can be used to construct sexp diary entries based on
3794 the Hebrew calendar in certain standard ways:
3796 `%%(diary-rosh-hodesh)'
3797 Make a diary entry that tells the occurrence and ritual
3798 announcement of each new Hebrew month.
3801 Make a Saturday diary entry that tells the weekly synagogue
3804 `%%(diary-sabbath-candles)'
3805 Make a Friday diary entry that tells the _local time_ of Sabbath
3809 Make a diary entry that gives the omer count, when appropriate.
3811 `%%(diary-yahrzeit MONTH DAY YEAR) NAME'
3812 Make a diary entry marking the anniversary of a date of death.
3813 The date is the _Gregorian_ (civil) date of death. The diary
3814 entry appears on the proper Hebrew calendar anniversary and on the
3815 day before. (In the European style, the order of the parameters
3816 is changed to DAY, MONTH, YEAR.)
3819 File: xemacs.info, Node: Appt Customizing, Prev: Sexp Diary Entries, Up: Calendar Customization
3821 Customizing Appointment Reminders
3822 .................................
3824 You can specify exactly how Emacs reminds you of an appointment, and
3825 how far in advance it begins doing so, by setting these variables:
3827 `appt-message-warning-time'
3828 The time in minutes before an appointment that the reminder
3829 begins. The default is 10 minutes.
3832 If this is `t' (the default), Emacs rings the terminal bell for
3833 appointment reminders.
3836 If this is `t' (the default), Emacs displays the appointment
3837 message in echo area.
3839 `appt-display-mode-line'
3840 If this is `t' (the default), Emacs displays the number of minutes
3841 to the appointment on the mode line.
3844 If this is `t' (the default), Emacs displays the appointment
3845 message in another window.
3847 `appt-display-duration'
3848 The number of seconds an appointment message is displayed. The
3849 default is 5 seconds.
3852 File: xemacs.info, Node: Sorting, Next: Shell, Prev: Calendar/Diary, Up: Top
3857 XEmacs provides several commands for sorting text in a buffer. All
3858 operate on the contents of the region (the text between point and the
3859 mark). They divide the text of the region into many "sort records",
3860 identify a "sort key" for each record, and then reorder the records
3861 using the order determined by the sort keys. The records are ordered so
3862 that their keys are in alphabetical order, or, for numerical sorting, in
3863 numerical order. In alphabetical sorting, all upper-case letters `A'
3864 through `Z' come before lower-case `a', in accordance with the ASCII
3867 The sort commands differ in how they divide the text into sort
3868 records and in which part of each record they use as the sort key.
3869 Most of the commands make each line a separate sort record, but some
3870 commands use paragraphs or pages as sort records. Most of the sort
3871 commands use each entire sort record as its own sort key, but some use
3872 only a portion of the record as the sort key.
3875 Divide the region into lines and sort by comparing the entire text
3876 of a line. A prefix argument means sort in descending order.
3878 `M-x sort-paragraphs'
3879 Divide the region into paragraphs and sort by comparing the entire
3880 text of a paragraph (except for leading blank lines). A prefix
3881 argument means sort in descending order.
3884 Divide the region into pages and sort by comparing the entire text
3885 of a page (except for leading blank lines). A prefix argument
3886 means sort in descending order.
3889 Divide the region into lines and sort by comparing the contents of
3890 one field in each line. Fields are defined as separated by
3891 whitespace, so the first run of consecutive non-whitespace
3892 characters in a line constitutes field 1, the second such run
3893 constitutes field 2, etc.
3895 You specify which field to sort by with a numeric argument: 1 to
3896 sort by field 1, etc. A negative argument means sort in descending
3897 order. Thus, minus 2 means sort by field 2 in reverse-alphabetical
3900 `M-x sort-numeric-fields'
3901 Like `M-x sort-fields', except the specified field is converted to
3902 a number for each line and the numbers are compared. `10' comes
3903 before `2' when considered as text, but after it when considered
3907 Like `M-x sort-fields', except that the text within each line used
3908 for comparison comes from a fixed range of columns. An explanation
3911 For example, if the buffer contains:
3913 On systems where clash detection (locking of files being edited) is
3914 implemented, XEmacs also checks the first time you modify a buffer
3915 whether the file has changed on disk since it was last visited or
3916 saved. If it has, you are asked to confirm that you want to change
3919 then if you apply `M-x sort-lines' to the entire buffer you get:
3921 On systems where clash detection (locking of files being edited) is
3922 implemented, XEmacs also checks the first time you modify a buffer
3923 saved. If it has, you are asked to confirm that you want to change
3925 whether the file has changed on disk since it was last visited or
3927 where the upper case `O' comes before all lower case letters. If you
3928 apply instead `C-u 2 M-x sort-fields' you get:
3930 saved. If it has, you are asked to confirm that you want to change
3931 implemented, XEmacs also checks the first time you modify a buffer
3933 On systems where clash detection (locking of files being edited) is
3934 whether the file has changed on disk since it was last visited or
3936 where the sort keys were `If', `XEmacs', `buffer', `systems', and `the'.
3938 `M-x sort-columns' requires more explanation. You specify the
3939 columns by putting point at one of the columns and the mark at the other
3940 column. Because this means you cannot put point or the mark at the
3941 beginning of the first line to sort, this command uses an unusual
3942 definition of `region': all of the line point is in is considered part
3943 of the region, and so is all of the line the mark is in.
3945 For example, to sort a table by information found in columns 10 to
3946 15, you could put the mark on column 10 in the first line of the table,
3947 and point on column 15 in the last line of the table, and then use this
3948 command. Or you could put the mark on column 15 in the first line and
3949 point on column 10 in the last line.
3951 This can be thought of as sorting the rectangle specified by point
3952 and the mark, except that the text on each line to the left or right of
3953 the rectangle moves along with the text inside the rectangle. *Note
3957 File: xemacs.info, Node: Shell, Next: Narrowing, Prev: Sorting, Up: Top
3959 Running Shell Commands from XEmacs
3960 ==================================
3962 XEmacs has commands for passing single command lines to inferior shell
3963 processes; it can also run a shell interactively with input and output
3964 to an XEmacs buffer `*shell*'.
3967 Run a specified shell command line and display the output
3971 Run a specified shell command line with region contents as input;
3972 optionally replace the region with the output
3973 (`shell-command-on-region').
3976 Run a subshell with input and output through an XEmacs buffer.
3977 You can then give commands interactively.
3980 Run a subshell with input and output through an XEmacs buffer.
3981 You can then give commands interactively. Full terminal emulation
3986 * Single Shell:: How to run one shell command and return.
3987 * Interactive Shell:: Permanent shell taking input via XEmacs.
3988 * Shell Mode:: Special XEmacs commands used with permanent shell.
3989 * Terminal emulator:: An XEmacs window as a terminal emulator.
3990 * Term Mode:: Special XEmacs commands used in Term mode.
3991 * Paging in Term:: Paging in the terminal emulator.
3994 File: xemacs.info, Node: Single Shell, Next: Interactive Shell, Prev: Shell, Up: Shell
3996 Single Shell Commands
3997 ---------------------
3999 `M-!' (`shell-command') reads a line of text using the minibuffer and
4000 creates an inferior shell to execute the line as a command. Standard
4001 input from the command comes from the null device. If the shell
4002 command produces any output, the output goes to an XEmacs buffer named
4003 `*Shell Command Output*', which is displayed in another window but not
4004 selected. A numeric argument, as in `M-1 M-!', directs this command to
4005 insert any output into the current buffer. In that case, point is left
4006 before the output and the mark is set after the output.
4008 `M-|' (`shell-command-on-region') is like `M-!' but passes the
4009 contents of the region as input to the shell command, instead of no
4010 input. If a numeric argument is used to direct output to the current
4011 buffer, then the old region is deleted first and the output replaces it
4012 as the contents of the region.
4014 Both `M-!' and `M-|' use `shell-file-name' to specify the shell to
4015 use. This variable is initialized based on your `SHELL' environment
4016 variable when you start XEmacs. If the file name does not specify a
4017 directory, the directories in the list `exec-path' are searched; this
4018 list is initialized based on the `PATH' environment variable when you
4019 start XEmacs. You can override either or both of these default
4020 initializations in your init file. *Note Init File::.
4022 When you use `M-!' and `M-|', XEmacs has to wait until the shell
4023 command completes. You can quit with `C-g'; that terminates the shell
4027 File: xemacs.info, Node: Interactive Shell, Next: Shell Mode, Prev: Single Shell, Up: Shell
4029 Interactive Inferior Shell
4030 --------------------------
4032 To run a subshell interactively with its typescript in an XEmacs
4033 buffer, use `M-x shell'. This creates (or reuses) a buffer named
4034 `*shell*' and runs a subshell with input coming from and output going
4035 to that buffer. That is to say, any "terminal output" from the subshell
4036 will go into the buffer, advancing point, and any "terminal input" for
4037 the subshell comes from text in the buffer. To give input to the
4038 subshell, go to the end of the buffer and type the input, terminated by
4041 XEmacs does not wait for the subshell to do anything. You can switch
4042 windows or buffers and edit them while the shell is waiting, or while
4043 it is running a command. Output from the subshell waits until XEmacs
4044 has time to process it; this happens whenever XEmacs is waiting for
4045 keyboard input or for time to elapse.
4047 To get multiple subshells, change the name of buffer `*shell*' to
4048 something different by using `M-x rename-buffer'. The next use of `M-x
4049 shell' creates a new buffer `*shell*' with its own subshell. By
4050 renaming this buffer as well you can create a third one, and so on.
4051 All the subshells run independently and in parallel.
4053 The file name used to load the subshell is the value of the variable
4054 `explicit-shell-file-name', if that is non-`nil'. Otherwise, the
4055 environment variable `ESHELL' is used, or the environment variable
4056 `SHELL' if there is no `ESHELL'. If the file name specified is
4057 relative, the directories in the list `exec-path' are searched (*note
4058 Single Shell Commands: Single Shell.).
4060 As soon as the subshell is started, it is sent as input the contents
4061 of the file `~/.emacs_SHELLNAME', if that file exists, where SHELLNAME
4062 is the name of the file that the shell was loaded from. For example,
4063 if you use `csh', the file sent to it is `~/.emacs_csh'.
4065 `cd', `pushd', and `popd' commands given to the inferior shell are
4066 watched by XEmacs so it can keep the `*shell*' buffer's default
4067 directory the same as the shell's working directory. These commands
4068 are recognized syntactically by examining lines of input that are sent.
4069 If you use aliases for these commands, you can tell XEmacs to
4070 recognize them also. For example, if the value of the variable
4071 `shell-pushd-regexp' matches the beginning of a shell command line,
4072 that line is regarded as a `pushd' command. Change this variable when
4073 you add aliases for `pushd'. Likewise, `shell-popd-regexp' and
4074 `shell-cd-regexp' are used to recognize commands with the meaning of
4077 `M-x shell-resync-dirs' queries the shell and resynchronizes XEmacs'
4078 idea of what the current directory stack is. `M-x
4079 shell-dirtrack-toggle' turns directory tracking on and off.
4081 XEmacs keeps a history of the most recent commands you have typed in
4082 the `*shell*' buffer. If you are at the beginning of a shell command
4083 line and type <M-p>, the previous shell input is inserted into the
4084 buffer before point. Immediately typing <M-p> again deletes that input
4085 and inserts the one before it. By repeating <M-p> you can move
4086 backward through your commands until you find one you want to repeat.
4087 You may then edit the command before typing <RET> if you wish. <M-n>
4088 moves forward through the command history, in case you moved backward
4089 past the one you wanted while using <M-p>. If you type the first few
4090 characters of a previous command and then type <M-p>, the most recent
4091 shell input starting with those characters is inserted. This can be
4092 very convenient when you are repeating a sequence of shell commands.
4093 The variable `input-ring-size' controls how many commands are saved in
4094 your input history. The default is 30.
4097 File: xemacs.info, Node: Shell Mode, Next: Terminal emulator, Prev: Interactive Shell, Up: Shell
4102 The shell buffer uses Shell mode, which defines several special keys
4103 attached to the `C-c' prefix. They are chosen to resemble the usual
4104 editing and job control characters present in shells that are not under
4105 XEmacs, except that you must type `C-c' first. Here is a list of the
4106 special key bindings of Shell mode:
4109 At end of buffer send line as input; otherwise, copy current line
4110 to end of buffer and send it (`send-shell-input'). When a line is
4111 copied, any text at the beginning of the line that matches the
4112 variable `shell-prompt-pattern' is left out; this variable's value
4113 should be a regexp string that matches the prompts that you use in
4117 Send end-of-file as input, probably causing the shell or its
4118 current subjob to finish (`shell-send-eof').
4121 If point is not at the end of the buffer, delete the next
4122 character just like most other modes. If point is at the end of
4123 the buffer, send end-of-file as input, instead of generating an
4124 error as in other modes (`comint-delchar-or-maybe-eof').
4127 Kill all text that has yet to be sent as input
4128 (`kill-shell-input').
4131 Kill a word before point (`backward-kill-word').
4134 Interrupt the shell or its current subjob if any
4135 (`interrupt-shell-subjob').
4138 Stop the shell or its current subjob if any (`stop-shell-subjob').
4141 Send quit signal to the shell or its current subjob if any
4142 (`quit-shell-subjob').
4145 Delete last batch of output from shell (`kill-output-from-shell').
4148 Scroll top of last batch of output to top of window
4149 (`show-output-from-shell').
4152 Copy the previous bunch of shell input and insert it into the
4153 buffer before point (`copy-last-shell-input'). No final newline
4154 is inserted, and the input copied is not resubmitted until you type
4158 Move backward through the input history. Search for a matching
4159 command if you have typed the beginning of a command
4160 (`comint-previous-input').
4163 Move forward through the input history. Useful when you are using
4164 <M-p> quickly and go past the desired command
4165 (`comint-next-input').
4168 Complete the file name preceding point (`comint-dynamic-complete').
4171 File: xemacs.info, Node: Terminal emulator, Next: Term Mode, Prev: Shell Mode, Up: Shell
4173 Interactive Inferior Shell with Terminal Emulator
4174 -------------------------------------------------
4176 To run a subshell in a terminal emulator, putting its typescript in an
4177 XEmacs buffer, use `M-x term'. This creates (or reuses) a buffer named
4178 `*term*' and runs a subshell with input coming from your keyboard and
4179 output going to that buffer.
4181 All the normal keys that you type are sent without any interpretation
4182 by XEmacs directly to the subshell, as "terminal input." Any "echo" of
4183 your input is the responsibility of the subshell. (The exception is
4184 the terminal escape character, which by default is `C-c'. *note Term
4185 Mode::.) Any "terminal output" from the subshell goes into the buffer,
4188 Some programs (such as XEmacs itself) need to control the appearance
4189 on the terminal screen in detail. They do this by sending special
4190 control codes. The exact control codes needed vary from terminal to
4191 terminal, but nowadays most terminals and terminal emulators (including
4192 xterm) understand the so-called "ANSI escape sequences" (first
4193 popularized by the Digital's VT100 family of terminal). The term mode
4194 also understands these escape sequences, and for each control code does
4195 the appropriate thing to change the buffer so that the appearance of
4196 the window will match what it would be on a real terminal. Thus you
4197 can actually run XEmacs inside an XEmacs Term window!
4199 XEmacs does not wait for the subshell to do anything. You can switch
4200 windows or buffers and edit them while the shell is waiting, or while
4201 it is running a command. Output from the subshell waits until XEmacs
4202 has time to process it; this happens whenever XEmacs is waiting for
4203 keyboard input or for time to elapse.
4205 To make multiple terminal emulators, rename the buffer `*term*' to
4206 something different using `M-x rename-uniquely', just as with Shell
4209 The file name used to load the subshell is determined the same way
4212 Unlike Shell mode, Term mode does not track the current directory by
4213 examining your input. Instead, if you use a programmable shell, you
4214 can have it tell Term what the current directory is. This is done
4215 automatically by bash for version 1.15 and later.
4218 File: xemacs.info, Node: Term Mode, Next: Paging in Term, Prev: Terminal emulator, Up: Shell
4223 Term uses Term mode, which has two input modes: In line mode, Term
4224 basically acts like Shell mode. *Note Shell Mode::. In Char mode,
4225 each character is sent directly to the inferior subshell, except for
4226 the Term escape character, normally `C-c'.
4228 To switch between line and char mode, use these commands:
4229 findex term-char-mode
4232 Switch to line mode. Do nothing if already in line mode.
4235 Switch to char mode. Do nothing if already in char mode.
4237 The following commands are only available in Char mode:
4239 Send a literal <C-c> to the sub-shell.
4242 A prefix command to conveniently access the global <C-x> commands.
4243 For example, `C-c C-x o' invokes the global binding of `C-x o',
4244 which is normally `other-window'.
4247 File: xemacs.info, Node: Paging in Term, Prev: Term Mode, Up: Shell
4249 Paging in the terminal emulator
4250 -------------------------------
4252 Term mode has a pager feature. When the pager is enabled, term mode
4253 will pause at the end of each screenful.
4256 Toggles the pager feature: Disables the pager if it is enabled,
4257 and vice versa. This works in both line and char modes. If the
4258 pager enabled, the mode-line contains the word `page'.
4260 If the pager is enabled, and Term receives more than a screenful of
4261 output since your last input, Term will enter More break mode. This is
4262 indicated by `**MORE**' in the mode-line. Type a `Space' to display
4263 the next screenful of output. Type `?' to see your other options. The
4264 interface is similar to the Unix `more' program.
4267 File: xemacs.info, Node: Narrowing, Next: Hardcopy, Prev: Shell, Up: Top
4272 "Narrowing" means focusing in on some portion of the buffer, making the
4273 rest temporarily invisible and inaccessible. Cancelling the narrowing
4274 and making the entire buffer once again visible is called "widening".
4275 The amount of narrowing in effect in a buffer at any time is called the
4276 buffer's "restriction".
4279 Narrow down to between point and mark (`narrow-to-region').
4282 Widen to make the entire buffer visible again (`widen').
4284 Narrowing sometimes makes it easier to concentrate on a single
4285 subroutine or paragraph by eliminating clutter. It can also be used to
4286 restrict the range of operation of a replace command or repeating
4287 keyboard macro. The word `Narrow' appears in the mode line whenever
4288 narrowing is in effect. When you have narrowed to a part of the
4289 buffer, that part appears to be all there is. You can't see the rest,
4290 can't move into it (motion commands won't go outside the visible part),
4291 and can't change it in any way. However, the invisible text is not
4292 gone; if you save the file, it will be saved.
4294 The primary narrowing command is `C-x n n' (`narrow-to-region'). It
4295 sets the current buffer's restrictions so that the text in the current
4296 region remains visible but all text before the region or after the
4297 region is invisible. Point and mark do not change.
4299 Because narrowing can easily confuse users who do not understand it,
4300 `narrow-to-region' is normally a disabled command. Attempting to use
4301 this command asks for confirmation and gives you the option of enabling
4302 it; once you enable the command, confirmation will no longer be
4303 required. *Note Disabling::.
4305 To undo narrowing, use `C-x n w' (`widen'). This makes all text in
4306 the buffer accessible again.
4308 Use the `C-x =' command to get information on what part of the
4309 buffer you narrowed down. *Note Position Info::.
4312 File: xemacs.info, Node: Hardcopy, Next: Recursive Edit, Prev: Narrowing, Up: Top
4317 The XEmacs commands for making hardcopy derive their names from the
4318 Unix commands `print' and `lpr'.
4321 Print hardcopy of current buffer using Unix command `print'
4322 (`lpr -p'). This command adds page headings containing the file
4323 name and page number.
4326 Print hardcopy of current buffer using Unix command `lpr'. This
4327 command does not add page headings.
4330 Like `print-buffer', but prints only the current region.
4333 Like `lpr-buffer', but prints only the current region.
4335 All the hardcopy commands pass extra switches to the `lpr' program
4336 based on the value of the variable `lpr-switches'. Its value should be
4337 a list of strings, each string a switch starting with `-'. For
4338 example, the value could be `("-Pfoo")' to print on printer `foo'.
4341 File: xemacs.info, Node: Recursive Edit, Next: Dissociated Press, Prev: Hardcopy, Up: Top
4343 Recursive Editing Levels
4344 ========================
4346 A "recursive edit" is a situation in which you are using XEmacs
4347 commands to perform arbitrary editing while in the middle of another
4348 XEmacs command. For example, when you type `C-r' inside a
4349 `query-replace', you enter a recursive edit in which you can change the
4350 current buffer. When you exit from the recursive edit, you go back to
4351 the `query-replace'.
4353 "Exiting" a recursive edit means returning to the unfinished
4354 command, which continues execution. For example, exiting the recursive
4355 edit requested by `C-r' in `query-replace' causes query replacing to
4356 resume. Exiting is done with `C-M-c' (`exit-recursive-edit').
4358 You can also "abort" a recursive edit. This is like exiting, but
4359 also quits the unfinished command immediately. Use the command `C-]'
4360 (`abort-recursive-edit') for this. *Note Quitting::.
4362 The mode line shows you when you are in a recursive edit by
4363 displaying square brackets around the parentheses that always surround
4364 the major and minor mode names. Every window's mode line shows the
4365 square brackets, since XEmacs as a whole, rather than any particular
4366 buffer, is in a recursive edit.
4368 It is possible to be in recursive edits within recursive edits. For
4369 example, after typing `C-r' in a `query-replace', you might type a
4370 command that entered the debugger. In such a case, two or more sets of
4371 square brackets appear in the mode line(s). Exiting the inner
4372 recursive edit (here with the debugger `c' command) resumes the
4373 query-replace command where it called the debugger. After the end of
4374 the query-replace command, you would be able to exit the first
4375 recursive edit. Aborting exits only one level of recursive edit; it
4376 returns to the command level of the previous recursive edit. You can
4377 then abort that one as well.
4379 The command `M-x top-level' aborts all levels of recursive edits,
4380 returning immediately to the top level command reader.
4382 The text you edit inside the recursive edit need not be the same text
4383 that you were editing at top level. If the command that invokes the
4384 recursive edit selects a different buffer first, that is the buffer you
4385 will edit recursively. You can switch buffers within the recursive edit
4386 in the normal manner (as long as the buffer-switching keys have not been
4387 rebound). While you could theoretically do the rest of your editing
4388 inside the recursive edit, including visiting files, this could have
4389 surprising effects (such as stack overflow) from time to time. It is
4390 best if you always exit or abort a recursive edit when you no longer
4393 In general, XEmacs tries to avoid using recursive edits. It is
4394 usually preferable to allow users to switch among the possible editing
4395 modes in any order they like. With recursive edits, the only way to get
4396 to another state is to go "back" to the state that the recursive edit
4400 File: xemacs.info, Node: Dissociated Press, Next: CONX, Prev: Recursive Edit, Up: Top
4405 `M-x dissociated-press' is a command for scrambling a file of text
4406 either word by word or character by character. Starting from a buffer
4407 of straight English, it produces extremely amusing output. The input
4408 comes from the current XEmacs buffer. Dissociated Press writes its
4409 output in a buffer named `*Dissociation*', and redisplays that buffer
4410 after every couple of lines (approximately) to facilitate reading it.
4412 `dissociated-press' asks every so often whether to continue
4413 operating. Answer `n' to stop it. You can also stop at any time by
4414 typing `C-g'. The dissociation output remains in the `*Dissociation*'
4415 buffer for you to copy elsewhere if you wish.
4417 Dissociated Press operates by jumping at random from one point in the
4418 buffer to another. In order to produce plausible output rather than
4419 gibberish, it insists on a certain amount of overlap between the end of
4420 one run of consecutive words or characters and the start of the next.
4421 That is, if it has just printed out `president' and then decides to
4422 jump to a different point in the file, it might spot the `ent' in
4423 `pentagon' and continue from there, producing `presidentagon'. Long
4424 sample texts produce the best results.
4426 A positive argument to `M-x dissociated-press' tells it to operate
4427 character by character, and specifies the number of overlap characters.
4428 A negative argument tells it to operate word by word and specifies the
4429 number of overlap words. In this mode, whole words are treated as the
4430 elements to be permuted, rather than characters. No argument is
4431 equivalent to an argument of two. For your againformation, the output
4432 goes only into the buffer `*Dissociation*'. The buffer you start with
4435 Dissociated Press produces nearly the same results as a Markov chain
4436 based on a frequency table constructed from the sample text. It is,
4437 however, an independent, ignoriginal invention. Dissociated Press
4438 techniquitously copies several consecutive characters from the sample
4439 between random choices, whereas a Markov chain would choose randomly for
4440 each word or character. This makes for more plausible sounding results
4443 It is a mustatement that too much use of Dissociated Press can be a
4444 developediment to your real work. Sometimes to the point of outragedy.
4445 And keep dissociwords out of your documentation, if you want it to be
4446 well userenced and properbose. Have fun. Your buggestions are welcome.
4449 File: xemacs.info, Node: CONX, Next: Amusements, Prev: Dissociated Press, Up: Top
4454 Besides producing a file of scrambled text with Dissociated Press, you
4455 can generate random sentences by using CONX.
4458 Generate random sentences in the `*conx*' buffer.
4461 Absorb the text in the current buffer into the `conx' database.
4464 Forget the current word-frequency tree.
4467 Load a `conx' database that has been previously saved with `M-x
4471 Absorb the text in the current buffer into the `conx' database.
4474 Save the current `conx' database to a file for future retrieval.
4476 Copy text from a buffer using `M-x conx-buffer' or `M-x conx-region'
4477 and then type `M-x conx'. Output is continuously generated until you
4478 type <^G>. You can save the `conx' database to a file with `M-x
4479 conx-save', which you can retrieve with `M-x conx-load'. To clear the
4480 database, use `M-x conx-init'.
4483 File: xemacs.info, Node: Amusements, Next: Emulation, Prev: CONX, Up: Top
4488 If you are a little bit bored, you can try `M-x hanoi'. If you are
4489 considerably bored, give it a numeric argument. If you are very, very
4490 bored, try an argument of 9. Sit back and watch.
4492 When you are frustrated, try the famous Eliza program. Just do `M-x
4493 doctor'. End each input by typing `RET' twice.
4495 When you are feeling strange, type `M-x yow'.
4498 File: xemacs.info, Node: Emulation, Next: Customization, Prev: Amusements, Up: Top
4503 XEmacs can be programmed to emulate (more or less) most other editors.
4504 Standard facilities can emulate these:
4506 Viper (a vi emulator)
4507 In XEmacs, Viper is the preferred emulation of vi within XEmacs.
4508 Viper is designed to allow you to take advantage of the best
4509 features of XEmacs while still doing your basic editing in a
4510 familiar, vi-like fashion. Viper provides various different
4511 levels of vi emulation, from a quite complete emulation that
4512 allows almost no access to native XEmacs commands, to an "expert"
4513 mode that combines the most useful vi commands with the most
4514 useful XEmacs commands.
4516 To start Viper, put the command
4520 in your init file. *Note Init File::.
4522 Viper comes with a separate manual that is provided standard with
4523 the XEmacs distribution.
4525 EDT (DEC VMS editor)
4526 Turn on EDT emulation with `M-x edt-emulation-on'. `M-x
4527 edt-emulation-off' restores normal Emacs command bindings.
4529 Most of the EDT emulation commands are keypad keys, and most
4530 standard Emacs key bindings are still available. The EDT
4531 emulation rebindings are done in the global keymap, so there is no
4532 problem switching buffers or major modes while in EDT emulation.
4535 Turn on emulation of Gosling Emacs (aka Unipress Emacs) with `M-x
4536 set-gosmacs-bindings'. This redefines many keys, mostly on the
4537 `C-x' and `ESC' prefixes, to work as they do in Gosmacs. `M-x
4538 set-gnu-bindings' returns to normal XEmacs by rebinding the same
4539 keys to the definitions they had at the time `M-x
4540 set-gosmacs-bindings' was done.
4542 It is also possible to run Mocklisp code written for Gosling Emacs.
4546 File: xemacs.info, Node: Customization, Next: Quitting, Prev: Emulation, Up: Top
4551 This chapter talks about various topics relevant to adapting the
4552 behavior of Emacs in minor ways.
4554 All kinds of customization affect only the particular Emacs job that
4555 you do them in. They are completely lost when you kill the Emacs job,
4556 and have no effect on other Emacs jobs you may run at the same time or
4557 later. The only way an Emacs job can affect anything outside of it is
4558 by writing a file; in particular, the only way to make a customization
4559 `permanent' is to put something in your init file or other appropriate
4560 file to do the customization in each session. *Note Init File::.
4564 * Minor Modes:: Each minor mode is one feature you can turn on
4565 independently of any others.
4566 * Variables:: Many Emacs commands examine Emacs variables
4567 to decide what to do; by setting variables,
4568 you can control their functioning.
4569 * Keyboard Macros:: A keyboard macro records a sequence of keystrokes
4570 to be replayed with a single command.
4571 * Key Bindings:: The keymaps say what command each key runs.
4572 By changing them, you can "redefine keys".
4573 * Syntax:: The syntax table controls how words and expressions
4575 * Init File:: How to write common customizations in the init file.
4576 * Audible Bell:: Changing how Emacs sounds the bell.
4577 * Faces:: Changing the fonts and colors of a region of text.
4578 * Frame Components:: Controlling the presence and positions of the
4579 menubar, toolbars, and gutters.
4580 * X Resources:: X resources controlling various aspects of the
4584 File: xemacs.info, Node: Minor Modes, Next: Variables, Up: Customization
4589 Minor modes are options which you can use or not. For example, Auto
4590 Fill mode is a minor mode in which <SPC> breaks lines between words as
4591 you type. All the minor modes are independent of each other and of the
4592 selected major mode. Most minor modes inform you in the mode line when
4593 they are on; for example, `Fill' in the mode line means that Auto Fill
4596 Append `-mode' to the name of a minor mode to get the name of a
4597 command function that turns the mode on or off. Thus, the command to
4598 enable or disable Auto Fill mode is called `M-x auto-fill-mode'. These
4599 commands are usually invoked with `M-x', but you can bind keys to them
4600 if you wish. With no argument, the function turns the mode on if it was
4601 off and off if it was on. This is known as "toggling". A positive
4602 argument always turns the mode on, and an explicit zero argument or a
4603 negative argument always turns it off.
4605 Auto Fill mode allows you to enter filled text without breaking lines
4606 explicitly. Emacs inserts newlines as necessary to prevent lines from
4607 becoming too long. *Note Filling::.
4609 Overwrite mode causes ordinary printing characters to replace
4610 existing text instead of moving it to the right. For example, if point
4611 is in front of the `B' in `FOOBAR', and you type a `G' in Overwrite
4612 mode, it changes to `FOOGAR', instead of `FOOGBAR'.
4614 Abbrev mode allows you to define abbreviations that automatically
4615 expand as you type them. For example, `amd' might expand to `abbrev
4616 mode'. *Note Abbrevs::, for full information.
4619 File: xemacs.info, Node: Variables, Next: Keyboard Macros, Prev: Minor Modes, Up: Customization
4624 A "variable" is a Lisp symbol which has a value. Variable names can
4625 contain any characters, but by convention they are words separated by
4626 hyphens. A variable can also have a documentation string, which
4627 describes what kind of value it should have and how the value will be
4630 Lisp allows any variable to have any kind of value, but most
4631 variables that Emacs uses require a value of a certain type. Often the
4632 value has to be a string or a number. Sometimes we say that a certain
4633 feature is turned on if a variable is "non-`nil'," meaning that if the
4634 variable's value is `nil', the feature is off, but the feature is on
4635 for any other value. The conventional value to turn on the
4636 feature--since you have to pick one particular value when you set the
4639 Emacs uses many Lisp variables for internal recordkeeping, as any
4640 Lisp program must, but the most interesting variables for you are the
4641 ones that exist for the sake of customization. Emacs does not
4642 (usually) change the values of these variables; instead, you set the
4643 values, and thereby alter and control the behavior of certain Emacs
4644 commands. These variables are called "options". Most options are
4645 documented in this manual and appear in the Variable Index (*note
4648 One example of a variable which is an option is `fill-column', which
4649 specifies the position of the right margin (as a number of characters
4650 from the left margin) to be used by the fill commands (*note Filling::).
4654 * Examining:: Examining or setting one variable's value.
4655 * Easy Customization:: Convenient and easy customization of variables.
4656 * Edit Options:: Examining or editing list of all variables' values.
4657 * Locals:: Per-buffer values of variables.
4658 * File Variables:: How files can specify variable values.
4661 File: xemacs.info, Node: Examining, Next: Easy Customization, Up: Variables
4663 Examining and Setting Variables
4664 -------------------------------
4667 `M-x describe-variable'
4668 Print the value and documentation of a variable.
4671 Change the value of a variable.
4673 To examine the value of a single variable, use `C-h v'
4674 (`describe-variable'), which reads a variable name using the
4675 minibuffer, with completion. It prints both the value and the
4676 documentation of the variable.
4678 C-h v fill-column <RET>
4680 prints something like:
4682 fill-column's value is 75
4685 *Column beyond which automatic line-wrapping should happen.
4686 Automatically becomes local when set in any fashion.
4688 The star at the beginning of the documentation indicates that this
4689 variable is an option. `C-h v' is not restricted to options; it allows
4692 If you know which option you want to set, you can use `M-x
4693 set-variable' to set it. This prompts for the variable name in the
4694 minibuffer (with completion), and then prompts for a Lisp expression
4695 for the new value using the minibuffer a second time. For example,
4697 M-x set-variable <RET> fill-column <RET> 75 <RET>
4699 sets `fill-column' to 75, as if you had executed the Lisp expression
4700 `(setq fill-column 75)'.
4702 Setting variables in this way, like all means of customizing Emacs
4703 except where explicitly stated, affects only the current Emacs session.
4706 File: xemacs.info, Node: Easy Customization, Next: Edit Options, Prev: Examining, Up: Variables
4708 Easy Customization Interface
4709 ----------------------------
4711 A convenient way to find the user option variables that you want to
4712 change, and then change them, is with `M-x customize' (or use a
4713 keyboard shortcut, `C-h C'. This command creates a "customization
4714 buffer" with which you can browse through the Emacs user options in a
4715 logically organized structure, then edit and set their values. You can
4716 also use the customization buffer to save settings permanently. (Not
4717 all Emacs user options are included in this structure as of yet, but we
4718 are adding the rest.)
4722 * Groups: Customization Groups.
4723 How options are classified in a structure.
4724 * Changing an Option:: How to edit a value and set an option.
4725 * Face Customization:: How to edit the attributes of a face.
4726 * Specific Customization:: Making a customization buffer for specific
4727 options, faces, or groups.
4730 File: xemacs.info, Node: Customization Groups, Next: Changing an Option, Up: Easy Customization
4732 Customization Groups
4733 ....................
4735 For customization purposes, user options are organized into "groups" to
4736 help you find them. Groups are collected into bigger groups, all the
4737 way up to a master group called `Emacs'.
4739 `M-x customize' (or `C-h C') creates a customization buffer that
4740 shows the top-level `Emacs' group and the second-level groups
4741 immediately under it. It looks like this, in part:
4743 /- Emacs group: ---------------------------------------------------\
4744 [State]: visible group members are all at standard settings.
4745 Customization of the One True Editor.
4748 [Open] Editing group
4749 Basic text editing facilities.
4751 [Open] External group
4752 Interfacing to external utilities.
4754 MORE SECOND-LEVEL GROUPS
4756 \- Emacs group end ------------------------------------------------/
4758 This says that the buffer displays the contents of the `Emacs' group.
4759 The other groups are listed because they are its contents. But they
4760 are listed differently, without indentation and dashes, because _their_
4761 contents are not included. Each group has a single-line documentation
4762 string; the `Emacs' group also has a `[State]' line.
4764 Most of the text in the customization buffer is read-only, but it
4765 typically includes some "editable fields" that you can edit. There are
4766 also "active fields"; this means a field that does something when you
4767 "invoke" it. To invoke an active field, either click on it with
4768 `Mouse-1', or move point to it and type <RET>.
4770 For example, the phrase `[Open]' that appears in a second-level
4771 group is an active field. Invoking the `[Open]' field for a group
4772 opens up a new customization buffer, which shows that group and its
4773 contents. This field is a kind of hypertext link to another group.
4775 The `Emacs' group does not include any user options itself, but
4776 other groups do. By examining various groups, you will eventually find
4777 the options and faces that belong to the feature you are interested in
4778 customizing. Then you can use the customization buffer to set them.
4780 You can view the structure of customization groups on a larger scale
4781 with `M-x customize-browse'. This command creates a special kind of
4782 customization buffer which shows only the names of the groups (and
4783 options and faces), and their structure.
4785 In this buffer, you can show the contents of a group by invoking
4786 `[+]'. When the group contents are visible, this button changes to
4787 `[-]'; invoking that hides the group contents.
4789 Each group, option or face name in this buffer has an active field
4790 which says `[Group]', `[Option]' or `[Face]'. Invoking that active
4791 field creates an ordinary customization buffer showing just that group
4792 and its contents, just that option, or just that face. This is the way
4793 to set values in it.
4796 File: xemacs.info, Node: Changing an Option, Next: Face Customization, Prev: Customization Groups, Up: Easy Customization
4801 Here is an example of what a user option looks like in the
4802 customization buffer:
4804 Kill Ring Max: [Hide] 30
4805 [State]: this option is unchanged from its standard setting.
4806 Maximum length of kill ring before oldest elements are thrown away.
4808 The text following `[Hide]', `30' in this case, indicates the
4809 current value of the option. If you see `[Show]' instead of `[Hide]',
4810 it means that the value is hidden; the customization buffer initially
4811 hides values that take up several lines. Invoke `[Show]' to show the
4814 The line after the option name indicates the "customization state"
4815 of the option: in the example above, it says you have not changed the
4816 option yet. The word `[State]' at the beginning of this line is
4817 active; you can get a menu of various operations by invoking it with
4818 `Mouse-1' or <RET>. These operations are essential for customizing the
4821 The line after the `[State]' line displays the beginning of the
4822 option's documentation string. If there are more lines of
4823 documentation, this line ends with `[More]'; invoke this to show the
4824 full documentation string.
4826 To enter a new value for `Kill Ring Max', move point to the value
4827 and edit it textually. For example, you can type `M-d', then insert
4830 When you begin to alter the text, you will see the `[State]' line
4831 change to say that you have edited the value:
4833 [State]: you have edited the value as text, but not set the option.
4835 Editing the value does not actually set the option variable. To do
4836 that, you must "set" the option. To do this, invoke the word `[State]'
4837 and choose `Set for Current Session'.
4839 The state of the option changes visibly when you set it:
4841 [State]: you have set this option, but not saved it for future sessions.
4843 You don't have to worry about specifying a value that is not valid;
4844 setting the option checks for validity and will not really install an
4847 While editing a value or field that is a file name, directory name,
4848 command name, or anything else for which completion is defined, you can
4849 type `M-<TAB>' (`widget-complete') to do completion.
4851 Some options have a small fixed set of possible legitimate values.
4852 These options don't let you edit the value textually. Instead, an
4853 active field `[Value Menu]' appears before the value; invoke this field
4854 to edit the value. For a boolean "on or off" value, the active field
4855 says `[Toggle]', and it changes to the other value. `[Value Menu]' and
4856 `[Toggle]' edit the buffer; the changes take effect when you use the
4857 `Set for Current Session' operation.
4859 Some options have values with complex structure. For example, the
4860 value of `load-path' is a list of directories. Here is how it appears
4861 in the customization buffer:
4864 [INS] [DEL] [Current dir?]: /usr/local/share/emacs/19.34.94/site-lisp
4865 [INS] [DEL] [Current dir?]: /usr/local/share/emacs/site-lisp
4866 [INS] [DEL] [Current dir?]: /usr/local/share/emacs/19.34.94/leim
4867 [INS] [DEL] [Current dir?]: /usr/local/share/emacs/19.34.94/lisp
4868 [INS] [DEL] [Current dir?]: /build/emacs/e19/lisp
4869 [INS] [DEL] [Current dir?]: /build/emacs/e19/lisp/gnus
4871 [State]: this item has been changed outside the customization buffer.
4872 List of directories to search for files to load....
4874 Each directory in the list appears on a separate line, and each line has
4875 several editable or active fields.
4877 You can edit any of the directory names. To delete a directory from
4878 the list, invoke `[DEL]' on that line. To insert a new directory in
4879 the list, invoke `[INS]' at the point where you want to insert it.
4881 You can also invoke `[Current dir?]' to switch between including a
4882 specific named directory in the path, and including `nil' in the path.
4883 (`nil' in a search path means "try the current directory.")
4885 Two special commands, <TAB> and `S-<TAB>', are useful for moving
4886 through the customization buffer. <TAB> (`widget-forward') moves
4887 forward to the next active or editable field; `S-<TAB>'
4888 (`widget-backward') moves backward to the previous active or editable
4891 Typing <RET> on an editable field also moves forward, just like
4892 <TAB>. The reason for this is that people have a tendency to type
4893 <RET> when they are finished editing a field. If you have occasion to
4894 insert a newline in an editable field, use `C-o' or `C-q C-j',
4896 Setting the option changes its value in the current Emacs session;
4897 "saving" the value changes it for future sessions as well. This works
4898 by writing code into your init file so as to set the option variable
4899 again each time you start Emacs. *Note Init File::. To save the
4900 option, invoke `[State]' and select the `Save for Future Sessions'
4903 You can also restore the option to its standard value by invoking
4904 `[State]' and selecting the `Reset' operation. There are actually
4905 three reset operations:
4908 If you have made some modifications and not yet set the option,
4909 this restores the text in the customization buffer to match the
4913 This restores the value of the option to the last saved value, and
4914 updates the text accordingly.
4916 `Reset to Standard Settings'
4917 This sets the option to its standard value, and updates the text
4918 accordingly. This also eliminates any saved value for the option,
4919 so that you will get the standard value in future Emacs sessions.
4921 The state of a group indicates whether anything in that group has
4922 been edited, set or saved. You can select `Set for Current Session',
4923 `Save for Future Sessions' and the various kinds of `Reset' operation
4924 for the group; these operations on the group apply to all options in
4925 the group and its subgroups.
4927 Near the top of the customization buffer there are two lines
4928 containing several active fields:
4930 [Set] [Save] [Reset] [Done]
4932 Invoking `[Done]' buries this customization buffer. Each of the other
4933 fields performs an operation--set, save or reset--on each of the items
4934 in the buffer that could meaningfully be set, saved or reset.
4937 File: xemacs.info, Node: Face Customization, Next: Specific Customization, Prev: Changing an Option, Up: Easy Customization
4942 In addition to user options, some customization groups also include
4943 faces. When you show the contents of a group, both the user options and
4944 the faces in the group appear in the customization buffer. Here is an
4945 example of how a face looks:
4947 Custom Changed Face: (sample)
4948 [State]: this face is unchanged from its standard setting.
4949 Face used when the customize item has been changed.
4950 Parent groups: [Custom Magic Faces]
4951 Attributes: [ ] Bold: [Toggle] off (nil)
4952 [ ] Italic: [Toggle] off (nil)
4953 [ ] Underline: [Toggle] off (nil)
4954 [ ] Foreground: white (sample)
4955 [ ] Background: blue (sample)
4956 [ ] Inverse: [Toggle] off (nil)
4962 Each face attribute has its own line. The `[X]' field before the
4963 attribute name indicates whether the attribute is "enabled"; `X' means
4964 that it is. You can enable or disable the attribute by invoking that
4965 field. When the attribute is enabled, you can change the attribute
4966 value in the usual ways.
4968 *Note Faces::, for description of how `face-frob-from-locale-first'
4969 variable affects changing `Bold' and `Italic' attributes.
4971 Setting, saving and resetting a face work like the same operations
4972 for options (*note Changing an Option::).
4974 A face can specify different appearances for different types of
4975 display. For example, a face can make text red on a color display, but
4976 use a bold font on a monochrome display. To specify multiple
4977 appearances for a face, select `Show Display Types' in the menu you get
4978 from invoking `[State]'.
4981 File: xemacs.info, Node: Specific Customization, Prev: Face Customization, Up: Easy Customization
4983 Customizing Specific Items
4984 ..........................
4986 Instead of finding the options you want to change by moving down
4987 through the structure of groups, you can specify the particular option,
4988 face or group that you want to customize.
4990 `M-x customize-option <RET> OPTION <RET>'
4991 Set up a customization buffer with just one option, OPTION.
4993 `M-x customize-face <RET> FACE <RET>'
4994 Set up a customization buffer with just one face, FACE.
4996 `M-x customize-group <RET> GROUP <RET>'
4997 Set up a customization buffer with just one group, GROUP.
4999 `M-x customize-apropos <RET> REGEXP <RET>'
5000 Set up a customization buffer with all the options, faces and
5001 groups that match REGEXP.
5003 `M-x customize-saved'
5004 Set up a customization buffer containing all options and faces
5005 that you have saved with customization buffers.
5007 `M-x customize-customized'
5008 Set up a customization buffer containing all options and faces
5009 that you have customized but not saved.
5011 If you want to alter a particular user option variable with the
5012 customization buffer, and you know its name, you can use the command
5013 `M-x customize-option' and specify the option name. This sets up the
5014 customization buffer with just one option--the one that you asked for.
5015 Editing, setting and saving the value work as described above, but only
5016 for the specified option.
5018 Likewise, you can modify a specific face, chosen by name, using `M-x
5021 You can also set up the customization buffer with a specific group,
5022 using `M-x customize-group'. The immediate contents of the chosen
5023 group, including option variables, faces, and other groups, all appear
5024 as well. However, these subgroups' own contents start out hidden. You
5025 can show their contents in the usual way, by invoking `[Show]'.
5027 To control more precisely what to customize, you can use `M-x
5028 customize-apropos'. You specify a regular expression as argument; then
5029 all options, faces and groups whose names match this regular expression
5030 are set up in the customization buffer. If you specify an empty regular
5031 expression, this includes _all_ groups, options and faces in the
5032 customization buffer (but that takes a long time).
5034 If you change option values and then decide the change was a mistake,
5035 you can use two special commands to revisit your previous changes. Use
5036 `customize-saved' to look at the options and faces that you have saved.
5037 Use `M-x customize-customized' to look at the options and faces that
5038 you have set but not saved.
5041 File: xemacs.info, Node: Edit Options, Next: Locals, Prev: Easy Customization, Up: Variables
5043 Editing Variable Values
5044 -----------------------
5047 Display a buffer listing names, values, and documentation of all
5051 Change option values by editing a list of options.
5053 `M-x list-options' displays a list of all Emacs option variables in
5054 an Emacs buffer named `*List Options*'. Each option is shown with its
5055 documentation and its current value. Here is what a portion of it might
5059 ("." "/usr/local/bin" "/usr/ucb" "/bin" "/usr/bin" "/u2/emacs/etc")
5060 *List of directories to search programs to run in subprocesses.
5061 Each element is a string (directory name)
5062 or nil (try the default directory).
5066 *Column beyond which automatic line-wrapping should happen.
5067 Automatically becomes local when set in any fashion.
5070 `M-x edit-options' goes one step further and immediately selects the
5071 `*List Options*' buffer; this buffer uses the major mode Options mode,
5072 which provides commands that allow you to point at an option and change
5076 Set the variable point is in or near to a new value read using the
5080 Toggle the variable point is in or near: if the value was `nil',
5081 it becomes `t'; otherwise it becomes `nil'.
5084 Set the variable point is in or near to `t'.
5087 Set the variable point is in or near to `nil'.
5091 Move to the next or previous variable.
5094 File: xemacs.info, Node: Locals, Next: File Variables, Prev: Edit Options, Up: Variables
5099 `M-x make-local-variable'
5100 Make a variable have a local value in the current buffer.
5102 `M-x kill-local-variable'
5103 Make a variable use its global value in the current buffer.
5105 `M-x make-variable-buffer-local'
5106 Mark a variable so that setting it will make it local to the
5107 buffer that is current at that time.
5109 You can make any variable "local" to a specific Emacs buffer. This
5110 means that the variable's value in that buffer is independent of its
5111 value in other buffers. A few variables are always local in every
5112 buffer. All other Emacs variables have a "global" value which is in
5113 effect in all buffers that have not made the variable local.
5115 Major modes always make the variables they set local to the buffer.
5116 This is why changing major modes in one buffer has no effect on other
5119 `M-x make-local-variable' reads the name of a variable and makes it
5120 local to the current buffer. Further changes in this buffer will not
5121 affect others, and changes in the global value will not affect this
5124 `M-x make-variable-buffer-local' reads the name of a variable and
5125 changes the future behavior of the variable so that it automatically
5126 becomes local when it is set. More precisely, once you have marked a
5127 variable in this way, the usual ways of setting the variable will
5128 automatically invoke `make-local-variable' first. We call such
5129 variables "per-buffer" variables.
5131 Some important variables have been marked per-buffer already. They
5132 include `abbrev-mode', `auto-fill-function', `case-fold-search',
5133 `comment-column', `ctl-arrow', `fill-column', `fill-prefix',
5134 `indent-tabs-mode', `left-margin',
5135 `mode-line-format', `overwrite-mode', `selective-display-ellipses',
5136 `selective-display', `tab-width', and `truncate-lines'. Some other
5137 variables are always local in every buffer, but they are used for
5140 Note: the variable `auto-fill-function' was formerly named
5143 If you want a variable to cease to be local to the current buffer,
5144 call `M-x kill-local-variable' and provide the name of a variable to
5145 the prompt. The global value of the variable is again in effect in
5146 this buffer. Setting the major mode kills all the local variables of
5149 To set the global value of a variable, regardless of whether the
5150 variable has a local value in the current buffer, you can use the Lisp
5151 function `setq-default'. It works like `setq'. If there is a local
5152 value in the current buffer, the local value is not affected by
5153 `setq-default'; thus, the new global value may not be visible until you
5154 switch to another buffer, as in the case of:
5156 (setq-default fill-column 75)
5158 `setq-default' is the only way to set the global value of a variable
5159 that has been marked with `make-variable-buffer-local'.
5161 Programs can look at a variable's default value with `default-value'.
5162 This function takes a symbol as an argument and returns its default
5163 value. The argument is evaluated; usually you must quote it
5164 explicitly, as in the case of:
5166 (default-value 'fill-column)
5169 File: xemacs.info, Node: File Variables, Prev: Locals, Up: Variables
5171 Local Variables in Files
5172 ------------------------
5174 A file can contain a "local variables list", which specifies the values
5175 to use for certain Emacs variables when that file is edited. Visiting
5176 the file checks for a local variables list and makes each variable in
5177 the list local to the buffer in which the file is visited, with the
5178 value specified in the file.
5180 A local variables list goes near the end of the file, in the last
5181 page. (It is often best to put it on a page by itself.) The local
5182 variables list starts with a line containing the string `Local
5183 Variables:', and ends with a line containing the string `End:'. In
5184 between come the variable names and values, one set per line, as
5185 `VARIABLE: VALUE'. The VALUEs are not evaluated; they are used
5188 The line which starts the local variables list does not have to say
5189 just `Local Variables:'. If there is other text before `Local
5190 Variables:', that text is called the "prefix", and if there is other
5191 text after, that is called the "suffix". If a prefix or suffix are
5192 present, each entry in the local variables list should have the prefix
5193 before it and the suffix after it. This includes the `End:' line. The
5194 prefix and suffix are included to disguise the local variables list as
5195 a comment so the compiler or text formatter will ignore it. If you do
5196 not need to disguise the local variables list as a comment in this way,
5197 there is no need to include a prefix or a suffix.
5199 Two "variable" names are special in a local variables list: a value
5200 for the variable `mode' sets the major mode, and a value for the
5201 variable `eval' is simply evaluated as an expression and the value is
5202 ignored. These are not real variables; setting them in any other
5203 context does not have the same effect. If `mode' is used in a local
5204 variables list, it should be the first entry in the list.
5206 Here is an example of a local variables list:
5207 ;;; Local Variables: ***
5209 ;;; comment-column:0 ***
5210 ;;; comment-start: ";;; " ***
5211 ;;; comment-end:"***" ***
5214 Note that the prefix is `;;; ' and the suffix is ` ***'. Note also
5215 that comments in the file begin with and end with the same strings.
5216 Presumably the file contains code in a language which is enough like
5217 Lisp for Lisp mode to be useful but in which comments start and end
5218 differently. The prefix and suffix are used in the local variables
5219 list to make the list look like several lines of comments when the
5220 compiler or interpreter for that language reads the file.
5222 The start of the local variables list must be no more than 3000
5223 characters from the end of the file, and must be in the last page if the
5224 file is divided into pages. Otherwise, Emacs will not notice it is
5225 there. The purpose is twofold: a stray `Local Variables:' not in the
5226 last page does not confuse Emacs, and Emacs never needs to search a
5227 long file that contains no page markers and has no local variables list.
5229 You may be tempted to turn on Auto Fill mode with a local variable
5230 list. That is inappropriate. Whether you use Auto Fill mode or not is
5231 a matter of personal taste, not a matter of the contents of particular
5232 files. If you want to use Auto Fill, set up major mode hooks with your
5233 init file to turn it on (when appropriate) for you alone (*note Init
5234 File::). Don't try to use a local variable list that would impose your
5235 taste on everyone working with the file.
5237 XEmacs allows you to specify local variables in the first line of a
5238 file, in addition to specifying them in the `Local Variables' section
5239 at the end of a file.
5241 If the first line of a file contains two occurrences of ``-*-'',
5242 XEmacs uses the information between them to determine what the major
5243 mode and variable settings should be. For example, these are all legal:
5245 ;;; -*- mode: emacs-lisp -*-
5246 ;;; -*- mode: postscript; version-control: never -*-
5247 ;;; -*- tags-file-name: "/foo/bar/TAGS" -*-
5249 For historical reasons, the syntax ``-*- modename -*-'' is allowed
5250 as well; for example, you can use:
5252 ;;; -*- emacs-lisp -*-
5254 The variable `enable-local-variables' controls the use of local
5255 variables lists in files you visit. The value can be `t', `nil', or
5256 something else. A value of `t' means local variables lists are obeyed;
5257 `nil' means they are ignored; anything else means query.
5259 The command `M-x normal-mode' always obeys local variables lists and
5260 ignores this variable.
5263 File: xemacs.info, Node: Keyboard Macros, Next: Key Bindings, Prev: Variables, Up: Customization
5268 A "keyboard macro" is a command defined by the user to abbreviate a
5269 sequence of keys. For example, if you discover that you are about to
5270 type `C-n C-d' forty times, you can speed your work by defining a
5271 keyboard macro to invoke `C-n C-d' and calling it with a repeat count
5275 Start defining a keyboard macro (`start-kbd-macro').
5278 End the definition of a keyboard macro (`end-kbd-macro').
5281 Execute the most recent keyboard macro (`call-last-kbd-macro').
5284 Re-execute last keyboard macro, then add more keys to its
5288 When this point is reached during macro execution, ask for
5289 confirmation (`kbd-macro-query').
5291 `M-x name-last-kbd-macro'
5292 Give a command name (for the duration of the session) to the most
5293 recently defined keyboard macro.
5295 `M-x insert-kbd-macro'
5296 Insert in the buffer a keyboard macro's definition, as Lisp code.
5298 Keyboard macros differ from other Emacs commands in that they are
5299 written in the Emacs command language rather than in Lisp. This makes
5300 it easier for the novice to write them and makes them more convenient as
5301 temporary hacks. However, the Emacs command language is not powerful
5302 enough as a programming language to be useful for writing anything
5303 general or complex. For such things, Lisp must be used.
5305 You define a keyboard macro by executing the commands which are its
5306 definition. Put differently, as you are defining a keyboard macro, the
5307 definition is being executed for the first time. This way, you see
5308 what the effects of your commands are, and don't have to figure them
5309 out in your head. When you are finished, the keyboard macro is defined
5310 and also has been executed once. You can then execute the same set of
5311 commands again by invoking the macro.
5315 * Basic Kbd Macro:: Defining and running keyboard macros.
5316 * Save Kbd Macro:: Giving keyboard macros names; saving them in files.
5317 * Kbd Macro Query:: Keyboard macros that do different things each use.
5320 File: xemacs.info, Node: Basic Kbd Macro, Next: Save Kbd Macro, Up: Keyboard Macros
5325 To start defining a keyboard macro, type `C-x (' (`start-kbd-macro').
5326 From then on, anything you type continues to be executed, but also
5327 becomes part of the definition of the macro. `Def' appears in the mode
5328 line to remind you of what is going on. When you are finished, the
5329 `C-x )' command (`end-kbd-macro') terminates the definition, without
5330 becoming part of it.
5336 defines a macro to move forward a word and then insert `foo'.
5338 You can give `C-x )' a repeat count as an argument, in which case it
5339 repeats the macro that many times right after defining it, but defining
5340 the macro counts as the first repetition (since it is executed as you
5341 define it). If you give `C-x )' an argument of 4, it executes the
5342 macro immediately 3 additional times. An argument of zero to `C-x e'
5343 or `C-x )' means repeat the macro indefinitely (until it gets an error
5346 Once you have defined a macro, you can invoke it again with the `C-x
5347 e' command (`call-last-kbd-macro'). You can give the command a repeat
5348 count numeric argument to execute the macro many times.
5350 To repeat an operation at regularly spaced places in the text,
5351 define a macro and include as part of the macro the commands to move to
5352 the next place you want to use it. For example, if you want to change
5353 each line, you should position point at the start of a line, and define
5354 a macro to change that line and leave point at the start of the next
5355 line. Repeating the macro will then operate on successive lines.
5357 After you have terminated the definition of a keyboard macro, you
5358 can add to the end of its definition by typing `C-u C-x ('. This is
5359 equivalent to plain `C-x (' followed by retyping the whole definition
5360 so far. As a consequence it re-executes the macro as previously
5364 File: xemacs.info, Node: Save Kbd Macro, Next: Kbd Macro Query, Prev: Basic Kbd Macro, Up: Keyboard Macros
5366 Naming and Saving Keyboard Macros
5367 ---------------------------------
5369 To save a keyboard macro for longer than until you define the next one,
5370 you must give it a name using `M-x name-last-kbd-macro'. This reads a
5371 name as an argument using the minibuffer and defines that name to
5372 execute the macro. The macro name is a Lisp symbol, and defining it in
5373 this way makes it a valid command name for calling with `M-x' or for
5374 binding a key to with `global-set-key' (*note Keymaps::). If you
5375 specify a name that has a prior definition other than another keyboard
5376 macro, Emacs prints an error message and nothing is changed.
5378 Once a macro has a command name, you can save its definition in a
5379 file. You can then use it in another editing session. First visit the
5380 file you want to save the definition in. Then use the command:
5382 M-x insert-kbd-macro <RET> MACRONAME <RET>
5384 This inserts some Lisp code that, when executed later, will define the
5385 same macro with the same definition it has now. You need not
5386 understand Lisp code to do this, because `insert-kbd-macro' writes the
5387 Lisp code for you. Then save the file. You can load the file with
5388 `load-file' (*note Lisp Libraries::). If the file you save in is your
5389 initialization file (*note Init File::), then the macro will be defined
5390 each time you run Emacs.
5392 If you give `insert-kbd-macro' a prefix argument, it creates
5393 additional Lisp code to record the keys (if any) that you have bound to
5394 the keyboard macro, so that the macro is reassigned the same keys when
5398 File: xemacs.info, Node: Kbd Macro Query, Prev: Save Kbd Macro, Up: Keyboard Macros
5400 Executing Macros With Variations
5401 --------------------------------
5403 You can use `C-x q' (`kbd-macro-query'), to get an effect similar to
5404 that of `query-replace'. The macro asks you each time whether to make
5405 a change. When you are defining the macro, type `C-x q' at the point
5406 where you want the query to occur. During macro definition, the `C-x
5407 q' does nothing, but when you invoke the macro, `C-x q' reads a
5408 character from the terminal to decide whether to continue.
5410 The special answers to a `C-x q' query are <SPC>, <DEL>, `C-d',
5411 `C-l', and `C-r'. Any other character terminates execution of the
5412 keyboard macro and is then read as a command. <SPC> means to continue.
5413 <DEL> means to skip the remainder of this repetition of the macro,
5414 starting again from the beginning in the next repetition. `C-d' means
5415 to skip the remainder of this repetition and cancel further repetition.
5416 `C-l' redraws the frame and asks you again for a character to specify
5417 what to do. `C-r' enters a recursive editing level, in which you can
5418 perform editing that is not part of the macro. When you exit the
5419 recursive edit using `C-M-c', you are asked again how to continue with
5420 the keyboard macro. If you type a <SPC> at this time, the rest of the
5421 macro definition is executed. It is up to you to leave point and the
5422 text in a state such that the rest of the macro will do what you want.
5424 `C-u C-x q', which is `C-x q' with a numeric argument, performs a
5425 different function. It enters a recursive edit reading input from the
5426 keyboard, both when you type it during the definition of the macro and
5427 when it is executed from the macro. During definition, the editing you
5428 do inside the recursive edit does not become part of the macro. During
5429 macro execution, the recursive edit gives you a chance to do some
5430 particularized editing. *Note Recursive Edit::.
5433 File: xemacs.info, Node: Key Bindings, Next: Syntax, Prev: Keyboard Macros, Up: Customization
5435 Customizing Key Bindings
5436 ========================
5438 This section deals with the "keymaps" that define the bindings between
5439 keys and functions, and shows how you can customize these bindings.
5441 A command is a Lisp function whose definition provides for
5442 interactive use. Like every Lisp function, a command has a function
5443 name, which is a Lisp symbol whose name usually consists of lower case
5444 letters and hyphens.
5448 * Keymaps:: Definition of the keymap data structure.
5449 Names of Emacs's standard keymaps.
5450 * Rebinding:: How to redefine one key's meaning conveniently.
5451 * Disabling:: Disabling a command means confirmation is required
5452 before it can be executed. This is done to protect
5453 beginners from surprises.
5456 File: xemacs.info, Node: Keymaps, Next: Rebinding, Up: Key Bindings
5461 The bindings between characters and command functions are recorded in
5462 data structures called "keymaps". Emacs has many of these. One, the
5463 "global" keymap, defines the meanings of the single-character keys that
5464 are defined regardless of major mode. It is the value of the variable
5467 Each major mode has another keymap, its "local keymap", which
5468 contains overriding definitions for the single-character keys that are
5469 redefined in that mode. Each buffer records which local keymap is
5470 installed for it at any time, and the current buffer's local keymap is
5471 the only one that directly affects command execution. The local keymaps
5472 for Lisp mode, C mode, and many other major modes always exist even when
5473 not in use. They are the values of the variables `lisp-mode-map',
5474 `c-mode-map', and so on. For less frequently used major modes, the
5475 local keymap is sometimes constructed only when the mode is used for the
5476 first time in a session, to save space.
5478 There are local keymaps for the minibuffer, too; they contain various
5479 completion and exit commands.
5481 * `minibuffer-local-map' is used for ordinary input (no completion).
5483 * `minibuffer-local-ns-map' is similar, except that <SPC> exits just
5484 like <RET>. This is used mainly for Mocklisp compatibility.
5486 * `minibuffer-local-completion-map' is for permissive completion.
5488 * `minibuffer-local-must-match-map' is for strict completion and for
5489 cautious completion.
5491 * `repeat-complex-command-map' is for use in `C-x <ESC> <ESC>'.
5493 * `isearch-mode-map' contains the bindings of the special keys which
5494 are bound in the pseudo-mode entered with `C-s' and `C-r'.
5496 Finally, each prefix key has a keymap which defines the key sequences
5497 that start with it. For example, `ctl-x-map' is the keymap used for
5498 characters following a `C-x'.
5500 * `ctl-x-map' is the variable name for the map used for characters
5503 * `help-map' is used for characters that follow `C-h'.
5505 * `esc-map' is for characters that follow <ESC>. All Meta characters
5506 are actually defined by this map.
5508 * `ctl-x-4-map' is for characters that follow `C-x 4'.
5510 * `mode-specific-map' is for characters that follow `C-c'.
5512 The definition of a prefix key is the keymap to use for looking up
5513 the following character. Sometimes the definition is actually a Lisp
5514 symbol whose function definition is the following character keymap. The
5515 effect is the same, but it provides a command name for the prefix key
5516 that you can use as a description of what the prefix key is for. Thus
5517 the binding of `C-x' is the symbol `Ctl-X-Prefix', whose function
5518 definition is the keymap for `C-x' commands, the value of `ctl-x-map'.
5520 Prefix key definitions can appear in either the global map or a
5521 local map. The definitions of `C-c', `C-x', `C-h', and <ESC> as prefix
5522 keys appear in the global map, so these prefix keys are always
5523 available. Major modes can locally redefine a key as a prefix by
5524 putting a prefix key definition for it in the local map.
5526 A mode can also put a prefix definition of a global prefix character
5527 such as `C-x' into its local map. This is how major modes override the
5528 definitions of certain keys that start with `C-x'. This case is
5529 special, because the local definition does not entirely replace the
5530 global one. When both the global and local definitions of a key are
5531 other keymaps, the next character is looked up in both keymaps, with
5532 the local definition overriding the global one. The character after the
5533 `C-x' is looked up in both the major mode's own keymap for redefined
5534 `C-x' commands and in `ctl-x-map'. If the major mode's own keymap for
5535 `C-x' commands contains `nil', the definition from the global keymap
5536 for `C-x' commands is used.
5539 File: xemacs.info, Node: Rebinding, Next: Disabling, Prev: Keymaps, Up: Key Bindings
5541 Changing Key Bindings
5542 ---------------------
5544 You can redefine an Emacs key by changing its entry in a keymap. You
5545 can change the global keymap, in which case the change is effective in
5546 all major modes except those that have their own overriding local
5547 definitions for the same key. Or you can change the current buffer's
5548 local map, which affects all buffers using the same major mode.
5552 * Interactive Rebinding:: Changing Key Bindings Interactively
5553 * Programmatic Rebinding:: Changing Key Bindings Programmatically
5554 * Key Bindings Using Strings:: Using Strings for Changing Key Bindings
5557 File: xemacs.info, Node: Interactive Rebinding, Next: Programmatic Rebinding, Up: Rebinding
5559 Changing Key Bindings Interactively
5560 ...................................
5562 `M-x global-set-key <RET> KEY CMD <RET>'
5563 Defines KEY globally to run CMD.
5565 `M-x local-set-key <RET> KEYS CMD <RET>'
5566 Defines KEY locally (in the major mode now in effect) to run CMD.
5568 `M-x local-unset-key <RET> KEYS <RET>'
5569 Removes the local binding of KEY.
5571 CMD is a symbol naming an interactively-callable function.
5573 When called interactively, KEY is the next complete key sequence
5574 that you type. When called as a function, KEY is a string, a vector of
5575 events, or a vector of key-description lists as described in the
5576 `define-key' function description. The binding goes in the current
5577 buffer's local map, which is shared with other buffers in the same
5580 The following example:
5582 M-x global-set-key <RET> C-f next-line <RET>
5584 redefines `C-f' to move down a line. The fact that CMD is read second
5585 makes it serve as a kind of confirmation for KEY.
5587 These functions offer no way to specify a particular prefix keymap as
5588 the one to redefine in, but that is not necessary, as you can include
5589 prefixes in KEY. KEY is read by reading characters one by one until
5590 they amount to a complete key (that is, not a prefix key). Thus, if
5591 you type `C-f' for KEY, Emacs enters the minibuffer immediately to read
5592 CMD. But if you type `C-x', another character is read; if that
5593 character is `4', another character is read, and so on. For example,
5595 M-x global-set-key <RET> C-x 4 $ spell-other-window <RET>
5597 redefines `C-x 4 $' to run the (fictitious) command
5598 `spell-other-window'.
5600 The most general way to modify a keymap is the function
5601 `define-key', used in Lisp code (such as your init file). `define-key'
5602 takes three arguments: the keymap, the key to modify in it, and the new
5603 definition. *Note Init File::, for an example.
5604 `substitute-key-definition' is used similarly; it takes three
5605 arguments, an old definition, a new definition, and a keymap, and
5606 redefines in that keymap all keys that were previously defined with the
5607 old definition to have the new definition instead.
5610 File: xemacs.info, Node: Programmatic Rebinding, Next: Key Bindings Using Strings, Prev: Interactive Rebinding, Up: Rebinding
5612 Changing Key Bindings Programmatically
5613 ......................................
5615 You can use the functions `global-set-key' and `define-key' to rebind
5616 keys under program control.
5618 ``(global-set-key KEYS CMD)''
5619 Defines KEYS globally to run CMD.
5621 ``(define-key KEYMAP KEYS DEF)''
5622 Defines KEYS to run DEF in the keymap KEYMAP.
5624 KEYMAP is a keymap object.
5626 KEYS is the sequence of keystrokes to bind.
5628 DEF is anything that can be a key's definition:
5630 * `nil', meaning key is undefined in this keymap
5632 * A command, that is, a Lisp function suitable for interactive
5635 * A string or key sequence vector, which is treated as a keyboard
5638 * A keymap to define a prefix key
5640 * A symbol so that when the key is looked up, the symbol stands for
5641 its function definition, which should at that time be one of the
5642 above, or another symbol whose function definition is used, and so
5645 * A cons, `(string . defn)', meaning that DEFN is the definition
5646 (DEFN should be a valid definition in its own right)
5648 * A cons, `(keymap . char)', meaning use the definition of CHAR in
5651 For backward compatibility, XEmacs allows you to specify key
5652 sequences as strings. However, the preferred method is to use the
5653 representations of key sequences as vectors of keystrokes. *Note
5654 Keystrokes::, for more information about the rules for constructing key
5657 Emacs allows you to abbreviate representations for key sequences in
5658 most places where there is no ambiguity. Here are some rules for
5661 * The keysym by itself is equivalent to a list of just that keysym,
5662 i.e., `f1' is equivalent to `(f1)'.
5664 * A keystroke by itself is equivalent to a vector containing just
5665 that keystroke, i.e., `(control a)' is equivalent to `[(control
5668 * You can use ASCII codes for keysyms that have them. i.e., `65' is
5669 equivalent to `A'. (This is not so much an abbreviation as an
5670 alternate representation.)
5672 Here are some examples of programmatically binding keys:
5675 ;;; Bind `my-command' to <f1>
5676 (global-set-key 'f1 'my-command)
5678 ;;; Bind `my-command' to Shift-f1
5679 (global-set-key '(shift f1) 'my-command)
5681 ;;; Bind `my-command' to C-c Shift-f1
5682 (global-set-key '[(control c) (shift f1)] 'my-command)
5684 ;;; Bind `my-command' to the middle mouse button.
5685 (global-set-key 'button2 'my-command)
5687 ;;; Bind `my-command' to <META> <CTL> <Right Mouse Button>
5688 ;;; in the keymap that is in force when you are running `dired'.
5689 (define-key dired-mode-map '(meta control button3) 'my-command)
5692 File: xemacs.info, Node: Key Bindings Using Strings, Prev: Programmatic Rebinding, Up: Rebinding
5694 Using Strings for Changing Key Bindings
5695 .......................................
5697 For backward compatibility, you can still use strings to represent key
5698 sequences. Thus you can use commands like the following:
5700 ;;; Bind `end-of-line' to C-f
5701 (global-set-key "\C-f" 'end-of-line)
5703 Note, however, that in some cases you may be binding more than one
5704 key sequence by using a single command. This situation can arise
5705 because in ASCII, `C-i' and <TAB> have the same representation.
5706 Therefore, when Emacs sees:
5708 (global-set-key "\C-i" 'end-of-line)
5710 it is unclear whether the user intended to bind `C-i' or <TAB>. The
5711 solution XEmacs adopts is to bind both of these key sequences.
5713 After binding a command to two key sequences with a form like:
5715 (define-key global-map "\^X\^I" 'command-1)
5717 it is possible to redefine only one of those sequences like so:
5719 (define-key global-map [(control x) (control i)] 'command-2)
5720 (define-key global-map [(control x) tab] 'command-3)
5722 This applies only when running under a window system. If you are
5723 talking to Emacs through an ASCII-only channel, you do not get any of
5726 Here is a table of pairs of key sequences that behave in a similar
5735 control @ control space
5738 File: xemacs.info, Node: Disabling, Prev: Rebinding, Up: Key Bindings
5743 Disabling a command marks it as requiring confirmation before it can be
5744 executed. The purpose of disabling a command is to prevent beginning
5745 users from executing it by accident and being confused.
5747 The direct mechanism for disabling a command is to have a non-`nil'
5748 `disabled' property on the Lisp symbol for the command. These
5749 properties are normally set by the user's init file with Lisp
5750 expressions such as:
5752 (put 'delete-region 'disabled t)
5756 If the value of the `disabled' property is a string, that string is
5757 included in the message printed when the command is used:
5759 (put 'delete-region 'disabled
5760 "Text deleted this way cannot be yanked back!\n")
5762 You can disable a command either by editing the init file directly
5763 or with the command `M-x disable-command', which edits the init file
5764 for you. *Note Init File::.
5766 When you attempt to invoke a disabled command interactively in Emacs,
5767 a window is displayed containing the command's name, its documentation,
5768 and some instructions on what to do next; then Emacs asks for input
5769 saying whether to execute the command as requested, enable it and
5770 execute, or cancel it. If you decide to enable the command, you are
5771 asked whether to do this permanently or just for the current session.
5772 Enabling permanently works by automatically editing your init file.
5773 You can use `M-x enable-command' at any time to enable any command
5776 Whether a command is disabled is independent of what key is used to
5777 invoke it; it also applies if the command is invoked using `M-x'.
5778 Disabling a command has no effect on calling it as a function from Lisp
5782 File: xemacs.info, Node: Syntax, Next: Init File, Prev: Key Bindings, Up: Customization
5787 All the Emacs commands which parse words or balance parentheses are
5788 controlled by the "syntax table". The syntax table specifies which
5789 characters are opening delimiters, which are parts of words, which are
5790 string quotes, and so on. Actually, each major mode has its own syntax
5791 table (though sometimes related major modes use the same one) which it
5792 installs in each buffer that uses that major mode. The syntax table
5793 installed in the current buffer is the one that all commands use, so we
5794 call it "the" syntax table. A syntax table is a Lisp object, a vector
5795 of length 256 whose elements are numbers.
5799 * Entry: Syntax Entry. What the syntax table records for each character.
5800 * Change: Syntax Change. How to change the information.
5803 File: xemacs.info, Node: Syntax Entry, Next: Syntax Change, Up: Syntax
5805 Information About Each Character
5806 --------------------------------
5808 The syntax table entry for a character is a number that encodes six
5809 pieces of information:
5811 * The syntactic class of the character, represented as a small
5814 * The matching delimiter, for delimiter characters only (the
5815 matching delimiter of `(' is `)', and vice versa)
5817 * A flag saying whether the character is the first character of a
5818 two-character comment starting sequence
5820 * A flag saying whether the character is the second character of a
5821 two-character comment starting sequence
5823 * A flag saying whether the character is the first character of a
5824 two-character comment ending sequence
5826 * A flag saying whether the character is the second character of a
5827 two-character comment ending sequence
5829 The syntactic classes are stored internally as small integers, but
5830 are usually described to or by the user with characters. For example,
5831 `(' is used to specify the syntactic class of opening delimiters. Here
5832 is a table of syntactic classes, with the characters that specify them.
5835 The class of whitespace characters. Please don't use the formerly
5836 advertised , which is not supported by GNU Emacs.
5839 The class of word-constituent characters.
5842 The class of characters that are part of symbol names but not
5843 words. This class is represented by `_' because the character `_'
5844 has this class in both C and Lisp.
5847 The class of punctuation characters that do not fit into any other
5851 The class of opening delimiters.
5854 The class of closing delimiters.
5857 The class of expression-adhering characters. These characters are
5858 part of a symbol if found within or adjacent to one, and are part
5859 of a following expression if immediately preceding one, but are
5860 like whitespace if surrounded by whitespace.
5863 The class of string-quote characters. They match each other in
5864 pairs, and the characters within the pair all lose their syntactic
5865 significance except for the `\' and `/' classes of escape
5866 characters, which can be used to include a string-quote inside the
5870 The class of self-matching delimiters. This is intended for TeX's
5871 `$', which is used both to enter and leave math mode. Thus, a
5872 pair of matching `$' characters surround each piece of math mode
5873 TeX input. A pair of adjacent `$' characters act like a single
5874 one for purposes of matching.
5877 The class of escape characters that always just deny the following
5878 character its special syntactic significance. The character after
5879 one of these escapes is always treated as alphabetic.
5882 The class of C-style escape characters. In practice, these are
5883 treated just like `/'-class characters, because the extra
5884 possibilities for C escapes (such as being followed by digits)
5885 have no effect on where the containing expression ends.
5888 The class of comment-starting characters. Only single-character
5889 comment starters (such as `;' in Lisp mode) are represented this
5893 The class of comment-ending characters. Newline has this syntax in
5896 The characters flagged as part of two-character comment delimiters
5897 can have other syntactic functions most of the time. For example, `/'
5898 and `*' in C code, when found separately, have nothing to do with
5899 comments. The comment-delimiter significance overrides when the pair of
5900 characters occur together in the proper order. Only the list and sexp
5901 commands use the syntax table to find comments; the commands
5902 specifically for comments have other variables that tell them where to
5903 find comments. Moreover, the list and sexp commands notice comments
5904 only if `parse-sexp-ignore-comments' is non-`nil'. This variable is set
5905 to `nil' in modes where comment-terminator sequences are liable to
5906 appear where there is no comment, for example, in Lisp mode where the
5907 comment terminator is a newline but not every newline ends a comment.
5910 File: xemacs.info, Node: Syntax Change, Prev: Syntax Entry, Up: Syntax
5912 Altering Syntax Information
5913 ---------------------------
5915 It is possible to alter a character's syntax table entry by storing a
5916 new number in the appropriate element of the syntax table, but it would
5917 be hard to determine what number to use. Emacs therefore provides a
5918 command that allows you to specify the syntactic properties of a
5919 character in a convenient way.
5921 `M-x modify-syntax-entry' is the command to change a character's
5922 syntax. It can be used interactively and is also used by major modes
5923 to initialize their own syntax tables. Its first argument is the
5924 character to change. The second argument is a string that specifies the
5925 new syntax. When called from Lisp code, there is a third, optional
5926 argument, which specifies the syntax table in which to make the change.
5927 If not supplied, or if this command is called interactively, the third
5928 argument defaults to the current buffer's syntax table.
5930 1. The first character in the string specifies the syntactic class.
5931 It is one of the characters in the previous table (*note Syntax
5934 2. The second character is the matching delimiter. For a character
5935 that is not an opening or closing delimiter, this should be a
5936 space, and may be omitted if no following characters are needed.
5938 3. The remaining characters are flags. The flag characters allowed
5942 Flag this character as the first of a two-character comment
5946 Flag this character as the second of a two-character comment
5950 Flag this character as the first of a two-character comment
5954 Flag this character as the second of a two-character comment
5957 Use `C-h s' (`describe-syntax') to display a description of the
5958 contents of the current syntax table. The description of each
5959 character includes both the string you have to pass to
5960 `modify-syntax-entry' to set up that character's current syntax, and
5961 some English to explain that string if necessary.
5964 File: xemacs.info, Node: Init File, Next: Audible Bell, Prev: Syntax, Up: Customization
5969 When you start Emacs, it normally loads either `.xemacs/init.el' or the
5970 file `.emacs' (whichever comes first) in your home directory. This
5971 file, if it exists, should contain Lisp code. It is called your
5972 initialization file or "init file". Use the command line switch `-q'
5973 to tell Emacs whether to load an init file (*note Entering Emacs::).
5974 Use the command line switch `-user-init-file' (*note Command
5975 Switches::) to tell Emacs to load a different file instead of
5976 `~/.xemacs/init.el'/`~/.emacs'.
5978 When the init file is read, the variable `user-init-file' says which
5979 init file was loaded.
5981 At some sites there is a "default init file", which is the library
5982 named `default.el', found via the standard search path for libraries.
5983 The Emacs distribution contains no such library; your site may create
5984 one for local customizations. If this library exists, it is loaded
5985 whenever you start Emacs. But your init file, if any, is loaded first;
5986 if it sets `inhibit-default-init' non-`nil', then `default' is not
5989 If you have a large amount of code in your init file, you should
5990 byte-compile it to `~/.xemacs/init.elc' or `~/.emacs.elc'.
5994 * Init Syntax:: Syntax of constants in Emacs Lisp.
5995 * Init Examples:: How to do some things with an init file.
5996 * Terminal Init:: Each terminal type can have an init file.
5999 File: xemacs.info, Node: Init Syntax, Next: Init Examples, Up: Init File
6004 The init file contains one or more Lisp function call expressions.
6005 Each consists of a function name followed by arguments, all surrounded
6006 by parentheses. For example, `(setq fill-column 60)' represents a call
6007 to the function `setq' which is used to set the variable `fill-column'
6008 (*note Filling::) to 60.
6010 The second argument to `setq' is an expression for the new value of
6011 the variable. This can be a constant, a variable, or a function call
6012 expression. In the init file, constants are used most of the time.
6016 Integers are written in decimal, with an optional initial minus
6019 If a sequence of digits is followed by a period and another
6020 sequence of digits, it is interpreted as a floating point number.
6022 The number prefixes `#b', `#o', and `#x' are supported to
6023 represent numbers in binary, octal, and hexadecimal notation (or
6027 Lisp string syntax is the same as C string syntax with a few extra
6028 features. Use a double-quote character to begin and end a string
6031 Newlines and special characters may be present literally in
6032 strings. They can also be represented as backslash sequences:
6033 `\n' for newline, `\b' for backspace, `\r' for return, `\t' for
6034 tab, `\f' for formfeed (control-l), `\e' for escape, `\\' for a
6035 backslash, `\"' for a double-quote, or `\OOO' for the character
6036 whose octal code is OOO. Backslash and double-quote are the only
6037 characters for which backslash sequences are mandatory.
6039 You can use `\C-' as a prefix for a control character, as in
6040 `\C-s' for ASCII Control-S, and `\M-' as a prefix for a Meta
6041 character, as in `\M-a' for Meta-A or `\M-\C-a' for Control-Meta-A.
6044 Lisp character constant syntax consists of a `?' followed by
6045 either a character or an escape sequence starting with `\'.
6046 Examples: `?x', `?\n', `?\"', `?\)'. Note that strings and
6047 characters are not interchangeable in Lisp; some contexts require
6048 one and some contexts require the other.
6051 `t' stands for `true'.
6054 `nil' stands for `false'.
6057 Write a single-quote (') followed by the Lisp object you want.
6060 File: xemacs.info, Node: Init Examples, Next: Terminal Init, Prev: Init Syntax, Up: Init File
6065 Here are some examples of doing certain commonly desired things with
6068 * Make <TAB> in C mode just insert a tab if point is in the middle
6071 (setq c-tab-always-indent nil)
6073 Here we have a variable whose value is normally `t' for `true' and
6074 the alternative is `nil' for `false'.
6076 * Make searches case sensitive by default (in all buffers that do not
6079 (setq-default case-fold-search nil)
6081 This sets the default value, which is effective in all buffers
6082 that do not have local values for the variable. Setting
6083 `case-fold-search' with `setq' affects only the current buffer's
6084 local value, which is probably not what you want to do in an init
6087 * Make Text mode the default mode for new buffers.
6089 (setq default-major-mode 'text-mode)
6091 Note that `text-mode' is used because it is the command for
6092 entering the mode we want. A single-quote is written before it to
6093 make a symbol constant; otherwise, `text-mode' would be treated as
6096 * Turn on Auto Fill mode automatically in Text mode and related
6099 (setq text-mode-hook
6100 '(lambda () (auto-fill-mode 1)))
6102 Here we have a variable whose value should be a Lisp function. The
6103 function we supply is a list starting with `lambda', and a single
6104 quote is written in front of it to make it (for the purpose of this
6105 `setq') a list constant rather than an expression. Lisp functions
6106 are not explained here; for mode hooks it is enough to know that
6107 `(auto-fill-mode 1)' is an expression that will be executed when
6108 Text mode is entered. You could replace it with any other
6109 expression that you like, or with several expressions in a row.
6111 (setq text-mode-hook 'turn-on-auto-fill)
6113 This is another way to accomplish the same result.
6114 `turn-on-auto-fill' is a symbol whose function definition is
6115 `(lambda () (auto-fill-mode 1))'.
6117 * Load the installed Lisp library named `foo' (actually a file
6118 `foo.elc' or `foo.el' in a standard Emacs directory).
6122 When the argument to `load' is a relative pathname, not starting
6123 with `/' or `~', `load' searches the directories in `load-path'
6126 * Load the compiled Lisp file `foo.elc' from your home directory.
6130 Here an absolute file name is used, so no searching is done.
6132 * Rebind the key `C-x l' to run the function `make-symbolic-link'.
6134 (global-set-key "\C-xl" 'make-symbolic-link)
6138 (define-key global-map "\C-xl" 'make-symbolic-link)
6140 Note once again the single-quote used to refer to the symbol
6141 `make-symbolic-link' instead of its value as a variable.
6143 * Do the same thing for C mode only.
6145 (define-key c-mode-map "\C-xl" 'make-symbolic-link)
6147 * Bind the function key <F1> to a command in C mode. Note that the
6148 names of function keys must be lower case.
6150 (define-key c-mode-map 'f1 'make-symbolic-link)
6152 * Bind the shifted version of <F1> to a command.
6154 (define-key c-mode-map '(shift f1) 'make-symbolic-link)
6156 * Redefine all keys which now run `next-line' in Fundamental mode to
6157 run `forward-line' instead.
6159 (substitute-key-definition 'next-line 'forward-line
6162 * Make `C-x C-v' undefined.
6164 (global-unset-key "\C-x\C-v")
6166 One reason to undefine a key is so that you can make it a prefix.
6167 Simply defining `C-x C-v ANYTHING' would make `C-x C-v' a prefix,
6168 but `C-x C-v' must be freed of any non-prefix definition first.
6170 * Make `$' have the syntax of punctuation in Text mode. Note the
6171 use of a character constant for `$'.
6173 (modify-syntax-entry ?\$ "." text-mode-syntax-table)
6175 * Enable the use of the command `eval-expression' without
6178 (put 'eval-expression 'disabled nil)
6181 File: xemacs.info, Node: Terminal Init, Prev: Init Examples, Up: Init File
6183 Terminal-Specific Initialization
6184 --------------------------------
6186 Each terminal type can have a Lisp library to be loaded into Emacs when
6187 it is run on that type of terminal. For a terminal type named
6188 TERMTYPE, the library is called `term/TERMTYPE' and it is found by
6189 searching the directories `load-path' as usual and trying the suffixes
6190 `.elc' and `.el'. Normally it appears in the subdirectory `term' of
6191 the directory where most Emacs libraries are kept.
6193 The usual purpose of the terminal-specific library is to define the
6194 escape sequences used by the terminal's function keys using the library
6195 `keypad.el'. See the file `term/vt100.el' for an example of how this
6198 When the terminal type contains a hyphen, only the part of the name
6199 before the first hyphen is significant in choosing the library name.
6200 Thus, terminal types `aaa-48' and `aaa-30-rv' both use the library
6201 `term/aaa'. The code in the library can use `(getenv "TERM")' to find
6202 the full terminal type name.
6204 The library's name is constructed by concatenating the value of the
6205 variable `term-file-prefix' and the terminal type. Your init file can
6206 prevent the loading of the terminal-specific library by setting
6207 `term-file-prefix' to `nil'. *Note Init File::.
6209 The value of the variable `term-setup-hook', if not `nil', is called
6210 as a function of no arguments at the end of Emacs initialization, after
6211 both your init file and any terminal-specific library have been read.
6212 *Note Init File::. You can set the value in the init file to override
6213 part of any of the terminal-specific libraries and to define
6214 initializations for terminals that do not have a library.
6217 File: xemacs.info, Node: Audible Bell, Next: Faces, Prev: Init File, Up: Customization
6219 Changing the Bell Sound
6220 =======================
6222 You can now change how the audible bell sounds using the variable
6225 `sound-alist''s value is an list associating symbols with, among
6226 other things, strings of audio-data. When `ding' is called with one of
6227 the symbols, the associated sound data is played instead of the
6228 standard beep. This only works if you are logged in on the console of a
6229 machine with audio hardware. To listen to a sound of the provided type,
6230 call the function `play-sound' with the argument SOUND. You can also
6231 set the volume of the sound with the optional argument VOLUME.
6233 Each element of `sound-alist' is a list describing a sound. The
6234 first element of the list is the name of the sound being defined.
6235 Subsequent elements of the list are alternating keyword/value pairs:
6238 A string of raw sound data, or the name of another sound to play.
6239 The symbol `t' here means use the default X beep.
6242 An integer from 0-100, defaulting to `bell-volume'.
6245 If using the default X beep, the pitch (Hz) to generate.
6248 If using the default X beep, the duration (milliseconds).
6250 For compatibility, elements of `sound-alist' may also be of the form:
6252 ( SOUND-NAME . <SOUND> )
6253 ( SOUND-NAME <VOLUME> <SOUND> )
6255 You should probably add things to this list by calling the function
6258 Note that you can only play audio data if running on the console
6259 screen of a machine with audio hardware which emacs understands, which
6260 at this time means a Sun SparcStation, SGI, or HP9000s700.
6262 Also note that the pitch, duration, and volume options are available
6263 everywhere, but most X servers ignore the `pitch' option.
6265 The variable `bell-volume' should be an integer from 0 to 100, with
6266 100 being loudest, which controls how loud the sounds emacs makes
6267 should be. Elements of the `sound-alist' may override this value.
6268 This variable applies to the standard X bell sound as well as sound
6271 If the symbol `t' is in place of a sound-string, Emacs uses the
6272 default X beep. This allows you to define beep-types of different
6273 volumes even when not running on the console.
6275 You can add things to this list by calling the function
6276 `load-sound-file', which reads in an audio-file and adds its data to
6277 the sound-alist. You can specify the sound with the SOUND-NAME argument
6278 and the file into which the sounds are loaded with the FILENAME
6279 argument. The optional VOLUME argument sets the volume.
6281 `load-sound-file (FILENAME SOUND-NAME &optional VOLUME)'
6283 To load and install some sound files as beep-types, use the function
6284 `load-default-sounds' (note that this only works if you are on display
6285 0 of a machine with audio hardware).
6287 The following beep-types are used by Emacs itself. Other Lisp
6288 packages may use other beep types, but these are the ones that the C
6289 kernel of Emacs uses.
6292 An auto-save does not succeed
6295 The Emacs command loop catches an error
6298 You type a key that is undefined
6301 You use an undefined mouse-click combination
6304 Completion was not possible
6307 You type something other than the required `y' or `n'
6310 You type something other than `yes' or `no'
6313 File: xemacs.info, Node: Faces, Next: Frame Components, Prev: Audible Bell, Up: Customization
6318 XEmacs has objects called extents and faces. An "extent" is a region
6319 of text and a "face" is a collection of textual attributes, such as
6320 fonts and colors. Every extent is displayed in some face; therefore,
6321 changing the properties of a face immediately updates the display of
6322 all associated extents. Faces can be frame-local: you can have a
6323 region of text that displays with completely different attributes when
6324 its buffer is viewed from a different X window.
6326 The display attributes of faces may be specified either in Lisp or
6327 through the X resource manager.
6332 You can change the face of an extent with the functions in this
6333 section. All the functions prompt for a FACE as an argument; use
6334 completion for a list of possible values.
6337 Swap the foreground and background colors of the given FACE.
6339 `M-x make-face-bold'
6340 Make the font of the given FACE bold. When called from a program,
6341 returns `nil' if this is not possible.
6343 `M-x make-face-bold-italic'
6344 Make the font of the given FACE bold italic. When called from a
6345 program, returns `nil' if not possible.
6347 `M-x make-face-italic'
6348 Make the font of the given FACE italic. When called from a
6349 program, returns `nil' if not possible.
6351 `M-x make-face-unbold'
6352 Make the font of the given FACE non-bold. When called from a
6353 program, returns `nil' if not possible.
6355 `M-x make-face-unitalic'
6356 Make the font of the given FACE non-italic. When called from a
6357 program, returns `nil' if not possible.
6359 `M-x make-face-larger'
6360 Make the font of the given FACE a little larger. When called from
6361 a program, returns `nil' if not possible.
6363 `M-x make-face-smaller'
6364 Make the font of the given FACE a little smaller. When called
6365 from a program, returns `nil' if not possible.
6367 `M-x set-face-background'
6368 Change the background color of the given FACE.
6370 `M-x set-face-background-pixmap'
6371 Change the background pixmap of the given FACE.
6374 Change the font of the given FACE.
6376 `M-x set-face-foreground'
6377 Change the foreground color of the given FACE.
6379 `M-x set-face-underline-p'
6380 Change whether the given FACE is underlined.
6382 You can exchange the foreground and background color of the selected
6383 FACE with the function `invert-face'. If the face does not specify both
6384 foreground and background, then its foreground and background are set
6385 to the background and foreground of the default face. When calling
6386 this from a program, you can supply the optional argument FRAME to
6387 specify which frame is affected; otherwise, all frames are affected.
6389 The work of `make-face-bold', `make-face-bold-italic',
6390 `make-face-italic', `make-face-unbold', `make-face-unitalic' functions
6391 is affected by `face-frob-from-locale-first' variable. If it is `nil',
6392 those functions first try to manipulate device specific data like X
6393 font names to obtain the desired font face specification. This may be
6394 unsuitable in environments using different font face specifications for
6395 different frames, non-Mule environments in particular.
6397 If the variable is non-`nil', those functions first try to figure
6398 out whether the face font is the same as one of predefined faces:
6399 `default', `bold', `italic', `bold-italic'. If it is the same, then
6400 the new face font specification is set to be the same as that of a
6401 corresponding predefined face. Thus if the predefined face is set up
6402 properly for different frames, the same will hold for the face being
6403 changed by the functions. This is the behavior one might desire in
6404 non-Mule environments mentioned above: face being changed still looks
6405 right in all frames.
6407 How predefined faces might be set up for different frames in such an
6408 environments is described in *Note Face Resources::.
6410 You can set the background color of the specified FACE with the
6411 function `set-face-background'. The argument `color' should be a
6412 string, the name of a color. When called from a program, if the
6413 optional FRAME argument is provided, the face is changed only in that
6414 frame; otherwise, it is changed in all frames.
6416 You can set the background pixmap of the specified FACE with the
6417 function `set-face-background-pixmap'. The pixmap argument NAME should
6418 be a string, the name of a file of pixmap data. The directories listed
6419 in the `x-bitmap-file-path' variable are searched. The bitmap may also
6420 be a list of the form `(WIDTH HEIGHT DATA)', where WIDTH and HEIGHT are
6421 the size in pixels, and DATA is a string containing the raw bits of the
6422 bitmap. If the optional FRAME argument is provided, the face is
6423 changed only in that frame; otherwise, it is changed in all frames.
6425 The variable `x-bitmap-file-path' takes as a value a list of the
6426 directories in which X bitmap files may be found. If the value is
6427 `nil', the list is initialized from the `*bitmapFilePath' resource.
6429 If the environment variable XBMLANGPATH is set, then it is consulted
6430 before the `x-bitmap-file-path' variable.
6432 You can set the font of the specified FACE with the function
6433 `set-face-font'. The FONT argument should be a string, the name of a
6434 font. When called from a program, if the optional FRAME argument is
6435 provided, the face is changed only in that frame; otherwise, it is
6436 changed in all frames.
6438 You can set the foreground color of the specified FACE with the
6439 function `set-face-foreground'. The argument COLOR should be a string,
6440 the name of a color. If the optional FRAME argument is provided, the
6441 face is changed only in that frame; otherwise, it is changed in all
6444 You can set underline the specified FACE with the function
6445 `set-face-underline-p'. The argument UNDERLINE-P can be used to make
6446 underlining an attribute of the face or not. If the optional FRAME
6447 argument is provided, the face is changed only in that frame;
6448 otherwise, it is changed in all frames.
6451 File: xemacs.info, Node: Frame Components, Next: X Resources, Prev: Faces, Up: Customization
6456 You can control the presence and position of most frame components, such
6457 as the menubar, toolbars, and gutters.
6459 This section is not written yet. Try the Lisp Reference Manual:
6460 *Note Menubar: (lispref)Menubar, *Note Toolbar Intro: (lispref)Toolbar
6461 Intro, and *Note Gutter Intro: (lispref)Gutter Intro.
6464 File: xemacs.info, Node: X Resources, Prev: Frame Components, Up: Customization
6469 Historically, XEmacs has used the X resource application class `Emacs'
6470 for its resources. Unfortunately, GNU Emacs uses the same application
6471 class, and resources are not compatible between the two Emacsen. This
6472 sharing of the application class often leads to trouble if you want to
6475 Starting with XEmacs 21, XEmacs uses the class `XEmacs' if it finds
6476 any XEmacs resources in the resource database when the X connection is
6477 initialized. Otherwise, it will use the class `Emacs' for backwards
6478 compatibility. The variable `x-emacs-application-class' may be
6479 consulted to determine the application class being used.
6481 The examples in this section assume the application class is `Emacs'.
6483 The Emacs resources are generally set per-frame. Each Emacs frame
6484 can have its own name or the same name as another, depending on the
6485 name passed to the `make-frame' function.
6487 You can specify resources for all frames with the syntax:
6489 Emacs*parameter: value
6493 Emacs*EmacsFrame.parameter:value
6495 You can specify resources for a particular frame with the syntax:
6497 Emacs*FRAME-NAME.parameter: value
6501 * Geometry Resources:: Controlling the size and position of frames.
6502 * Iconic Resources:: Controlling whether frames come up iconic.
6503 * Resource List:: List of resources settable on a frame or device.
6504 * Face Resources:: Controlling faces using resources.
6505 * Widgets:: The widget hierarchy for XEmacs.
6506 * Menubar Resources:: Specifying resources for the menubar.
6509 File: xemacs.info, Node: Geometry Resources, Next: Iconic Resources, Up: X Resources
6514 To make the default size of all Emacs frames be 80 columns by 55 lines,
6517 Emacs*EmacsFrame.geometry: 80x55
6519 To set the geometry of a particular frame named `fred', do this:
6521 Emacs*fred.geometry: 80x55
6523 Important! Do not use the following syntax:
6525 Emacs*geometry: 80x55
6527 You should never use `*geometry' with any X application. It does not
6528 say "make the geometry of Emacs be 80 columns by 55 lines." It really
6529 says, "make Emacs and all subwindows thereof be 80x55 in whatever units
6530 they care to measure in." In particular, that is both telling the
6531 Emacs text pane to be 80x55 in characters, and telling the menubar pane
6532 to be 80x55 pixels, which is surely not what you want.
6534 As a special case, this geometry specification also works (and sets
6535 the default size of all Emacs frames to 80 columns by 55 lines):
6537 Emacs.geometry: 80x55
6539 since that is the syntax used with most other applications (since most
6540 other applications have only one top-level window, unlike Emacs). In
6541 general, however, the top-level shell (the unmapped ApplicationShell
6542 widget named `Emacs' that is the parent of the shell widgets that
6543 actually manage the individual frames) does not have any interesting
6544 resources on it, and you should set the resources on the frames instead.
6546 The `-geometry' command-line argument sets only the geometry of the
6547 initial frame created by Emacs.
6549 A more complete explanation of geometry-handling is
6551 * The `-geometry' command-line option sets the `Emacs.geometry'
6552 resource, that is, the geometry of the ApplicationShell.
6554 * For the first frame created, the size of the frame is taken from
6555 the ApplicationShell if it is specified, otherwise from the
6556 geometry of the frame.
6558 * For subsequent frames, the order is reversed: First the frame, and
6559 then the ApplicationShell.
6561 * For the first frame created, the position of the frame is taken
6562 from the ApplicationShell (`Emacs.geometry') if it is specified,
6563 otherwise from the geometry of the frame.
6565 * For subsequent frames, the position is taken only from the frame,
6566 and never from the ApplicationShell.
6568 This is rather complicated, but it does seem to provide the most
6569 intuitive behavior with respect to the default sizes and positions of
6570 frames created in various ways.
6573 File: xemacs.info, Node: Iconic Resources, Next: Resource List, Prev: Geometry Resources, Up: X Resources
6578 Analogous to `-geometry', the `-iconic' command-line option sets the
6579 iconic flag of the ApplicationShell (`Emacs.iconic') and always applies
6580 to the first frame created regardless of its name. However, it is
6581 possible to set the iconic flag on particular frames (by name) by using
6582 the `Emacs*FRAME-NAME.iconic' resource.
6585 File: xemacs.info, Node: Resource List, Next: Face Resources, Prev: Iconic Resources, Up: X Resources
6590 Emacs frames accept the following resources:
6592 `geometry' (class `Geometry'): string
6593 Initial geometry for the frame. *Note Geometry Resources::, for a
6594 complete discussion of how this works.
6596 `iconic' (class `Iconic'): boolean
6597 Whether this frame should appear in the iconified state.
6599 `internalBorderWidth' (class `InternalBorderWidth'): int
6600 How many blank pixels to leave between the text and the edge of the
6603 `interline' (class `Interline'): int
6604 How many pixels to leave between each line (may not be
6607 `menubar' (class `Menubar'): boolean
6608 Whether newly-created frames should initially have a menubar. Set
6611 `initiallyUnmapped' (class `InitiallyUnmapped'): boolean
6612 Whether XEmacs should leave the initial frame unmapped when it
6613 starts up. This is useful if you are starting XEmacs as a server
6614 (e.g. in conjunction with gnuserv or the external client widget).
6615 You can also control this with the `-unmapped' command-line option.
6617 `barCursor' (class `BarColor'): boolean
6618 Whether the cursor should be displayed as a bar, or the
6621 `cursorColor' (class `CursorColor'): color-name
6622 The color of the text cursor.
6624 `scrollBarWidth' (class `ScrollBarWidth'): integer
6625 How wide the vertical scrollbars should be, in pixels; 0 means no
6626 vertical scrollbars. You can also use a resource specification of
6627 the form `*scrollbar.width', or the usual toolkit scrollbar
6628 resources: `*XmScrollBar.width' (Motif), `*XlwScrollBar.width'
6629 (Lucid), or `*Scrollbar.thickness' (Athena). We don't recommend
6630 that you use the toolkit resources, though, because they're
6631 dependent on how exactly your particular build of XEmacs was
6634 `scrollBarHeight' (class `ScrollBarHeight'): integer
6635 How high the horizontal scrollbars should be, in pixels; 0 means no
6636 horizontal scrollbars. You can also use a resource specification
6637 of the form `*scrollbar.height', or the usual toolkit scrollbar
6638 resources: `*XmScrollBar.height' (Motif), `*XlwScrollBar.height'
6639 (Lucid), or `*Scrollbar.thickness' (Athena). We don't recommend
6640 that you use the toolkit resources, though, because they're
6641 dependent on how exactly your particular build of XEmacs was
6644 `scrollBarPlacement' (class `ScrollBarPlacement'): string
6645 Where the horizontal and vertical scrollbars should be positioned.
6646 This should be one of the four strings `BOTTOM_LEFT',
6647 `BOTTOM_RIGHT', `TOP_LEFT', and `TOP_RIGHT'. Default is
6648 `BOTTOM_RIGHT' for the Motif and Lucid scrollbars and
6649 `BOTTOM_LEFT' for the Athena scrollbars.
6651 `topToolBarHeight' (class `TopToolBarHeight'): integer
6652 `bottomToolBarHeight' (class `BottomToolBarHeight'): integer
6653 `leftToolBarWidth' (class `LeftToolBarWidth'): integer
6654 `rightToolBarWidth' (class `RightToolBarWidth'): integer
6655 Height and width of the four possible toolbars.
6657 `topToolBarShadowColor' (class `TopToolBarShadowColor'): color-name
6658 `bottomToolBarShadowColor' (class `BottomToolBarShadowColor'): color-name
6659 Color of the top and bottom shadows for the toolbars. NOTE: These
6660 resources do _not_ have anything to do with the top and bottom
6661 toolbars (i.e. the toolbars at the top and bottom of the frame)!
6662 Rather, they affect the top and bottom shadows around the edges of
6663 all four kinds of toolbars.
6665 `topToolBarShadowPixmap' (class `TopToolBarShadowPixmap'): pixmap-name
6666 `bottomToolBarShadowPixmap' (class `BottomToolBarShadowPixmap'): pixmap-name
6667 Pixmap of the top and bottom shadows for the toolbars. If set,
6668 these resources override the corresponding color resources. NOTE:
6669 These resources do _not_ have anything to do with the top and
6670 bottom toolbars (i.e. the toolbars at the top and bottom of the
6671 frame)! Rather, they affect the top and bottom shadows around the
6672 edges of all four kinds of toolbars.
6674 `toolBarShadowThickness' (class `ToolBarShadowThickness'): integer
6675 Thickness of the shadows around the toolbars, in pixels.
6677 `visualBell' (class `VisualBell'): boolean
6678 Whether XEmacs should flash the screen rather than making an
6681 `bellVolume' (class `BellVolume'): integer
6682 Volume of the audible beep.
6684 `useBackingStore' (class `UseBackingStore'): boolean
6685 Whether XEmacs should set the backing-store attribute of the X
6686 windows it creates. This increases the memory usage of the X
6687 server but decreases the amount of X traffic necessary to update
6688 the screen, and is useful when the connection to the X server goes
6689 over a low-bandwidth line such as a modem connection.
6691 Emacs devices accept the following resources:
6693 `textPointer' (class `Cursor'): cursor-name
6694 The cursor to use when the mouse is over text. This resource is
6695 used to initialize the variable `x-pointer-shape'.
6697 `selectionPointer' (class `Cursor'): cursor-name
6698 The cursor to use when the mouse is over a selectable text region
6699 (an extent with the `highlight' property; for example, an Info
6700 cross-reference). This resource is used to initialize the variable
6701 `x-selection-pointer-shape'.
6703 `spacePointer' (class `Cursor'): cursor-name
6704 The cursor to use when the mouse is over a blank space in a buffer
6705 (that is, after the end of a line or after the end-of-file). This
6706 resource is used to initialize the variable
6707 `x-nontext-pointer-shape'.
6709 `modeLinePointer' (class `Cursor'): cursor-name
6710 The cursor to use when the mouse is over a modeline. This
6711 resource is used to initialize the variable `x-mode-pointer-shape'.
6713 `gcPointer' (class `Cursor'): cursor-name
6714 The cursor to display when a garbage-collection is in progress.
6715 This resource is used to initialize the variable
6716 `x-gc-pointer-shape'.
6718 `scrollbarPointer' (class `Cursor'): cursor-name
6719 The cursor to use when the mouse is over the scrollbar. This
6720 resource is used to initialize the variable
6721 `x-scrollbar-pointer-shape'.
6723 `pointerColor' (class `Foreground'): color-name
6724 `pointerBackground' (class `Background'): color-name
6725 The foreground and background colors of the mouse cursor. These
6726 resources are used to initialize the variables
6727 `x-pointer-foreground-color' and `x-pointer-background-color'.
6730 File: xemacs.info, Node: Face Resources, Next: Widgets, Prev: Resource List, Up: X Resources
6735 The attributes of faces are also per-frame. They can be specified as:
6737 Emacs.FACE_NAME.parameter: value
6741 Emacs*FRAME_NAME.FACE_NAME.parameter: value
6743 Faces accept the following resources:
6745 `attributeFont' (class `AttributeFont'): font-name
6746 The font of this face.
6748 `attributeForeground' (class `AttributeForeground'): color-name
6749 `attributeBackground' (class `AttributeBackground'): color-name
6750 The foreground and background colors of this face.
6752 `attributeBackgroundPixmap' (class `AttributeBackgroundPixmap'): file-name
6753 The name of an XBM file (or XPM file, if your version of Emacs
6754 supports XPM), to use as a background stipple.
6756 `attributeUnderline' (class `AttributeUnderline'): boolean
6757 Whether text in this face should be underlined.
6759 All text is displayed in some face, defaulting to the face named
6760 `default'. To set the font of normal text, use
6761 `Emacs*default.attributeFont'. To set it in the frame named `fred', use
6762 `Emacs*fred.default.attributeFont'.
6764 These are the names of the predefined faces:
6767 Everything inherits from this.
6770 If this is not specified in the resource database, Emacs tries to
6771 find a bold version of the font of the default face.
6774 If this is not specified in the resource database, Emacs tries to
6775 find an italic version of the font of the default face.
6778 If this is not specified in the resource database, Emacs tries to
6779 find a bold-italic version of the font of the default face.
6782 This is the face that the modeline is displayed in. If not
6783 specified in the resource database, it is determined from the
6784 default face by reversing the foreground and background colors.
6787 This is the face that highlighted extents (for example, Info
6788 cross-references and possible completions, when the mouse passes
6789 over them) are displayed in.
6793 These are the faces that the left and right annotation margins are
6797 This is the face that mouse selections are displayed in.
6800 This is the face that the matched text being searched for is
6804 This is the face of info menu items. If unspecified, it is copied
6808 This is the face of info cross-references. If unspecified, it is
6809 copied from `bold'. (Note that, when the mouse passes over a
6810 cross-reference, the cross-reference's face is determined from a
6811 combination of the `info-xref' and `highlight' faces.)
6813 Other packages might define their own faces; to see a list of all
6814 faces, use any of the interactive face-manipulation commands such as
6815 `set-face-font' and type `?' when you are prompted for the name of a
6818 If the `bold', `italic', and `bold-italic' faces are not specified
6819 in the resource database, then XEmacs attempts to derive them from the
6820 font of the default face. It can only succeed at this if you have
6821 specified the default font using the XLFD (X Logical Font Description)
6822 format, which looks like
6824 *-courier-medium-r-*-*-*-120-*-*-*-*-*-*
6826 If you use any of the other, less strict font name formats, some of
6829 lucidasanstypewriter-12
6833 then XEmacs won't be able to guess the names of the bold and italic
6834 versions. All X fonts can be referred to via XLFD-style names, so you
6835 should use those forms. See the man pages for `X(1)', `xlsfonts(1)',
6839 File: xemacs.info, Node: Widgets, Next: Menubar Resources, Prev: Face Resources, Up: X Resources
6844 There are several structural widgets between the terminal EmacsFrame
6845 widget and the top level ApplicationShell; the exact names and types of
6846 these widgets change from release to release (for example, they changed
6847 between 19.8 and 19.9, 19.9 and 19.10, and 19.10 and 19.12) and are
6848 subject to further change in the future, so you should avoid mentioning
6849 them in your resource database. The above-mentioned syntaxes should be
6850 forward- compatible. As of 19.13, the exact widget hierarchy is as
6853 INVOCATION-NAME "shell" "container" FRAME-NAME
6854 x-emacs-application-class "EmacsShell" "EmacsManager" "EmacsFrame"
6856 where INVOCATION-NAME is the terminal component of the name of the
6857 XEmacs executable (usually `xemacs'), and `x-emacs-application-class'
6858 is generally `Emacs'.
6861 File: xemacs.info, Node: Menubar Resources, Prev: Widgets, Up: X Resources
6866 As the menubar is implemented as a widget which is not a part of XEmacs
6867 proper, it does not use the face mechanism for specifying fonts and
6868 colors: It uses whatever resources are appropriate to the type of widget
6869 which is used to implement it.
6871 If Emacs was compiled to use only the Lucid Motif-lookalike menu
6872 widgets, then one way to specify the font of the menubar would be
6874 Emacs*menubar*font: *-courier-medium-r-*-*-*-120-*-*-*-*-*-*
6876 If both the Lucid Motif-lookalike menu widgets and X Font Sets are
6877 configured to allow multilingual menubars, then one uses
6879 *menubar*FontSet: -*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-*, \
6880 -*-*-*-*-*-*-*-120-*-jisx0208.1983-0
6882 That would specify fonts for a Japanese menubar. Specifying only one
6883 XLFD is acceptable; specifying more than one for a given registry
6884 (language) is also allowed. When X Font Sets are configured, some .font
6885 resources (eg, menubars) are ignored in favor of the corresponding
6888 If the Motif library is being used, then one would have to use
6890 Emacs*menubar*fontList: *-courier-medium-r-*-*-*-120-*-*-*-*-*-*
6892 because the Motif library uses the `fontList' resource name instead
6893 of `font', which has subtly different semantics.
6895 The same is true of the scrollbars: They accept whichever resources
6896 are appropriate for the toolkit in use.
6899 File: xemacs.info, Node: Quitting, Next: Lossage, Prev: Customization, Up: Top
6901 Quitting and Aborting
6902 =====================
6905 Quit. Cancel running or partially typed command.
6908 Abort innermost recursive editing level and cancel the command
6909 which invoked it (`abort-recursive-edit').
6912 Abort all recursive editing levels that are currently executing.
6915 Cancel an already-executed command, usually (`undo').
6917 There are two ways of cancelling commands which are not finished
6918 executing: "quitting" with `C-g', and "aborting" with `C-]' or `M-x
6919 top-level'. Quitting is cancelling a partially typed command or one
6920 which is already running. Aborting is getting out of a recursive
6921 editing level and cancelling the command that invoked the recursive
6924 Quitting with `C-g' is used for getting rid of a partially typed
6925 command or a numeric argument that you don't want. It also stops a
6926 running command in the middle in a relatively safe way, so you can use
6927 it if you accidentally start executing a command that takes a long
6928 time. In particular, it is safe to quit out of killing; either your
6929 text will ALL still be there, or it will ALL be in the kill ring (or
6930 maybe both). Quitting an incremental search does special things
6931 documented under searching; in general, it may take two successive
6932 `C-g' characters to get out of a search. `C-g' works by setting the
6933 variable `quit-flag' to `t' the instant `C-g' is typed; Emacs Lisp
6934 checks this variable frequently and quits if it is non-`nil'. `C-g' is
6935 only actually executed as a command if it is typed while Emacs is
6938 If you quit twice in a row before the first `C-g' is recognized, you
6939 activate the "emergency escape" feature and return to the shell. *Note
6942 You can use `C-]' (`abort-recursive-edit') to get out of a recursive
6943 editing level and cancel the command which invoked it. Quitting with
6944 `C-g' does not do this, and could not do this because it is used to
6945 cancel a partially typed command within the recursive editing level.
6946 Both operations are useful. For example, if you are in the Emacs
6947 debugger (*note Lisp Debug::) and have typed `C-u 8' to enter a numeric
6948 argument, you can cancel that argument with `C-g' and remain in the
6951 The command `M-x top-level' is equivalent to "enough" `C-]' commands
6952 to get you out of all the levels of recursive edits that you are in.
6953 `C-]' only gets you out one level at a time, but `M-x top-level' goes
6954 out all levels at once. Both `C-]' and `M-x top-level' are like all
6955 other commands and unlike `C-g' in that they are effective only when
6956 Emacs is ready for a command. `C-]' is an ordinary key and has its
6957 meaning only because of its binding in the keymap. *Note Recursive
6960 `C-x u' (`undo') is not strictly speaking a way of cancelling a
6961 command, but you can think of it as cancelling a command already
6962 finished executing. *Note Undo::.
6965 File: xemacs.info, Node: Lossage, Next: Bugs, Prev: Quitting, Up: Top
6967 Dealing With Emacs Trouble
6968 ==========================
6970 This section describes various conditions in which Emacs fails to work,
6971 and how to recognize them and correct them.
6975 * Stuck Recursive:: `[...]' in mode line around the parentheses.
6976 * Screen Garbled:: Garbage on the screen.
6977 * Text Garbled:: Garbage in the text.
6978 * Unasked-for Search:: Spontaneous entry to incremental search.
6979 * Emergency Escape:: Emergency escape---
6980 What to do if Emacs stops responding.
6981 * Total Frustration:: When you are at your wits' end.
6984 File: xemacs.info, Node: Stuck Recursive, Next: Screen Garbled, Prev: Lossage, Up: Lossage
6986 Recursive Editing Levels
6987 ------------------------
6989 Recursive editing levels are important and useful features of Emacs, but
6990 they can seem like malfunctions to the user who does not understand
6993 If the mode line has square brackets `[...]' around the parentheses
6994 that contain the names of the major and minor modes, you have entered a
6995 recursive editing level. If you did not do this on purpose, or if you
6996 don't understand what that means, you should just get out of the
6997 recursive editing level. To do so, type `M-x top-level'. This is
6998 called getting back to top level. *Note Recursive Edit::.
7001 File: xemacs.info, Node: Screen Garbled, Next: Text Garbled, Prev: Stuck Recursive, Up: Lossage
7003 Garbage on the Screen
7004 ---------------------
7006 If the data on the screen looks wrong, the first thing to do is see
7007 whether the text is actually wrong. Type `C-l', to redisplay the
7008 entire screen. If the text appears correct after this, the problem was
7009 entirely in the previous screen update.
7011 Display updating problems often result from an incorrect termcap
7012 entry for the terminal you are using. The file `etc/TERMS' in the Emacs
7013 distribution gives the fixes for known problems of this sort.
7014 `INSTALL' contains general advice for these problems in one of its
7015 sections. Very likely there is simply insufficient padding for certain
7016 display operations. To investigate the possibility that you have this
7017 sort of problem, try Emacs on another terminal made by a different
7018 manufacturer. If problems happen frequently on one kind of terminal but
7019 not another kind, the real problem is likely to be a bad termcap entry,
7020 though it could also be due to a bug in Emacs that appears for terminals
7021 that have or lack specific features.
7024 File: xemacs.info, Node: Text Garbled, Next: Unasked-for Search, Prev: Screen Garbled, Up: Lossage
7029 If `C-l' shows that the text is wrong, try undoing the changes to it
7030 using `C-x u' until it gets back to a state you consider correct. Also
7031 try `C-h l' to find out what command you typed to produce the observed
7034 If a large portion of text appears to be missing at the beginning or
7035 end of the buffer, check for the word `Narrow' in the mode line. If it
7036 appears, the text is still present, but marked off-limits. To make it
7037 visible again, type `C-x n w'. *Note Narrowing::.
7040 File: xemacs.info, Node: Unasked-for Search, Next: Emergency Escape, Prev: Text Garbled, Up: Lossage
7042 Spontaneous Entry to Incremental Search
7043 ---------------------------------------
7045 If Emacs spontaneously displays `I-search:' at the bottom of the
7046 screen, it means that the terminal is sending `C-s' and `C-q' according
7047 to the poorly designed xon/xoff "flow control" protocol. You should
7048 try to prevent this by putting the terminal in a mode where it will not
7049 use flow control, or by giving it enough padding that it will never
7050 send a `C-s'. If that cannot be done, you must tell Emacs to expect
7051 flow control to be used, until you can get a properly designed terminal.
7053 Information on how to do these things can be found in the file
7054 `INSTALL' in the Emacs distribution.
7057 File: xemacs.info, Node: Emergency Escape, Next: Total Frustration, Prev: Unasked-for Search, Up: Lossage
7062 Because at times there have been bugs causing Emacs to loop without
7063 checking `quit-flag', a special feature causes Emacs to be suspended
7064 immediately if you type a second `C-g' while the flag is already set,
7065 so you can always get out of XEmacs. Normally Emacs recognizes and
7066 clears `quit-flag' (and quits!) quickly enough to prevent this from
7069 When you resume Emacs after a suspension caused by multiple `C-g', it
7070 asks two questions before going back to what it had been doing:
7073 Abort (and dump core)? (y or n)
7075 Answer each one with `y' or `n' followed by <RET>.
7077 Saying `y' to `Auto-save?' causes immediate auto-saving of all
7078 modified buffers in which auto-saving is enabled.
7080 Saying `y' to `Abort (and dump core)?' causes an illegal instruction
7081 to be executed, dumping core. This is to enable a wizard to figure out
7082 why Emacs was failing to quit in the first place. Execution does not
7083 continue after a core dump. If you answer `n', execution does
7084 continue. With luck, Emacs will ultimately check `quit-flag' and quit
7085 normally. If not, and you type another `C-g', it is suspended again.
7087 If Emacs is not really hung, but is just being slow, you may invoke
7088 the double `C-g' feature without really meaning to. In that case,
7089 simply resume and answer `n' to both questions, and you will arrive at
7090 your former state. Presumably the quit you requested will happen soon.
7092 The double-`C-g' feature may be turned off when Emacs is running
7093 under a window system, since the window system always enables you to
7094 kill Emacs or to create another window and run another program.
7097 File: xemacs.info, Node: Total Frustration, Prev: Emergency Escape, Up: Lossage
7099 Help for Total Frustration
7100 --------------------------
7102 If using Emacs (or something else) becomes terribly frustrating and none
7103 of the techniques described above solve the problem, Emacs can still
7106 First, if the Emacs you are using is not responding to commands, type
7107 `C-g C-g' to get out of it and then start a new one.
7109 Second, type `M-x doctor <RET>'.
7111 The doctor will make you feel better. Each time you say something to
7112 the doctor, you must end it by typing <RET> <RET>. This lets the
7113 doctor know you are finished.
7116 File: xemacs.info, Node: Bugs, Prev: Lossage, Up: Top
7121 Sometimes you will encounter a bug in Emacs. Although we cannot promise
7122 we can or will fix the bug, and we might not even agree that it is a
7123 bug, we want to hear about bugs you encounter in case we do want to fix
7126 To make it possible for us to fix a bug, you must report it. In
7127 order to do so effectively, you must know when and how to do it.
7132 If Emacs executes an illegal instruction, or dies with an operating
7133 system error message that indicates a problem in the program (as
7134 opposed to something like "disk full"), then it is certainly a bug.
7136 If Emacs updates the display in a way that does not correspond to
7137 what is in the buffer, then it is certainly a bug. If a command seems
7138 to do the wrong thing but the problem corrects itself if you type
7139 `C-l', it is a case of incorrect display updating.
7141 Taking forever to complete a command can be a bug, but you must make
7142 certain that it was really Emacs's fault. Some commands simply take a
7143 long time. Type `C-g' and then `C-h l' to see whether the input Emacs
7144 received was what you intended to type; if the input was such that you
7145 KNOW it should have been processed quickly, report a bug. If you don't
7146 know whether the command should take a long time, find out by looking
7147 in the manual or by asking for assistance.
7149 If a command you are familiar with causes an Emacs error message in a
7150 case where its usual definition ought to be reasonable, it is probably a
7153 If a command does the wrong thing, that is a bug. But be sure you
7154 know for certain what it ought to have done. If you aren't familiar
7155 with the command, or don't know for certain how the command is supposed
7156 to work, then it might actually be working right. Rather than jumping
7157 to conclusions, show the problem to someone who knows for certain.
7159 Finally, a command's intended definition may not be best for editing
7160 with. This is a very important sort of problem, but it is also a
7161 matter of judgment. Also, it is easy to come to such a conclusion out
7162 of ignorance of some of the existing features. It is probably best not
7163 to complain about such a problem until you have checked the
7164 documentation in the usual ways, feel confident that you understand it,
7165 and know for certain that what you want is not available. If you are
7166 not sure what the command is supposed to do after a careful reading of
7167 the manual, check the index and glossary for any terms that may be
7168 unclear. If you still do not understand, this indicates a bug in the
7169 manual. The manual's job is to make everything clear. It is just as
7170 important to report documentation bugs as program bugs.
7172 If the online documentation string of a function or variable
7173 disagrees with the manual, one of them must be wrong, so report the bug.
7178 When you decide that there is a bug, it is important to report it and to
7179 report it in a way which is useful. What is most useful is an exact
7180 description of what commands you type, starting with the shell command
7181 to run Emacs, until the problem happens. Always include the version
7182 number of Emacs that you are using; type `M-x emacs-version' to print
7185 The most important principle in reporting a bug is to report FACTS,
7186 not hypotheses or categorizations. It is always easier to report the
7187 facts, but people seem to prefer to strain to posit explanations and
7188 report them instead. If the explanations are based on guesses about
7189 how Emacs is implemented, they will be useless; we will have to try to
7190 figure out what the facts must have been to lead to such speculations.
7191 Sometimes this is impossible. But in any case, it is unnecessary work
7194 For example, suppose that you type `C-x C-f /glorp/baz.ugh <RET>',
7195 visiting a file which (you know) happens to be rather large, and Emacs
7196 prints out `I feel pretty today'. The best way to report the bug is
7197 with a sentence like the preceding one, because it gives all the facts
7198 and nothing but the facts.
7200 Do not assume that the problem is due to the size of the file and
7201 say, "When I visit a large file, Emacs prints out `I feel pretty
7202 today'." This is what we mean by "guessing explanations". The problem
7203 is just as likely to be due to the fact that there is a `z' in the file
7204 name. If this is so, then when we got your report, we would try out
7205 the problem with some "large file", probably with no `z' in its name,
7206 and not find anything wrong. There is no way in the world that we
7207 could guess that we should try visiting a file with a `z' in its name.
7209 Alternatively, the problem might be due to the fact that the file
7210 starts with exactly 25 spaces. For this reason, you should make sure
7211 that you inform us of the exact contents of any file that is needed to
7212 reproduce the bug. What if the problem only occurs when you have typed
7213 the `C-x a l' command previously? This is why we ask you to give the
7214 exact sequence of characters you typed since starting to use Emacs.
7216 You should not even say "visit a file" instead of `C-x C-f' unless
7217 you know that it makes no difference which visiting command is used.
7218 Similarly, rather than saying "if I have three characters on the line,"
7219 say "after I type `<RET> A B C <RET> C-p'," if that is the way you
7222 If you are not in Fundamental mode when the problem occurs, you
7223 should say what mode you are in.
7225 If the manifestation of the bug is an Emacs error message, it is
7226 important to report not just the text of the error message but a
7227 backtrace showing how the Lisp program in Emacs arrived at the error.
7228 To make the backtrace, you must execute the Lisp expression `(setq
7229 debug-on-error t)' before the error happens (that is to say, you must
7230 execute that expression and then make the bug happen). This causes the
7231 Lisp debugger to run (*note Lisp Debug::). The debugger's backtrace
7232 can be copied as text into the bug report. This use of the debugger is
7233 possible only if you know how to make the bug happen again. Do note
7234 the error message the first time the bug happens, so if you can't make
7235 it happen again, you can report at least that.
7237 Check whether any programs you have loaded into the Lisp world,
7238 including your init file, set any variables that may affect the
7239 functioning of Emacs. *Note Init File::. Also, see whether the
7240 problem happens in a freshly started Emacs without loading your init
7241 file (start Emacs with the `-q' switch to prevent loading the init
7242 file). If the problem does NOT occur then, it is essential that we
7243 know the contents of any programs that you must load into the Lisp
7244 world in order to cause the problem to occur.
7246 If the problem does depend on an init file or other Lisp programs
7247 that are not part of the standard Emacs system, then you should make
7248 sure it is not a bug in those programs by complaining to their
7249 maintainers first. After they verify that they are using Emacs in a
7250 way that is supposed to work, they should report the bug.
7252 If you can tell us a way to cause the problem without visiting any
7253 files, please do so. This makes it much easier to debug. If you do
7254 need files, make sure you arrange for us to see their exact contents.
7255 For example, it can often matter whether there are spaces at the ends
7256 of lines, or a newline after the last line in the buffer (nothing ought
7257 to care whether the last line is terminated, but tell that to the bugs).
7259 The easy way to record the input to Emacs precisely is to write a
7260 dribble file; execute the Lisp expression:
7262 (open-dribble-file "~/dribble")
7264 using `Meta-<ESC>' or from the `*scratch*' buffer just after starting
7265 Emacs. From then on, all Emacs input will be written in the specified
7266 dribble file until the Emacs process is killed.
7268 For possible display bugs, it is important to report the terminal
7269 type (the value of environment variable `TERM'), the complete termcap
7270 entry for the terminal from `/etc/termcap' (since that file is not
7271 identical on all machines), and the output that Emacs actually sent to
7272 the terminal. The way to collect this output is to execute the Lisp
7275 (open-termscript "~/termscript")
7277 using `Meta-<ESC>' or from the `*scratch*' buffer just after starting
7278 Emacs. From then on, all output from Emacs to the terminal will be
7279 written in the specified termscript file as well, until the Emacs
7280 process is killed. If the problem happens when Emacs starts up, put
7281 this expression into your init file so that the termscript file will be
7282 open when Emacs displays the screen for the first time. *Note Init
7283 File::. Be warned: it is often difficult, and sometimes impossible, to
7284 fix a terminal-dependent bug without access to a terminal of the type
7285 that stimulates the bug.
7287 The newsgroup `comp.emacs.xemacs' may be used for bug reports, other
7288 discussions and requests for assistance.
7290 If you don't have access to this newgroup, you can subscribe to the
7291 mailing list version: the newsgroup is bidirectionally gatewayed into
7292 the mailing list `xemacs@xemacs.org'.
7294 To be added or removed from this mailing list, send mail to
7295 `xemacs-request@xemacs.org'. Do not send requests for addition to the
7296 mailing list itself.
7298 The mailing lists and newsgroups are archived on our anonymous FTP
7299 server, `ftp.xemacs.org', and at various other archive sites around the
7300 net. You should also check the `FAQ' in `/pub/xemacs' on our anonymous
7301 FTP server. It provides some introductory information and help for
7302 initial configuration problems.