X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/f863537572e99e59af3ab7a7b86c94c24e3cd504..9048ad82a936a79bc3a186e501ef3ed1cb043744:/man/faq.texi diff --git a/man/faq.texi b/man/faq.texi index adc1871b58..fb45436480 100644 --- a/man/faq.texi +++ b/man/faq.texi @@ -192,9 +192,9 @@ pressed.}. @kbd{C-?} a ``control'' key, since 127 has both bits 5 and 6 turned ON. Also, on very few keyboards does @kbd{C-?} generate ASCII code 127. -@inforef{Characters, Characters, emacs}, and @inforef{Keys, Keys, emacs}, -for more information. (@xref{On-line manual}, for more information about -Info.) +@inforef{Text Characters, Text Characters, emacs}, and @inforef{Keys, +Keys, emacs}, for more information. (@xref{On-line manual}, for more +information about Info.) @node Extended commands, On-line manual, Basic keys, FAQ notation @section What does @file{M-x @var{command}} mean? @@ -274,7 +274,7 @@ default, Info documentation is placed in @file{/usr/local/info}. Some of these files are available individually via FTP or e-mail; see @ref{Informational files for Emacs}. They all are available in the source distribution. Many of the files in the @file{etc} directory are -also available via the Emacs "@samp{Help} menu, or by typing @kbd{C-h ?} +also available via the Emacs @samp{Help} menu, or by typing @kbd{C-h ?} (@kbd{M-x help-for-help}). Your system administrator may have removed the @file{src} directory and @@ -797,9 +797,9 @@ parentheses. This goes to the node named ``Top'' in that file. For example, to view a Info file named @file{@var{info-file}} in your home directory, you can type this: -@lisp -C-h i g (~/@var{info-file}) @key{RET} -@end lisp +@example +@kbd{C-h i g (~/@var{info-file}) @key{RET}} +@end example @item You can create your own Info directory. You can tell Emacs where that @@ -1031,8 +1031,8 @@ Via HTTP or FTP. You can always fetch the latest FAQ from @item In the Emacs distribution. Since Emacs 18.56, the FAQ at the time -of release has been part of the Emacs distribution as -@file{man/faq.texi} (@pxref{File-name conventions}). +of release has been part of the Emacs distribution as either +@file{etc/FAQ} or @file{man/faq.texi} (@pxref{File-name conventions}). @item Via the World Wide Web. A hypertext version is available at @@ -1165,9 +1165,9 @@ modern GUI programs, and includes 3D widgets (used for the mode line and the scroll bars), a configurable and extensible toolbar, tooltips (a.k.a.@: balloon help), and other niceties. -@cindex Colors on character terminals +@cindex Colors on text-only terminals @cindex TTY colors -In addition, Emacs 21 supports faces on character terminals. This means +In addition, Emacs 21 supports faces on text-only terminals. This means that you can now have colors when you run Emacs on a GNU/Linux console and on @code{xterm} with @kbd{emacs -nw}. @@ -1195,6 +1195,7 @@ and on @code{xterm} with @kbd{emacs -nw}. * Using an already running Emacs process:: * Compiler error messages:: * Indenting switch statements:: +* Customizing C and C++ indentation:: * Horizontal scrolling:: * Overwrite mode:: * Turning off beeping:: @@ -1260,7 +1261,7 @@ interested in performing frequently requested, basic tasks. @cindex Console, colors As of Emacs 21.1, colors and faces are supported in non-windowed mode, -i.e.@: on Unix and GNU/Linux character terminals and consoles, and when +i.e.@: on Unix and GNU/Linux text-only terminals and consoles, and when invoked as @samp{emacs -nw} on X and MS-Windows. (Colors and faces were supported in the MS-DOS port since Emacs 19.29.) Emacs automatically detects color support at startup and uses it if available. If you think @@ -1358,8 +1359,8 @@ variables.) By default, the titlebar for a frame does contain the name of the buffer currently being visited, except if there is a single frame. In such a -case, the titlebar contains the name of the user and the machine at -which Emacs was invoked. This is done by setting +case, the titlebar contains Emacs invocation name and the name of the +machine at which Emacs was invoked. This is done by setting @code{frame-title-format} to the default value of @lisp @@ -1480,7 +1481,7 @@ to search for unprintable characters using @code{re-search-forward}: Using @code{isearch-forward-regexp}: -@kbd{M-C-s [^ @key{TAB} @key{RET} C-q @key{RET} C-q C-l @key{SPC} -~]} +@kbd{M-C-s [^ @key{TAB} @key{LFD} C-q @key{RET} C-q C-l @key{SPC} -~]} To delete all unprintable characters, simply use replace-regexp: @@ -1506,13 +1507,14 @@ something in the minibuffer. @cindex @code{transient-mark-mode} @cindex Region, highlighting a -If you are using a windowing system such as X, you can cause the region -to be highlighted when the mark is active by including +You can cause the region to be highlighted when the mark is active by +including @lisp (transient-mark-mode t) @end lisp +@noindent in your @file{.emacs} file. (Also see @ref{Turning on syntax highlighting}.) @@ -1625,9 +1627,9 @@ or by invoking @code{server-start} from @file{.emacs}: @end lisp When this is done, Emacs starts a subprocess running a program called -@samp{server}. @samp{server} creates a Unix domain socket. The socket -is either named @file{.emacs_server}, in the user's home directory, -or @file{esrv-@var{user-id}-@var{system-name}}, in the @file{/tmp} +@samp{emacsserver}. @samp{emacsserver} creates a Unix domain socket. +The socket is either named @file{.emacs_server}, in the user's home directory, +or @file{esrv-@var{userid}-@var{systemname}}, in the @file{/tmp} directory, depending on how @samp{emacsserver} was compiled. To get your news reader, mail reader, etc., to invoke @@ -1666,8 +1668,9 @@ share the same filesystem for this to work. The pathnames that @samp{emacsclient} specifies should be correct for the filesystem that the Emacs process sees. The Emacs process should not be suspended at the time @samp{emacsclient} is invoked. On Unix and GNU/Linux systems, -@samp{emacsclient} should either be invoked from another X window or -from a shell window inside Emacs itself. +@samp{emacsclient} should either be invoked from another X window, or +from a shell window inside Emacs itself, or from another interactive +session, e.g., by means of a @code{screen} program. @cindex @code{gnuserv} There is an enhanced version of @samp{emacsclient}/server called @@ -1709,7 +1712,7 @@ following to inform Emacs of your changes: compilation-error-regexp-alist)) @end lisp -@node Indenting switch statements, Horizontal scrolling, Compiler error messages, Common requests +@node Indenting switch statements, Customizing C and C++ indentation, Compiler error messages, Common requests @section How do I change the indentation for @code{switch}? @cindex @code{switch}, indenting @cindex Indenting of @code{switch} @@ -1746,7 +1749,91 @@ C programming in Emacs 20 and later) and add the following line to yoyr There appears to be no way to do this with the old @code{c-mode}. -@node Horizontal scrolling, Overwrite mode, Indenting switch statements, Common requests +@node Customizing C and C++ indentation, Horizontal scrolling, Indenting switch statements, Common requests +@section How to customize indentation in C, C@t{++}, and Java buffers? +@cindex Indentation, how to customize +@cindex Customize indentation + +The Emacs @code{cc-mode} features an interactive procedure for +customizing the indentation style, which is fully explained in the +@cite{CC Mode} manual that is part of the Emacs distribution, see +@ref{Customizing Indentation, , Customization Indentation, ccmode, +The CC Mode Manual}. Here's a short summary of the procedure: + +@enumerate +@item +Go to the beginning of the first line where you don't like the +indentation and type @kbd{C-c C-o}. Emacs will prompt you for the +syntactic symbol; type @key{RET} to accept the default it suggests. + +@item +Emacs now prompts for the offset of this syntactic symbol, showing the +default (the current definition) inside parentheses. You can choose +one of these: + +@table @code +@item 0 +No extra indentation. +@item + +Indent one basic offset. +@item - +Outdent one basic offset. +@item ++ +Indent two basic offsets +@item -- +Outdent two basic offsets. +@item * +Indent half basic offset. +@item / +Outdent half basic offset. +@end table + +@item +After choosing one of these symbols, type @kbd{C-c C-q} to reindent +the line or the block according to what you just specified. + +@item +If you don't like the result, go back to step 1. Otherwise, add the +following line to your @file{.emacs}: + +@lisp +(c-set-offset '@var{syntactic-symbol} @var{offset}) +@end lisp + +@noindent +where @var{syntactic-symbol} is the name Emacs shows in the minibuffer +when you type @kbd{C-c C-o} at the beginning of the line, and +@var{offset} is one of the indentation symbols listed above (@code{+}, +@code{/}, @code{0}, etc.) that you've chosen during the interactive +procedure. + +@item +Go to the next line whose indentation is not to your liking and repeat +the process there. +@end enumerate + +It is recommended to put all the resulting @code{(c-set-offset ...)} +customizations inside a C mode hook, like this: + +@lisp +(defun my-c-mode-hook () + (c-set-offset ...) + (c-set-offset ...)) +(add-hook 'c-mode-hook 'my-c-mode-hook) +@end lisp + +@noindent +Using @code{c-mode-hook} avoids the need to put a @w{@code{(require +'cc-mode)}} into your @file{.emacs} file, because @code{c-set-offset} +might be unavailable when @code{cc-mode} is not loaded. + +Note that @code{c-mode-hook} runs for C source files only; use +@code{c++-mode-hook} for C@t{++} sources, @code{java-mode-hook} for +Java sources, etc. If you want the same customizations to be in +effect in @emph{all} languages supported by @code{cc-mode}, use +@code{c-mode-common-hook}. + +@node Horizontal scrolling, Overwrite mode, Customizing C and C++ indentation, Common requests @section How can I make Emacs automatically scroll horizontally? @cindex @code{hscroll-mode} @cindex Horizontal scrolling @@ -2072,11 +2159,11 @@ when you press the @key{TAB} character in certain modes. To do this to an entire buffer, type @kbd{M-< M-x replace-regexp @key{RET} ^ @key{RET} > @key{RET}}. -To do this to a region, use @code{string-rectangle} (@kbd{C-x r t}). +To do this to a region, use @code{string-insert-rectangle}. Set the mark (@kbd{C-@key{SPC}}) at the beginning of the first line you want to prefix, move the cursor to last line to be prefixed, and type -@kbd{C-x r t > @key{RET}}. To do this for the whole buffer, type -@kbd{C-x h C-x r t > @key{RET}}. +@kbd{M-x string-insert-rectangle @key{RET}}. To do this for the whole +buffer, type @kbd{C-x h M-x string-insert-rectangle @key{RET}}. If you are trying to prefix a yanked mail message with @samp{>}, you might want to set the variable @code{mail-yank-prefix}. Better yet, use @@ -2367,8 +2454,8 @@ To move a menu option from one position to another, simply evaluate More detailed information---and more examples of how to create and modify menu options---are in the @cite{Emacs Lisp Reference Manual}, under -``Keymaps''. (@xref{Emacs Lisp documentation}, for information on this -manual.) +``Menu Keymaps''. (@xref{Emacs Lisp documentation}, for information on +this manual.) @node Deleting menus and menu options, Turning on syntax highlighting, Modifying pull-down menus, Common requests @section How do I delete menus and menu options? @@ -2609,6 +2696,7 @@ later), which converts these ANSI escape sequences into colors. * Problems with very large files:: * ^M in the shell buffer:: * Shell process exits abnormally:: +* Problems with Shell Mode on MS-Windows:: * Termcap/Terminfo entries for Emacs:: * Spontaneous entry into isearch-mode:: * Problems talking to certain hosts:: @@ -2720,6 +2808,16 @@ with the following Lisp form, (setenv "ESHELL" "/bin/csh") @end lisp +The above solutions try to prevent the shell from producing the +@samp{^M} characters in the first place. If this is not possible +(e.g., if you use a Windows shell), you can get Emacs to remove these +characters from the buffer by adding this to your @file{.emacs} init +file: + +@smalllisp +(add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m) +@end smalllisp + On a related note: If your shell is echoing your input line in the shell buffer, you might want to try the following command in your shell start-up file: @@ -2728,7 +2826,7 @@ start-up file: stty -icrnl -onlcr -echo susp ^Z @end example -@node Shell process exits abnormally, Termcap/Terminfo entries for Emacs, ^M in the shell buffer, Bugs and problems +@node Shell process exits abnormally, Problems with Shell Mode on MS-Windows, ^M in the shell buffer, Bugs and problems @section Why do I get "Process shell exited abnormally with code 1"? @cindex Abnormal exits from @code{shell-mode} @cindex @code{shell-mode} exits @@ -2753,10 +2851,39 @@ It has been reported that this sometimes happened when Emacs was started as an X client from an xterm window (i.e., had a controlling tty) but the xterm was later terminated. -See also @samp{PROBLEMS} (in the top-level directory when you unpack the -Emacs source) for other possible causes of this message. +See also @samp{PROBLEMS} (in the @file{etc} subdirectory of the +top-level directory when you unpack the Emacs source) for other +possible causes of this message. -@node Termcap/Terminfo entries for Emacs, Spontaneous entry into isearch-mode, Shell process exits abnormally, Bugs and problems +@node Problems with Shell Mode on MS-Windows, Termcap/Terminfo entries for Emacs, Shell process exits abnormally, Bugs and problems +@section Why do I get an error message when I try to run @kbd{M-x shell}? + +@cindex Shell Mode, and MS-Windows +@cindex @code{explicit-shell-file-name} +On MS-Windows, this might happen because Emacs tries to look for the +shell in a wrong place. The default file name @file{/bin/sh} is +usually incorrect for non-Unix systems. If you know where your shell +executable is, set the variable @code{explicit-shell-file-name} in +your @file{.emacs} file to point to its full file name, like this: + +@lisp +(setq explicit-shell-file-name "d:/shells/bash.exe") +@end lisp + +If you don't know what shell does Emacs use, try the @kbd{M-!} +command; if that works, put the following line into your +@file{.emacs}: + +@lisp +(setq explicit-shell-file-name shell-file-name) +@end lisp + +@cindex Antivirus programs, and Shell Mode +Some people have trouble with Shell Mode because of intrusive +antivirus software; disabling the resident antivirus program solves +the problems in those cases. + +@node Termcap/Terminfo entries for Emacs, Spontaneous entry into isearch-mode, Problems with Shell Mode on MS-Windows, Bugs and problems @section Where is the termcap/terminfo entry for terminal type "emacs"? @cindex Termcap @cindex Terminfo @@ -3293,10 +3420,10 @@ files before you upgrade, and you shouldn't have too much trouble. @cindex Problems building Emacs @cindex Errors when building Emacs -First look in the file @file{PROBLEMS} (in the top-level directory when -you unpack the Emacs source) to see if there is already a solution for -your problem. Next, look for other questions in this FAQ that have to -do with Emacs installation and compilation problems. +First look in the file @file{etc/PROBLEMS} (where you unpack the Emacs +source) to see if there is already a solution for your problem. Next, +look for other questions in this FAQ that have to do with Emacs +installation and compilation problems. If you'd like to have someone look at your problem and help solve it, see @ref{Help installing Emacs}. @@ -3304,7 +3431,7 @@ see @ref{Help installing Emacs}. If you cannot find a solution in the documentation, send a message to @email{bug-gnu-emacs@@gnu.org}. -Please do not post it to @uref{news:gnu.emacs.help} or send e-mail to +Please don't post it to @uref{news:gnu.emacs.help} or send e-mail to @email{help-gnu-emacs@@gnu.org}. For further guidelines, see @ref{Guidelines for newsgroup postings} and @ref{Reporting bugs}. @@ -3640,9 +3767,9 @@ All of these utilities are available at @end table -The files @file{INSTALL} (near its end) and @file{PROBLEMS} in the -top-level directory of the Emacs source contains some additional -information regarding Emacs under MS-DOS. +The files @file{INSTALL} (near its end) and @file{etc/PROBLEMS} in the +directory of the Emacs sources contains some additional information +regarding Emacs under MS-DOS. For a list of other MS-DOS implementations of Emacs (and Emacs look-alikes), consult the list of "Emacs implementations and literature," @@ -3656,9 +3783,9 @@ lack certain features, such as the Emacs Lisp extension language. @node Emacs for Windows, Emacs for OS/2, Emacs for MS-DOS, Finding Emacs and related packages @section Where can I get Emacs for Microsoft Windows @cindex FAQ for NT Emacs +@cindex Emacs for MS-Windows @cindex Microsoft Windows, Emacs for -@cindex Windows NT and Windows 2K, Emacs for -@cindex Windows 95, 98, and ME, Emacs for +@cindex Windows 9X, ME, NT, 2K, and CE, Emacs for For information on Emacs for Windows 95 and NT, read the FAQ produced by @email{voelker@@cs.washington.edu, Geoff Voelker}, available at @@ -3667,6 +3794,15 @@ For information on Emacs for Windows 95 and NT, read the FAQ produced by @xref{Emacs for MS-DOS}, for Windows 3.1. +A port of Emacs 20.7 for Windows CE, based on NTEmacs, is available at + +@uref{http://www.rainer-keuchel.de/software.html} + +@noindent +This port was done by @email{coyxc@@rainer-keuchel.de, Rainer Keuchel}, +and supports all Emacs features except async subprocesses and menus. +You will need MSVC 6.0 and a Windows CE SDK to build this port. + @node Emacs for OS/2, Emacs for Atari ST, Emacs for Windows, Finding Emacs and related packages @section Where can I get Emacs for my PC running OS/2? @cindex OS/2, Emacs for @@ -4439,11 +4575,13 @@ change the default swap keys (@code{flow-control-c-s-replacement} and If you are fixing this for yourself, simply put the form in your @file{.emacs} file. If you are fixing this for your entire site, the -best place to put it is in the @file{lisp/site-start.el} file. Putting -this form in @file{lisp/default.el} has the problem that if the user's -@file{.emacs} file has an error, this will prevent -@file{lisp/default.el} from being loaded and Emacs may be unusable for -the user, even for correcting their @file{.emacs} file (unless they're +best place to put it is in the @file{site-lisp/site-start.el} file. +(Here @file{site-lisp} is actually a subdirectory of your Emacs +installation directory, typically @file{/usr/local/share/emacs}.) +Putting this form in @file{site-lisp/default.el} has the problem that +if the user's @file{.emacs} file has an error, this will prevent +@file{default.el} from being loaded and Emacs may be unusable for the +user, even for correcting their @file{.emacs} file (unless they're smart enough to move it to another name). @code{enable-flow-control} can be invoked interactively as well: @@ -4463,11 +4601,11 @@ To bind @kbd{C-s} and @kbd{C-q}, use either @code{enable-flow-control} or @code{enable-flow-control-on}. @xref{Handling C-s and C-q with flow control}, for usage and implementation details. -To bind other keys, use @code{keyboard-translate}. @xref{Swapping keys}, -for usage details. To do this for an entire site, you should swap the -keys in @file{lisp/site-start.el}. @xref{Handling C-s and C-q with flow -control}, for an explanation of why @file{lisp/default.el} should not be -used. +To bind other keys, use @code{keyboard-translate}. @xref{Swapping +keys}, for usage details. To do this for an entire site, you should +swap the keys in @file{site-lisp/site-start.el}. @xref{Handling C-s +and C-q with flow control}, for an explanation of why +@file{site-lisp/default.el} should not be used. @itemize @bullet @@ -4698,7 +4836,7 @@ is how to make @kbd{H-M-RIGHT} move forward a word: Not all modifiers are permitted in all situations. @key{Hyper}, @key{Super}, and @key{Alt} are not available on Unix character terminals. Non-ASCII keys and mouse events (e.g. @kbd{C-=} and -@kbd{mouse-1}) also fall under this category. +@kbd{Mouse-1}) also fall under this category. @end itemize @@ -4725,7 +4863,7 @@ You may have big problems using @code{mwm} as your window manager. @item For X11: Make sure it really is a @key{Meta} key. Use @code{xev} to find out what keysym your @key{Meta} key generates. It should be either -@key{Meta}_L or @key{Meta}_R. If it isn't, use @file{xmodmap} to fix +@code{Meta_L} or @code{Meta_R}. If it isn't, use @file{xmodmap} to fix the situation. @item @@ -4809,7 +4947,7 @@ undesirable if you actually intend to use them. @cindex Eight-bit characters, displaying @inforef{Single-Byte Character Support, Single-byte Character Set -Support, emacs}. On a Unix, when Emacs runs on a character terminal +Support, emacs}. On a Unix, when Emacs runs on a text-only terminal display or is invoked with @samp{emacs -nw}, you typically need to use @code{set-terminal-coding-system} to tell Emacs what the terminal can display, even after setting the language environment; otherwise @@ -4858,7 +4996,7 @@ Emacs 18. Write to Joel if you want the patches or package. @c FIXME: Should we mention Ehud Karni's package? @file{hebrew.el} requires a Hebrew screen font, but no other hardware support. -Joel has a screen font for PCs running MS-DOS and Linux. +Joel has a screen font for PCs running MS-DOS or GNU/Linux. You might also try to query archie for files named with @file{hebrew}; several ftp sites in Israel may also have the necessary files.