Emacs is a gorgeous text editor for GNU! It is favoured by computer programmers (and many other people) because it has many nice features! It was first written in the 70's, and as you might imagine, it looks like software from the 70's. This is what you see when you first open Emacs:
The fact that it looks so cluttered is the reason many people shy away from it, despite the fact that it's actually, objectively the best code editor out there! (Okay that may be a bit bias, but many people would agree with me!)
Emacs can be modified to look more modern & minimalistic (if that's your thing)! Take my Emacs startup window for example:
Believe it or not, I'm only using two external extensions for the GUI (the dark theme and the green modeline)
In this short article I'm going to go through every step in configuring Emacs to make it look just like mine (but you can edit whatever you want)
At the top of your window, next to "File" and "Edit", there should be an "Options" button. From there we start by removing the fluff we don't need and adding the fluff we want!:
Alrighty, now still in the options menu, go to "Show/Hide", and from there:
That's it for our Options menu configuration. Oh, and if you're wondering, I use DejaVu Sans Mono, font size 14.
Now it's time for our .emacs file! The .emacs file is generally located in your home directory: ~/.emacs
If you cannot find a .emacs file, create it now.
The MELPA is an Emacs package archive, and it's not recommended to live without. At the very top of your .emacs file, put down:
(require 'package) (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/"))
Just below it you should see a line reading
If you don't see it, add that in.
Everything from now on will take place between
The Mode-line in Emacs is a little boring, I sure wish we had some nice arrows or something going on down there! Introducing Powerline!
Download Powerline from the MELPA archive with:
M-x package-install RET powerline RET
And, just underneath our previous .emacs code, write in:
Moe Theme is a theme for Emacs that includes colour for text highlighting and Powerline. It includes a dark theme and a light theme. You can install Moe officially from the MELPA by running:
M-x package-install RET moe-theme RET
After Moe is installed, go back to your .emacs file, and right under the Powerline code we just typed in, add:
(require 'moe-theme) (moe-theme-set-color 'magenta) ;;Available Colors: blue, orange, green, magenta, yellow, purple, red, cyan, w/b (moe-dark)
(moe-theme-set-color) sets the color for the Powerline. The "Available colours" comment under it lists all the colours that you can use instead of magenta.
(moe-dark) is the dark Moe theme. (moe-light) can be used instead, or, if you like light in the day & dark at night, use (require 'moe-theme-switcher) instead!
One more thing, at the very bottom of your .emacs file (the very, very bottom), type:
This should make your Powerline look defined & stylish with the Moe theme!
I use a slightly transparent window so I can see my nice wallpaper through Emacs! Under the moe-theme code typed above, add in:
(set-frame-parameter (selected-frame) 'alpha '(92 . 90)) (add-to-list 'default-frame-alist '(alpha . (92 . 90)))
Change the numbers to higher or lower values depending on the transparency you want!
Under our previous code, let's do a few things!
Change the window title:
(set-frame-name "Tulips Smell Nice")
Or if you'd rather have the entire file path in the title bar:
(setq frame-title-format '("%f" (dired-directory dired-directory "%b")))
Change the startup scratch message:
(setq initial-scratch-message ";;Hello, Lily!")
Disable the beeping sound when hitting the end of a file:
setq ring-bell-function 'ignore
Change the Minibuffer startup message:
(defun display-startup-echo-area-message () (message "Bake me a cake!"))
Alrighty! Pretty good so far, Just one more thing. When we save a file, it gives us a "backup" file just next to it! This is handy sometimes, but lets plop those in another directory, just to keep our workplace clean:
(setq backup-directory-alist `((".*" . ,temporary-file-directory))) (setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t)))
Perfect! If there's any really cool thing that you think is a "must have" for Emacs users, let me know via Email (shack AT muto DOT ca) or on Wire @mutoshack
Here's how the entire file should look when we're done:
;;Very top of file ;;MELPA (require 'package) (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/")) (package-initialize) ;;Powerline (require 'powerline) ;;Moe Theme (require 'moe-theme) (moe-theme-set-color 'magenta) ;;Colors: blue, orange, green, magenta, yellow, purple, red, cyan, w/b. (require 'moe-theme-switcher) ;;Transparency (set-frame-parameter (selected-frame) 'alpha '(92 . 90)) (add-to-list 'default-frame-alist '(alpha . (92 . 90))) ;;Titlebar (set-frame-name "Tulips Smell Nice") ;;Scratch message (setq initial-scratch-message ";;Hello, Lily!") ;;Minibuffer message (defun display-startup-echo-area-message () (message "Bake me a cake!")) ;;Backup directory (setq backup-directory-alist `((".*" . ,temporary-file-directory))) (setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t))) (custom-set-variables ;;... ;;... ;;... ;;Down at the bottom (powerline-moe-theme)
Well, I have to go make myself a tea. Stay stylish! -Muto