Basic initial customization of Emacs
June 15, 2018 5 minutes reading time Development
How to start making Emacs your own.
I’m a software developer. My most important tool is an editor. For a long time it has been Epsilon by Lugaru Software Ltd. It’s an Emacs clone. I sort-of had to use it because until the late 90s I was working with DOS and Windows.
When I switched to Linux, I used the ‘real’ stuff: Emacs. It’s a very powerful editor that’s easy to extend and customize. You’ll need some time to learn all the relevant commands, but if your editor is the most important tool for you, you better use the best tool that’s available.
Nowadays, I use Emacs less than before.
The reason for that is the existence of really powerful IDEs like Eclipse (past)
and Jetbrains IntelliJ IDEA (present).
These tools have better support for the things I need to do as a developer.
But nothing beats Emacs when it comes to writing.
I especially love its Org-mode (
Now, what does
M-x org-mode mean? It’s the command for activating Org-mode.
M- is the Emacs meta key,
While I’m at it:
Ctrl (used later).
M-x org-mode means: press the
Alt key and hold it (if you use the
Esc key you can release it),
At the bottom of the screen you can now enter the text
org-mode and press the enter key (often seen as
RET in commands).
So you’ve decided to give Emacs a try and have installed it? Good! Now you’ve probably heard that it’s difficult to customize. Most of its customization settings are stored in a file, and you have to manually edit it? While the first part is true, the second part isn’t. You can - of course - always edit the file yourself, but for many things you don’t have to.
It’s a good idea to at least look at the contents of the file.
In my case (Emacs 24, Ubuntu 14.04) it’s this file:
Depending on your operating system and Emacs version, it might be somewhere else.
Here it is - at least for the purpose of this article:
(package-initialize) ;; Powerline (require 'powerline) (powerline-default-theme) (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(custom-enabled-themes (quote (tango-dark))) '(inhibit-startup-screen t) '(package-archives (quote ( ("gnu" . "http://elpa.gnu.org/packages/") ("melpa" . "http://stable.melpa.org/packages/")))) '(powerline-display-hud nil) '(scroll-bar-mode nil) '(tool-bar-mode nil)) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(powerline-active1 ((t (:inherit mode-line :background "gray20" :foreground "gray80")))))
(custom-set-variables ...) and
(custom-set-faces ...) are maintained
by an interactive customization tool built into Emacs.
You always can edit these sections yourself, but why would you?
Invoking the command
M-x customize will open a buffer that lets you change many settings interactively.
Either find your way through the menu structure of the tool,
or just enter the name of the setting (or a keyword) into the search field and hit
After you’ve changed a setting, save it by either hit the
state button or the
apply and save button at the top of the buffer.
This will make sure your changes get written to your settings file.
Here are a few things I like to customize:
custom-enabled-themes: select your theme from a list of options
inhibit-startup-screen: start with the
*scratch*buffer instead of the Emacs startup screen/buffer
tool-bar-mode: get rid of the tool bar
scroll-bar-mode: get rid of the scroll bar
package-archives: I’ve added the repository for stable packages. Hit the
insbutton and fill out the name (
melpa) and the URL (
You might want to get rid of the menu bar, too.
I kept it because some Emacs commands overlap with Linux system commands (like the command for regular expression search:
I could have solved it differently, but that’s a personal choice. You might try playing with
Bonus: Powerline, the Emacs version of the Vim powerline
If you want to have a fancy Emacs status line, you can start by using the package
There are other more powerful packages available, but that’s what we’ll use here - just for the fun of it.
After you’ve added the MELPA archive to the list of archives, your Emacs can get the
Powerline package from there.
M-x package-install RET powerline. Remember,
RET is the return key here.
Now, add the following lines to the start of your settings file (mine was
(package-initialize) ;; Powerline (require 'powerline) (powerline-default-theme)
You can open this file for editing via Emacs with
C-x C-f and then enter the file name:
After you’ve made the changes, save it with
C-x C-s. To reload the changes just made,
M-x load-file and press enter twice to accept the default filename, which is the current file being edited.
Alternatively, you can quit Emacs (and restart it later):
Now you can customize the Powerline package:
M-x customize and enter
powerline in the search field.
All the configurable options of Powerline will appear and can be changed.
As an example, I’ve changed just one setting:
I’m not a fan of colors in the status line, but that’s me. Feel free to try out every color you like!
If you made all the changes, your Emacs will look a lot like mine.
This story was also published on Medium.