Getting started with Emacs (1)

Source: Internet
Author: User
I have long heard of Emacs, an open-source file editor. I heard that it is very powerful, so I decided to try it out, I didn't expect the trial result to be the first impression that this "best-to-use" editor gave me: "I Don't Know What To use." But as I keep learning, I began to experience the great charm of Emacs, I started to raise the topic and hoped to introduce this text editor to more friends. If you are already familiar with Emacs, this guide is not prepared for you. This Guide only describes the most basic functions of Emacs and provides beginners with an opportunity to get started. In addition, this article is based on Emacs on the Windows platform. If you use Emacs on other platforms, you can refer to it.
Let's start our learning journey.
First of all, you must obtain the Emacs software package and install it. You can find it in section 5obtaining GNU Emacs on http://www.gnu.org/software/emacs/emacs.html. I downloaded the full version of emacs-21.3-fullbin-i386.tar.gz on Windows 21.3. You can also use Emacs to download the latest single emacs file in CVs of savannah.gnu.org. (What? I don't know what CVS is? Oh, it is an open-source version control software. If you don't know it, let me not say this. Next, I will write another CVS Getting Started Guide .)
Emacs does not need to be installed, you can use it directly after decompression, I solve it in the D:/program files/emacs-21.3 directory, the "installation directory of Emacs" may be mentioned later.
The emacsexecutable file is included in the BIND directory of the emacsinstallation directory, which is emacs.exe. You can double-click it to run it. If you want to run it in the console, you can add the parameter-NW to indicate no window. In addition, run addpm.exe in the bindirectory to automatically create a menu item for Emacs in the Start Menu. I also recommend that you create a shortcut for emacs.exe in the system's send tofolder. In this way, you can right-click the file you want to open with Emacs and select "send to" Emacs.
So far, we have seen the unfriendly Emacs interface. When starting Emacs, it will show a cover for introduction, click the mouse or press any key to switch to a buffer named * Scratch *. There are three lines of comments on it, indicating that you can simply write text that does not need to be stored on the disk, alternatively, you can execute some lisp statements. To create a file, press C-x C-f.
Note the following before using Emacs:
Due to historical reasons, many terms, Representation Methods, and Operation habits in Emacs are inconsistent with those that are commonly used today. Remember this point to avoid confusion during learning. In this article, the terms of Emacs are followed, and the table is expressed in English.
The method to start editing a new file is to press C-x C-F, which means: press Ctrl + X first, then press Ctrl + f (of course, you can press Ctrl and Press X and F respectively ). In this case, frame in Emacs (in terms of Emacs, frame refers to the "window" that we normally say in windows ", while the term "window" refers to several independent areas in a frame) the message "find file: D:/program files/emacs-21.3/bin/" appears in the minibuffer at the bottom /, here you can enter the file name of the file to be created, the default path is D:/program files/emacs-21.3/bin /. If the default path is not changed, enter a file name, and a blank buffer will be created in Emacs for editing. If you enter an existing file name, the file will be opened in a new buffer for editing. That is to say, C-x C-F is a command that can be used to create or open files. It is no wonder that it is interpreted in the Emacs manual as visit a file rather than new file or open file.
In most cases, it seems that you are not happy to create files in the default Emacs installation directory. Therefore, you may need to clear the existing default path and then write your actual path. In fact, it does not need to be so troublesome. emacs is very user-friendly in many small things, you only need to enter the actual file path after the last/In its default path. For example, if you do not care about its default path, directly enter/C: /1.txtyou can create or open the 1.txt file in the C root directory. when entering the path and file name, you can enter only one part and press the <tab> key. emacs will try to automatically complete the file, just like entering the file name and path at the Linux and high-version Windows command prompt.
One of the most important design concepts of Emacs is to keep your hands away from the primary keyboard (that is, the letter and number keys) during the entire operation to achieve the highest efficiency. Therefore, the introduction to mouse operations is rare in this article.
If you want to use the mouse to operate on Emacs to create or open a file, you can click open file in the File menu. You can also select a menu on the keyboard, but it is by no means Alt + F. you can press the F10 key and then select the corresponding menu item, the expression of F10 is different on the Windows interface and console interface, but the operation method is the same.
Now that you have opened a new buffer correctly to edit the file, you can try to enter something. Input. If the end of a row is exceeded, emacs will automatically wrap the line and display a new line break.
You may have tried the "copy/CUT/paste" operation during the input process, and the results will be disappointing, the commonly used shortcut keys such as Ctrl + C/Ctrl + V in windows are incorrect. remind you again that you will forget a lot of things before learning Emacs. When you get familiar with Emacs, you will like this powerful editor.
When you find that an error occurs during the process of making a shortcut, in most cases, you can press the C-G shortcut to interrupt the current error command from the beginning. For example, if you accidentally press C-S, this is a common shortcut for saving files in windows, but it prompts you in mini-buffer: here, you can press C-g to exit and return to the normal state. At the same time, quit is displayed in the minibuffer to exit the current command.
To save the file, the correct command is C-x C-s. To exit Emacs, the correct command is C-X c-c. If the content in the buffer is modified and not saved, it will prompt accordingly. If you choose not to save the content, it also needs to further confirm whether the Emacs is to be exited.
Now, you can use Emacs to open or create a file, edit and save it, and then exit Emacs.
Maybe you think that I am writing very well and the progress is slow. You can read the Emacs tutorial without reading my article, it uses a very incisive way to describe the most basic usage of Emacs. After entering Emacs, press c-h t (first press c-h, then press T, note that it is not c-h c-t) to read it. Currently, the release Emacs does not contain Chinese tutorials. You can find the Chinese tutorials in the etc directory of CVS in Emacs. The files are named tutorial.cn (simplified) and tutorial. en (traditional), the next version of Emacs should contain these files.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.