⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 539-541.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:
<HTML>

<HEAD>

<TITLE>Special Edition Using Linux, Fourth Edition:Using the emacs Editor</TITLE>

<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!--ISBN=0789717468//-->

<!--TITLE=Special Edition Using Linux, Fourth Edition//-->

<!--AUTHOR=Jack Tackett//-->

<!--AUTHOR=Jr.//-->

<!--AUTHOR=Steve Burnett//-->

<!--PUBLISHER=Macmillan Computer Publishing//-->

<!--IMPRINT=Que//-->

<!--CHAPTER=28//-->

<!--PAGES=539-541//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="../ch27/536-538.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="541-543.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<H2><A NAME="Heading1"></A><FONT COLOR="#000077">Chapter 28<BR>Using the <I>emacs</I> Editor

</FONT></H2>

<P><I>by Jack Tackett</I></P>

<DL>

<DT><B><BIG>I</BIG>n this chapter

</B><DT>Starting <TT>emacs</TT>

<DT>Using <TT>emacs</TT>

<DT>Writing Files and Saving the Buffer

<DT>Basic Command Summary

<DT>Customizing <TT>emacs</TT>

</DL>

<P>The name <TT>emacs</TT> stands for Editor MACroS, which began life as a replacement for an early text editor named <TT>teco. emacs</TT> is one of the most used, most widely ported editors available in the UNIX/Linux world today. In fact, versions of <TT>emacs</TT> are available on almost every computing platform known to the industry, from Linux to Microsoft Windows.</P>

<P>A full version of <TT>emacs</TT> is very large, taking up several megabytes of disk space. It&#146;s a full-featured editor, very powerful, and has been extended for functions beyond text editing. In some installations, you can use it to edit files, keep a calendar, work with e-mail, manage files, read UseNet or network news, create outlines, use it as a calculator, and even browse the World Wide Web. In some ways, <TT>emacs</TT> is a working environment that contains a text editor. A popular version of <TT>emacs</TT> is distributed via the GNU license. This is the version of <TT>emacs</TT> Linux installed during installation.</P>

<H3><A NAME="Heading2"></A><FONT COLOR="#000077">Starting <I>emacs</I>

</FONT></H3>

<P>GNU patriarch Richard Stallman created the <TT>emacs</TT> editor. The source code for <TT>emacs</TT> is essentially available for free under the GNU licenses. Stallman is the founder and proponent of the Free Software Foundation and the GNU (GNU&#146;s Not UNIX) project. The fact that <TT>emacs</TT> is freely available matches Stallman&#146;s philosophy that all software should be free and that computer systems should be open for use by anyone. Users are also encouraged to make modifications but must then share those changes with others.</P>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>See</B> &#147;The GNU License,&#148; <B>p. 800</B><HR></FONT>

</BLOCKQUOTE>

<P>The <TT>emacs</TT> editor doesn&#146;t have the two basic modes that <TT>vi</TT> does, which means that anything you type is put into the file buffer. To give the editor commands to save files, search for text, delete text, and so on, you must use other keys. In <TT>emacs</TT>, you use the &lt;Ctrl&gt; key in combination with various characters (usually &lt;Ctrl-x&gt; and &lt;Ctrl-c&gt;) and the &lt;Esc&gt; key to accomplish the various commands. A variety of common commands are described later in this chapter.</P>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>See</B> &#147;Looking at <TT>vi</TT> &#146;s Two Modes,&#148; <B>p. 182</B><HR></FONT>

</BLOCKQUOTE>

<P>These <TT>emacs</TT> commands are actually shortcuts for the full text commands. For example, &lt;Ctrl-x&gt;&lt;Ctrl-s&gt;, which saves the current buffer to a file, is actually a shortcut freeing the user from pressing &lt;Esc&gt; and then typing the actual <TT>emacs</TT> command: <TT>-x save-buffer</TT>. As you can see, using the &lt;Ctrl-x&gt;&lt;Ctrl-s&gt; key sequence is a lot more simple and much easier to remember than the full <TT>emacs</TT> command. A brief list of the basic commands is presented at the end of this chapter.</P>

<P><TT>emacs</TT> also allows you to edit multiple <I>buffers</I>, or files, in the same session. That is, you can edit more than one file at a time with <TT>emacs</TT>. This chapter also covers some of the buffer-manipulation commands. <TT>emacs</TT> also uses buffers to hold deleted text and also to prompt for commands.</P>

<P>To start <TT>emacs</TT>, type <TT><B>emacs</B></TT> and press &lt;Return&gt;. A blank screen with a status line at the bottom appears.</P>

<P>This chapter doesn&#146;t discuss all the keystrokes and commands used in <TT>emacs</TT>, but you can get help by pressing &lt;Ctrl-h&gt;&lt;h&gt;. After that, you can use &lt;Ctrl-x&gt;&lt;Ctrl-c&gt; to exit completely, or &lt;Ctrl-x&gt;&lt;1&gt; to return to your editing session. Thus, unlike <TT>vi</TT>, <TT>emacs</TT> has online help facilities and even a tutorial.</P>

<P>After you ask for online help, <TT>emacs</TT> presents another buffer and is ready to provide help. If you press &lt;t&gt;, <TT>emacs</TT> starts an excellent tutorial. If you press &lt;k&gt;, <TT>emacs</TT> provides help on the next command/key you enter. Thus, if you pressed &lt;Ctrl-h&gt;&lt;k&gt;&lt;Ctrl-w&gt;, <TT>emacs</TT> presents information on deleting a marked region.</P>

<P>To return to your editing session, press &lt;Ctrl-x&gt;&lt;1&gt; to return <TT>emacs</TT> to editing only one buffer.</P>

<P>The complete GNU <TT>emacs</TT> system is large but can be customized to match your local environment. Some smaller versions of <TT>emacs</TT> that are readily available are <TT>Freemacs</TT> by Russell Nelson and <TT>MicroEmacs</TT>, originally by Dave Conroy. Remember too that the Linux distribution provides for a few other <TT>emacs</TT> -like editors&#151;namely <TT>JED</TT>and <TT>JOVE</TT>, which are much smaller in size than the full <TT>emacs</TT> installation.</P>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>NOTE:&nbsp;&nbsp;</B>This chapter doesn&#146;t cover all the features of <TT>emacs</TT>&#151;that would take more space than is available. In fact, there are entire books written just on <TT>emacs</TT>. Instead, you learn the commands to do most necessary editing tasks. If you want to know about the more advanced features of <TT>emacs</TT> and advanced text-editing operations, consult the reference manual supplied with your system. You don&#146;t have to become an <TT>emacs</TT> expert to use it. <TT>emacs</TT> also has a very detailed tutorial as part of the system. More information on running the tutorial is presented later in this chapter, but you can start the tutorial by pressing &lt;Ctrl-h&gt;&lt;t&gt;.<HR></FONT>

</BLOCKQUOTE>

<P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="../ch27/536-538.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="541-543.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>





</td>
</tr>
</table>

<!-- begin footer information -->





</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -