annotate man/xemacs/entering.texi @ 408:501cfd01ee6d r21-2-34

Import from CVS: tag r21-2-34
author cvs
date Mon, 13 Aug 2007 11:18:11 +0200
parents 376386a54a3c
children 697ef44129c6 7844ab77b582
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
1 @c This is part of the XEmacs manual.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
2 @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995 Free Software Foundation, Inc.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
3 @c See file xemacs.texi for copying conditions.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 @node Entering Emacs, Exiting, Pull-down Menus, Top
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 @chapter Entering and Exiting Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 @cindex entering XEmacs
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
7 @cindex starting XEmacs
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
8
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
9 The usual way to invoke XEmacs is to type @kbd{xemacs @key{RET}} at
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
10 the shell. XEmacs clears the screen and then displays an initial
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
11 advisory message and copyright notice. You can begin typing XEmacs
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
12 commands immediately afterward.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
14 Some operating systems insist on discarding all type-ahead when XEmacs
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
15 starts up; they give XEmacs no way to prevent this. Therefore, it is
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
16 advisable to wait until XEmacs clears the screen before typing your first
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
17 editing command.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
19 If you run XEmacs from a shell window under the X Window System, run it
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
20 in the background with @samp{xemacs&}. This way, XEmacs does not tie up
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
21 the shell window, so you can use that to run other shell commands while
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
22 XEmacs operates its own X windows. You can begin typing XEmacs commands
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
23 as soon as you direct your keyboard input to the XEmacs frame.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 @vindex initial-major-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 Before Emacs reads the first command, you have not had a chance to
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
27 give a command to specify a file to edit. Since Emacs must always have
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
28 a current buffer for editing, it presents a buffer, by default, a buffer
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
29 named @samp{*scratch*}. The buffer is in Lisp Interaction mode; you can
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
30 use it to type Lisp expressions and evaluate them, or you can ignore
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
31 that capability and simply doodle. (You can specify a different major
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
32 mode for this buffer by setting the variable @code{initial-major-mode}
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
33 in your init file. @xref{Init File}.)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
34
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
35 It is possible to specify files to be visited, Lisp files to be
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
36 loaded, and functions to be called, by giving Emacs arguments in the
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
37 shell command line. @xref{Command Switches}. But we don't recommend
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
38 doing this. The feature exists mainly for compatibility with other
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
39 editors.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
41 Many other editors are designed to be started afresh each time you
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
42 want to edit. You edit one file and then exit the editor. The next
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
43 time you want to edit either another file or the same one, you must run
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
44 the editor again. With these editors, it makes sense to use a
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
45 command-line argument to say which file to edit.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
46
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
47 But starting a new Emacs each time you want to edit a different file
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
48 does not make sense. For one thing, this would be annoyingly slow. For
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
49 another, this would fail to take advantage of Emacs's ability to visit
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
50 more than one file in a single editing session. And it would lose the
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
51 other accumulated context, such as registers, undo history, and the mark
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
52 ring.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
53
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
54 The recommended way to use XEmacs is to start it only once, just
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
55 after you log in, and do all your editing in the same Emacs session.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
56 Each time you want to edit a different file, you visit it with the
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
57 existing Emacs, which eventually comes to have many files in it ready
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
58 for editing. Usually you do not kill the Emacs until you are about to
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
59 log out. @xref{Files}, for more information on visiting more than one
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
60 file.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 @node Exiting, Command Switches, Entering Emacs, Top
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 @section Exiting Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 @cindex exiting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 @cindex killing Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 @cindex suspending
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
67 @cindex leaving Emacs
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
68 @cindex quitting Emacs
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 @cindex shrinking XEmacs frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 There are two commands for exiting Emacs because there are two kinds
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 of exiting: @dfn{suspending} Emacs and @dfn{killing} Emacs.
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
73
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
74 @dfn{Suspending} means stopping Emacs temporarily and returning
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
75 control to its parent process (usually a shell), allowing you to resume
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
76 editing later in the same Emacs job, with the same buffers, same kill
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
77 ring, same undo history, and so on. This is the usual way to exit.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
78
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
79 @dfn{Killing} Emacs means destroying the Emacs job. You can run Emacs
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
80 again later, but you will get a fresh Emacs; there is no way to resume
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
81 the same editing session after it has been killed.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 @item C-z
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
85 Suspend Emacs or iconify a frame
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
86 (@code{suspend-emacs-or-iconify-frame}). If used under the X window
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
87 system, shrink the X window containing the Emacs frame to an icon (see
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
88 below).
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 @item C-x C-c
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 Kill Emacs (@code{save-buffers-kill-emacs}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 If you use XEmacs under the X window system, @kbd{C-z} shrinks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 the X window containing the Emacs frame to an icon. The Emacs process
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 is stopped temporarily, and control is returned to the window manager.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 If more than one frame is associated with the Emacs process, only the
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
97 frame from which you used @kbd{C-z} is iconified.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 To activate the "suspended" Emacs, use the appropriate window manager
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 mouse gestures. Usually left-clicking on the icon reactivates and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 reopens the X window containing the Emacs frame, but the window manager
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 you use determines what exactly happens. To actually kill the Emacs
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
103 process, use @kbd{C-x C-c} or the @b{Exit XEmacs} item on the @b{File}
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 @kindex C-z
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 @findex suspend-emacs
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
108 To suspend Emacs, type @kbd{C-z} (@code{suspend-emacs}). This takes
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
109 you back to the shell from which you invoked Emacs. You can resume
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
110 Emacs with the shell command @samp{%xemacs} in most common shells.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
111
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
112 On systems that do not support suspending programs, @kbd{C-z} starts
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
113 an inferior shell that communicates directly with the terminal.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
114 Emacs waits until you exit the subshell. (The way to do that is
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
115 probably with @kbd{C-d} or @samp{exit}, but it depends on which shell
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
116 you use.) The only way on these systems to get back to the shell from
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
117 which Emacs was run (to log out, for example) is to kill Emacs.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
118
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
119 Suspending also fails if you run Emacs under a shell that doesn't
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
120 support suspending programs, even if the system itself does support it.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
121 In such a case, you can set the variable @code{cannot-suspend} to a
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
122 non-@code{nil} value to force @kbd{C-z} to start an inferior shell.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
123 (One might also describe Emacs's parent shell as ``inferior'' for
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
124 failing to support job control properly, but that is a matter of taste.)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
125
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
126 When Emacs communicates directly with an X server and creates its own
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
127 dedicated X windows, @kbd{C-z} has a different meaning. Suspending an
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
128 applications that uses its own X windows is not meaningful or useful.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
129 Instead, @kbd{C-z} runs the command @code{iconify-or-deiconify-frame},
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
130 which temporarily closes up the selected Emacs frame.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
131 The way to get back to a shell window is with the window manager.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 @kindex C-x C-c
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 @findex save-buffers-kill-emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 To kill Emacs, type @kbd{C-x C-c} (@code{save-buffers-kill-emacs}). A
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
136 two-character key is used for this to make it harder to type. Selecting
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
137 the @b{Exit XEmacs} option of the @b{File} menu is an alternate way of
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
138 issuing the command.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 Unless a numeric argument is used, this command first offers to save any
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
141 modified file-visiting buffers. If you do not save all buffers, you are
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
142 asked for reconfirmation with @kbd{yes} before killing Emacs, since any
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
143 changes not saved will be lost forever. If any subprocesses are still
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
144 running, @kbd{C-x C-c} asks you to confirm killing them, since killing
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
145 Emacs will kill the subprocesses immediately.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
147 There is no way to restart an Emacs session once you have killed it.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
148 You can, however, arrange for Emacs to record certain session
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
149 information, such as which files are visited, when you kill it, so that
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
150 the next time you restart Emacs it will try to visit the same files and
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
151 so on.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
152 @c @xref{Saving Emacs Sessions}.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
154 The operating system usually listens for certain special characters
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
155 whose meaning is to kill or suspend the program you are running.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
156 @b{This operating system feature is turned off while you are in Emacs.}
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
157 The meanings of @kbd{C-z} and @kbd{C-x C-c} as keys in Emacs were
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
158 inspired by the use of @kbd{C-z} and @kbd{C-c} on several operating
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
159 systems as the characters for stopping or killing a program, but that is
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
160 their only relationship with the operating system. You can customize
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 0
diff changeset
161 these keys to run any commands of your choice (@pxref{Keymaps}).