Emacs Study Notes (7): simple configuration

Source: Internet
Author: User

Continue the Emacs learning plan. This is the last article in the "Beginner" phase. After completing the content in this section, you can enter the intermediate plan :)

After a period of use, you have adapted to the Emacs shortcut keys, but you still need to refer to the command memo table.

Emacser usually needs to customize Emacs for better use. It is said that one reason vimer laughed at emacser is:

Emacser cannot do anything if it loses the configuration file.

Okay, well, there is nothing to do with these arguments. I just used to like Emacs with vim. Back to the simple customization of Emacs.

1. Configuration File

The configuration file of Emacs is in ~ /. Emacs. Open this file with Emacs. If not, create one. First, change the color configuration to make Emacs look cool:

(Set-Background-color "black"); uses a black background
(Set-foreground-color "white"); use white foreground
(Set-face-foreground 'region "green"); the foreground color of the area is set to green.
(Set-face-Background 'region "blue"); regional background color is set to blue

Although you can restart Emacs to make the configuration take effect, you can enable it more quickly ~ /. Execute the M-x eval-buffer command in Emacs to make the configuration file take effect immediately.

2. Install the plug-in

Emacs and VIM both have a large number of plug-ins. The combination of some long-lasting and widely-used plug-ins reflects a kind of "collective wisdom ".

Emacs plug-ins are generally files suffixed with El. First, you must specify a plug-in directory, such ~ /. Emacs. d/lisps and then ~ /. Specify the plug-in directory and the plug-in to be used in Emacs:

(Add-to-list 'Load-path "~ /. Emacs. d/lisp /")
(Require 'ininname ')

Let's take a look at the color settings. The previous method only made some simple color settings, but some enthusiastic people wrote plug-ins and configured many schemes, not only the foreground background color, but also the syntax highlighting. Download from here, unzip and copy the color-theme.el file and themes folder to the plug-in directory, and then modify the configuration file:

(Add-to-list 'Load-path "~ /. Emacs. d/lisp /")

(Require 'color-theme)

(Color-theme-Initialize)

After M-x eval-buffer makes the configuration take effect, you can execute the Command provided by the plug-in: M-x color-theme-select ret to enter the color scheme selection interface. I chose classic.

After the selection, you may want to set the color scheme to default or modify the configuration file. On the color scheme selection page, press d after selecting the topic, and the configuration prompt is displayed, for example:

Color-theme-Classic is an interactive lisp function in
'Color-theme-library.el '.

(Color-theme-classic)

Color theme by Frederic giroud, created 2001-01-18.
Antiquewhite on darkslategrey scheme. Based on GNOME 2, with my favorit
Color foreground-color and fontlock color.

Add the content similar to (color-theme-classic) to. emacs, You can automatically select the color scheme each time you start Emacs.

3. Advanced

Do not trust yourself. Do not try to customize Emacs in the first place. Be sure to refer to or even copy the settings of the experts. For example, Steve Purcell. Learning their configurations not only allows you to directly learn "best practices", but also deepen your understanding of Emacs.

Finally, let's review the learning plan for beginners of Emacs:

1. You must have a plan to learn.

2. Understand Emacs. emacs is not just an editor.

3. Use the Help System of Emacs for on-demand Learning

4. If you have mastered the basic functions, you can start using them and use them more.

5. You can edit it faster.

6. Too many commands can't be remembered. You can print them and check them at any time.

7. Learn how to customize Emacs and refer to master Configuration

after completing this content, you can get started with Emacs. Next you can learn how to use Emacs to write Code , GTD, and send an email, browsing Web pages and so on, improve their Emacs level while achieving these goals, and eventually raise Emacs to a belief.

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.