XEmacs 21.2.22 "Mercedes".
[chise/xemacs-chise.git.1] / info / xemacs.info-3
1 This is ../info/xemacs.info, produced by makeinfo version 4.0 from
2 xemacs/xemacs.texi.
3
4 INFO-DIR-SECTION XEmacs Editor
5 START-INFO-DIR-ENTRY
6 * XEmacs: (xemacs).             XEmacs Editor.
7 END-INFO-DIR-ENTRY
8
9    This file documents the XEmacs editor.
10
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.
14
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.
18
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.
25
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.
31
32 \1f
33 File: xemacs.info,  Node: Exiting,  Next: Command Switches,  Prev: Entering Emacs,  Up: Top
34
35 Exiting Emacs
36 =============
37
38    There are two commands for exiting Emacs because there are two kinds
39 of exiting: "suspending" Emacs and "killing" Emacs.  "Suspending" means
40 stopping Emacs temporarily and returning control to its superior
41 (usually the shell), allowing you to resume editing later in the same
42 Emacs job, with the same files, same kill ring, same undo history, and
43 so on.  This is the usual way to exit.  "Killing" Emacs means
44 destroying the Emacs job.  You can run Emacs again later, but you will
45 get a fresh Emacs; there is no way to resume the same editing session
46 after it has been killed.
47
48 `C-z'
49      Suspend Emacs (`suspend-emacs').  If used under the X window
50      system, shrink the X window containing the Emacs frame to an icon
51      (see below).
52
53 `C-x C-c'
54      Kill Emacs (`save-buffers-kill-emacs').
55
56    If you use XEmacs under the X window system, `C-z' shrinks the X
57 window containing the Emacs frame to an icon.  The Emacs process is
58 stopped temporarily, and control is returned to the window manager.  If
59 more than one frame is associated with the Emacs process, only the
60 frame from which you used `C-z' is retained.  The X windows containing
61 the other Emacs frames are closed.
62
63    To activate the "suspended" Emacs, use the appropriate window manager
64 mouse gestures.  Usually left-clicking on the icon reactivates and
65 reopens the X window containing the Emacs frame, but the window manager
66 you use determines what exactly happens.  To actually kill the Emacs
67 process, use `C-x C-c' or the Exit Emacs item on the File menu.
68
69    On systems that do not permit programs to be suspended, `C-z' runs
70 an inferior shell that communicates directly with the terminal, and
71 Emacs waits until you exit the subshell.  On these systems, the only way
72 to return to the shell from which Emacs was started (to log out, for
73 example) is to kill Emacs.  `C-d' or `exit' are typical commands to
74 exit a subshell.
75
76    To kill Emacs, type `C-x C-c' (`save-buffers-kill-emacs').  A
77 two-character key is used for this to make it harder to type.  In
78 XEmacs, selecting the Exit Emacs option of the File menu is an
79 alternate way of issuing the command.
80
81    Unless a numeric argument is used, this command first offers to save
82 any modified buffers.  If you do not save all buffers, you are asked for
83 reconfirmation with `yes' before killing Emacs, since any changes not
84 saved will be lost.  If any subprocesses are still running, `C-x C-c'
85 asks you to confirm killing them, since killing Emacs kills the
86 subprocesses simultaneously.
87
88    In most programs running on Unix, certain characters may instantly
89 suspend or kill the program.  (In Berkeley Unix these characters are
90 normally `C-z' and `C-c'.)  This Unix feature is turned off while you
91 are in Emacs. The meanings of `C-z' and `C-x C-c' as keys in Emacs were
92 inspired by the standard Berkeley Unix meanings of `C-z' and `C-c', but
93 that is their only relationship with Unix.  You could customize these
94 keys to do anything (*note Keymaps::).
95
96 \1f
97 File: xemacs.info,  Node: Command Switches,  Next: Startup Paths,  Prev: Exiting,  Up: Top
98
99 Command Line Switches and Arguments
100 ===================================
101
102    XEmacs supports command line arguments you can use to request
103 various actions when invoking Emacs.  The commands are for compatibility
104 with other editors and for sophisticated activities.  If you are using
105 XEmacs under the X window system, you can also use a number of standard
106 Xt command line arguments. Command line arguments are not usually
107 needed for editing with Emacs; new users can skip this section.
108
109    Many editors are designed to be started afresh each time you want to
110 edit.  You start the editor to edit one file; then exit the editor.  The
111 next time you want to edit either another file or the same one, you
112 start the editor again.  Under these circumstances, it makes sense to
113 use a command line argument to say which file to edit.
114
115    The recommended way to use XEmacs is to start it only once, just
116 after you log in, and do all your editing in the same Emacs process.
117 Each time you want to edit a file, you visit it using the existing
118 Emacs.  Emacs creates a new buffer for each file, and (unless you kill
119 some of the buffers) Emacs eventually has many files in it ready for
120 editing.  Usually you do not kill the Emacs process until you are about
121 to log out.  Since you usually read files by typing commands to Emacs,
122 command line arguments for specifying a file when Emacs is started are
123 seldom needed.
124
125    Emacs accepts command-line arguments that specify files to visit,
126 functions to call, and other activities and operating modes.  If you are
127 running XEmacs under the X window system, a number of standard Xt
128 command line arguments are available as well.
129
130    The following subsections list:
131    * Command line arguments that you can always use
132
133    * Command line arguments that have to appear at the beginning of the
134      argument list
135
136    * Command line arguments that are only relevant if you are running
137      XEmacs under X
138
139 Command Line Arguments for Any Position
140 ---------------------------------------
141
142    Command line arguments are processed in the order they appear on the
143 command line; however, certain arguments (the ones in the second table)
144 must be at the front of the list if they are used.
145
146    Here are the arguments allowed:
147
148 `FILE'
149      Visit FILE using `find-file'.  *Note Visiting::.
150
151 `+LINENUM FILE'
152      Visit FILE using `find-file', then go to line number LINENUM in it.
153
154 `-load FILE'
155 `-l FILE'
156      Load a file FILE of Lisp code with the function `load'.  *Note
157      Lisp Libraries::.
158
159 `-funcall FUNCTION'
160 `-f FUNCTION'
161      Call Lisp function FUNCTION with no arguments.
162
163 `-eval FUNCTION'
164      Interpret the next argument as a Lisp expression, and evaluate it.
165      You must be very careful of the shell quoting here.
166
167 `-insert FILE'
168 `-i FILE'
169      Insert the contents of FILE into the current buffer.  This is like
170      what `M-x insert-buffer' does; *Note Misc File Ops::.
171
172 `-kill'
173      Exit from Emacs without asking for confirmation.
174
175 `-version'
176 `-V'
177      Prints version information.  This implies `-batch'.
178
179           % xemacs -version
180           XEmacs 19.13 of Mon Aug 21 1995 on willow (usg-unix-v) [formerly Lucid Emacs]
181
182 `-help'
183      Prints a summary of command-line options and then exits.
184
185 Command Line Arguments (Beginning of Line Only)
186 -----------------------------------------------
187
188    The following arguments are recognized only at the beginning of the
189 command line.  If more than one of them appears, they must appear in the
190 order in which they appear in this table.
191
192 `-t FILE'
193      Use FILE instead of the terminal for input and output.  This
194      implies the `-nw' option, documented below.
195
196 `-batch'
197      Run Emacs in "batch mode", which means that the text being edited
198      is not displayed and the standard Unix interrupt characters such as
199      `C-z' and `C-c' continue to have their normal effect.  Emacs in
200      batch mode outputs to `stderr' only what would normally be printed
201      in the echo area under program control.
202
203      Batch mode is used for running programs written in Emacs Lisp from
204      shell scripts, makefiles, and so on.  Normally the `-l' switch or
205      `-f' switch will be used as well, to invoke a Lisp program to do
206      the batch processing.
207
208      `-batch' implies `-q' (do not load an init file).  It also causes
209      Emacs to kill itself after all command switches have been
210      processed.  In addition, auto-saving is not done except in buffers
211      for which it has been explicitly requested.
212
213 `-nw'
214      Start up XEmacs in TTY mode (using the TTY XEmacs was started
215      from), rather than trying to connect to an X display.  Note that
216      this happens automatically if the `DISPLAY' environment variable
217      is not set.
218
219 `-debug-init'
220      Enter the debugger if an error in the init file occurs.
221
222 `-debug-paths'
223      Displays information on how XEmacs constructs the various paths
224      into its hierarchy on startup.  (See also *note Startup Paths::.)
225
226 `-unmapped'
227      Do not map the initial frame.  This is useful if you want to start
228      up XEmacs as a server (e.g. for gnuserv screens or external client
229      widgets).
230
231 `-no-init-file'
232 `-q'
233      Do not load your Emacs init file `~/.emacs'.
234
235 `-no-site-file'
236      Do not load the site-specific init file `lisp/site-start.el'.
237
238 `-no-autoloads'
239      Do not load global symbol files (`auto-autoloads') at startup.
240      This implies `-vanilla'.
241
242 `-no-early-packages'
243      Do not process early packages.  (For more information on startup
244      issues concerning the package system, *Note Startup Paths::.)
245
246 `-vanilla'
247      This is equivalent to `-q -no-site-file -no-early-packages'.
248
249 `-user-init-file FILE'
250      Load FILE as your Emacs init file instead of `~/.emacs'.
251
252 `-user-init-directory DIRECTORY'
253      Use DIRECTORY as the location of your early package hierarchies
254      and the various user-specific initialization files.
255
256 `-user USER'
257 `-u USER'
258      Equivalent to `-user-init-file ~USER/.emacs -user-init-directory
259      ~USER/.xemacs'.
260
261    Note that the init file can get access to the command line argument
262 values as the elements of a list in the variable `command-line-args'.
263 (The arguments in the second table above will already have been
264 processed and will not be in the list.)  The init file can override the
265 normal processing of the other arguments by setting this variable.
266
267    One way to use command switches is to visit many files automatically:
268
269      xemacs *.c
270
271 passes each `.c' file as a separate argument to Emacs, so that Emacs
272 visits each file (*note Visiting::).
273
274    Here is an advanced example that assumes you have a Lisp program file
275 called `hack-c-program.el' which, when loaded, performs some useful
276 operation on the current buffer, expected to be a C program.
277
278      xemacs -batch foo.c -l hack-c-program -f save-buffer -kill > log
279
280 Here Emacs is told to visit `foo.c', load `hack-c-program.el' (which
281 makes changes in the visited file), save `foo.c' (note that
282 `save-buffer' is the function that `C-x C-s' is bound to), and then
283 exit to the shell from which the command was executed.  `-batch'
284 guarantees there will be no problem redirecting output to `log',
285 because Emacs will not assume that it has a display terminal to work
286 with.
287
288 Command Line Arguments (for XEmacs Under X)
289 -------------------------------------------
290
291    If you are running XEmacs under X, a number of options are available
292 to control color, border, and window title and icon name:
293
294 `-title TITLE'
295 `-wn TITLE'
296 `-T TITLE'
297      Use TITLE as the window title. This sets the `frame-title-format'
298      variable, which controls the title of the X window corresponding
299      to the selected frame.  This is the same format as
300      `mode-line-format'.
301
302 `-iconname TITLE'
303 `-in TITLE'
304      Use TITLE as the icon name. This sets the
305      `frame-icon-title-format' variable, which controls the title of
306      the icon corresponding to the selected frame.
307
308 `-mc COLOR'
309      Use COLOR as the mouse color.
310
311 `-cr COLOR'
312      Use COLOR as the text-cursor foreground color.
313
314 `-private'
315      Install a private colormap for XEmacs.
316
317    In addition, XEmacs allows you to use a number of standard Xt
318 command line arguments.
319
320 `-background COLOR'
321 `-bg COLOR'
322      Use COLOR as the background color.
323
324 `-bordercolor COLOR'
325 `-bd COLOR'
326      Use COLOR as the border color.
327
328 `-borderwidth WIDTH'
329 `-bw WIDTH'
330      Use WIDTH as the border width.
331
332 `-display DISPLAY'
333 `-d DISPLAY'
334      When running under the X window system, create the window
335      containing the Emacs frame on the display named DISPLAY.
336
337 `-foreground COLOR'
338 `-fg COLOR'
339      Use COLOR as the foreground color.
340
341 `-font NAME'
342 `-fn NAME'
343      Use NAME as the default font.
344
345 `-geometry SPEC'
346 `-geom SPEC'
347 `-g SPEC'
348      Use the geometry (window size and/or position) specified by SPEC.
349
350 `-iconic'
351      Start up iconified.
352
353 `-rv'
354      Bring up Emacs in reverse video.
355
356 `-name NAME'
357      Use the resource manager resources specified by NAME.  The default
358      is to use the name of the program (`argv[0]') as the resource
359      manager name.
360
361 `-xrm'
362      Read something into the resource database for this invocation of
363      Emacs only.
364
365 \1f
366 File: xemacs.info,  Node: Startup Paths,  Next: Basic,  Prev: Command Switches,  Up: Top
367
368 How XEmacs finds Directories and Files
369 ======================================
370
371    XEmacs deals with a multitude of files during operation.  These files
372 are spread over many directories, and XEmacs determines the location of
373 most of these directories at startup and organizes them into various
374 paths.  (A "path", for the purposes of this section, is simply a list
375 of directories which XEmacs searches successively in order to locate a
376 file.)
377
378 XEmacs Directory Hierarchies
379 ----------------------------
380
381    Many of the files XEmacs looks for are located within the XEmacs
382 installation itself.  However, there are several views of what actually
383 constitutes the "XEmacs installation": XEmacs may be run from the
384 compilation directory, it may be installed into arbitrary directories,
385 spread over several directories unrelated to each other.  Moreover, it
386 may subsequently be moved to a different place.  (This last case is not
387 as uncommon as it sounds.  Binary kits work this way.)  Consequently,
388 XEmacs has quite complex procedures in place to find directories, no
389 matter where they may be hidden.
390
391    XEmacs will always respect directory options passed to `configure'.
392 However, if it cannot locate a directory at the configured place, it
393 will initiate a search for the directory in any of a number of
394 "hierarchies" rooted under a directory which XEmacs assumes contain
395 parts of the XEmacs installation; it may locate several such hierarchies
396 and search across them.  (Typically, there are just one or two
397 hierarchies: the hierarchy where XEmacs was or will be installed, and
398 the one where it is being built.)  Such a directory containing a
399 hierarchy is called a "root".  Whenever this section refers to a
400 directory using the shorthand `<root>', it means that XEmacs searches
401 for it under all hierarchies under all hierarchies XEmacs was able to
402 scrounge up.  In a running XEmacs, the hierarchy roots are stored in
403 the variable `emacs-roots'.
404
405 Package Hierarchies
406 -------------------
407
408    Many relevant directories and files XEmacs uses are actually not
409 part of the core installation.  They are part of any of the many
410 packages usually installed on top of an XEmacs installation.  (*Note
411 Packages::.)  Hence, they play a prominent role in the various paths
412 XEmacs sets up.
413
414    XEmacs locates packages in any of a number of package hierarchies.
415 Package hierarchies fall into three groups: "early", "late", and "last",
416 according to the relative location at which they show up in the various
417 XEmacs paths.  Early package hierarchies are at the very front, late
418 ones somewhere in the middle, and last hierarchies are (you guessed it)
419 last.
420
421    By default, XEmacs expects an early package hierarchy in the a
422 subdirectory `.xemacs' of the user's home directory.
423
424    Moreover, XEmacs expects late hierarchies in the subdirectories
425 `site-packages', `mule-packages', and `xemacs-packages' (in that order)
426 of the `<root>/lib/xemacs' subdirectory of one of the installation
427 hierarchies.  (If you run in-place, these are direct subdirectories of
428 the build directory.)  Furthermore, XEmacs will also search these
429 subdirectories in the `<root>/lib/xemacs-<VERSION>' subdirectory and
430 prefer directories found there.
431
432    By default, XEmacs does not have a pre-configured last package
433 hierarchy.  Last hierarchies are primarily for using package hierarchies
434 of outdated versions of XEmacs as a fallback option.  For example, it is
435 possible to run XEmacs 21.0 with the 20.4 package hierarchy as a last
436 hierarchy.
437
438    It is possible to specify at configure-time the location of the
439 various package hierarchies with the `--package-path' option to
440 configure.  The early, late, and last components of the package path
441 are separated by double instead of single colons.  If three components
442 are present, they are locate the early, late, and last package
443 hierarchies respectively.  If two components are present, they locate
444 the early and late hierarchies.  If only one component is present, it
445 locates the late hierarchy.  At run time, the package path may also be
446 specified via the `PACKAGEPATH' environment variable.
447
448    An XEmacs package is laid out just like a normal installed XEmacs
449 lisp directory.  It may have `lisp', `etc', `info', and `lib-src'
450 subdirectories.  XEmacs adds these at appropriate places within the
451 various system-wide paths.
452
453    There may be any number of package hierarchy directories.
454
455 Directories and Paths
456 ---------------------
457
458    Here is a list of the various directories and paths XEmacs tries to
459 locate during startup.  XEmacs distinguishes between directories and
460 paths specific to "version", "site", and "architecture" when looking
461 for them.
462
463 `version-specific'
464      directories are specific to the version of XEmacs they belong to
465      and typically reside under `<root>/lib/xemacs-<VERSION>'.
466
467 `site-specific'
468      directories are independent of the version of XEmacs they belong
469      to and typically reside under `<root>/lib/xemacs'
470
471 `architecture-specific'
472      directories are specific both to the version of XEmacs and the
473      architecture it runs on and typically reside under
474      `<root>/lib/xemacs-<VERSION>/<ARCHITECTURE>'.
475
476    During installation, all of these directories may also reside
477 directly under `<root>', because that is where they are in the XEmacs
478 tarball.
479
480    If XEmacs runs with the `-debug-paths' option (*note Command
481 Switches::), it will print the values of these variables, hopefully
482 aiding in debugging any problems which come up.
483
484 `lisp-directory'
485      Contains the version-specific location of the Lisp files that come
486      with the core distribution of XEmacs.  XEmacs will search it
487      recursively to a depth of 1 when setting up `load-path'.
488
489 `load-path'
490      Is where XEmacs searches for XEmacs Lisp files with commands like
491      `load-library'.  It contains the package lisp directories (see
492      further down) and the version-specific core Lisp directories.  If
493      the environment variable `EMACSLOADPATH' is set at startup, its
494      directories are prepended to `load-path'.
495
496 `Info-directory-list'
497      Contains the location of info files.  (See *Note (info)::.)  It
498      contains the package info directories and the version-specific core
499      documentation.  Moreover, XEmacs will add `/usr/info',
500      `/usr/local/info' as well as the directories of the environment
501      variable `INFOPATH' to `Info-directory-list'.
502
503 `lock-directory'
504 `superlock-file'
505      Are the site-specific locations of the lock directory and the
506      superlock file, respectively.  The `lock-directory' variable may
507      also be initialized from the `EMACSLOCKDIR' environment variable.
508
509 `exec-directory'
510      Is the directory of architecture-dependent files that come with
511      XEmacs, especially executable programs intended for XEmacs to
512      invoke.
513
514 `exec-path'
515      Is the path for executables which XEmacs may want to start.  It
516      contains the package executable paths as well as `exec-directory',
517      and the directories of the environment variables `PATH' and
518      `EMACSPATH'.
519
520 `doc-directory'
521      Is the directory containing the architecture-specific `DOC' file
522      that contains documentation for XEmacs' commands.
523
524 `data-directory'
525      Is the version-specific directory that contains core data files
526      XEmacs uses.  It may be initialized from the `EMACSDATA'
527      environment variable.
528
529 `data-directory-list'
530      Is the path where XEmacs looks for data files.  It contains
531      package data directories as well as `data-directory'.
532
533 \1f
534 File: xemacs.info,  Node: Basic,  Next: Undo,  Prev: Startup Paths,  Up: Top
535
536 Basic Editing Commands
537 **********************
538
539    We now give the basics of how to enter text, make corrections, and
540 save the text in a file.  If this material is new to you, you might
541 learn it more easily by running the Emacs learn-by-doing tutorial.  To
542 do this, type `Control-h t' (`help-with-tutorial').
543
544 Inserting Text
545 ==============
546
547    To insert printing characters into the text you are editing, just
548 type them.  This inserts the characters into the buffer at the cursor
549 (that is, at "point"; *note Point::).  The cursor moves forward.  Any
550 characters after the cursor move forward too.  If the text in the buffer
551 is `FOOBAR', with the cursor before the `B', and you type `XX', the
552 result is `FOOXXBAR', with the cursor still before the `B'.
553
554    To "delete" text you have just inserted, use <DEL>.  <DEL> deletes
555 the character BEFORE the cursor (not the one that the cursor is on top
556 of or under; that is the character AFTER the cursor).  The cursor and
557 all characters after it move backwards.  Therefore, if you type a
558 printing character and then type <DEL>, they cancel out.
559
560    To end a line and start typing a new one, type <RET>.  This inserts
561 a newline character in the buffer.  If point is in the middle of a
562 line, <RET> splits the line.  Typing <DEL> when the cursor is at the
563 beginning of a line rubs out the newline before the line, thus joining
564 the line with the preceding line.
565
566    Emacs automatically splits lines when they become too long, if you
567 turn on a special mode called "Auto Fill" mode.  *Note Filling::, for
568 information on using Auto Fill mode.
569
570    Customization information: <DEL>, in most modes, runs the command
571 `delete-backward-char'; <RET> runs the command `newline', and
572 self-inserting printing characters run the command `self-insert', which
573 inserts whatever character was typed to invoke it.  Some major modes
574 rebind <DEL> to other commands.
575
576    Direct insertion works for printing characters and <SPC>, but other
577 characters act as editing commands and do not insert themselves.  If
578 you need to insert a control character or a character whose code is
579 above 200 octal, you must "quote" it by typing the character
580 `control-q' (`quoted-insert') first.  There are two ways to use `C-q':
581
582    * `Control-q' followed by any non-graphic character (even `C-g')
583      inserts that character.
584
585    * `Control-q' followed by three octal digits inserts the character
586      with the specified character code.
587
588 A numeric argument to `C-q' specifies how many copies of the quoted
589 character should be inserted (*note Arguments::).
590
591    If you prefer to have text characters replace (overwrite) existing
592 text instead of moving it to the right, you can enable Overwrite mode, a
593 minor mode.  *Note Minor Modes::.
594
595 Changing the Location of Point
596 ==============================
597
598    To do more than insert characters, you have to know how to move point
599 (*note Point::).  Here are a few of the available commands.
600
601    NOTE: Many of the following commands have two versions, one that uses
602 the function keys (e.g. <LEFT> or <END>) and one that doesn't.  The
603 former versions may only be available on X terminals (i.e. not on
604 TTY's), but the latter are available on all terminals.
605
606 `C-a'
607 `HOME'
608      Move to the beginning of the line (`beginning-of-line').
609
610 `C-e'
611 `END'
612      Move to the end of the line (`end-of-line').
613
614 `C-f'
615 `RIGHT'
616      Move forward one character (`forward-char').
617
618 `C-b'
619 `LEFT'
620      Move backward one character (`backward-char').
621
622 `M-f'
623 `C-RIGHT'
624      Move forward one word (`forward-word').
625
626 `M-b'
627 `C-LEFT'
628      Move backward one word (`backward-word').
629
630 `C-n'
631 `DOWN'
632      Move down one line, vertically (`next-line').  This command
633      attempts to keep the horizontal position unchanged, so if you
634      start in the middle of one line, you end in the middle of the
635      next.  When on the last line of text, `C-n' creates a new line and
636      moves onto it.
637
638 `C-p'
639 `UP'
640      Move up one line, vertically (`previous-line').
641
642 `C-v'
643 `PGDN'
644      Move down one page, vertically (`scroll-up').
645
646 `M-v'
647 `PGUP'
648      Move up one page, vertically (`scroll-down').
649
650 `C-l'
651      Clear the frame and reprint everything (`recenter').  Text moves
652      on the frame to bring point to the center of the window.
653
654 `M-r'
655      Move point to left margin on the line halfway down the frame or
656      window (`move-to-window-line').  Text does not move on the frame.
657      A numeric argument says how many screen lines down from the top of
658      the window (zero for the top).  A negative argument counts from
659      the bottom (-1 for the bottom).
660
661 `C-t'
662      Transpose two characters, the ones before and after the cursor
663      (`transpose-chars').
664
665 `M-<'
666 `C-HOME'
667      Move to the top of the buffer (`beginning-of-buffer').  With
668      numeric argument N, move to N/10 of the way from the top.  *Note
669      Arguments::, for more information on numeric arguments.
670
671 `M->'
672 `C-END'
673      Move to the end of the buffer (`end-of-buffer').
674
675 `M-x goto-char'
676      Read a number N and move the cursor to character number N.
677      Position 1 is the beginning of the buffer.
678
679 `M-g'
680      Read a number N and move cursor to line number N (`goto-line').
681      Line 1 is the beginning of the buffer.
682
683 `C-x C-n'
684      Use the current column of point as the "semi-permanent goal
685      column" for `C-n' and `C-p' (`set-goal-column').  Henceforth, those
686      commands always move to this column in each line moved into, or as
687      close as possible given the contents of the line.  This goal
688      column remains in effect until canceled.
689
690 `C-u C-x C-n'
691      Cancel the goal column.  Henceforth, `C-n' and `C-p' once again
692      try to avoid changing the horizontal position, as usual.
693
694    If you set the variable `track-eol' to a non-`nil' value, `C-n' and
695 `C-p' move to the end of the line when at the end of the starting line.
696 By default, `track-eol' is `nil'.
697
698 Erasing Text
699 ============
700
701 `<DEL>'
702      Delete the character before the cursor (`delete-backward-char').
703
704 `C-d'
705      Delete the character after the cursor (`delete-char').
706
707 `C-k'
708      Kill to the end of the line (`kill-line').
709
710 `M-d'
711      Kill forward to the end of the next word (`kill-word').
712
713 `M-<DEL>'
714      Kill back to the beginning of the previous word
715      (`backward-kill-word').
716
717    In contrast to the <DEL> key, which deletes the character before the
718 cursor, `Control-d' deletes the character after the cursor, causing the
719 rest of the text on the line to shift left.  If `Control-d' is typed at
720 the end of a line, that line and the next line are joined.
721
722    To erase a larger amount of text, use `Control-k', which kills a
723 line at a time.  If you use `C-k' at the beginning or in the middle of
724 a line, it kills all the text up to the end of the line.  If you use
725 `C-k' at the end of a line, it joins that line and the next line.
726
727    *Note Killing::, for more flexible ways of killing text.
728
729 Files
730 =====
731
732    The commands above are sufficient for creating and altering text in
733 an Emacs buffer.  More advanced Emacs commands just make things easier.
734 But to keep any text permanently you must put it in a "file".  Files
735 are named units of text which are stored by the operating system and
736 which you can retrieve by name.  To look at or use the contents of a
737 file in any way, including editing the file with Emacs, you must
738 specify the file name.
739
740    Consider a file named `/usr/rms/foo.c'.  To begin editing this file
741 from Emacs, type:
742
743      C-x C-f /usr/rms/foo.c <RET>
744
745 The file name is given as an "argument" to the command `C-x C-f'
746 (`find-file').  The command uses the "minibuffer" to read the argument.
747 You have to type <RET> to terminate the argument (*note Minibuffer::).
748
749    You can also use the Open... menu item from the File menu, then type
750 the name of the file to the prompt.
751
752    Emacs obeys the command by "visiting" the file: it creates a buffer,
753 copies the contents of the file into the buffer, and then displays the
754 buffer for you to edit.  You can make changes in the buffer, and then
755 "save" the file by typing `C-x C-s' (`save-buffer') or choosing Save
756 Buffer from the File menu.  This makes the changes permanent by copying
757 the altered contents of the buffer back into the file `/usr/rms/foo.c'.
758 Until then, the changes are only inside your Emacs buffer, and the
759 file `foo.c' is not changed.
760
761    To create a file, visit the file with `C-x C-f' as if it already
762 existed or choose Open... from the File menu and provide the name for
763 the new file in the minibuffer.  Emacs will create an empty buffer in
764 which you can insert the text you want to put in the file.  When you
765 save the buffer with `C-x C-s', or by choosing Save Buffer from the
766 File menu, the file is created.
767
768    To learn more about using files, *note Files::.
769
770 Help
771 ====
772
773    If you forget what a key does, you can use the Help character
774 (`C-h') to find out: Type `C-h k' followed by the key you want to know
775 about.  For example, `C-h k C-n' tells you what `C-n' does.  `C-h' is a
776 prefix key; `C-h k' is just one of its subcommands (the command
777 `describe-key').  The other subcommands of `C-h' provide different
778 kinds of help.  Type `C-h' three times to get a description of all the
779 help facilities.  *Note Help::.
780
781 * Menu:
782
783 * Blank Lines::        Commands to make or delete blank lines.
784 * Continuation Lines:: Lines too wide for the frame.
785 * Position Info::      What page, line, row, or column is point on?
786 * Arguments::          Numeric arguments for repeating a command.
787
788 \1f
789 File: xemacs.info,  Node: Blank Lines,  Next: Continuation Lines,  Prev: Basic,  Up: Basic
790
791 Blank Lines
792 ===========
793
794    Here are special commands and techniques for entering and removing
795 blank lines.
796
797 `C-o'
798      Insert one or more blank lines after the cursor (`open-line').
799
800 `C-x C-o'
801      Delete all but one of many consecutive blank lines
802      (`delete-blank-lines').
803
804    When you want to insert a new line of text before an existing line,
805 you just type the new line of text, followed by <RET>.  If you prefer
806 to create a blank line first and then insert the desired text, use the
807 key `C-o' (`open-line'), which inserts a newline after point but leaves
808 point in front of the newline.  Then type the text into the new line.
809 `C-o F O O' has the same effect as `F O O <RET>', except for the final
810 location of point.
811
812    To create several blank lines, type `C-o' several times, or give
813 `C-o' an argument indicating how many blank lines to create.  *Note
814 Arguments::, for more information.
815
816    If you have many blank lines in a row and want to get rid of them,
817 use `C-x C-o' (`delete-blank-lines').  If point is on a blank line
818 which is adjacent to at least one other blank line, `C-x C-o' deletes
819 all but one of the blank lines.  If point is on a blank line with no
820 other adjacent blank line, the sole blank line is deleted.  If point is
821 on a non-blank line, `C-x C-o' deletes any blank lines following that
822 non-blank line.
823
824 \1f
825 File: xemacs.info,  Node: Continuation Lines,  Next: Position Info,  Prev: Blank Lines,  Up: Basic
826
827 Continuation Lines
828 ==================
829
830    If you add too many characters to one line without breaking with a
831 <RET>, the line grows to occupy two (or more) screen lines, with a
832 curved arrow at the extreme right margin of all but the last line.  The
833 curved arrow indicates that the following screen line is not really a
834 distinct line in the text, but just the "continuation" of a line too
835 long to fit the frame.  You can use Auto Fill mode (*note Filling::) to
836 have Emacs insert newlines automatically when a line gets too long.
837
838    Instead of continuation, long lines can be displayed by "truncation".
839 This means that all the characters that do not fit in the width of the
840 frame or window do not appear at all.  They remain in the buffer,
841 temporarily invisible.  Three diagonal dots in the last column (instead
842 of the curved arrow inform you that truncation is in effect.
843
844    To turn off continuation for a particular buffer, set the variable
845 `truncate-lines' to non-`nil' in that buffer.  Truncation instead of
846 continuation also happens whenever horizontal scrolling is in use, and
847 optionally whenever side-by-side windows are in use (*note Windows::).
848 Altering the value of `truncate-lines' makes it local to the current
849 buffer; until that time, the default value is in effect.  The default
850 is initially `nil'.  *Note Locals::.
851
852 \1f
853 File: xemacs.info,  Node: Position Info,  Next: Arguments,  Prev: Continuation Lines,  Up: Basic
854
855 Cursor Position Information
856 ===========================
857
858    If you are accustomed to other display editors, you may be surprised
859 that Emacs does not always display the page number or line number of
860 point in the mode line.  In Emacs, this information is only rarely
861 needed, and a number of commands are available to compute and print it.
862 Since text is stored in a way that makes it difficult to compute the
863 information, it is not displayed all the time.
864
865 `M-x what-page'
866      Print page number of point, and line number within page.
867
868 `M-x what-line'
869      Print line number of point in the buffer.
870
871 `M-='
872      Print number of lines and characters in the current region
873      (`count-lines-region').
874
875 `C-x ='
876      Print character code of character after point, character position
877      of point, and column of point (`what-cursor-position').
878
879    There are several commands for printing line numbers:
880    * `M-x what-line' counts lines from the beginning of the file and
881      prints the line number point is on.  The first line of the file is
882      line number 1.  You can use these numbers as arguments to `M-x
883      goto-line'.
884
885    * `M-x what-page' counts pages from the beginning of the file, and
886      counts lines within the page, printing both of them.  *Note
887      Pages::, for the command `C-x l', which counts the lines in the
888      current page.
889
890    * `M-=' (`count-lines-region') prints the number of lines in the
891      region (*note Mark::).
892
893    The command `C-x =' (`what-cursor-position') provides information
894 about point and about the column the cursor is in.  It prints a line in
895 the echo area that looks like this:
896
897      Char: x (0170)  point=65986 of 563027(12%)  column 44
898
899 (In fact, this is the output produced when point is before `column 44'
900 in the example.)
901
902    The two values after `Char:' describe the character following point,
903 first by showing it and second by giving its octal character code.
904
905    `point=' is followed by the position of point expressed as a
906 character count.  The front of the buffer counts as position 1, one
907 character later as 2, and so on.  The next, larger number is the total
908 number of characters in the buffer.  Afterward in parentheses comes the
909 position expressed as a percentage of the total size.
910
911    `column' is followed by the horizontal position of point, in columns
912 from the left edge of the window.
913
914    If the buffer has been narrowed, making some of the text at the
915 beginning and the end temporarily invisible, `C-x =' prints additional
916 text describing the current visible range.  For example, it might say:
917
918      Char: x (0170)  point=65986 of 563025(12%) <65102 - 68533>  column 44
919
920 where the two extra numbers give the smallest and largest character
921 position that point is allowed to assume.  The characters between those
922 two positions are the visible ones.  *Note Narrowing::.
923
924    If point is at the end of the buffer (or the end of the visible
925 part), `C-x =' omits any description of the character after point.  The
926 output looks like
927
928      point=563026 of 563025(100%)  column 0
929
930 \1f
931 File: xemacs.info,  Node: Arguments,  Prev: Position Info,  Up: Basic
932
933 Numeric Arguments
934 =================
935
936    Any Emacs command can be given a "numeric argument".  Some commands
937 interpret the argument as a repetition count.  For example, giving an
938 argument of ten to the key `C-f' (the command `forward-char', move
939 forward one character) moves forward ten characters.  With these
940 commands, no argument is equivalent to an argument of one.  Negative
941 arguments are allowed.  Often they tell a command to move or act
942 backwards.
943
944    If your keyboard has a <META> key (labelled with a diamond on
945 Sun-type keyboards and labelled `Alt' on some other keyboards), the
946 easiest way to specify a numeric argument is to type digits and/or a
947 minus sign while holding down the <META> key.  For example,
948      M-5 C-n
949
950 moves down five lines.  The characters `Meta-1', `Meta-2', and so on,
951 as well as `Meta--', do this because they are keys bound to commands
952 (`digit-argument' and `negative-argument') that are defined to
953 contribute to an argument for the next command.
954
955    Another way of specifying an argument is to use the `C-u'
956 (`universal-argument') command followed by the digits of the argument.
957 With `C-u', you can type the argument digits without holding down shift
958 keys.  To type a negative argument, start with a minus sign.  Just a
959 minus sign normally means -1.  `C-u' works on all terminals.
960
961    `C-u' followed by a character which is neither a digit nor a minus
962 sign has the special meaning of "multiply by four".  It multiplies the
963 argument for the next command by four.  `C-u' twice multiplies it by
964 sixteen.  Thus, `C-u C-u C-f' moves forward sixteen characters.  This
965 is a good way to move forward "fast", since it moves about 1/5 of a line
966 in the usual size frame.  Other useful combinations are `C-u C-n', `C-u
967 C-u C-n' (move down a good fraction of a frame), `C-u C-u C-o' (make "a
968 lot" of blank lines), and `C-u C-k' (kill four lines).
969
970    Some commands care only about whether there is an argument and not
971 about its value.  For example, the command `M-q' (`fill-paragraph') with
972 no argument fills text; with an argument, it justifies the text as well.
973 (*Note Filling::, for more information on `M-q'.)  Just `C-u' is a
974 handy way of providing an argument for such commands.
975
976    Some commands use the value of the argument as a repeat count, but do
977 something peculiar when there is no argument.  For example, the command
978 `C-k' (`kill-line') with argument N kills N lines, including their
979 terminating newlines.  But `C-k' with no argument is special: it kills
980 the text up to the next newline, or, if point is right at the end of
981 the line, it kills the newline itself.  Thus, two `C-k' commands with
982 no arguments can kill a non-blank line, just like `C-k' with an
983 argument of one.  (*Note Killing::, for more information on `C-k'.)
984
985    A few commands treat a plain `C-u' differently from an ordinary
986 argument.  A few others may treat an argument of just a minus sign
987 differently from an argument of -1.  These unusual cases will be
988 described when they come up; they are always to make the individual
989 command more convenient to use.
990
991 \1f
992 File: xemacs.info,  Node: Undo,  Next: Minibuffer,  Prev: Basic,  Up: Top
993
994 Undoing Changes
995 ***************
996
997    Emacs allows you to undo all changes you make to the text of a
998 buffer, up to a certain amount of change (8000 characters).  Each
999 buffer records changes individually, and the undo command always
1000 applies to the current buffer.  Usually each editing command makes a
1001 separate entry in the undo records, but some commands such as
1002 `query-replace' make many entries, and very simple commands such as
1003 self-inserting characters are often grouped to make undoing less
1004 tedious.
1005
1006 `C-x u'
1007      Undo one batch of changes (usually, one command's worth) (`undo').
1008
1009 `C-_'
1010      The same.
1011
1012    The command `C-x u' or `C-_' allows you to undo changes.  The first
1013 time you give this command, it undoes the last change.  Point moves to
1014 the text affected by the undo, so you can see what was undone.
1015
1016    Consecutive repetitions of the `C-_' or `C-x u' commands undo
1017 earlier and earlier changes, back to the limit of what has been
1018 recorded.  If all recorded changes have already been undone, the undo
1019 command prints an error message and does nothing.
1020
1021    Any command other than an undo command breaks the sequence of undo
1022 commands.  Starting at this moment, the previous undo commands are
1023 considered ordinary changes that can themselves be undone.  Thus, you
1024 can redo changes you have undone by typing `C-f' or any other command
1025 that have no important effect, and then using more undo commands.
1026
1027    If you notice that a buffer has been modified accidentally, the
1028 easiest way to recover is to type `C-_' repeatedly until the stars
1029 disappear from the front of the mode line.  When that happens, all the
1030 modifications you made have been canceled.  If you do not remember
1031 whether you changed the buffer deliberately, type `C-_' once. When you
1032 see Emacs undo the last change you made, you probably remember why you
1033 made it.  If the change was an accident, leave it undone.  If it was
1034 deliberate, redo the change as described in the preceding paragraph.
1035
1036    Whenever an undo command makes the stars disappear from the mode
1037 line, the buffer contents is the same as it was when the file was last
1038 read in or saved.
1039
1040    Not all buffers record undo information.  Buffers whose names start
1041 with spaces don't; these buffers are used internally by Emacs and its
1042 extensions to hold text that users don't normally look at or edit.
1043 Minibuffers, help buffers, and documentation buffers also don't record
1044 undo information.
1045
1046    Emacs can remember at most 8000 or so characters of deleted or
1047 modified text in any one buffer for reinsertion by the undo command.
1048 There is also a limit on the number of individual insert, delete, or
1049 change actions that Emacs can remember.
1050
1051    There are two keys to run the `undo' command, `C-x u' and `C-_',
1052 because on some keyboards, it is not obvious how to type `C-_'. `C-x u'
1053 is an alternative you can type in the same fashion on any terminal.
1054
1055 \1f
1056 File: xemacs.info,  Node: Minibuffer,  Next: M-x,  Prev: Undo,  Up: Top
1057
1058 The Minibuffer
1059 **************
1060
1061    Emacs commands use the "minibuffer" to read arguments more
1062 complicated than a single number.  Minibuffer arguments can be file
1063 names, buffer names, Lisp function names, Emacs command names, Lisp
1064 expressions, and many other things, depending on the command reading the
1065 argument.  To edit the argument in the minibuffer, you can use Emacs
1066 editing commands.
1067
1068    When the minibuffer is in use, it appears in the echo area, and the
1069 cursor moves there.  The beginning of the minibuffer line displays a
1070 "prompt" indicating what kind of input you should supply and how it
1071 will be used.  The prompt is often derived from the name of the command
1072 the argument is for.  The prompt normally ends with a colon.
1073
1074    Sometimes a "default argument" appears in parentheses after the
1075 colon; it, too, is part of the prompt.  The default is used as the
1076 argument value if you enter an empty argument (e.g., by just typing
1077 <RET>).  For example, commands that read buffer names always show a
1078 default, which is the name of the buffer that will be used if you type
1079 just <RET>.
1080
1081    The simplest way to give a minibuffer argument is to type the text
1082 you want, terminated by <RET> to exit the minibuffer.  To get out of
1083 the minibuffer and cancel the command that it was for, type `C-g'.
1084
1085    Since the minibuffer uses the screen space of the echo area, it can
1086 conflict with other ways Emacs customarily uses the echo area.  Here is
1087 how Emacs handles such conflicts:
1088
1089    * If a command gets an error while you are in the minibuffer, this
1090      does not cancel the minibuffer.  However, the echo area is needed
1091      for the error message and therefore the minibuffer itself is
1092      hidden for a while.  It comes back after a few seconds, or as soon
1093      as you type anything.
1094
1095    * If you use a command in the minibuffer whose purpose is to print a
1096      message in the echo area (for example `C-x =') the message is
1097      displayed normally, and the minibuffer is hidden for a while.  It
1098      comes back after a few seconds, or as soon as you type anything.
1099
1100    * Echoing of keystrokes does not take place while the minibuffer is
1101      in use.
1102
1103 * Menu:
1104
1105 * File: Minibuffer File.  Entering file names with the minibuffer.
1106 * Edit: Minibuffer Edit.  How to edit in the minibuffer.
1107 * Completion::            An abbreviation facility for minibuffer input.
1108 * Repetition::            Re-executing commands that used the minibuffer.
1109
1110 \1f
1111 File: xemacs.info,  Node: Minibuffer File,  Next: Minibuffer Edit,  Prev: Minibuffer,  Up: Minibuffer
1112
1113 Minibuffers for File Names
1114 ==========================
1115
1116    Sometimes the minibuffer starts out with text in it.  For example,
1117 when you are supposed to give a file name, the minibuffer starts out
1118 containing the "default directory", which ends with a slash.  This
1119 informs you in which directory the file will be looked for if you do
1120 not specify a different one. For example, the minibuffer might start
1121 out with:
1122
1123      Find File: /u2/emacs/src/
1124
1125 where `Find File: ' is the prompt.  Typing `buffer.c' specifies the file
1126 `/u2/emacs/src/buffer.c'.  To find files in nearby directories, use
1127 `..'; thus, if you type `../lisp/simple.el', the file that you visit
1128 will be the one named
1129 `/u2/emacs/lisp/simple.el'.  Alternatively, you can use  `M-<DEL>' to
1130 kill directory names you don't want (*note Words::).
1131
1132    You can also type an absolute file name, one starting with a slash
1133 or a tilde, ignoring the default directory.  For example, to find the
1134 file `/etc/termcap', just type the name, giving:
1135
1136      Find File: /u2/emacs/src//etc/termcap
1137
1138 Two slashes in a row are not normally meaningful in Unix file names, but
1139 they are allowed in XEmacs.  They mean, "ignore everything before the
1140 second slash in the pair."  Thus, `/u2/emacs/src/' is ignored, and you
1141 get the file `/etc/termcap'.
1142
1143    If you set `insert-default-directory' to `nil', the default
1144 directory is not inserted in the minibuffer.  This way, the minibuffer
1145 starts out empty.  But the name you type, if relative, is still
1146 interpreted with respect to the same default directory.
1147
1148 \1f
1149 File: xemacs.info,  Node: Minibuffer Edit,  Next: Completion,  Prev: Minibuffer File,  Up: Minibuffer
1150
1151 Editing in the Minibuffer
1152 =========================
1153
1154    The minibuffer is an Emacs buffer (albeit a peculiar one), and the
1155 usual Emacs commands are available for editing the text of an argument
1156 you are entering.
1157
1158    Since <RET> in the minibuffer is defined to exit the minibuffer, you
1159 must use `C-o' or `C-q <LFD>' to insert a newline into the minibuffer.
1160 (Recall that a newline is really the <LFD> character.)
1161
1162    The minibuffer has its own window, which always has space on the
1163 screen but acts as if it were not there when the minibuffer is not in
1164 use.  The minibuffer window is just like the others; you can switch to
1165 another window with `C-x o', edit text in other windows, and perhaps
1166 even visit more files before returning to the minibuffer to submit the
1167 argument.  You can kill text in another window, return to the minibuffer
1168 window, and then yank the text to use it in the argument.  *Note
1169 Windows::.
1170
1171    There are, however, some restrictions on the use of the minibuffer
1172 window.  You cannot switch buffers in it--the minibuffer and its window
1173 are permanently attached.  You also cannot split or kill the minibuffer
1174 window, but you can make it taller with `C-x ^'.
1175
1176    If you are in the minibuffer and issue a command that displays help
1177 text in another window, that window will be scrolled if you type
1178 `M-C-v' while in the minibuffer until you exit the minibuffer.  This
1179 feature is helpful if a completing minibuffer gives you a long list of
1180 possible completions.
1181
1182    If the variable `minibuffer-confirm-incomplete' is `t', you are
1183 asked for confirmation if there is no known completion for the text you
1184 typed. For example, if you attempted to visit a non-existent file, the
1185 minibuffer might read:
1186              Find File:chocolate_bar.c [no completions, confirm]
1187    If you press `Return' again, that confirms the filename. Otherwise,
1188 you can continue editing it.
1189
1190    Emacs supports recursive use of the minibuffer.  However, it is easy
1191 to do this by accident (because of autorepeating keyboards, for
1192 example) and get confused.  Therefore, most Emacs commands that use the
1193 minibuffer refuse to operate if the minibuffer window is selected.  If
1194 the minibuffer is active but you have switched to a different window,
1195 recursive use of the minibuffer is allowed--if you know enough to try
1196 to do this, you probably will not get confused.
1197
1198    If you set the variable `enable-recursive-minibuffers' to be
1199 non-`nil', recursive use of the minibuffer is always allowed.
1200