30 |
* Terminal Output:: Recording terminal output for debugging. |
* Terminal Output:: Recording terminal output for debugging. |
31 |
* Sound Output:: Playing sounds on the computer's speaker. |
* Sound Output:: Playing sounds on the computer's speaker. |
32 |
* X11 Keysyms:: Operating on key symbols for X Windows |
* X11 Keysyms:: Operating on key symbols for X Windows |
|
* Flow Control:: How to turn output flow control on or off. |
|
33 |
* Batch Mode:: Running Emacs without terminal interaction. |
* Batch Mode:: Running Emacs without terminal interaction. |
34 |
* Session Management:: Saving and restoring state with X Session Management. |
* Session Management:: Saving and restoring state with X Session Management. |
35 |
@end menu |
@end menu |
85 |
It runs the normal hook @code{before-init-hook}. |
It runs the normal hook @code{before-init-hook}. |
86 |
|
|
87 |
@item |
@item |
88 |
It loads the library @file{site-start}, unless the option |
It loads the library @file{site-start} (if any), unless the option |
89 |
@samp{-no-site-file} was specified. The library's file name is usually |
@samp{-Q} (or @samp{--no-site-file}) was specified. The library's file |
90 |
@file{site-start.el}. |
name is usually @file{site-start.el}. |
91 |
@cindex @file{site-start.el} |
@cindex @file{site-start.el} |
92 |
|
|
93 |
@item |
@item |
94 |
It loads your init file (usually @file{~/.emacs}), unless @samp{-q}, |
It loads your init file (usually @file{~/.emacs}), unless @samp{-q} |
95 |
@samp{-no-init-file}, or @samp{-batch} was specified on the command line. |
(or @samp{--no-init-file}), @samp{-Q}, or @samp{--batch} was specified |
96 |
The @samp{-u} option can specify another user whose home directory |
on the command line. The @samp{-u} option can specify another user |
97 |
should be used instead of @file{~}. |
whose home directory should be used instead of @file{~}. |
98 |
|
|
99 |
@item |
@item |
100 |
It loads the library @file{default}, unless @code{inhibit-default-init} |
It loads the library @file{default} (if any), unless |
101 |
is non-@code{nil}. (This is not done in @samp{-batch} mode or if |
@code{inhibit-default-init} is non-@code{nil}. (This is not done in |
102 |
@samp{-q} was specified on the command line.) The library's file name |
@samp{-batch} mode, or if @samp{-Q} or @samp{-q} was specified on the |
103 |
is usually @file{default.el}. |
command line.) The library's file name is usually @file{default.el}. |
104 |
@cindex @file{default.el} |
@cindex @file{default.el} |
105 |
|
|
106 |
@item |
@item |
117 |
|
|
118 |
@item |
@item |
119 |
It displays the initial echo area message, unless you have suppressed |
It displays the initial echo area message, unless you have suppressed |
120 |
that with @code{inhibit-startup-echo-area-message}. |
that with @code{inhibit-startup-echo-area-message} or @samp{-Q}. |
121 |
|
|
122 |
@item |
@item |
123 |
It processes the action arguments from the command line. |
It processes the action arguments from the command line. |
135 |
|
|
136 |
@item |
@item |
137 |
It displays copyleft, nonwarranty, and basic use information, provided |
It displays copyleft, nonwarranty, and basic use information, provided |
138 |
there were no remaining command-line arguments (a few steps above), |
the value of @code{inhibit-startup-message} is @code{nil}, you didn't |
139 |
the value of @code{inhibit-startup-message} is @code{nil}, and the |
specify @samp{--no-splash} or @samp{-Q}, and the buffer is still empty. |
|
buffer is still empty. |
|
140 |
@end enumerate |
@end enumerate |
141 |
|
|
142 |
@defopt inhibit-startup-message |
@defopt inhibit-startup-message |
177 |
@cindex @file{.emacs} |
@cindex @file{.emacs} |
178 |
|
|
179 |
When you start Emacs, it normally attempts to load your @dfn{init |
When you start Emacs, it normally attempts to load your @dfn{init |
180 |
file}, a file in your home directory. Its normal name is @file{.emacs}, |
file}, a file in your home directory. Its normal name is |
181 |
but you can alternatively call it @file{.emacs.el}, which enables you to |
@file{.emacs}, but you can alternatively call it @file{.emacs.el}. |
182 |
byte-compile it (@pxref{Byte Compilation}); then the actual file loaded |
You can also store it inside a subdirectory @file{.emacs.d}. |
183 |
will be @file{.emacs.elc}. |
Whichever place you use, you can also compile the file (@pxref{Byte |
184 |
|
Compilation}); then the actual file loaded will be @file{.emacs.elc}. |
185 |
The command-line switches @samp{-q} and @samp{-u} control whether and |
|
186 |
where to find the init file; @samp{-q} says not to load an init file, |
The command-line switches @samp{-q}, @samp{-Q}, and @samp{-u} |
187 |
and @samp{-u @var{user}} says to load @var{user}'s init file instead of |
control whether and where to find the init file; @samp{-q} (and the |
188 |
yours. @xref{Entering Emacs,,, emacs, The GNU Emacs Manual}. If |
stronger @samp{-Q}) says not to load an init file, while @samp{-u |
189 |
neither option is specified, Emacs uses the @code{LOGNAME} environment |
@var{user}} says to load @var{user}'s init file instead of yours. |
190 |
|
@xref{Entering Emacs,,, emacs, The GNU Emacs Manual}. If neither |
191 |
|
option is specified, Emacs uses the @code{LOGNAME} environment |
192 |
variable, or the @code{USER} (most systems) or @code{USERNAME} (MS |
variable, or the @code{USER} (most systems) or @code{USERNAME} (MS |
193 |
systems) variable, to find your home directory and thus your init file; |
systems) variable, to find your home directory and thus your init |
194 |
this way, even if you have su'd, Emacs still loads your own init file. |
file; this way, even if you have su'd, Emacs still loads your own init |
195 |
If those environment variables are absent, though, Emacs uses your |
file. If those environment variables are absent, though, Emacs uses |
196 |
user-id to find your home directory. |
your user-id to find your home directory. |
197 |
|
|
198 |
@cindex default init file |
@cindex default init file |
199 |
A site may have a @dfn{default init file}, which is the library named |
A site may have a @dfn{default init file}, which is the library |
200 |
@file{default.el}. Emacs finds the @file{default.el} file through the |
named @file{default.el}. Emacs finds the @file{default.el} file |
201 |
standard search path for libraries (@pxref{How Programs Do Loading}). |
through the standard search path for libraries (@pxref{How Programs Do |
202 |
The Emacs distribution does not come with this file; sites may provide |
Loading}). The Emacs distribution does not come with this file; sites |
203 |
one for local customizations. If the default init file exists, it is |
may provide one for local customizations. If the default init file |
204 |
loaded whenever you start Emacs, except in batch mode or if @samp{-q} is |
exists, it is loaded whenever you start Emacs, except in batch mode or |
205 |
specified. But your own personal init file, if any, is loaded first; if |
if @samp{-q} (or @samp{-Q}) is specified. But your own personal init |
206 |
it sets @code{inhibit-default-init} to a non-@code{nil} value, then |
file, if any, is loaded first; if it sets @code{inhibit-default-init} |
207 |
Emacs does not subsequently load the @file{default.el} file. |
to a non-@code{nil} value, then Emacs does not subsequently load the |
208 |
|
@file{default.el} file. |
209 |
|
|
210 |
Another file for site-customization is @file{site-start.el}. Emacs |
Another file for site-customization is @file{site-start.el}. Emacs |
211 |
loads this @emph{before} the user's init file. You can inhibit the |
loads this @emph{before} the user's init file. You can inhibit the |
212 |
loading of this file with the option @samp{-no-site-file}. |
loading of this file with the option @samp{--no-site-file}. |
213 |
|
|
214 |
@defvar site-run-file |
@defvar site-run-file |
215 |
This variable specifies the site-customization file to load before the |
This variable specifies the site-customization file to load before the |
1527 |
|
|
1528 |
If @var{flow} is non-@code{nil}, then Emacs uses @sc{xon/xoff} |
If @var{flow} is non-@code{nil}, then Emacs uses @sc{xon/xoff} |
1529 |
(@kbd{C-q}, @kbd{C-s}) flow control for output to the terminal. This |
(@kbd{C-q}, @kbd{C-s}) flow control for output to the terminal. This |
1530 |
has no effect except in @sc{cbreak} mode. @xref{Flow Control}. |
has no effect except in @sc{cbreak} mode. |
1531 |
|
|
1532 |
@c Emacs 19 feature |
@c Emacs 19 feature |
1533 |
The argument @var{meta} controls support for input character codes |
The argument @var{meta} controls support for input character codes |
1622 |
char-table. Then we fill it in to swap the characters @kbd{C-s} and |
char-table. Then we fill it in to swap the characters @kbd{C-s} and |
1623 |
@kbd{C-\} and the characters @kbd{C-q} and @kbd{C-^}. Subsequently, |
@kbd{C-\} and the characters @kbd{C-q} and @kbd{C-^}. Subsequently, |
1624 |
typing @kbd{C-\} has all the usual effects of typing @kbd{C-s}, and vice |
typing @kbd{C-\} has all the usual effects of typing @kbd{C-s}, and vice |
1625 |
versa. (@xref{Flow Control}, for more information on this subject.) |
versa. |
1626 |
|
|
1627 |
@cindex flow control example |
@cindex flow control example |
1628 |
@example |
@example |
1821 |
@section Terminal Output |
@section Terminal Output |
1822 |
@cindex terminal output |
@cindex terminal output |
1823 |
|
|
1824 |
The terminal output functions send output to the terminal, or keep |
The terminal output functions send output to a text terminal, or keep |
1825 |
track of output sent to the terminal. The variable @code{baud-rate} |
track of output sent to the terminal. The variable @code{baud-rate} |
1826 |
tells you what Emacs thinks is the output speed of the terminal. |
tells you what Emacs thinks is the output speed of the terminal. |
1827 |
|
|
1853 |
@defun send-string-to-terminal string |
@defun send-string-to-terminal string |
1854 |
This function sends @var{string} to the terminal without alteration. |
This function sends @var{string} to the terminal without alteration. |
1855 |
Control characters in @var{string} have terminal-dependent effects. |
Control characters in @var{string} have terminal-dependent effects. |
1856 |
|
This function operates only on text terminals. |
1857 |
|
|
1858 |
One use of this function is to define function keys on terminals that |
One use of this function is to define function keys on terminals that |
1859 |
have downloadable function key definitions. For example, this is how (on |
have downloadable function key definitions. For example, this is how (on |
2005 |
@end lisp |
@end lisp |
2006 |
@end defvar |
@end defvar |
2007 |
|
|
|
@node Flow Control |
|
|
@section Flow Control |
|
|
@cindex flow control characters |
|
|
|
|
|
This section attempts to answer the question ``Why does Emacs use |
|
|
flow-control characters in its command character set?'' For a second |
|
|
view on this issue, read the comments on flow control in the |
|
|
@file{emacs/INSTALL} file from the distribution; for help with Termcap |
|
|
entries and DEC terminal concentrators, see @file{emacs/etc/TERMS}. |
|
|
|
|
|
@cindex @kbd{C-s} |
|
|
@cindex @kbd{C-q} |
|
|
At one time, most terminals did not need flow control, and none used |
|
|
@code{C-s} and @kbd{C-q} for flow control. Therefore, the choice of |
|
|
@kbd{C-s} and @kbd{C-q} as command characters for searching and quoting |
|
|
was natural and uncontroversial. With so many commands needing key |
|
|
assignments, of course we assigned meanings to nearly all @acronym{ASCII} |
|
|
control characters. |
|
|
|
|
|
Later, some terminals were introduced which required these characters |
|
|
for flow control. They were not very good terminals for full-screen |
|
|
editing, so Emacs maintainers ignored them. In later years, flow |
|
|
control with @kbd{C-s} and @kbd{C-q} became widespread among terminals, |
|
|
but by this time it was usually an option. And the majority of Emacs |
|
|
users, who can turn flow control off, did not want to switch to less |
|
|
mnemonic key bindings for the sake of flow control. |
|
|
|
|
|
So which usage is ``right''---Emacs's or that of some terminal and |
|
|
concentrator manufacturers? This question has no simple answer. |
|
|
|
|
|
One reason why we are reluctant to cater to the problems caused by |
|
|
@kbd{C-s} and @kbd{C-q} is that they are gratuitous. There are other |
|
|
techniques (albeit less common in practice) for flow control that |
|
|
preserve transparency of the character stream. Note also that their use |
|
|
for flow control is not an official standard. Interestingly, on the |
|
|
model 33 teletype with a paper tape punch (around 1970), @kbd{C-s} and |
|
|
@kbd{C-q} were sent by the computer to turn the punch on and off! |
|
|
|
|
|
As window systems and PC terminal emulators replace character-only |
|
|
terminals, the flow control problem is gradually disappearing. For the |
|
|
mean time, Emacs provides a convenient way of enabling flow control if |
|
|
you want it: call the function @code{enable-flow-control}. |
|
|
|
|
|
@deffn Command enable-flow-control &optional arg |
|
|
When @var{arg} is a positive integer, this function enables use of |
|
|
@kbd{C-s} and @kbd{C-q} for output flow control, and provides the |
|
|
characters @kbd{C-\} and @kbd{C-^} as aliases for them using |
|
|
@code{keyboard-translate-table} (@pxref{Translating Input}). |
|
|
|
|
|
When @var{arg} is a negative integer or zero, it disables these |
|
|
features. When @var{arg} is @code{nil} or omitted, it toggles. |
|
|
Interactively, @var{arg} is the prefix argument. If non-@code{nil}, |
|
|
its numeric value is used. |
|
|
@end deffn |
|
|
|
|
|
You can use the function @code{enable-flow-control-on} in your |
|
|
init file to enable flow control automatically on certain |
|
|
terminal types. |
|
|
|
|
|
@defun enable-flow-control-on &rest termtypes |
|
|
This function enables flow control, and the aliases @kbd{C-\} and @kbd{C-^}, |
|
|
if the terminal type is one of @var{termtypes}. For example: |
|
|
|
|
|
@smallexample |
|
|
(enable-flow-control-on "vt200" "vt300" "vt101" "vt131") |
|
|
@end smallexample |
|
|
@end defun |
|
|
|
|
|
Here is how @code{enable-flow-control} does its job: |
|
|
|
|
|
@enumerate |
|
|
@item |
|
|
@cindex @sc{cbreak} |
|
|
It sets @sc{cbreak} mode for terminal input, and tells the operating |
|
|
system to handle flow control. This is done using @code{set-input-mode}. |
|
|
|
|
|
@item |
|
|
It sets up @code{keyboard-translate-table} to translate @kbd{C-\} and |
|
|
@kbd{C-^} into @kbd{C-s} and @kbd{C-q}. Except at its very |
|
|
lowest level, Emacs never knows that the characters typed were anything |
|
|
but @kbd{C-s} and @kbd{C-q}, so you can in effect type them as @kbd{C-\} |
|
|
and @kbd{C-^} even when they are input for other commands. |
|
|
@xref{Translating Input}. |
|
|
@end enumerate |
|
|
|
|
|
If the terminal is the source of the flow control characters, then once |
|
|
you enable kernel flow control handling, you probably can make do with |
|
|
less padding than normal for that terminal. You can reduce the amount |
|
|
of padding by customizing the Termcap entry. You can also reduce it by |
|
|
setting @code{baud-rate} to a smaller value so that Emacs uses a smaller |
|
|
speed when calculating the padding needed. @xref{Terminal Output}. |
|
|
|
|
2008 |
@node Batch Mode |
@node Batch Mode |
2009 |
@section Batch Mode |
@section Batch Mode |
2010 |
@cindex batch mode |
@cindex batch mode |
2016 |
to be outputting to an erasable screen. The idea is that you specify |
to be outputting to an erasable screen. The idea is that you specify |
2017 |
Lisp programs to run; when they are finished, Emacs should exit. The |
Lisp programs to run; when they are finished, Emacs should exit. The |
2018 |
way to specify the programs to run is with @samp{-l @var{file}}, which |
way to specify the programs to run is with @samp{-l @var{file}}, which |
2019 |
loads the library named @var{file}, and @samp{-f @var{function}}, which |
loads the library named @var{file}, or @samp{-f @var{function}}, which |
2020 |
calls @var{function} with no arguments. |
calls @var{function} with no arguments, or @samp{--eval @var{form}}. |
2021 |
|
|
2022 |
Any Lisp program output that would normally go to the echo area, |
Any Lisp program output that would normally go to the echo area, |
2023 |
either using @code{message}, or using @code{prin1}, etc., with @code{t} |
either using @code{message}, or using @code{prin1}, etc., with @code{t} |