aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2008-07-15 20:57:39 +0000
committerChong Yidong2008-07-15 20:57:39 +0000
commit321ca37f5380ecd5f02893f4f5b651e3a4681c1e (patch)
treebeeeccd2b532763b7ba189443aa0b0e32168591b
parent0ef9470696006f0c75fd9590c2261d41217628f0 (diff)
downloademacs-321ca37f5380ecd5f02893f4f5b651e3a4681c1e.tar.gz
emacs-321ca37f5380ecd5f02893f4f5b651e3a4681c1e.zip
(Exiting): Don't describe text-only terminals as the
default. Describe the new startup screen. (Exiting): Describe how to kill Emacs first. Change description of iconification to handle modern window systems.
-rw-r--r--doc/emacs/entering.texi240
1 files changed, 114 insertions, 126 deletions
diff --git a/doc/emacs/entering.texi b/doc/emacs/entering.texi
index 38b501e9646..bb8fa1f3029 100644
--- a/doc/emacs/entering.texi
+++ b/doc/emacs/entering.texi
@@ -2,164 +2,152 @@
2@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 2001, 2002, 2003, 2@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 2001, 2002, 2003,
3@c 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. 3@c 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
4@c See file emacs.texi for copying conditions. 4@c See file emacs.texi for copying conditions.
5@node Entering Emacs, Exiting, Commands, Top 5@iftex
6@chapter Entering and Exiting Emacs 6@chapter Entering and Exiting Emacs
7
8 This chapter explains how to enter Emacs, and how to exit it.
9@end iftex
10
11@ifnottex
12@raisesections
13@end ifnottex
14
15@node Entering Emacs, Exiting, Commands, Top
16@section Entering Emacs
7@cindex entering Emacs 17@cindex entering Emacs
8@cindex starting Emacs 18@cindex starting Emacs
9 19
10 The usual way to invoke Emacs is with the shell command 20 The usual way to invoke Emacs is with the shell command
11@command{emacs}. Emacs clears the screen, then displays an initial 21@command{emacs}. From a terminal window running in the X Window
12help message and copyright notice. Some operating systems discard 22System, you can also run Emacs in the background with
13your type-ahead when Emacs starts up; they give Emacs no way to 23@command{emacs&}; this way, Emacs won't tie up the terminal window, so
14prevent this. On those systems, wait for Emacs to clear the screen 24you can use it to run other shell commands.
15before you start typing. 25
16 26@cindex startup screen
17 From a shell window under the X Window System, run Emacs in the 27 When Emacs starts up, the initial frame displays a special buffer
18background with @command{emacs&}. This way, Emacs won't tie up the 28named @samp{*GNU Emacs*}. This buffer contains @dfn{links} to common
19shell window, so you can use it to run other shell commands while 29tasks that might be useful to beginning users. For instance,
20Emacs is running. You can type Emacs commands as soon as you direct 30activating the @samp{Emacs Tutorial} link opens the Emacs tutorial;
21your keyboard input to an Emacs frame. 31this does the same thing as the command @kbd{C-h t}
22 32(@code{help-with-tutorial}). To activate a link, either move point
23@vindex initial-major-mode 33onto it and type @kbd{@key{RET}}, or click on it with @kbd{mouse-1}
24 When Emacs starts up, it creates a buffer named @samp{*scratch*}. 34(the left mouse button).
25That's the buffer you start out in. The @samp{*scratch*} buffer uses 35
26Lisp Interaction mode; you can use it to type Lisp expressions and 36 Using a command line argument, you can tell Emacs to visit one or
27evaluate them. You can also ignore that capability and just write notes 37more specific files as soon as it starts up. For example,
28there. You can specify a different major mode for this buffer by 38@command{emacs foo.txt} starts Emacs with a buffer displaying the
29setting the variable @code{initial-major-mode} in your init file. 39contents of the file @samp{foo.txt}. This feature exists mainly for
30@xref{Init File}. 40compatibility with other editors, which are designed to edit one file
31 41at a time: once you are done with that file, you exit the editor, and
32 It is possible to specify files to be visited, Lisp files to be 42start it again the next time you need it.
33loaded, and functions to be called through Emacs command-line 43
34arguments. @xref{Emacs Invocation}. The feature exists mainly for 44 Using Emacs in this way---starting it afresh each time you want to
35compatibility with other editors, and for scripts. 45edit a file---is unnecessary and wasteful. Emacs can visit more than
36 46one file in a single editing session, and exiting the Emacs session
37 Many editors are designed to edit one file. When done with that 47loses valuable accumulated context, such as the kill ring, registers,
38file, you exit the editor. The next time you want to edit a file, you 48undo history, and mark ring. These features, described later in the
39must start the editor again. Working this way, it is convenient to 49manual, are useful for performing edits across multiple files, or
40use a command-line argument to say which file to edit. 50continuing edits to a single file.
41 51
42 However, killing Emacs after editing one each and starting it afresh 52 The recommended way to use Emacs is to start it only once, just
43for the next file is both unnecessary and harmful, since it denies you
44the full power of Emacs. Emacs can visit more than one file in a
45single editing session, and that is the right way to use it. Exiting
46the Emacs session loses valuable accumulated context, such as the kill
47ring, registers, undo history, and mark ring. These features are
48useful for operating on multiple files, or even continuing to edit one
49file. If you kill Emacs after each file, you don't take advantage of
50them.
51
52 The recommended way to use GNU Emacs is to start it only once, just
53after you log in, and do all your editing in the same Emacs session. 53after you log in, and do all your editing in the same Emacs session.
54Each time you edit a file, you visit it with the existing Emacs, which 54Each time you edit a file, visit it with the existing Emacs, which
55eventually has many files in it ready for editing. Usually you do not 55eventually has many files in it ready for editing. @xref{Files}, for
56kill Emacs until you are about to log out. @xref{Files}, for more 56more information on visiting more than one file.
57information on visiting more than one file.
58 57
59 To edit a file from another program while Emacs is running, you can 58 To edit a file from another program while Emacs is running, you can
60use the @command{emacsclient} helper program to open a file in the 59use the @command{emacsclient} helper program to open a file in the
61already running Emacs. @xref{Emacs Server}. 60already running Emacs. @xref{Emacs Server}.
62 61
63@ifnottex 62 Emacs accepts other command line arguments that tell it to load
64@raisesections 63certain Lisp files, call certain functions, and so forth. These
65@end ifnottex 64features exist mainly for advanced users. @xref{Emacs Invocation}.
66 65
67@node Exiting, Basic, Entering Emacs, Top 66@node Exiting, Basic, Entering Emacs, Top
68@section Exiting Emacs 67@section Exiting Emacs
69@cindex exiting 68@cindex exiting
70@cindex killing Emacs 69@cindex killing Emacs
71@cindex suspending
72@cindex leaving Emacs 70@cindex leaving Emacs
73@cindex quitting Emacs 71@cindex quitting Emacs
74 72
75 There are two commands for exiting Emacs, and three kinds of
76exiting: @dfn{iconifying} Emacs, @dfn{suspending} Emacs, and
77@dfn{killing} Emacs.
78
79 @dfn{Iconifying} means replacing the Emacs frame with a small box or
80``icon'' on the screen. This is the usual way to exit Emacs when
81you're using a graphical display---if you bother to ``exit'' at all.
82(Just switching to another application is usually sufficient.)
83
84 @dfn{Suspending} means stopping Emacs temporarily and returning
85control to its parent process (usually a shell), allowing you to
86resume editing later in the same Emacs job. This is the usual way to
87exit Emacs when running it on a text terminal.
88
89 @dfn{Killing} Emacs means destroying the Emacs job. You can run Emacs
90again later, but you will get a fresh Emacs; there is no way to resume
91the same editing session after it has been killed.
92
93@table @kbd 73@table @kbd
74@item C-x C-c
75Kill Emacs (@code{save-buffers-kill-emacs}).
94@item C-z 76@item C-z
95Suspend Emacs (@code{suspend-emacs}) or iconify a frame 77Suspend Emacs (@code{suspend-emacs}) or iconify a frame
96(@code{iconify-or-deiconify-frame}). 78(@code{iconify-or-deiconify-frame}).
97@item C-x C-c
98Kill Emacs (@code{save-buffers-kill-emacs}).
99@end table 79@end table
100 80
101@kindex C-z
102@findex iconify-or-deiconify-frame
103 On graphical displays, @kbd{C-z} runs the command
104@code{iconify-or-deiconify-frame}, which temporarily iconifies (or
105``minimizes'') the selected Emacs frame (@pxref{Frames}). You can
106then use the window manager to select some other application. (You
107could select another application without iconifying Emacs first, but
108getting the Emacs frame out of the way can make it more convenient to
109find the other application.)
110
111@findex suspend-emacs
112 On a text terminal, @kbd{C-z} runs the command @code{suspend-emacs}.
113Suspending Emacs takes you back to the shell from which you invoked
114Emacs. You can resume Emacs with the shell command @command{%emacs}
115in most common shells. On systems that don't support suspending
116programs, @kbd{C-z} starts an inferior shell that communicates
117directly with the terminal, and Emacs waits until you exit the
118subshell. (The way to do that is probably with @kbd{C-d} or
119@command{exit}, but it depends on which shell you use.) On these
120systems, you can only get back to the shell from which Emacs was run
121(to log out, for example) when you kill Emacs.
122
123@vindex cannot-suspend
124 Suspending can fail if you run Emacs under a shell that doesn't
125support suspension of its subjobs, even if the system itself does
126support it. In such a case, you can set the variable
127@code{cannot-suspend} to a non-@code{nil} value to force @kbd{C-z} to
128start an inferior shell.
129
130@kindex C-x C-c 81@kindex C-x C-c
131@findex save-buffers-kill-emacs 82@findex save-buffers-kill-emacs
132 To exit and kill Emacs, type @kbd{C-x C-c} 83 @dfn{Killing} Emacs means terminating the Emacs program. To do
133(@code{save-buffers-kill-emacs}). A two-character key is used to make 84this, type @kbd{C-x C-c} (@code{save-buffers-kill-emacs}). A
134it harder to type by accident. This command first offers to save any 85two-character key is used to make it harder to type by accident. If
135modified file-visiting buffers. If you do not save them all, it asks 86there are any modified file-visiting buffers when you type @kbd{C-x
136for confirmation with @kbd{yes} before killing Emacs, since any 87C-c}, Emacs first offers to save these buffers. If you do not save
137changes not saved now will be lost forever. Also, if any subprocesses are 88them all, it asks for confirmation again, since the unsaved changes
138still running, @kbd{C-x C-c} asks for confirmation about them, since 89will be lost. Emacs also asks for confirmation if any subprocesses
139killing Emacs will also kill the subprocesses. 90are still running, since killing Emacs will also kill the subprocesses
91(@pxref{Shell}).
92
93 Emacs can, optionally, record certain session information when you
94kill it, such as the files you were visiting at the time. This
95information is then available the next time you start Emacs.
96@xref{Saving Emacs Sessions}.
140 97
141@vindex confirm-kill-emacs 98@vindex confirm-kill-emacs
142 If the value of the variable @code{confirm-kill-emacs} is 99 If the value of the variable @code{confirm-kill-emacs} is
143non-@code{nil}, @kbd{C-x C-c} assumes that its value is a predicate 100non-@code{nil}, @kbd{C-x C-c} assumes that its value is a predicate
144function, and calls that function. If the result is non-@code{nil}, the 101function, and calls that function. If the result of the function call
145session is killed, otherwise Emacs continues to run. One convenient 102is non-@code{nil}, the session is killed, otherwise Emacs continues to
146function to use as the value of @code{confirm-kill-emacs} is the 103run. One convenient function to use as the value of
147function @code{yes-or-no-p}. The default value of 104@code{confirm-kill-emacs} is the function @code{yes-or-no-p}. The
148@code{confirm-kill-emacs} is @code{nil}. 105default value of @code{confirm-kill-emacs} is @code{nil}.
149 106
150 You can't resume an Emacs session after killing it. Emacs can, 107@cindex minimizing a frame
151however, record certain session information when you kill it, such as 108@cindex iconifying
152which files you visited, so the next time you start Emacs it will try 109@cindex suspending
153to visit the same files. @xref{Saving Emacs Sessions}. 110 You can ``exit'' Emacs in two other ways. On a graphical display,
154 111you can @dfn{iconify} (or @dfn{minimize}) an Emacs frame; depending on
155 The operating system usually listens for certain special characters 112the window system, this either replaces the Emacs frame with a tiny
113``icon'' or conceals the frame entirely (@pxref{Frames}). On a
114text-only terminal, you can @dfn{suspend} Emacs; this means stopping
115the Emacs program temporarily, returning control to its parent process
116(usually a shell).
117
118@kindex C-z
119@findex iconify-or-deiconify-frame
120@findex suspend-emacs
121 On a graphical display, @kbd{C-z} runs the command
122@code{iconify-or-deiconify-frame}, which iconifies the selected Emacs
123frame. On a text terminal, @kbd{C-z} runs the command
124@code{suspend-emacs}, which suspends Emacs.
125
126 After iconifying or suspending Emacs, you can return to it and
127continue editing wherever you left off. The way to do this depends on
128the window system or shell. In most common shells, you can resume
129Emacs after suspending it with the shell command @command{%emacs}.
130
131@vindex cannot-suspend
132 On very old systems that don't support suspending programs,
133@kbd{C-z} starts an inferior shell that communicates directly with the
134terminal, and Emacs waits until you exit the subshell. (The way to
135exit the subshell is usually @kbd{C-d} or @command{exit}.) On these
136systems, you can only get back to the shell from which Emacs was run
137(to log out, for example) when you kill Emacs. Suspending can also
138fail if you run Emacs under a shell that doesn't support suspending
139jobs, even if the system itself does support it. In this case, you
140can set the variable @code{cannot-suspend} to a non-@code{nil} value
141to force @kbd{C-z} to start an inferior shell.
142
143 Text-only terminals usually listen for certain special characters
156whose meaning is to kill or suspend the program you are running. 144whose meaning is to kill or suspend the program you are running.
157@b{This operating system feature is turned off while you are in Emacs.} 145@b{This terminal feature is turned off while you are in Emacs.} The
158The meanings of @kbd{C-z} and @kbd{C-x C-c} as keys in Emacs were 146meanings of @kbd{C-z} and @kbd{C-x C-c} as keys in Emacs were inspired
159inspired by the use of @kbd{C-z} and @kbd{C-c} on several operating 147by the use of @kbd{C-z} and @kbd{C-c} on several operating systems as
160systems as the characters for stopping or killing a program, but that is 148the characters for stopping or killing a program, but that is their
161their only relationship with the operating system. You can customize 149only relationship with the operating system. You can customize these
162these keys to run any commands of your choice (@pxref{Keymaps}). 150keys to run any commands of your choice (@pxref{Keymaps}).
163 151
164@ifnottex 152@ifnottex
165@lowersections 153@lowersections