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

📄 ch32_02.htm

📁 the unix power tools
💻 HTM
字号:
<HTML><!--Distributed by F --><HEAD><TITLE>[Chapter 32] 32.2 Emacs Features: A Laundry List </TITLE><METANAME="DC.title"CONTENT="UNIX Power Tools"><METANAME="DC.creator"CONTENT="Jerry Peek, Tim O'Reilly &amp; Mike Loukides"><METANAME="DC.publisher"CONTENT="O'Reilly &amp; Associates, Inc."><METANAME="DC.date"CONTENT="1998-08-04T21:46:33Z"><METANAME="DC.type"CONTENT="Text.Monograph"><METANAME="DC.format"CONTENT="text/html"SCHEME="MIME"><METANAME="DC.source"CONTENT="1-56592-260-3"SCHEME="ISBN"><METANAME="DC.language"CONTENT="en-US"><METANAME="generator"CONTENT="Jade 1.1/O'Reilly DocBook 3.0 to HTML 4.0"><LINKREV="made"HREF="mailto:online-books@oreilly.com"TITLE="Online Books Comments"><LINKREL="up"HREF="ch32_01.htm"TITLE="32. GNU Emacs"><LINKREL="prev"HREF="ch32_01.htm"TITLE="32.1 Emacs: The Other Editor "><LINKREL="next"HREF="ch32_03.htm"TITLE="32.3 Customizations and How to Avoid Them "></HEAD><BODYBGCOLOR="#FFFFFF"TEXT="#000000"><DIVCLASS="htmlnav"><H1><IMGSRC="gifs/smbanner.gif"ALT="UNIX Power Tools"USEMAP="#srchmap"BORDER="0"></H1><MAPNAME="srchmap"><AREASHAPE="RECT"COORDS="0,0,466,58"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="467,0,514,18"HREF="jobjects/fsearch.htm"ALT="Search this book"></MAP><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch32_01.htm"TITLE="32.1 Emacs: The Other Editor "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 32.1 Emacs: The Other Editor "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><B><FONTFACE="ARIEL,HELVETICA,HELV,SANSERIF"SIZE="-1">Chapter 32<BR>GNU Emacs</FONT></B></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch32_03.htm"TITLE="32.3 Customizations and How to Avoid Them "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 32.3 Customizations and How to Avoid Them "BORDER="0"></A></TD></TR></TABLE>&nbsp;<HRALIGN="LEFT"WIDTH="515"TITLE="footer"></DIV><DIVCLASS="SECT1"><H2CLASS="sect1"><ACLASS="title"NAME="UPT-ART-5541">32.2 Emacs Features: A Laundry List </A></H2><PCLASS="para">Here's the list we promised&nbsp;- my personal list of favorite features:</P><DLCLASS="variablelist"><DTCLASS="term"><BCLASS="emphasis.bold">Windows</B></DT><DDCLASS="listitem"><PCLASS="para">Emacs is a &quot;windowed editor.&quot; Before anyone heard of the X WindowSystem or the Macintosh, Emacs had the ability to divide a terminal'sscreen into several &quot;windows,&quot; allowing you to do different things ineach window. You can edit a different file in each window or readmail in one window, answer mail in another, issue shell commands in athird, and so on.Now that we all have nice workstations with mice and other crawlythings for navigating around a bitmapped screen, why do you care?First, you may not have a bitmapped screen, and even if you have onein the office, you may not at home. Second, Istill find Emacs preferable to most &quot;modern&quot; window systems because I<ACLASS="indexterm"NAME="AUTOID-35827"></A>don't have to use a mouse. If I want to create another window, I justtype <CODECLASS="literal">CTRL-x</CODE>&nbsp;<CODECLASS="literal">2</CODE> (which splits the current window, whatever it is,into two); if I want to work in another window, I just type<CODECLASS="literal">CTRL-x</CODE>&nbsp;<CODECLASS="literal">o</CODE>; if I want to delete a window, I type <CODECLASS="literal">CTRL-x</CODE>&nbsp;<CODECLASS="literal">0</CODE>.Is this faster than reaching for my mouse and moving it around? Youbet. Particularly since my mouse is hidden under a pile of paper.(Of course, it's hidden because I hardly ever need it.) Once you'vecreated a window, it's just as easy to start editing a new file,initiate a shell session, and so on.</P></DD><DTCLASS="term"><BCLASS="emphasis.bold">Shells</B></DT><DDCLASS="listitem"><PCLASS="para">You can start an interactive shell within any Emacswindow; just type <CODECLASS="literal">ESC&nbsp;x&nbsp;shell</CODE>, and you'll see yourfamiliar shell prompt. It's easy to see why thisis so useful. It's trivial to return to earlier comands, copy them,and edit them. Even more important, you can easily take the output ofa command and copy it into a text file that you're editing&nbsp;- obviouslyan extremely useful feature when you're writing a book like this.Emacs also lets you issue commands that operate on the contents ofa window or a selected region within a window.</P></DD><DTCLASS="term"><BCLASS="emphasis.bold">Keyboard Macros</B></DT><DDCLASS="listitem"><PCLASS="para">Emacs lets you define &quot;keyboard macros,&quot; sequences of commands thatcan be executed automatically. This is similar to <EMCLASS="emphasis">vi</EM>'s<SPANCLASS="link"><EMCLASS="emphasis">map</EM> (<ACLASS="linkend"HREF="ch31_02.htm"TITLE="Save Time and Typing with the vi map Commands ">31.2</A>)</SPAN>facility, with one extra twist: Emacs actually executes thecommands while you're defining the macro, while <EMCLASS="emphasis">vi</EM> expects youto figure out what you need to do, type it in without any feedback,and hope that the macro doesn't do anything hostile when you edit it.With Emacs, it's much easier to get the macro right. You can see whatit's going to do as you're defining it, and if you make a mistake, youcan correct it immediately.</P></DD><DTCLASS="term"><BCLASS="emphasis.bold">Editing Modes</B></DT><DDCLASS="listitem"><PCLASS="para">Emacs has a large number of special editing &quot;modes&quot; that provide&quot;context sensitive&quot; help while you're writing. For example, if you'rewriting a C program, the C mode will help you to observe conventionsfor indentation and commenting. It automatically lines up braces for you, and tells you when parentheses are unbalanced.There are special modes for virtually every programming language I've ever heard of. There are alsospecial modes for HTML, <EMCLASS="emphasis">troff</EM>, TeX, outlines, stick figures, etc.</P></DD><DTCLASS="term"><BCLASS="emphasis.bold">Mail</B></DT><DDCLASS="listitem"><PCLASS="para">Although I often use Emacs' mail facility as an example, I'm notpersonally fond of it. However, if you really like working withinthe Emacs environment, you should try it. </P></DD><DTCLASS="term"><BCLASS="emphasis.bold">Customization</B></DT><DDCLASS="listitem"><PCLASS="para">Emacs is the most customizable tool I've ever seen. Customization isbased on the LISP programming language, so you need to learn some LISPbefore you can work with it much. However, once you know LISP, youcan do virtually anything. For example, I have no doubt that youcould write a complete spreadsheet program within Emacs&nbsp;- which meansthat you could use your normal Emacs commands to edit the spreadsheet and incorporate it (in whole or in part) into your documents.(An Emacs-based spreadsheet may already exist, though I'm not aware of it.)And, because of the<SPANCLASS="link">FSF's (<ACLASS="linkend"HREF="glossary.htm#UPT-ART-1010"TITLE="Glossary">52.9</A>)</SPAN>General Public License,virtually all special-purpose packages are available for free.  </P></DD></DL><ACLASS="indexterm"NAME="AUTOID-35868"></A><DIVCLASS="sect1info"><PCLASS="SECT1INFO">- <SPANCLASS="authorinitials">ML</SPAN></P></DIV></DIV><DIVCLASS="htmlnav"><P></P><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch32_01.htm"TITLE="32.1 Emacs: The Other Editor "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 32.1 Emacs: The Other Editor "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="book"HREF="index.htm"TITLE="UNIX Power Tools"><IMGSRC="gifs/txthome.gif"SRC="gifs/txthome.gif"ALT="UNIX Power Tools"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch32_03.htm"TITLE="32.3 Customizations and How to Avoid Them "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 32.3 Customizations and How to Avoid Them "BORDER="0"></A></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172">32.1 Emacs: The Other Editor </TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="index"HREF="index/idx_0.htm"TITLE="Book Index"><IMGSRC="gifs/index.gif"SRC="gifs/index.gif"ALT="Book Index"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172">32.3 Customizations and How to Avoid Them </TD></TR></TABLE><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><IMGSRC="gifs/smnavbar.gif"SRC="gifs/smnavbar.gif"USEMAP="#map"BORDER="0"ALT="The UNIX CD Bookshelf Navigation"><MAPNAME="map"><AREASHAPE="RECT"COORDS="0,0,73,21"HREF="../index.htm"ALT="The UNIX CD Bookshelf"><AREASHAPE="RECT"COORDS="74,0,163,21"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="164,0,257,21"HREF="../unixnut/index.htm"ALT="UNIX in a Nutshell"><AREASHAPE="RECT"COORDS="258,0,321,21"HREF="../vi/index.htm"ALT="Learning the vi Editor"><AREASHAPE="RECT"COORDS="322,0,378,21"HREF="../sedawk/index.htm"ALT="sed &amp; awk"><AREASHAPE="RECT"COORDS="379,0,438,21"HREF="../ksh/index.htm"ALT="Learning the Korn Shell"><AREASHAPE="RECT"COORDS="439,0,514,21"HREF="../lrnunix/index.htm"ALT="Learning the UNIX Operating System"></MAP></DIV></BODY></HTML>

⌨️ 快捷键说明

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