comparison doc/lispref/os.texi @ 103024:91ec7dabacb2

* os.texi (Startup Summary): Copyedits. The init file is not necessarily named .emacs now. Document initial-buffer-choice and initial-scratch-message. Note where Emacs exits in batch mode. Document inhibit-splash-screen as an alias. (Init File): Be neutral about which init file name to use.
author Chong Yidong <cyd@stupidchicken.com>
date Mon, 20 Apr 2009 01:34:27 +0000
parents a447859a557b
children 952d96227f27
comparison
equal deleted inserted replaced
103023:30ed0fca4cdd 103024:91ec7dabacb2
9 9
10 This chapter is about starting and getting out of Emacs, access to 10 This chapter is about starting and getting out of Emacs, access to
11 values in the operating system environment, and terminal input, output, 11 values in the operating system environment, and terminal input, output,
12 and flow control. 12 and flow control.
13 13
14 @xref{Building Emacs}, for related information. See also 14 @xref{Building Emacs}, for related information. @xref{Display}, for
15 @ref{Display}, for additional operating system status information 15 additional operating system status information pertaining to the
16 pertaining to the terminal and the screen. 16 terminal and the screen.
17 17
18 @menu 18 @menu
19 * Starting Up:: Customizing Emacs startup processing. 19 * Starting Up:: Customizing Emacs startup processing.
20 * Getting Out:: How exiting works (permanent or temporary). 20 * Getting Out:: How exiting works (permanent or temporary).
21 * System Environment:: Distinguish the name and kind of system. 21 * System Environment:: Distinguish the name and kind of system.
44 This section describes what Emacs does when it is started, and how you 44 This section describes what Emacs does when it is started, and how you
45 can customize these actions. 45 can customize these actions.
46 46
47 @menu 47 @menu
48 * Startup Summary:: Sequence of actions Emacs performs at startup. 48 * Startup Summary:: Sequence of actions Emacs performs at startup.
49 * Init File:: Details on reading the init file (@file{.emacs}). 49 * Init File:: Details on reading the init file.
50 * Terminal-Specific:: How the terminal-specific Lisp file is read. 50 * Terminal-Specific:: How the terminal-specific Lisp file is read.
51 * Command-Line Arguments:: How command-line arguments are processed, 51 * Command-Line Arguments:: How command-line arguments are processed,
52 and how you can customize them. 52 and how you can customize them.
53 @end menu 53 @end menu
54 54
56 @subsection Summary: Sequence of Actions at Startup 56 @subsection Summary: Sequence of Actions at Startup
57 @cindex initialization of Emacs 57 @cindex initialization of Emacs
58 @cindex startup of Emacs 58 @cindex startup of Emacs
59 @cindex @file{startup.el} 59 @cindex @file{startup.el}
60 60
61 The order of operations performed (in @file{startup.el}) by Emacs when 61 When Emacs is started up, it performs the following operations
62 it is started up is as follows: 62 (which are defined in @file{startup.el}):
63 63
64 @enumerate 64 @enumerate
65 @item 65 @item
66 It adds subdirectories to @code{load-path}, by running the file named 66 It adds subdirectories to @code{load-path}, by running the file named
67 @file{subdirs.el} in each directory in the list. Normally this file 67 @file{subdirs.el} in each directory in the list. Normally, this file
68 adds the directory's subdirectories to the list, and these will be 68 adds the directory's subdirectories to the list, and those are scanned
69 scanned in their turn. The files @file{subdirs.el} are normally 69 in their turn. The files @file{subdirs.el} are normally generated
70 generated automatically by Emacs installation. 70 automatically when Emacs is installed.
71 71
72 @vindex before-init-time 72 @vindex before-init-time
73 @item 73 @item
74 It records in the variable @code{before-init-time} the value of 74 It sets the variable @code{before-init-time} to the value of
75 @code{current-time} (@pxref{Time of Day}). It also sets 75 @code{current-time} (@pxref{Time of Day}). It also sets
76 @code{after-init-time} to @code{nil}, so as to signal Lisp programs 76 @code{after-init-time} to @code{nil}, which signals to Lisp programs
77 that Emacs initialization is in progress. 77 that Emacs is being initialized.
78 78
79 @vindex initial-window-system@r{, and startup} 79 @vindex initial-window-system@r{, and startup}
80 @vindex window-system-initialization-alist 80 @vindex window-system-initialization-alist
81 @item 81 @item
82 It loads the initialization library for the window system specified by 82 It loads the initialization library for the window system specified by
83 the variable @code{initial-window-system} (@pxref{Window Systems, 83 the variable @code{initial-window-system} (@pxref{Window Systems,
84 initial-window-system}). This library's name is 84 initial-window-system}). This library's name is
85 @file{term/@var{windowsystem}-win.el}, where @var{windowsystem} is the 85 @file{term/@var{windowsystem}-win.el}, where @var{windowsystem} is the
86 value of @code{initial-window-system}. From that library, it calls 86 value of @code{initial-window-system}. From that library, it calls
87 the appropriate initialization function. The initialization function 87 the appropriate initialization function. The initialization function
88 is specified by @code{window-system-initialization-alist}, for each 88 for each supported window system is specified by
89 supported window system. 89 @code{window-system-initialization-alist}.
90 90
91 @item 91 @item
92 It sets the language environment and the terminal coding system, 92 It sets the language environment and the terminal coding system,
93 if requested by environment variables such as @code{LANG}. 93 if requested by environment variables such as @code{LANG}.
94 94
102 @item 102 @item
103 It initializes the window frame and faces, if appropriate, and turns 103 It initializes the window frame and faces, if appropriate, and turns
104 on the menu bar and tool bar, if the initial frame needs them. 104 on the menu bar and tool bar, if the initial frame needs them.
105 105
106 @item 106 @item
107 It registers the default colors for text-only terminals. 107 It loads the library @file{site-start}, if it exists. This is not
108 108 done if the options @samp{-Q} or @samp{--no-site-file} were specified.
109 @item
110 It loads the library @file{site-start} (if any), unless the option
111 @samp{-Q} (or @samp{--no-site-file}) was specified. The library's file
112 name is usually @file{site-start.el}.
113 @cindex @file{site-start.el} 109 @cindex @file{site-start.el}
114 110
115 @item 111 @item
116 It loads your init file (usually @file{~/.emacs}), unless the option 112 It loads your init file (@pxref{Init File}). This is not done if the
117 @samp{-q} (or @samp{--no-init-file}), @samp{-Q}, or @samp{--batch} was 113 options @samp{-q}, @samp{-Q}, or @samp{--batch} were specified. If
118 specified on the command line. The @samp{-u} option can specify 114 the @samp{-u} option was specified, Emacs looks for the init file in
119 another user whose home directory should be used instead of @file{~}. 115 that user's home directory instead.
120 116
121 @item 117 @item
122 It loads the library @file{default} (if any), unless 118 It loads the library @file{default}, if it exists. This is not done
123 @code{inhibit-default-init} is non-@code{nil}. (This is not done in 119 if @code{inhibit-default-init} is non-@code{nil}, nor if the options
124 @samp{-batch} mode, or if @samp{-Q} or @samp{-q} was specified on the 120 @samp{-q}, @samp{-Q}, or @samp{--batch} were specified.
125 command line.) The library's file name is usually @file{default.el}.
126 @cindex @file{default.el} 121 @cindex @file{default.el}
127 122
128 @item 123 @item
129 It loads your abbrevs from the file specified by 124 It loads your abbrevs from the file specified by
130 @code{abbrev-file-name} (@pxref{Abbrev Files, abbrev-file-name}), if 125 @code{abbrev-file-name}, if that file exists and can be read
131 that file exists and can be read. (This is not done in @samp{-batch} 126 (@pxref{Abbrev Files, abbrev-file-name}). This is not done if the
132 mode.) 127 option @samp{--batch} was specified.
133 128
134 @vindex after-init-time 129 @vindex after-init-time
135 @item 130 @item
136 It records in the variable @code{after-init-time} the value of 131 It sets the variable @code{after-init-time} to the value of
137 @code{current-time}. This variable was set to @code{nil} at the 132 @code{current-time}. This variable was set to @code{nil} earlier;
138 beginning of the Emacs session initialization (see above), so setting 133 setting it to the current time signals that the initialization phase
139 it to the current time both signals that the initialization phase is 134 is over, and, together with @code{before-init-time}, provides the
140 over, and, together with @code{before-init-time}, provides the
141 measurement of how long it took. 135 measurement of how long it took.
142 136
143 @item 137 @item
144 It runs the normal hook @code{after-init-hook}. 138 It runs the normal hook @code{after-init-hook}.
145 139
146 @item 140 @item
147 It sets the major mode according to @code{initial-major-mode}, provided 141 If the buffer @samp{*scratch*} exists and is still in Fundamental mode
148 the buffer @samp{*scratch*} is still current and still in Fundamental 142 (as it should be by default), it sets its major mode according to
149 mode. 143 @code{initial-major-mode}.
150 144
151 @item 145 @item
152 It loads the terminal-specific Lisp library, if any, except when in 146 If started on a text-only terminal, it loads the terminal-specific
153 batch mode or when the variable @code{initial-window-system} (see 147 Lisp library, which is specified by the variable
154 above) specifies a non-@code{nil} window system. The name of this 148 @code{term-file-prefix} (@pxref{Terminal-Specific}). This is not done
155 library is computed from the value of the variable 149 in @code{--batch} mode, nor if @code{term-file-prefix} is @code{nil}.
156 @code{term-file-prefix}; for the details, see @ref{Terminal-Specific}.
157
158 If the value of @code{term-file-prefix} is @code{nil}, this step is skipped.
159 150
160 @item 151 @item
161 It displays the initial echo area message, unless you have suppressed 152 It displays the initial echo area message, unless you have suppressed
162 that with @code{inhibit-startup-echo-area-message}. 153 that with @code{inhibit-startup-echo-area-message}.
163 154
164 @item 155 @item
165 It processes the action arguments from the command line. 156 It processes the action arguments from the command line.
157
158 @item
159 It now exits if the option @code{--batch} was specified.
160
161 @item
162 If @code{initial-buffer-choice} is a string, it visits the file with
163 that name. Furthermore, if the @samp{*scratch*} buffer exists and is
164 empty, it inserts @code{initial-scratch-message} into that buffer.
166 165
167 @item 166 @item
168 It runs @code{emacs-startup-hook} and then @code{term-setup-hook}. 167 It runs @code{emacs-startup-hook} and then @code{term-setup-hook}.
169 168
170 @item 169 @item
174 173
175 @item 174 @item
176 It runs @code{window-setup-hook}. @xref{Window Systems}. 175 It runs @code{window-setup-hook}. @xref{Window Systems}.
177 176
178 @item 177 @item
179 It displays copyleft, nonwarranty, and basic use information, provided 178 If the option @code{--daemon} was specified, it calls
180 the value of @code{inhibit-startup-screen} is @code{nil}, you didn't 179 @code{server-start} and detaches from the controlling terminal.
181 specify @samp{--no-splash} or @samp{-Q}. 180 @xref{Emacs Server,,, emacs, The GNU Emacs Manual}.
182 181
183 @item 182 @item
184 If the command-line arguments specified @option{--daemon}, @c FIXME: xref 183 It displays the @dfn{startup screen}, which is a special buffer that
185 it calls @code{server-start} (@pxref{Emacs Server,,, emacs, The GNU 184 contains information about copyleft and basic Emacs usage. This is
186 Emacs Manual}). 185 not done if @code{initial-buffer-choice} or
186 @code{inhibit-startup-screen} are @code{nil}, nor if the
187 @samp{--no-splash} or @samp{-Q} command-line options were specified.
187 188
188 @item 189 @item
189 If started by the X session manager, it calls 190 If started by the X session manager, it calls
190 @code{emacs-session-restore} passing it as argument the ID of the 191 @code{emacs-session-restore} passing it as argument the ID of the
191 previous session. @c FIXME: add an xref to the Emacs manual! 192 previous session. @c FIXME: add an xref to the Emacs manual!
192 @end enumerate 193 @end enumerate
193 194
194 @defopt inhibit-startup-screen 195 @defopt inhibit-startup-screen
195 This variable inhibits the initial startup messages (the nonwarranty, 196 This variable, if non-@code{nil}, inhibits the startup screen. In
196 etc.). If it is non-@code{nil}, then the messages are not printed. 197 that case, Emacs typically displays the @samp{*scratch*} buffer; but
197 198 see @code{initial-buffer-choice}, below.
198 This variable exists so you can set it in your personal init file, once 199
199 you are familiar with the contents of the startup message. Do not set 200 Do not set this variable in the init file of a new user, or in a way
200 this variable in the init file of a new user, or in a way that affects 201 that affects more than one user, as that would prevent new users from
201 more than one user, because that would prevent new users from receiving 202 receiving information about copyleft and basic Emacs usage.
202 the information they are supposed to see. 203
203 204 @code{inhibit-startup-message} and @code{inhibit-splash-screen} are
204 @code{inhibit-startup-message} is an alias for this variable, for 205 aliases for this variable.
205 back-compatibility. 206 @end defopt
207
208 @defopt initial-buffer-choice
209 This variable, if non-@code{nil}, determines a file or buffer for
210 Emacs to display after starting up, instead of the startup screen. If
211 its value is @code{t}, Emacs displays the @samp{*scratch*} buffer. If
212 its value is a string, that specifies the name of a file for Emacs to
213 visit.
206 @end defopt 214 @end defopt
207 215
208 @defopt inhibit-startup-echo-area-message 216 @defopt inhibit-startup-echo-area-message
209 This variable controls the display of the startup echo area message. 217 This variable controls the display of the startup echo area message.
210 You can suppress the startup echo area message by adding text with this 218 You can suppress the startup echo area message by adding text with this
217 225
218 Emacs explicitly checks for an expression as shown above in your init 226 Emacs explicitly checks for an expression as shown above in your init
219 file; your login name must appear in the expression as a Lisp string 227 file; your login name must appear in the expression as a Lisp string
220 constant. Other methods of setting 228 constant. Other methods of setting
221 @code{inhibit-startup-echo-area-message} to the same value do not 229 @code{inhibit-startup-echo-area-message} to the same value do not
222 inhibit the startup message. 230 inhibit the startup message. This way, you can easily inhibit the
223 231 message for yourself if you wish, but thoughtless copying of your init
224 This way, you can easily inhibit the message for yourself if you wish, 232 file will not inhibit the message for someone else.
225 but thoughtless copying of your init file will not inhibit the message 233 @end defopt
226 for someone else. 234
235 @defopt initial-scratch-message
236 This variable, if non-@code{nil}, should be a string, which is
237 inserted into the @samp{*scratch*} buffer when Emacs starts up. If it
238 is @code{nil}, the @samp{*scratch*} buffer is empty.
227 @end defopt 239 @end defopt
228 240
229 @node Init File 241 @node Init File
230 @subsection The Init File, @file{.emacs} 242 @subsection The Init File, @file{.emacs}
231 @cindex init file 243 @cindex init file
232 @cindex @file{.emacs} 244 @cindex @file{.emacs}
233 245
234 When you start Emacs, it normally attempts to load your @dfn{init 246 When you start Emacs, it normally attempts to load your @dfn{init
235 file}, a file in your home directory. Its normal name is 247 file}. This is either a file named @file{.emacs} or @file{.emacs.el}
236 @file{.emacs}, but you can also call it @file{.emacs.el}. 248 in your home directory, or a file named @file{init.el} in a
237 Alternatively, you can use a file named @file{init.el} in a 249 subdirectory named @file{.emacs.d} in your home directory. Whichever
238 subdirectory @file{.emacs.d}. Whichever place you use, you can also 250 place you use, you can also compile the file (@pxref{Byte
239 compile the file (@pxref{Byte Compilation}); then the actual file 251 Compilation}); then the actual file loaded will be @file{.emacs.elc}
240 loaded will be @file{.emacs.elc} or @file{init.elc}. 252 or @file{init.elc}.
241 253
242 The command-line switches @samp{-q}, @samp{-Q}, and @samp{-u} 254 The command-line switches @samp{-q}, @samp{-Q}, and @samp{-u}
243 control whether and where to find the init file; @samp{-q} (and the 255 control whether and where to find the init file; @samp{-q} (and the
244 stronger @samp{-Q}) says not to load an init file, while @samp{-u 256 stronger @samp{-Q}) says not to load an init file, while @samp{-u
245 @var{user}} says to load @var{user}'s init file instead of yours. 257 @var{user}} says to load @var{user}'s init file instead of yours.