Mercurial > emacs
comparison man/misc.texi @ 36168:df827c1def99
Clean up close-quote punctuation.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 17 Feb 2001 17:50:28 +0000 |
parents | fd06a4e20d87 |
children | 62cf166239f3 |
comparison
equal
deleted
inserted
replaced
36167:aae9fb198e83 | 36168:df827c1def99 |
---|---|
305 @cindex subshell | 305 @cindex subshell |
306 @cindex shell commands | 306 @cindex shell commands |
307 | 307 |
308 Emacs has commands for passing single command lines to inferior shell | 308 Emacs has commands for passing single command lines to inferior shell |
309 processes; it can also run a shell interactively with input and output | 309 processes; it can also run a shell interactively with input and output |
310 to an Emacs buffer named @samp{*shell*} or run s shell inside a terminal | 310 to an Emacs buffer named @samp{*shell*} or run a shell inside a terminal |
311 emulator window. | 311 emulator window. |
312 | 312 |
313 There is a shell implemented entirely in Emacs, documented in a separate | 313 There is a shell implemented entirely in Emacs, documented in a separate |
314 manual. @xref{, ,Eshell , eshell, Eshell: The Emacs Shell}. | 314 manual. @xref{, ,Eshell , eshell, Eshell: The Emacs Shell}. |
315 | 315 |
336 @menu | 336 @menu |
337 * Single Shell:: How to run one shell command and return. | 337 * Single Shell:: How to run one shell command and return. |
338 * Interactive Shell:: Permanent shell taking input via Emacs. | 338 * Interactive Shell:: Permanent shell taking input via Emacs. |
339 * Shell Mode:: Special Emacs commands used with permanent shell. | 339 * Shell Mode:: Special Emacs commands used with permanent shell. |
340 * History: Shell History. Repeating previous commands in a shell buffer. | 340 * History: Shell History. Repeating previous commands in a shell buffer. |
341 * Directory Tracking:: Keeping track when the subshell changes directory. | |
341 * Options: Shell Options. Options for customizing Shell mode. | 342 * Options: Shell Options. Options for customizing Shell mode. |
342 * Terminal emulator:: An Emacs window as a terminal emulator. | 343 * Terminal emulator:: An Emacs window as a terminal emulator. |
343 * Term Mode:: Special Emacs commands used in Term mode. | 344 * Term Mode:: Special Emacs commands used in Term mode. |
344 * Paging in Term:: Paging in the terminal emulator. | 345 * Paging in Term:: Paging in the terminal emulator. |
345 * Remote Host:: Connecting to another computer. | 346 * Remote Host:: Connecting to another computer. |
417 windows or buffers and edit them while the shell is waiting, or while it is | 418 windows or buffers and edit them while the shell is waiting, or while it is |
418 running a command. Output from the subshell waits until Emacs has time to | 419 running a command. Output from the subshell waits until Emacs has time to |
419 process it; this happens whenever Emacs is waiting for keyboard input or | 420 process it; this happens whenever Emacs is waiting for keyboard input or |
420 for time to elapse. | 421 for time to elapse. |
421 | 422 |
423 @cindex @code{comint-highlight-input} face | |
424 @cindex @code{comint-highlight-prompt} face | |
425 Input lines, once you submit them, are displayed using the face | |
426 @code{comint-highlight-input}, and prompts are displayed using the | |
427 face @code{comint-highlight-prompt}. This makes it easier to see | |
428 previous input lines in the buffer. @xref{Faces}. | |
429 | |
422 To make multiple subshells, rename the buffer @samp{*shell*} to | 430 To make multiple subshells, rename the buffer @samp{*shell*} to |
423 something different using @kbd{M-x rename-uniquely}. Then type @kbd{M-x | 431 something different using @kbd{M-x rename-uniquely}. Then type @kbd{M-x |
424 shell} again to create a new buffer @samp{*shell*} with its own | 432 shell} again to create a new buffer @samp{*shell*} with its own |
425 subshell. If you rename this buffer as well, you can create a third | 433 subshell. If you rename this buffer as well, you can create a third |
426 one, and so on. All the subshells run independently and in parallel. | 434 one, and so on. All the subshells run independently and in parallel. |
435 specified is relative, the directories in the list @code{exec-path} are | 443 specified is relative, the directories in the list @code{exec-path} are |
436 searched; this list is initialized based on the environment variable | 444 searched; this list is initialized based on the environment variable |
437 @env{PATH} when Emacs is started. Your @file{.emacs} file can override | 445 @env{PATH} when Emacs is started. Your @file{.emacs} file can override |
438 either or both of these default initializations. | 446 either or both of these default initializations. |
439 | 447 |
448 Emacs sends the new shell the contents of the file | |
449 @file{~/.emacs_@var{shellname}} as input, if it exists, where | |
450 @var{shellname} is the name of the file that the shell was loaded | |
451 from. For example, if you use bash, the file sent to it is | |
452 @file{~/.emacs_bash}. | |
453 | |
440 To specify a coding system for the shell, you can use the command | 454 To specify a coding system for the shell, you can use the command |
441 @kbd{C-x @key{RET} c} immediately before @kbd{M-x shell}. You can also | 455 @kbd{C-x @key{RET} c} immediately before @kbd{M-x shell}. You can also |
442 specify a coding system after starting the shell by using @kbd{C-x | 456 specify a coding system after starting the shell by using @kbd{C-x |
443 @key{RET} p} in the shell buffer. @xref{Specify Coding}. | 457 @key{RET} p} in the shell buffer. @xref{Specify Coding}. |
444 | |
445 As soon as the subshell is started, it is sent as input the contents | |
446 of the file @file{~/.emacs_@var{shellname}}, if that file exists, where | |
447 @var{shellname} is the name of the file that the shell was loaded from. | |
448 For example, if you use bash, the file sent to it is | |
449 @file{~/.emacs_bash}. | |
450 | |
451 @vindex shell-pushd-regexp | |
452 @vindex shell-popd-regexp | |
453 @vindex shell-cd-regexp | |
454 @code{cd}, @code{pushd} and @code{popd} commands given to the inferior | |
455 shell are watched by Emacs so it can keep the @samp{*shell*} buffer's | |
456 default directory the same as the shell's working directory. These | |
457 commands are recognized syntactically by examining lines of input that are | |
458 sent. If you use aliases for these commands, you can tell Emacs to | |
459 recognize them also. For example, if the value of the variable | |
460 @code{shell-pushd-regexp} matches the beginning of a shell command line, | |
461 that line is regarded as a @code{pushd} command. Change this variable when | |
462 you add aliases for @samp{pushd}. Likewise, @code{shell-popd-regexp} and | |
463 @code{shell-cd-regexp} are used to recognize commands with the meaning of | |
464 @samp{popd} and @samp{cd}. These commands are recognized only at the | |
465 beginning of a shell command line.@refill | |
466 | |
467 @vindex shell-set-directory-error-hook | |
468 If Emacs gets an error while trying to handle what it believes is a | |
469 @samp{cd}, @samp{pushd} or @samp{popd} command, it runs the hook | |
470 @code{shell-set-directory-error-hook} (@pxref{Hooks}). | |
471 | |
472 @findex dirs | |
473 If Emacs does not properly track changes in the current directory of | |
474 the subshell, use the command @kbd{M-x dirs} to ask the shell what its | |
475 current directory is. This command works for shells that support the | |
476 most common command syntax; it may not work for unusual shells. | |
477 | |
478 @findex dirtrack-mode | |
479 You can also use @kbd{M-x dirtrack-mode} to enable (or disable) an | |
480 alternative and more aggressive method of tracking changes in the | |
481 current directory. | |
482 | 458 |
483 Emacs defines the environment variable @env{EMACS} in the subshell, | 459 Emacs defines the environment variable @env{EMACS} in the subshell, |
484 with value @code{t}. A shell script can check this variable to | 460 with value @code{t}. A shell script can check this variable to |
485 determine whether it has been run from an Emacs subshell. | 461 determine whether it has been run from an Emacs subshell. |
486 | 462 |
497 | 473 |
498 @table @kbd | 474 @table @kbd |
499 @item @key{RET} | 475 @item @key{RET} |
500 @kindex RET @r{(Shell mode)} | 476 @kindex RET @r{(Shell mode)} |
501 @findex comint-send-input | 477 @findex comint-send-input |
502 @vindex comint-use-prompt-regexp-instead-of-fields | |
503 @cindex prompt, shell | 478 @cindex prompt, shell |
504 At end of buffer send line as input; otherwise, copy current line to end | 479 At end of buffer send line as input; otherwise, copy current line to |
505 of buffer and send it (@code{comint-send-input}). When a line is | 480 end of buffer and send it (@code{comint-send-input}). When a line is |
506 copied, any prompt is left out (where the prompt is the part of the line | 481 copied, any prompt at the beginning if the line (text output by |
507 that was not input by the user; see also | 482 programs preceding your input) is omitted. See also |
508 @code{comint-use-prompt-regexp-instead-of-fields}). | 483 @code{comint-use-prompt-regexp-instead-of-fields}). |
509 | 484 |
510 @item @key{TAB} | 485 @item @key{TAB} |
511 @kindex TAB @r{(Shell mode)} | 486 @kindex TAB @r{(Shell mode)} |
512 @findex comint-dynamic-complete | 487 @findex comint-dynamic-complete |
825 | 800 |
826 @node History References | 801 @node History References |
827 @subsubsection Shell History References | 802 @subsubsection Shell History References |
828 @cindex history reference | 803 @cindex history reference |
829 | 804 |
830 Various shells including csh and bash support @dfn{history references} | 805 Various shells including csh and bash support @dfn{history |
831 that begin with @samp{!} and @samp{^}. Shell mode can understand these | 806 references} that begin with @samp{!} and @samp{^}. Shell mode |
832 constructs and perform the history substitution for you. If you insert | 807 recognizes these constructs, and can perform the history substitution |
833 a history reference and type @key{TAB}, this searches the input history | 808 for you. |
834 for a matching command, performs substitution if necessary, and places | 809 |
835 the result in the buffer in place of the history reference. For | 810 If you insert a history reference and type @key{TAB}, this searches |
836 example, you can fetch the most recent command beginning with @samp{mv} | 811 the input history for a matching command, performs substitution if |
837 with @kbd{! m v @key{TAB}}. You can edit the command if you wish, and | 812 necessary, and places the result in the buffer in place of the history |
838 then resubmit the command to the shell by typing @key{RET}. | 813 reference. For example, you can fetch the most recent command |
814 beginning with @samp{mv} with @kbd{! m v @key{TAB}}. You can edit the | |
815 command if you wish, and then resubmit the command to the shell by | |
816 typing @key{RET}. | |
817 | |
818 @vindex comint-input-autoexpand | |
819 @findex comint-magic-space | |
820 Shell mode can optionally expand history references in the buffer | |
821 when you send them to the shell. To request this, set the variable | |
822 @code{comint-input-autoexpand} to @code{input}. You can make | |
823 @key{SPC} perform history expansion by binding @key{SPC} to the | |
824 command @code{comint-magic-space}. | |
839 | 825 |
840 @vindex shell-prompt-pattern | 826 @vindex shell-prompt-pattern |
841 @vindex comint-prompt-regexp | 827 @vindex comint-prompt-regexp |
842 @vindex comint-use-prompt-regexp-instead-of-fields | 828 @vindex comint-use-prompt-regexp-instead-of-fields |
843 @cindex prompt, shell | 829 @cindex prompt, shell |
844 History references take effect only following a shell prompt. The | 830 Shell mode recognizes history references when they follow a prompt. |
845 prompt is defined to be any text not input by the user, unless the | 831 Normally, any text output by a program at the beginning of an input |
846 variable @code{comint-use-prompt-regexp-instead-of-fields} is | 832 line is considered a prompt. However, if the variable |
847 non-@code{nil} (the default value is @code{nil}). When | 833 @code{comint-use-prompt-regexp-instead-of-fields} is non-@code{nil}, |
848 @code{comint-use-prompt-regexp-instead-of-fields} is non-@code{nil}, the | 834 then Comint mode uses a regular expression to recognize prompts. In |
849 variable @code{shell-prompt-pattern} specifies how to recognize a shell | 835 general, the variable @code{comint-prompt-regexp} specifies the |
850 prompt, and comint modes in general use the variable | 836 regular expression; Shell mode uses the variable |
851 @code{comint-prompt-regexp} (shell mode uses @code{shell-prompt-pattern} | 837 @code{shell-prompt-pattern} to set up @code{comint-prompt-regexp} in |
852 to set up the local value of @code{comint-prompt-regexp}). | 838 the shell buffer. |
853 | 839 |
854 @vindex comint-input-autoexpand | 840 @node Directory Tracking |
855 Shell mode can optionally expand history references in the buffer when | 841 @subsection Directory Tracking |
856 you send them to the shell. To request this, set the variable | 842 @cindex directory tracking |
857 @code{comint-input-autoexpand} to @code{input}. | 843 |
858 | 844 @vindex shell-pushd-regexp |
859 @findex comint-magic-space | 845 @vindex shell-popd-regexp |
860 You can make @key{SPC} perform history expansion by binding @key{SPC} to | 846 @vindex shell-cd-regexp |
861 the command @code{comint-magic-space}. | 847 Shell mode keeps track of @samp{cd}, @samp{pushd} and @samp{popd} |
848 commands given to the inferior shell, so it can keep the | |
849 @samp{*shell*} buffer's default directory the same as the shell's | |
850 working directory. It recognizes these commands syntactically, by | |
851 examining lines of input that are sent. | |
852 | |
853 If you use aliases for these commands, you can tell Emacs to | |
854 recognize them also. For example, if the value of the variable | |
855 @code{shell-pushd-regexp} matches the beginning of a shell command | |
856 line, that line is regarded as a @code{pushd} command. Change this | |
857 variable when you add aliases for @samp{pushd}. Likewise, | |
858 @code{shell-popd-regexp} and @code{shell-cd-regexp} are used to | |
859 recognize commands with the meaning of @samp{popd} and @samp{cd}. | |
860 These commands are recognized only at the beginning of a shell command | |
861 line. | |
862 | |
863 @vindex shell-set-directory-error-hook | |
864 If Emacs gets an error while trying to handle what it believes is a | |
865 @samp{cd}, @samp{pushd} or @samp{popd} command, it runs the hook | |
866 @code{shell-set-directory-error-hook} (@pxref{Hooks}). | |
867 | |
868 @findex dirs | |
869 If Emacs gets confused about changes in the current directory of the | |
870 subshell, use the command @kbd{M-x dirs} to ask the shell what its | |
871 current directory is. This command works for shells that support the | |
872 most common command syntax; it may not work for unusual shells. | |
873 | |
874 @findex dirtrack-mode | |
875 You can also use @kbd{M-x dirtrack-mode} to enable (or disable) an | |
876 alternative and more aggressive method of tracking changes in the | |
877 current directory. | |
862 | 878 |
863 @node Shell Options | 879 @node Shell Options |
864 @subsection Shell Mode Options | 880 @subsection Shell Mode Options |
865 | 881 |
866 @vindex comint-scroll-to-bottom-on-input | 882 @vindex comint-scroll-to-bottom-on-input |
927 directory stack if they are not already on it | 943 directory stack if they are not already on it |
928 (@code{shell-pushd-dunique}). The values you choose should match the | 944 (@code{shell-pushd-dunique}). The values you choose should match the |
929 underlying shell, of course. | 945 underlying shell, of course. |
930 | 946 |
931 @node Terminal emulator | 947 @node Terminal emulator |
932 @subsection Interactive Inferior Shell with Terminal Emulator | 948 @subsection Emacs Terminal Emulator |
933 @findex term | 949 @findex term |
934 | 950 |
935 To run a subshell in a terminal emulator, putting its typescript in an Emacs | 951 To run a subshell in a terminal emulator, putting its typescript in |
936 buffer, use @kbd{M-x term}. This creates (or reuses) a buffer named | 952 an Emacs buffer, use @kbd{M-x term}. This creates (or reuses) a |
937 @samp{*term*} and runs a subshell with input coming from your keyboard and | 953 buffer named @samp{*term*}, and runs a subshell with input coming from |
938 output going to that buffer. | 954 your keyboard, and output going to that buffer. |
939 | 955 |
940 All the normal keys that you type are sent without any interpretation | 956 The terminal emulator uses Term mode, which has two input modes. In |
941 by Emacs directly to the subshell, as ``terminal input''. | 957 line mode, Term basically acts like Shell mode; see @ref{Shell Mode}. |
942 Any ``echo'' of your input is the responsibility of the subshell. | 958 |
943 (The exception is the terminal escape character, | 959 In char mode, each character is sent directly to the inferior |
944 which by default is @kbd{C-c}. @xref{Term Mode}.) | 960 subshell, as ``terminal input.'' Any ``echoing'' of your input is the |
961 responsibility of the subshell. The sole exception is the terminal | |
962 escape character, which by default is @kbd{C-c} (@pxref{Term Mode}). | |
945 Any ``terminal output'' from the subshell goes into the buffer, | 963 Any ``terminal output'' from the subshell goes into the buffer, |
946 advancing point. | 964 advancing point. |
947 | 965 |
948 Some programs (such as Emacs itself) need to control the | 966 Some programs (such as Emacs itself) need to control the appearance |
949 appearance on the terminal screen in detail. They do this by | 967 on the terminal screen in detail. They do this by sending special |
950 sending special control codes. The exact control | 968 control codes. The exact control codes needed vary from terminal to |
951 codes needed vary from terminal to terminal, but nowadays | 969 terminal, but nowadays most terminals and terminal emulators |
952 most terminals and terminal emulators (including @code{xterm}) | 970 (including @code{xterm}) understand the ANSI-standard (VT100-style) |
953 understand the ANSI-standard (VT100-style) escape sequences. | 971 escape sequences. Term mode recognizes these escape sequences, and |
954 Term mode also understands these escape sequences, | 972 handles each one appropriately, changing the buffer so that the |
955 and for each control code does the appropriate thing | 973 appearance of the window matches what it would be on a real terminal. |
956 to change the buffer so that the appearance of the window | 974 You can actually run Emacs inside an Emacs Term window. |
957 matches what it would be on a real terminal. | 975 |
958 Thus you can actually run Emacs inside an Emacs Term window! | 976 The file name used to load the subshell is determined the same way |
959 | 977 as for Shell mode. To make multiple terminal emulators, rename the |
960 Emacs does not wait for the subshell to do anything. You can switch | 978 buffer @samp{*term*} to something different using @kbd{M-x |
961 windows or buffers and edit them while the shell is waiting, or while | 979 rename-uniquely}, just as with Shell mode. |
962 it is running a command. Output from the subshell waits until Emacs | 980 |
963 has time to process it; this happens whenever Emacs is waiting for | 981 Unlike Shell mode, Term mode does not track the current directory by |
964 keyboard input or for time to elapse. | 982 examining your input. But some shells can tell Term what the current |
965 | 983 directory is. This is done automatically by @code{bash} version 1.15 |
966 To make multiple terminal emulators, rename the buffer @samp{*term*} | 984 and later. |
967 to something different using @kbd{M-x rename-uniquely}, | |
968 just as with Shell mode. | |
969 | |
970 The file name used to load the subshell is determined | |
971 the same way as for Shell mode. | |
972 | |
973 Unlike Shell mode, Term mode does not track the current directory | |
974 by examining your input. Instead, if you use a programmable | |
975 shell, you can have it tell Term what the current directory is. | |
976 This is done automatically by @code{bash} version 1.15 and later. | |
977 | 985 |
978 @node Term Mode | 986 @node Term Mode |
979 @subsection Term Mode | 987 @subsection Term Mode |
980 @cindex Term mode | 988 @cindex Term mode |
981 @cindex mode, Term | 989 @cindex mode, Term |
982 | 990 |
983 Term uses Term mode, which has two input modes: | 991 The terminal emulator uses Term mode, which has two input modes. In |
984 In line mode, Term basically acts like Shell mode. @xref{Shell Mode}. | 992 line mode, Term basically acts like Shell mode; see @ref{Shell Mode}. |
985 In Char mode, each character is sent directly to the inferior subshell, | 993 In char mode, each character is sent directly to the inferior |
986 except for the Term escape character, normally @kbd{C-c}. | 994 subshell, except for the Term escape character, normally @kbd{C-c}. |
987 | 995 |
988 To switch between line and char mode, use these commands: | 996 To switch between line and char mode, use these commands: |
997 | |
989 @table @kbd | 998 @table @kbd |
990 @kindex C-c C-k @r{(Term mode)} | 999 @kindex C-c C-k @r{(Term mode)} |
991 @findex term-char-mode | 1000 @findex term-char-mode |
992 @item C-c C-k | 1001 @item C-c C-k |
993 Switch to line mode. Do nothing if already in line mode. | 1002 Switch to line mode. Do nothing if already in line mode. |
996 @findex term-line-mode | 1005 @findex term-line-mode |
997 @item C-c C-j | 1006 @item C-c C-j |
998 Switch to char mode. Do nothing if already in char mode. | 1007 Switch to char mode. Do nothing if already in char mode. |
999 @end table | 1008 @end table |
1000 | 1009 |
1001 The following commands are only available in Char mode: | 1010 The following commands are only available in char mode: |
1011 | |
1002 @table @kbd | 1012 @table @kbd |
1003 @item C-c C-c | 1013 @item C-c C-c |
1004 Send a literal @key{C-c} to the sub-shell. | 1014 Send a literal @key{C-c} to the sub-shell. |
1005 | 1015 |
1006 @item C-c C-x | 1016 @item C-c C-x |
1008 For example, @kbd{C-c C-x o} invokes the global binding of | 1018 For example, @kbd{C-c C-x o} invokes the global binding of |
1009 @kbd{C-x o}, which is normally @samp{other-window}. | 1019 @kbd{C-x o}, which is normally @samp{other-window}. |
1010 @end table | 1020 @end table |
1011 | 1021 |
1012 @node Paging in Term | 1022 @node Paging in Term |
1013 @subsection Paging in the terminal emulator | 1023 @subsection Page-At-A-Time Output |
1014 | 1024 @cindex page-at-a-time |
1015 Term mode has a pager feature. When the pager is enabled, | 1025 |
1016 term mode will pause at the end of each screenful. | 1026 Term mode has a page-at-a-time feature. When enabled it makes |
1027 output pause at the end of each screenful. | |
1017 | 1028 |
1018 @table @kbd | 1029 @table @kbd |
1019 @kindex C-c C-q @r{(Term mode)} | 1030 @kindex C-c C-q @r{(Term mode)} |
1020 @findex term-pager-toggle | 1031 @findex term-pager-toggle |
1021 @item C-c C-q | 1032 @item C-c C-q |
1022 Toggles the pager feature: Disables the pager if it is enabled, | 1033 Toggle the page-at-a-time feature. This command works in both line |
1023 and vice versa. This works in both line and char modes. | 1034 and char modes. When page-at-a-time is enabled, the mode-line |
1024 If the pager enabled, the mode-line contains the word @samp{page}. | 1035 displays the word @samp{page}. |
1025 @end table | 1036 @end table |
1026 | 1037 |
1027 If the pager is enabled, and Term receives more than a screenful | 1038 With page-at-a-time enabled, whenever Term receives more than a |
1028 of output since your last input, Term will enter More break mode. | 1039 screenful of output since your last input, it pauses, displaying |
1029 This is indicated by @samp{**MORE**} in the mode-line. | 1040 @samp{**MORE**} in the mode-line. Type @key{SPC} to display the next |
1030 Type a @kbd{Space} to display the next screenful of output. | 1041 screenful of output. Type @kbd{?} to see your other options. The |
1031 Type @kbd{?} to see your other options. The interface is similar | 1042 interface is similar to the Unix @code{more} program. |
1032 to the Unix @code{more} program. | |
1033 | 1043 |
1034 @node Remote Host | 1044 @node Remote Host |
1035 @subsection Remote Host Shell | 1045 @subsection Remote Host Shell |
1036 @cindex remote host | 1046 @cindex remote host |
1037 @cindex connecting to remote host | 1047 @cindex connecting to remote host |
1040 | 1050 |
1041 You can login to a remote computer, using whatever commands you | 1051 You can login to a remote computer, using whatever commands you |
1042 would from a regular terminal (e.g.@: using the @code{telnet} or | 1052 would from a regular terminal (e.g.@: using the @code{telnet} or |
1043 @code{rlogin} commands), from a Term window. | 1053 @code{rlogin} commands), from a Term window. |
1044 | 1054 |
1045 A program that asks you for a password will normally suppress | 1055 A program that asks you for a password will normally suppress |
1046 echoing of the password, so the password will not show up in the buffer. | 1056 echoing of the password, so the password will not show up in the |
1047 This will happen just as if you were using a real terminal, if | 1057 buffer. This will happen just as if you were using a real terminal, |
1048 the buffer is in char mode. If it is in line mode, the password | 1058 if the buffer is in char mode. If it is in line mode, the password is |
1049 will be temporarily visible, but will be erased when you hit return. | 1059 temporarily visible, but will be erased when you hit return. (This |
1050 (This happens automatically; there is no special password processing.) | 1060 happens automatically; there is no special password processing.) |
1051 | 1061 |
1052 When you log in to a different machine, you need to specify the | 1062 When you log in to a different machine, you need to specify the type |
1053 type of terminal your using. Terminal types @samp{ansi} | 1063 of terminal your using. Terminal types @samp{ansi} or @samp{vt100} |
1054 or @samp{vt100} will work on most systems. | 1064 will work on most systems. |
1055 | 1065 |
1056 @c If you are talking to a Bourne-compatible | 1066 @c If you are talking to a Bourne-compatible |
1057 @c shell, and your system understands the @env{TERMCAP} variable, | 1067 @c shell, and your system understands the @env{TERMCAP} variable, |
1058 @c you can use the command @kbd{M-x shell-send-termcap}, which | 1068 @c you can use the command @kbd{M-x shell-send-termcap}, which |
1059 @c sends a string specifying the terminal type and size. | 1069 @c sends a string specifying the terminal type and size. |
1064 @c it will send special commands to Emacs that will cause Emacs to | 1074 @c it will send special commands to Emacs that will cause Emacs to |
1065 @c pop up the source files you're debugging. This will work | 1075 @c pop up the source files you're debugging. This will work |
1066 @c whether or not gdb is running on a different computer than Emacs, | 1076 @c whether or not gdb is running on a different computer than Emacs, |
1067 @c as long as Emacs can access the source files specified by gdb. | 1077 @c as long as Emacs can access the source files specified by gdb. |
1068 | 1078 |
1069 You cannot log into to a remove comuter using the Shell mode. | 1079 @ignore |
1080 You cannot log into to a remote computer using the Shell mode. | |
1070 @c (This will change when Shell is re-written to use Term.) | 1081 @c (This will change when Shell is re-written to use Term.) |
1071 Instead, Emacs provides two commands for logging in to another computer | 1082 Instead, Emacs provides two commands for logging in to another computer |
1072 and communicating with it through an Emacs buffer. | 1083 and communicating with it through an Emacs buffer using Comint mode: |
1073 | 1084 |
1074 @table @kbd | 1085 @table @kbd |
1075 @item M-x telnet @key{RET} @var{hostname} @key{RET} | 1086 @item M-x telnet @key{RET} @var{hostname} @key{RET} |
1076 Set up a Telnet connection to the computer named @var{hostname}. | 1087 Set up a Telnet connection to the computer named @var{hostname}. |
1077 @item M-x rlogin @key{RET} @var{hostname} @key{RET} | 1088 @item M-x rlogin @key{RET} @var{hostname} @key{RET} |
1111 You can use the command @code{rlogin-directory-tracking-mode} to switch | 1122 You can use the command @code{rlogin-directory-tracking-mode} to switch |
1112 modes. No argument means use remote directory names, a positive | 1123 modes. No argument means use remote directory names, a positive |
1113 argument means use local names, and a negative argument means turn | 1124 argument means use local names, and a negative argument means turn |
1114 off directory tracking. | 1125 off directory tracking. |
1115 | 1126 |
1127 @end ignore | |
1128 | |
1116 @node Emacs Server, Hardcopy, Shell, Top | 1129 @node Emacs Server, Hardcopy, Shell, Top |
1117 @section Using Emacs as a Server | 1130 @section Using Emacs as a Server |
1118 @pindex emacsclient | 1131 @pindex emacsclient |
1119 @cindex Emacs as a server | 1132 @cindex Emacs as a server |
1120 @cindex server, using Emacs as | 1133 @cindex server, using Emacs as |
1159 | 1172 |
1160 You can switch to a server buffer manually if you wish; you don't have | 1173 You can switch to a server buffer manually if you wish; you don't have |
1161 to arrive at it with @kbd{C-x #}. But @kbd{C-x #} is the only way to | 1174 to arrive at it with @kbd{C-x #}. But @kbd{C-x #} is the only way to |
1162 say that you are ``finished'' with one. | 1175 say that you are ``finished'' with one. |
1163 | 1176 |
1177 @vindex server-kill-new-buffers | |
1178 @vindex server-temp-file-regexp | |
1179 Finishing with a server buffer also kills the buffer, unless it | |
1180 already existed in the Emacs session before the server asked to create | |
1181 it. However, if you set @code{server-kill-new-buffers} to @code{nil}, | |
1182 then a different criterion is used: finishing with a server buffer | |
1183 kills it if the file name matches the regular expression | |
1184 @code{server-temp-file-regexp}. This is set up to distinguish certain | |
1185 ``temporary'' files. | |
1186 | |
1164 @vindex server-window | 1187 @vindex server-window |
1165 If you set the variable @code{server-window} to a window or a frame, | 1188 If you set the variable @code{server-window} to a window or a frame, |
1166 @kbd{C-x #} displays the server buffer in that window or in that frame. | 1189 @kbd{C-x #} displays the server buffer in that window or in that frame. |
1167 | 1190 |
1168 While @code{mail} or another application is waiting for | 1191 While @code{mail} or another application is waiting for |
1169 @code{emacsclient} to finish, @code{emacsclient} does not read terminal | 1192 @code{emacsclient} to finish, @code{emacsclient} does not read terminal |
1170 input. So the terminal that @code{mail} was using is effectively | 1193 input. So the terminal that @code{mail} was using is effectively |
1171 blocked for the duration. In order to edit with your principal Emacs, | 1194 blocked for the duration. In order to edit with your principal Emacs, |
1172 you need to be able to use it without using that terminal. There are | 1195 you need to be able to use it without using that terminal. There are |
1173 two ways to do this: | 1196 three ways to do this: |
1174 | 1197 |
1175 @itemize @bullet | 1198 @itemize @bullet |
1176 @item | 1199 @item |
1177 Using a window system, run @code{mail} and the principal Emacs in two | 1200 Using a window system, run @code{mail} and the principal Emacs in two |
1178 separate windows. While @code{mail} is waiting for @code{emacsclient}, | 1201 separate windows. While @code{mail} is waiting for @code{emacsclient}, |
1179 the window where it was running is blocked, but you can use Emacs by | 1202 the window where it was running is blocked, but you can use Emacs by |
1180 switching windows. | 1203 switching windows. |
1181 | 1204 |
1182 @item | 1205 @item |
1183 Use Shell mode in Emacs to run the other program such as @code{mail}; | 1206 Using virtual terminals, run @code{mail} in one virtual terminal |
1184 then, @code{emacsclient} blocks only the subshell under Emacs, and you | 1207 and run Emacs in another. |
1185 can still use Emacs to edit the file. | 1208 |
1209 @item | |
1210 Use Shell mode or Term mode in Emacs to run the other program such as | |
1211 @code{mail}; then, @code{emacsclient} blocks only the subshell under | |
1212 Emacs, and you can still use Emacs to edit the file. | |
1186 @end itemize | 1213 @end itemize |
1187 | 1214 |
1188 @vindex server-temp-file-regexp | |
1189 Some programs write temporary files for you to edit. After you edit | |
1190 the temporary file, the program reads it back and deletes it. If the | |
1191 Emacs server is later asked to edit the same file name, it should assume | |
1192 this has nothing to do with the previous occasion for that file name. | |
1193 The server accomplishes this by killing the temporary file's buffer when | |
1194 you finish with the file. Use the variable | |
1195 @code{server-temp-file-regexp} to specify which files are temporary in | |
1196 this sense; its value should be a regular expression that matches file | |
1197 names that are temporary. | |
1198 | |
1199 @vindex server-kill-new-buffers | |
1200 If the variable @code{server-kill-new-buffers} is set to non-nil, | |
1201 buffers which still have a client are killed when you are done with | |
1202 them, unless they were already present before Emacs Server visited | |
1203 them. This overrides the effect of the @code{server-temp-file-regexp} | |
1204 variable. By default, @code{server-kill-new-buffers} has a non-nil | |
1205 value; set it to nil if you want the old behavior governed by | |
1206 @code{server-temp-file-regexp}. | |
1207 | |
1208 If you run @code{emacsclient} with the option @samp{--no-wait}, it | 1215 If you run @code{emacsclient} with the option @samp{--no-wait}, it |
1209 returns immediately without waiting for you to ``finish'' the buffer in | 1216 returns immediately without waiting for you to ``finish'' the buffer |
1210 Emacs. Note that it this case, buffers for temporary files will not be | 1217 in Emacs. Note that server buffers created in this way are not killed |
1211 killed automatically with the default value of | 1218 automatically when you finish with them. |
1212 @code{server-kill-new-buffers}, since those buffers will not have a | 1219 |
1213 client. | 1220 @menu |
1214 | 1221 * Invoking emacsclient:: |
1215 If you have forgotten to start Emacs, then the option | 1222 @end menu |
1216 @samp{--alternate-editor=@var{command}} may be useful. It specifies a | 1223 |
1217 command to run if @code{emacsclient} fails to contact Emacs. For | 1224 @node Invoking emacsclient,, Emacs Server, Emacs Server |
1218 example, the following setting for the @var{EDITOR} environment variable | 1225 @section Invoking @code{emacsclient} |
1219 will always give an editor, even if Emacs is not running. | 1226 |
1227 To run the @code{emacsclient} program, specify file names as arguments, | |
1228 and optionally line numbers as well. Do it like this: | |
1229 | |
1230 @example | |
1231 emacsclient @r{@{}@r{[}+@var{line}@r{]} @var{filename}@r{@}}@dots{} | |
1232 @end example | |
1233 | |
1234 @noindent | |
1235 This tells Emacs to visit each of the specified files; if you specify a | |
1236 line number for a certain file, Emacs moves to that line in the file. | |
1237 | |
1238 Ordinarily, @code{emacsclient} does not return until you use the | |
1239 @kbd{C-x #} command on each of these buffers. When that happens, | |
1240 Emacs sends a message to the @code{emacsclient} program telling it to | |
1241 return. | |
1242 | |
1243 But if you use the option @samp{-n} or @samp{--no-wait} when running | |
1244 @code{emacsclient}, then it returns immediately. (You can take as | |
1245 long as you like to edit the files in Emacs.) | |
1246 | |
1247 The option @samp{--alternate-editor=@var{command}} is useful when | |
1248 running @code{emacsclient} in a script. It specifies a command to run | |
1249 if @code{emacsclient} fails to contact Emacs. For example, the | |
1250 following setting for the @var{EDITOR} environment variable will | |
1251 always give an editor, even if Emacs is not running: | |
1220 | 1252 |
1221 @example | 1253 @example |
1222 EDITOR="emacsclient --alternate-editor vi +%d %s" | 1254 EDITOR="emacsclient --alternate-editor vi +%d %s" |
1223 @end example | 1255 @end example |
1224 | 1256 |
1257 @noindent | |
1225 The environment variable @var{ALTERNATE_EDITOR} has the same effect, but | 1258 The environment variable @var{ALTERNATE_EDITOR} has the same effect, but |
1226 the value of the @samp{--alternate-editor} takes precedence. | 1259 the value of the @samp{--alternate-editor} takes precedence. |
1227 | 1260 |
1228 @pindex emacs.bash | 1261 @pindex emacs.bash |
1229 Alternatively, the file @file{etc/emacs.bash} defines a function for | 1262 Alternatively, the file @file{etc/emacs.bash} defines a bash |
1230 @command{bash} which will use a running Emacs server or start one if | 1263 function which will communicate with a running Emacs server, or start |
1231 none exists. | 1264 one if none exists. |
1232 | |
1233 @menu | |
1234 * Invoking emacsclient:: | |
1235 @end menu | |
1236 | |
1237 @node Invoking emacsclient,, Emacs Server, Emacs Server | |
1238 @section Invoking @code{emacsclient} | |
1239 | |
1240 To run the @code{emacsclient} program, specify file names as arguments, | |
1241 and optionally line numbers as well. Do it like this: | |
1242 | |
1243 @example | |
1244 emacsclient @r{@{}@r{[}+@var{line}@r{]} @var{filename}@r{@}}@dots{} | |
1245 @end example | |
1246 | |
1247 This tells Emacs to visit each of the specified files; if you specify a | |
1248 line number for a certain file, Emacs moves to that line in the file. | |
1249 | |
1250 Ordinarily, @code{emacsclient} does not return until you use the | |
1251 @kbd{C-x #} command on each of these buffers. When that happens, Emacs | |
1252 sends a message to the @code{emacsclient} program telling it to return. | |
1253 | |
1254 But if you use the option @samp{-n} or @samp{--no-wait} when running | |
1255 @code{emacsclient}, then it returns immediately. (You can take as long | |
1256 as you like to edit the files in Emacs.) | |
1257 | |
1258 | 1265 |
1259 @node Hardcopy, PostScript, Emacs Server, Top | 1266 @node Hardcopy, PostScript, Emacs Server, Top |
1260 @section Hardcopy Output | 1267 @section Hardcopy Output |
1261 @cindex hardcopy | 1268 @cindex hardcopy |
1262 | 1269 |
1401 with color information; on black-and-white printers, colors are emulated | 1408 with color information; on black-and-white printers, colors are emulated |
1402 with shades of gray. This might produce illegible output, even if your | 1409 with shades of gray. This might produce illegible output, even if your |
1403 screen colors only use shades of gray. | 1410 screen colors only use shades of gray. |
1404 | 1411 |
1405 @vindex ps-use-face-background | 1412 @vindex ps-use-face-background |
1406 By default, PostScript printing ignored the background of the faces, | 1413 By default, PostScript printing ignores the background colors of the |
1407 unless the variable @code{ps-use-face-background} is set to a | 1414 faces, unless the variable @code{ps-use-face-background} is |
1408 non-@code{nil} value. This is to avoid unwanted interference with the | 1415 non-@code{nil}. This is to avoid unwanted interference with the zebra |
1409 zebra stripes and background image/text. | 1416 stripes and background image/text. |
1410 | 1417 |
1411 @vindex ps-paper-type | 1418 @vindex ps-paper-type |
1412 @vindex ps-page-dimensions-database | 1419 @vindex ps-page-dimensions-database |
1413 The variable @code{ps-paper-type} specifies which size of paper to | 1420 The variable @code{ps-paper-type} specifies which size of paper to |
1414 format for; legitimate values include @code{a4}, @code{a3}, | 1421 format for; legitimate values include @code{a4}, @code{a3}, |
1834 @xref{Remote Files}. | 1841 @xref{Remote Files}. |
1835 | 1842 |
1836 @vindex save-place | 1843 @vindex save-place |
1837 @cindex Saveplace | 1844 @cindex Saveplace |
1838 @findex toggle-save-place | 1845 @findex toggle-save-place |
1839 There is a simpler mechanism provided by Saveplace library which records | 1846 The Saveplace library provides a simpler feature that records your |
1840 your position in each file when you kill its buffer (or kill Emacs), and | 1847 position in each file when you kill its buffer (or kill Emacs), and |
1841 jumps to the same position when you visit the file again (even in | 1848 jumps to the same position when you visit the file again (even in |
1842 another Emacs session). Use @kbd{M-x toggle-save-place} to turn on | 1849 another Emacs session). Use @kbd{M-x toggle-save-place} to turn on |
1843 place-saving in a given file. Customize the option @code{save-place} to | 1850 place-saving in a given file. Customize the option @code{save-place} |
1844 turn it on for all files in each session. | 1851 to turn it on for all files in each session. |
1845 | 1852 |
1846 @node Recursive Edit, Emulation, Saving Emacs Sessions, Top | 1853 @node Recursive Edit, Emulation, Saving Emacs Sessions, Top |
1847 @section Recursive Editing Levels | 1854 @section Recursive Editing Levels |
1848 @cindex recursive editing level | 1855 @cindex recursive editing level |
1849 @cindex editing level, recursive | 1856 @cindex editing level, recursive |
1955 buffers or major modes while in EDT emulation. | 1962 buffers or major modes while in EDT emulation. |
1956 | 1963 |
1957 @item `PC' bindings | 1964 @item `PC' bindings |
1958 @findex pc-bindings-mode | 1965 @findex pc-bindings-mode |
1959 @cindex `PC' key bindings | 1966 @cindex `PC' key bindings |
1960 The command @kbd{M-x pc-bindings-mode} sets up certain key bindings for | 1967 The command @kbd{M-x pc-bindings-mode} sets up certain key bindings |
1961 `PC compatibility'---what people are often used to on PCs---as follows: | 1968 for ``PC compatibility''---what people are often used to on PCs---as |
1962 @kbd{Delete} and its variants) delete forward instead of backward, | 1969 follows: @kbd{Delete} and its variants delete forward instead of |
1963 @kbd{C-Backspace} kills backward a word (as @kbd{C-Delete} normally | 1970 backward, @kbd{C-Backspace} kills backward a word (as @kbd{C-Delete} |
1964 would), @kbd{M-Backspace} does undo, @kbd{Home} and @kbd{End} move to | 1971 normally would), @kbd{M-Backspace} does undo, @kbd{Home} and @kbd{End} |
1965 beginning and end of line, @kbd{C-Home} and @kbd{C-End} move to | 1972 move to beginning and end of line, @kbd{C-Home} and @kbd{C-End} move |
1966 beginning and end of buffer and @kbd{C-Escape} does @code{list-buffers}. | 1973 to beginning and end of buffer and @kbd{C-Escape} does |
1974 @code{list-buffers}. | |
1967 | 1975 |
1968 @item PC Selection mode | 1976 @item PC Selection mode |
1969 @findex pc-selection-mode | 1977 @findex pc-selection-mode |
1970 @cindex PC Selection minor mode | 1978 @cindex PC Selection minor mode |
1971 @cindex mode, PC selection | 1979 @cindex mode, PC selection |
1972 @cindex selection, `PC' | 1980 @cindex selection, `PC' |
1973 The command @kbd{M-x pc-selction-mode} turns on a global minor mode | 1981 The command @kbd{M-x pc-selection-mode} enables a global minor mode |
1974 which emulates the mark, copy, cut and paste | 1982 that emulates the mark, copy, cut and paste commands of various other |
1975 look-and-feel of Motif programs (which is the same as the Macintosh GUI | 1983 systems---an interface known as CUA. It establishes the keybindings |
1976 and MS-Windows). It makes the keybindings of PC mode and also modifies | 1984 of PC mode, and also modifies the bindings of the cursor keys and the |
1977 the bindings of the cursor keys and the @kbd{next}, @kbd{prior}, | 1985 @kbd{next}, @kbd{prior}, @kbd{home} and @kbd{end} keys. It does not |
1978 @kbd{home} and @kbd{end} keys. It does not provide the full set of CUA | 1986 provide the full set of CUA keybindings---the fundamental Emacs keys |
1979 keybindings---the fundamental Emacs keys @kbd{C-c}, @kbd{C-v} and | 1987 @kbd{C-c}, @kbd{C-v} and @kbd{C-x} are not changed. |
1980 @kbd{C-x} are not rebound. | 1988 |
1981 | 1989 The standard keys for moving around (@kbd{right}, @kbd{left}, |
1982 The standard keys for moving around (@kbd{right}, @kbd{left}, @kbd{up}, | 1990 @kbd{up}, @kbd{down}, @kbd{home}, @kbd{end}, @kbd{prior}, @kbd{next}, |
1983 @kbd{down}, @kbd{home}, @kbd{end}, @kbd{prior}, @kbd{next}, called | 1991 called ``move-keys'') deactivate the mark in PC selection mode. |
1984 ``move-keys'') will always de-activate the mark. Using @kbd{Shift} | 1992 However, using @kbd{Shift} together with the ``move keys'' activates |
1985 together with the ``move keys'' activates the region over which they | 1993 the region over which they move. The copy, cut and paste functions |
1986 move. The copy, cut and paste functions (as in many other programs) | 1994 are available on @kbd{C-insert}, @kbd{S-delete} and @kbd{S-insert} |
1987 operate on the active region, bound to @kbd{C-insert}, @kbd{S-delete} | 1995 respectively. |
1988 and @kbd{S-insert} respectively. | |
1989 | 1996 |
1990 @cindex s-region package | 1997 @cindex s-region package |
1991 The @code{s-region} package provides similar, but less complete, | 1998 The @code{s-region} package provides similar, but less complete, |
1992 facilities. | 1999 facilities. |
1993 | 2000 |
2044 @section Hyperlinking and Navigation Features | 2051 @section Hyperlinking and Navigation Features |
2045 | 2052 |
2046 @cindex hyperlinking | 2053 @cindex hyperlinking |
2047 @cindex URLs | 2054 @cindex URLs |
2048 @cindex navigation | 2055 @cindex navigation |
2049 Various modes documented elsewhere have hypertext features whereby you | 2056 Various modes documented elsewhere have hypertext features so that |
2050 can follow links, usually with @kbd{mouse-2} or @kbd{RET} on the text of | 2057 you can follow links, usually by clicking @kbd{Mouse-2} on the link or |
2051 the link. Info mode, Help mode and the Dired-like modes are examples. | 2058 typing @key{RET} while point is on the link. Info mode, Help mode and |
2052 The Tags facility links between uses and definitions in source files, | 2059 the Dired-like modes are examples. The Tags facility links between |
2053 see @ref{Tags}. Imenu provides navigation amongst items indexed in the | 2060 uses and definitions in source files, see @ref{Tags}. Imenu provides |
2054 current buffer, see @ref{Imenu}. Info-lookup provides mode-specific | 2061 navigation amongst items indexed in the current buffer, see |
2055 lookup of definitions in Info indexes, see @ref{Documentation}. | 2062 @ref{Imenu}. Info-lookup provides mode-specific lookup of definitions |
2056 Speedbar maintains a frame in which links to files, and locations in | 2063 in Info indexes, see @ref{Documentation}. Speedbar maintains a frame |
2057 files are displayed, see @ref{Speedbar}. | 2064 in which links to files, and locations in files are displayed, see |
2058 | 2065 @ref{Speedbar}. |
2059 Other non-mode-specific facilities described in this section enable | 2066 |
2060 following links from the current buffer in a context-sensitive fashion. | 2067 Other non-mode-specific facilities described in this section enable |
2068 following links from the current buffer in a context-sensitive | |
2069 fashion. | |
2061 | 2070 |
2062 @menu | 2071 @menu |
2063 * Browse-URL:: Following URLs. | 2072 * Browse-URL:: Following URLs. |
2064 * Goto-address:: Activating URLs. | 2073 * Goto-address:: Activating URLs. |
2065 * FFAP:: Finding files etc. at point. | 2074 * FFAP:: Finding files etc. at point. |
2081 Load a URL into a Web browser. | 2090 Load a URL into a Web browser. |
2082 @end table | 2091 @end table |
2083 | 2092 |
2084 The Browse-URL package provides facilities for following URLs specifying | 2093 The Browse-URL package provides facilities for following URLs specifying |
2085 links on the World Wide Web. Usually this works by invoking a web | 2094 links on the World Wide Web. Usually this works by invoking a web |
2086 browser but you can, for instance, arrange to invoke @code{compose-mail} | 2095 browser, but you can, for instance, arrange to invoke @code{compose-mail} |
2087 from @samp{mailto:} URLs. Packages such as Gnus may make active links | 2096 from @samp{mailto:} URLs. |
2088 from URLs themselves. Otherwise you can use @kbd{M-x browse-url} to | 2097 |
2089 follow a link, defaulting to the URL at point. Other commands are | 2098 The general way to use this feature is to type @kbd{M-x browse-url}, |
2090 available which you might like to bind to keys, such as | 2099 which displays a specified URL. If point is located near a plausible |
2100 URL, that URL is used as the default. Other commands are available | |
2101 which you might like to bind to keys, such as | |
2091 @code{browse-url-at-point} and @code{browse-url-at-mouse}. | 2102 @code{browse-url-at-point} and @code{browse-url-at-mouse}. |
2092 | 2103 |
2093 @vindex browse-url-browser-function | 2104 @vindex browse-url-browser-function |
2094 You can customize Browse-URL's behaviour via various options in the | 2105 You can customize Browse-URL's behaviour via various options in the |
2095 @code{browse-url} Customize group, particularly | 2106 @code{browse-url} Customize group, particularly |
2096 @code{browse-url-browser-function}. You can invoke actions dependent on | 2107 @code{browse-url-browser-function}. You can invoke actions dependent |
2097 the type of URL by defining @code{browse-url-browser-function} as an | 2108 on the type of URL by defining @code{browse-url-browser-function} as |
2098 association list. The package's commentary available via @kbd{C-h p} | 2109 an association list. The package's commentary available via @kbd{C-h |
2099 provides more information. Packages with facilities for following URLs | 2110 p} provides more information. Packages with facilities for following |
2100 should use Browse-URL, so customizing options in the @code{browse-url} | 2111 URLs should always go through Browse-URL, so that the customization |
2101 group should be sufficient to determine how they all work in that | 2112 options for Browse-URL will affect all browsing in Emacs. |
2102 respect. | |
2103 | 2113 |
2104 @node Goto-address | 2114 @node Goto-address |
2105 @subsection Activating URLs | 2115 @subsection Activating URLs |
2106 @findex goto-address | 2116 @findex goto-address |
2107 @cindex Goto-address | 2117 @cindex Goto-address |
2110 @table @kbd | 2120 @table @kbd |
2111 @item M-x goto-address | 2121 @item M-x goto-address |
2112 Activate URLs and e-mail addresses in the current buffer. | 2122 Activate URLs and e-mail addresses in the current buffer. |
2113 @end table | 2123 @end table |
2114 | 2124 |
2115 You can arrange to activate URLs in any buffer with @kbd{M-x | 2125 You can make URLs in the current buffer active with @kbd{M-x |
2116 goto-address}. It may be useful to add @code{goto-address} to hooks | 2126 goto-address}. This finds all the URLs in the buffer, and establishes |
2117 invoked when buffers are displayed in particular modes. | 2127 bindings for @kbd{Mouse-2} and @kbd{C-c @key{RET}} on them. After |
2118 @code{rmail-show-message-hook} is the appropriate hook if you use Rmail, | 2128 activation, if you click on a URL with @kbd{Mouse-2}, or move to a URL |
2119 or @code{mh-show-mode-hook} if you use MH. | 2129 and type @kbd{C-c @key{RET}}, that will display the web page that the URL |
2130 specifies. For a @samp{mailto} URL, it sends mail instead, using your | |
2131 selected mail-composition method (@pxref{Mail Methods}). | |
2132 | |
2133 It can be useful to add @code{goto-address} to mode hooks and the | |
2134 hooks used to display an incoming message. | |
2135 @code{rmail-show-message-hook} is the appropriate hook for Rmail, and | |
2136 @code{mh-show-mode-hook} for MH-E. This is not needed for Gnus, | |
2137 which has a similar feature of its own. | |
2138 | |
2120 | 2139 |
2121 @node FFAP | 2140 @node FFAP |
2122 @subsection Finding Files and URLs at Point | 2141 @subsection Finding Files and URLs at Point |
2123 @findex ffap | 2142 @findex ffap |
2124 @findex find-file-at-point | 2143 @findex find-file-at-point |
2125 @findex ffap | 2144 @findex ffap |
2126 @findex ffap-dired-at-point | 2145 @findex ffap-dired-at-point |
2127 @findex ffap-next | 2146 @findex ffap-next |
2128 @findex ffap-menu | 2147 @findex ffap-menu |
2129 @cindex FFAP | 2148 @cindex FFAP |
2130 @cindex URLs | |
2131 @cindex finding file at point | 2149 @cindex finding file at point |
2132 | 2150 |
2133 @table @kbd | 2151 FFAP mode replaces certain key bindings for finding files, including |
2134 @item M-x ffap @key{RET} @var{filename} @key{RET} | 2152 @kbd{C-x C-f}, with commands that provide more sensitive defaults. |
2135 Find @var{filename}, guessing a default from text around point. | 2153 These commands behave like the ordinary ones when given a prefix |
2136 @item M-x ffap-next | 2154 argument. Otherwise, they get the default file name or URL from the |
2137 Search buffer for next file or URL, and run `ffap'. With single prefix | 2155 text around point. If what is found in the buffer has the form of a |
2138 arg, search backwards, with double arg wrap search forwards, with triple | 2156 URL rather than a file name, the commands use @code{browse-url} to |
2139 arg wrap search backwards. | 2157 view it. |
2140 @item M-x ffap-menu | 2158 |
2141 Put up a menu of files and URLs mentioned in current buffer and try to | 2159 This feature is useful for following references in mail or news |
2142 fetch the selected one. | 2160 buffers, @file{README} files, @file{MANIFEST} files, and so on. The |
2143 @item M-x ffap-dired-at-point | 2161 @samp{ffap} package's commentary available via @kbd{C-h p} and the |
2144 Start Dired, defaulting to file at point. | 2162 @code{ffap} Custom group provide details. |
2145 @end table | |
2146 | |
2147 The command @kbd{M-x find-file-at-point} (or @kbd{M-x ffap}) can be used | |
2148 as a replacement for @kbd{M-x find-file}. With a prefix argument it | |
2149 behaves as @kbd{M-x find-file}. Otherwise it tries to guess a default | |
2150 file or URL from the text around point. In the case of a URL, it will | |
2151 invoke @code{browse-url} rather than finding a file. This is useful for | |
2152 following references in mail or news buffers, @file{README}s, | |
2153 @file{MANIFEST}s, and so on. The @samp{ffap} package's | |
2154 commentary available via @kbd{C-h p} and the @code{ffap} Custom group | |
2155 provide details. | |
2156 | 2163 |
2157 @cindex FFAP minor mode | 2164 @cindex FFAP minor mode |
2158 @findex ffap-mode | 2165 @findex ffap-mode |
2159 You can turn on FFAP minor mode to make the following key bindings and | 2166 You can turn on FFAP minor mode to make the following key bindings |
2160 to install hooks for using @code{ffap} in Rmail, Gnus and VM article | 2167 and to install hooks for using @code{ffap} in Rmail, Gnus and VM |
2161 buffers. | 2168 article buffers. |
2162 | 2169 |
2163 @table @kbd | 2170 @table @kbd |
2164 @item C-x C-f | 2171 @item C-x C-f @var{filename} @key{RET} |
2165 @kindex C-x C-f @r{(FFAP)} | 2172 @kindex C-x C-f @r{(FFAP)} |
2166 @kbd{find-file-at-point}; | 2173 Find @var{filename}, guessing a default from text around point |
2174 (@code{find-file-at-point}). | |
2167 @item C-x 4 f | 2175 @item C-x 4 f |
2168 @kindex C-x 4 f @r{(FFAP)} | 2176 @kindex C-x 4 f @r{(FFAP)} |
2169 @code{ffap-other-window}, analagous to @kbd{M-x find-file-other-window}; | 2177 @code{ffap-other-window}, analogous to @code{find-file-other-window}. |
2170 @item C-x 5 f | 2178 @item C-x 5 f |
2171 @kindex C-x 5 f @r{(FFAP)} | 2179 @kindex C-x 5 f @r{(FFAP)} |
2172 @code{ffap-other-frame}, analagous to @kbd{M-x find-file-other-frame}; | 2180 @code{ffap-other-frame}, analogous to @code{find-file-other-frame}. |
2173 @item C-x d | 2181 @item M-x ffap-next |
2182 Search buffer for next file name or URL, then find that file or URL. | |
2183 @item C-x d @var{directory} @key{RET} | |
2174 @kindex C-x d @r{(FFAP)} | 2184 @kindex C-x d @r{(FFAP)} |
2175 @code{ffap-dired-at-point}, analogous to @kbd{M-x dired}; | 2185 Start Dired on @var{directory}, defaulting to the directory name at |
2176 @item S-mouse-3 | 2186 point (@code{ffap-dired-at-point}). |
2177 @kindex S-mouse-3 @r{(FFAP)} | 2187 @item S-Mouse-3 |
2188 @kindex S-Mouse-3 @r{(FFAP)} | |
2178 @code{ffap-at-mouse} finds the file guessed from text around the position | 2189 @code{ffap-at-mouse} finds the file guessed from text around the position |
2179 of a mouse click; | 2190 of a mouse click. |
2180 @item C-S-mouse-3 | 2191 @item C-S-Mouse-3 |
2181 @kindex C-S-mouse-3 @r{(FFAP)} | 2192 @kindex C-S-Mouse-3 @r{(FFAP)} |
2182 @code{ffap-menu} puts up a selectable menu of files and URLs mentioned in | 2193 Display a menu of files and URLs mentioned in current buffer, then |
2183 the current buffer. | 2194 find the one you select (@code{ffap-menu}). |
2184 @end table | 2195 @end table |
2185 | 2196 |
2186 @node Find-func | 2197 @node Find-func |
2187 @subsection Finding Function and Variable Definitions | 2198 @subsection Finding Function and Variable Definitions |
2199 @cindex definitions, finding in Lisp sources | |
2200 @cindex Lisp definitions, finding in sources | |
2201 | |
2202 @table @kbd | |
2203 @item M-x find-function @key{RET} @var{function} @key{RET} | |
2204 Find the definition @var{function} in its source file. | |
2205 @item M-x find-variable @key{RET} @var{variable} @key{RET} | |
2206 Find the definition of @var{variable} in its source file. | |
2207 @item M-x find-function-on-key @key{RET} @var{key} | |
2208 Find the definition of the function that @var{key} invokes. | |
2209 @end table | |
2210 | |
2211 These commands provide an easy way to find the definitions of Emacs | |
2212 Lisp functions and variables. They are similar in purpose to the Tags | |
2213 facility (@pxref{Tags}), but don't require a tags table; on the other | |
2214 hand, they only works for function and variable definitions that are | |
2215 already loaded in the Emacs session. | |
2216 | |
2188 @findex find-function | 2217 @findex find-function |
2189 @findex find-function-on-key | 2218 @findex find-function-on-key |
2190 @findex find-variable | 2219 @findex find-variable |
2191 @cindex examples of Lisp functions | 2220 To find the definition of a function, use @kbd{M-x find-function}. |
2192 @cindex Lisp examples | 2221 @kbd{M-x find-variable} finds the definition of a specified variable. |
2193 @cindex Find-func | 2222 @kbd{M-x find-function-on-key} finds the definition of the function |
2194 @cindex Lisp definitions | 2223 bound to a specified key. |
2195 @cindex definitions, locating in sources | 2224 |
2196 @cindex tags | 2225 To use these commands, you must have the Lisp source (@samp{.el}) |
2197 | 2226 files available along with the compiled (@samp{.elc}) files, in |
2198 @table @kbd | 2227 directories in @code{load-path}. You can use compressed source files |
2199 @item M-x find-function @key{RET} @var{function} @key{RET} | 2228 if you enable Auto Compression mode. These commands only handle |
2200 Find the definition of the @var{function} at point. | 2229 definitions written in Lisp, not primitive functions or variables |
2201 @item M-x find-variable @key{RET} @var{variable} @key{RET} | 2230 defined in the C code of Emacs. |
2202 Find the definition of the @var{variable} at point. | |
2203 @item M-x find-function-on-key @var{key} | |
2204 Find the definition of the function that @var{key} invokes. | |
2205 @end table | |
2206 | |
2207 The Find-func package provides convenient facilities for finding the | |
2208 definitions of Emacs Lisp functions and variables. It has a somewhat | |
2209 similar function to the Tags facility (@pxref{Tags}) but uses Emacs's | |
2210 introspective facilities which maintain information about loaded | |
2211 libraries. In contrast to Tags, it only works for functions and | |
2212 variables with definitions which are already loaded but it relates to | |
2213 the code actually running and doesn't require maintaining tags files. | |
2214 | |
2215 You need to have the Lisp source (@samp{.el}) files available on your | |
2216 load path along with the compiled (@samp{.elc}) versions for this to | |
2217 work. You can use compressed source files if you turn on | |
2218 @code{auto-compression-mode}. | |
2219 | |
2220 The commands available include @kbd{M-x find-function} to find the | |
2221 definition of a named function, @kbd{find-function-on-key} to find the | |
2222 definition of the function bound to a key and @kbd{find-variable} to | |
2223 find a variable's definition. These only work for things defined in | |
2224 Lisp source files, not primitive functions or variables defined | |
2225 primitively in the Emacs layer implemented in C. | |
2226 | |
2227 Find-func is useful for finding examples of how to do things if you want | |
2228 to write an Emacs Lisp extension similar to some existing function. | |
2229 | 2231 |
2230 @node Dissociated Press, Amusements, Hyperlinking, Top | 2232 @node Dissociated Press, Amusements, Hyperlinking, Top |
2231 @section Dissociated Press | 2233 @section Dissociated Press |
2232 | 2234 |
2233 @findex dissociated-press | 2235 @findex dissociated-press |
2339 @kbd{M-x morse-region} converts text in a region to Morse code and | 2341 @kbd{M-x morse-region} converts text in a region to Morse code and |
2340 @kbd{M-x unmorse-region} converts it back. No cause for remorse. | 2342 @kbd{M-x unmorse-region} converts it back. No cause for remorse. |
2341 | 2343 |
2342 @findex pong | 2344 @findex pong |
2343 @cindex Pong game | 2345 @cindex Pong game |
2344 @kbd{M-x pong} plays an implementation of the game Pong, bouncing the | 2346 @kbd{M-x pong} plays a Pong-like game, bouncing the ball off opposing |
2345 ball off opposing bats. | 2347 bats. |
2346 | 2348 |
2347 @findex solitaire | 2349 @findex solitaire |
2348 @cindex solitaire | 2350 @cindex solitaire |
2349 @kbd{M-x solitaire} plays a game of solitaire in which you jump pegs | 2351 @kbd{M-x solitaire} plays a game of solitaire in which you jump pegs |
2350 across other pegs. | 2352 across other pegs. |
2351 | 2353 |
2352 @findex studlify-region | 2354 @findex studlify-region |
2353 @cindex StudlyCaps | 2355 @cindex StudlyCaps |
2354 @kbd{M-x studlify-region} studlify-cases the region, that is | 2356 @kbd{M-x studlify-region} studlify-cases the region, producing |
2357 text like this: | |
2355 | 2358 |
2356 @example | 2359 @example |
2357 M-x stUdlIfY-RegioN stUdlIfY-CaSeS thE region. | 2360 M-x stUdlIfY-RegioN stUdlIfY-CaSeS thE region. |
2358 @end example | 2361 @end example |
2359 | 2362 |
2360 @findex tetris | 2363 @findex tetris |
2361 @cindex Tetris | 2364 @cindex Tetris |
2362 @kbd{M-x tetris} runs an implementation of the well-known Tetris game. | |
2363 @findex snake | 2365 @findex snake |
2364 @cindex Snake | 2366 @cindex Snake |
2367 @kbd{M-x tetris} runs an implementation of the well-known Tetris game. | |
2365 Likewise, @kbd{M-x snake} provides an implementation of Snake. | 2368 Likewise, @kbd{M-x snake} provides an implementation of Snake. |
2366 | 2369 |
2367 When you are frustrated, try the famous Eliza program. Just do | 2370 When you are frustrated, try the famous Eliza program. Just do |
2368 @kbd{M-x doctor}. End each input by typing @key{RET} twice. | 2371 @kbd{M-x doctor}. End each input by typing @key{RET} twice. |
2369 | 2372 |