http:^^www.cs.washington.edu^homes^voelker^ntemacs.html
来自「This data set contains WWW-pages collect」· HTML 代码 · 共 1,495 行 · 第 1/5 页
HTML
1,495 行
</dl><hr><h3><a name="subproc">Subprocesses under Emacs</h3>Emacs on NT and Win95 can utilize subprocesses just like Unix Emacs.However, the behavior of subprocesses with Emacs may be unintuitive insome situations. This section discusses these situations, and how youmight work around them. <p><h4><a name="subproc-console">Programs reading input hang</h4>Programs that explicitly use a handle to the console ("CON" or "CON:")instead of stdin and stdout cannot be used as subprocesses to Emacs,and they will also not work in shell-mode (the default ftp clients onWin95 and NT are examples of such programs). There is no convenientway for either Emacs or any shell used in shell-mode to redirect theinput and output of such processes from the console to input andoutput pipes. The only workaround is to use a differentimplementation of the program that does not use the console directly(see the discussion on <!WA113><!WA113><!WA113><a href="#ange-ftp">ange-ftp</a> for areplacement for the default ftp clients). <p><h4><a name="subproc-buffer">Buffering in shells</h4>You may notice that some programs, when run in a shell in shell-mode,have their output buffered (e.g., people have found this happening tothem with sql-mode). When the program has a lot of output, itoverflows the buffering and gets printed to the shell buffer; however,if the program only outputs a small amount of text, it will remainbuffered and won't appear in the shell buffer. <p>Although it may at first seem like the shell is buffering the outputfrom the program, it is actually the program that is buffering output.The C runtime typically decides how to buffer output based uponwhether stdout is bound to a handle to a console window or not. Ifbound to a console window, output is buffered line by line; if boundto a block device, such as a file, output is buffered block by block. <p>In a shell buffer, stdout is a pipe handle and so is buffered inblocks. If you would like the buffering behavior of your program tobehave differently, the program itself is going to have to be changed;you can use setbuf and setvbuf to manipulate the buffering semantics.<p><h4><a name="subproc-dos">DOS subprocesses</h4>You can run DOS subprocesses under Emacs, but with the limitation thatyou run only one at a time. The implication of this is that, if youuse command.com under Win95 as your shell, then you can only run oneshell process at a time (command.com is still a DOS process even underWin95). You can use other shells, such as bash, tcsh, or 4NT, insteadof command.com; see the <!WA114><!WA114><!WA114><a href="#other-tools">section below on othertools</a> for pointers to other sites. <p>Andrew Innes is working on removing this limitation. If all goeswell, it should be available in 19.35. <p><hr><h3><a name="shell">How do I use a shell in Emacs?</h3>You can use an interactive subshell in Emacs by typing "M-x shell".Emacs uses the SHELL configuration variable to determine which programto use as the shell. If you installed Emacs using the addpm.exeprogram, then addpm.exe will associate the value %COMSPEC% with SHELLin the registry. Emacs will then use the value of the COMSPECenvironment variable when it starts up, <i>unless</i> the SHELLenvironment variable is explicitly defined (as when using theemacs.bat batch file). <p>If you would like to specify a different shell for Emacs to use, thenyou should do one of two things. You should either explicitly set theenvironment variable SHELL to be the shell you want to use, or, if youwant to have the COMSPEC environment variable determine the shell,then you need to install Emacs using the addpm.exe program and ensurethat the SHELL environment variable is <i>not</i> defined when youstart up Emacs. <p><h4><a name="shell-echo">How do I prevent shell commands from being echoed?</h4>Some shells echo the commands that you send to them, and the echoedcommands appear in the output buffer. In particular, the defaultshells, command.com on Win95 and cmd.exe on NT, have thisbehavior. <p>To prevent echoed commands from being printed, you can place thefollowing in your startup file: <p><blockquote><pre>(setq comint-process-echoes t)</pre></blockquote>If shell-mode still is not stripping echoed commands, then you'll haveto explicitly tell the shell to not echo commands. You can do this bysetting the <tt>explicit-<i>SHELL</i>-args</tt> variableappropriately, where <tt><i>SHELL</i></tt> is the value of your shellenvironment variable (do a "M-: (getenv "SHELL")" to see what it iscurrently set to). Assuming that you are on NT and that your SHELLenvironment variable is set to cmd.exe, then placing the following inyour startup file will tell cmd.exe to not echo commands: <p><blockquote><pre>(setq explicit-cmd.exe-args '("/q"))</pre></blockquote>The comint package will use the value of this variable as an argumentto cmd.exe every time it starts up a new shell (as in shell-mode); the<tt>/q</tt> is the argument to cmd.exe that stops the echoing (in ashell, invoking "cmd /?" will show you all of the command linearguments to cmd.exe). <p>Note that this variable is case sensitive; if the value of your SHELLenvironment variable is CMD.EXE instead, then this variable needs tobe named <tt>explicit-CMD.EXE-args</tt> instead. <p><h4><a name="shell-command_com">Why is a "Specified COMMAND search directory bad" message printed?</h4>The function <tt>shell</tt> in shell.el automatically invokes theshell program with the argument "-i", and parses this as the directoryin which the shell program resides (which, of course, is invalid). Toprevent this message from being printed, you can create a variablenamed according to the form specified in the help message of<tt>shell</tt> (to look at the help message, type "C-h f shell"). Forthe default shells, then, you could place the following in yourstartup file to prevent this message (these will eventually get intowinnt.el so you don't have to do this):<blockquote><pre>(setq explicit-command.com-args nil)(setq explicit-COMMAND.COM-args nil)(setq explicit-cmd.exe-args nil)(setq explicit-CMD.EXE-args nil)</pre></blockquote>Multiple lines for each shell are given since variable names are casesensitive and shell names can be any case (so this only handles themost common situations). If you have an entirely different shell thatalso complains about being given the "-i" switch, you can initialize asimilarly named variable to prevent the "-i" switch from being sent tothe shell. <p>Note that, if you would like to always pass arguments to aninteractive shell when it starts up, you would change the nil value inthe appropriate assignment above to the list of arguments you wouldlike to use with your shell. For example, if you would like to invokecommand.com and tell it which directory its executable resides, youcould place something like the following in your startup file: <p><blockquote><pre>;; Determine the directory containing the shell program, explicitly making;; certain that the directory separator is a backslash when doing so.(let ((directory-sep-char ?\\)) (setq shell-directory (file-name-directory (getenv "SHELL"))))(setq explicit-command.com-args (list shell-directory))(setq explicit-COMMAND.COM-args (list shell-directory))</pre></blockquote><h4><a name="shell-invalid">When I run programs within a shell I get"Incorrect DOS version" messages. Why?</h4>This might happen if, for example, you invoke nmake in a shell and ittries to create subshells. The problem is related to the one abovewhere, again, when the shell is initially created, the first argumentto the shell is not the directory in which the shell program resides.When this happens, command.com fabricates a value for its COMSPECenvironment variable that is incorrect. Then, when other programs goto use COMSPEC to find the shell, they are given the wrong value. <p>The fix for this is to either prevent any arguments from being sent tothe shell when it starts up (in which case command.com will use adefault, and correct, value for COMSPEC), or to have the firstargument be the directory in which the shell executable resides.Examples of how to do both of these are in shown in the <!WA115><!WA115><!WA115><ahref="#shell-command_com">previous subsection</a>. <p><hr><h3><a name="mail">How do I use mail with Emacs?</h3>You do not need to do much to use mail with Emacs under Win32, but youdo need to be able to communicate with local mail daemons and mailservers (they do most of the work) to both receive and send mail fromyour system. These daemons and servers are typically running on themachines in your local network that are already handling mail for youand/or other users on other systems. <p>I've only tested the outgoing and incoming RMAIL setups. If you findthat the suggested code for any of the other incoming mailconfigurations is inaccurate, please let me know. <p><h4><a name="mail-outgoing">Outgoing</h4>For outgoing mail, you need an elisp file, <!WA116><!WA116><!WA116><ahref="http://www.cs.washington.edu/homes/voelker/ntemacs/contrib/smtpmail.el">smtpmail.el</a>, that enables Emacsto talk SMTP with mail daemons (smtpmail.el was written by TomojiKagatani <kagatani@rbc.ncl.omron.co.jp> and has been submitted tobe included in future distributions). You also need to add thefollowing to your startup file (be sure to customize for you and yoursystem): <p><blockquote><pre>(setq user-full-name <i>"Your full name"</i>)(setq user-mail-address <i>"Your email address"</i>)(setq smtpmail-default-smtp-server <i>"Domain name of machine with SMTP server"</i>)(setq smtpmail-local-domain nil)(setq send-mail-function 'smtpmail-send-it)(load-library "smtpmail")</pre></blockquote><h4><a name="mail-rmail">Incoming: RMAIL and POP3</h4>For incoming mail using the RMAIL package and a POP3 mail server, youneed only place the following in your startup file (again, be sure tocustomize): <p><blockquote><pre>(setenv "MAILHOST" <i>"Domain name of machine with POP3 server"</i>)(setq rmail-primary-inbox-list '("po:<i>Your login</i>") rmail-pop-password-required t)</pre></blockquote>Note that you will need to customize the <i>Domain name of machinewith POP3 server</i> and <i>Your login</i> fields to be the name ofyour POP server and your login name. <p><h4><a name="mail-vm-pop3">Incoming: VM and POP3</h4>For incoming mail using the VM package and a POP3 mail server, youfirst need the vm package (check any elisp archive) and then you needto place the following in your .vm configuration file: <p><blockquote><pre>(setq vm-spool-files (list (list "~/INBOX" "<i>POP3 server</i>:110:pass:<i>POP user name</i>:<i>*</i>" "~/INBOX.CRASH")))</pre></blockquote>Note that you will need to customize the <i>POP3 server</i> and <i>POPuser name</i> fields to be your login name and the name of your POPserver. You will also probably want to customize the name of yourinbox and crash files (<tt>~/INBOX</tt> and <tt>~/INBOX.CRASH</tt> inthe example above.) <p><h4><a name="mail-gnus">Incoming: GNUS</h4>You should be able to use Gnus 5.2 and above as a mail reader. Thefollowing was sent as an example by Marc Fleischeuers<Marc.Fleischeuers@kub.nl>:<blockquote><pre>;; For sending mail(setq message-send-mail-function 'smtpmail-send-it);; For reading mail (other backends can be substituted for nnml)(setq gnus-secondary-select-methods '((nnml "")))(setq nnmail-spool-file "po:<i>POP user name</i>")(setq nnmail-pop-password-required t)</pre></blockquote>Be sure to customize the <i>POP user name</i> field appropriately. <p><h4><a name="mail-tm">tm</h4>I don't know of any complete ports of tm to the Win32 environment, butFabrice POPINEAU <popineau@esemetz.ese-metz.fr> has made somemodifications to the OS2 version of tm. See <!WA117><!WA117><!WA117><ahref="http://www.cs.washington.edu/homes/voelker/ntemacs/contrib/tm-support">his description</a> of what he hasdone for more info. The support programs mentioned can be found in <!WA118><!WA118><!WA118><ahref="http://www.cs.washington.edu/homes/voelker/ntemacs/contrib/mm.zip">mm.zip</a> (note that they have onlybeen tested on NT 4.0, though). <p><hr><h3><a name="ange-ftp">How do I use ange-ftp with Emacs?</h3>You will need some additional files before ange-ftp will work withEmacs. Partly this is due to the unfortunate fact that the ftpprogram shipped with Win95 and NT does not accept a password from apipe or a redirected file, and partly this is due to someincompatibilities in the ange-ftp.el lisp file when used onWindows. <p>Chris Szurgot <szurgot@itribe.net> has been working on both ofthese problems. He has a version of ftp that solves the passwordproblem, and a version of ange-ftp that deals with theincompatibilities. You can find both on his ftp server: <p><ul><li><!WA119><!WA119><!WA119><a href="ftp://ftp.itribe.net/pub/virtunix/ftp.zip">ftp://ftp.itribe.net/pub/virtunix/ftp.zip</a><li><!WA120><!WA120><!WA120><a href="http://www.itribe.net/virtunix/files/emacs/ange-ftp.el">http://www.itribe.net/virtunix/files/emacs/ange-ftp.el</a></ul>Place the ftp.exe executable in a directory where you keep your localexecutables, and the ange-ftp.el file in whatever directory you keepcustom and personalized elisp files (you will probably also w
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?