Emacs is the kitchen sink of extensibility. It was initially made to be a simple text editor similar to nano. These days, Emacs is often thought of as a Lisp interpreter that can do just about anything.
Emacs can be your web browser, your music player, and even your window manager. In this article, we talk about five packages that can improve your productivity and how you can install those in vanilla Emacs.
Tip: Download our Emacs keyboard shortcuts cheatsheet to further increase your productivity.
A minimal installation of Emacs is, for the most part, already feature complete. It has an easy-to-approach tutorial that teaches the basics of using it as a text editor.
It also has a powerful documentation mode that describes each function it has. Lastly, among others, Emacs has a powerful package management system that allows us to install third-party extensions from within itself.
How to Install Emacs Packages
Installing third-party packages in Emacs is relatively simple. Just open the command buffer and type a command. Do this by pressing Alt + x and typing
list-packages. This will open a window that will show all of the available packages you can install.
This window behaves similarly to a standard Emacs buffer. Conduct searches within it using Ctrl + s and move using the standard Emacs movement controls, such as Ctrl + n and Ctrl + p.
Now, to install software in
list-packages we only need to press Enter or click the package name in the list. In my case, I wanted to install the ledger-mode package.
To do that, I searched for the name of the package I wanted to install. Once selected, I pressed Enter to open a separate buffer that showed the details of the package.
In this buffer, you can see information about the particular package we selected. This is also where we install the package. do this by either moving the cursor to that buffer using Ctrl + x + o and pressing Enter on the ‘Install’ button or clicking the “Install” button using the mouse.
ELPA and MELPA: Package Repositories for Emacs
One important thing to note is that Emacs has two big sources for its packages. The first one, ELPA, is the Emacs Lisp Package Archive, a repository of packages directly maintained by the Emacs developers.
ELPA mostly contains a set of basic and stable packages that are either maintained directly by the developers or used by a majority of Emacs users.
The second repository, on the other hand, is the Milkypostman’s Emacs Lisp Package Archive (MELPA). The broader Emacs community actively maintains this third-party repository that contains most, if not all, of the available packages for Emacs. It is constantly being updated for new versions of packages.
However, MELPA is not the default in Emacs. To add the repository to your Emacs installation, add the following lines to your “init.el” file:
(require 'package) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) (package-initialize)
This piece of Lisp code will first load the “package.el” package within Emacs. It then modifies its internal list of archives using the “add-to-list” function. In our case, we are adding the MELPA archive and its URL for Emacs to use.
The last command that we are executing is package-initialize. This signifies that we are now starting the “package.el” package and that Emacs can now load both ELPA and MELPA.
Below are description of the five useful Emacs packages.
1. Org Mode
Org Mode is an extensive program. At its core, it is a scheduling and organization mode for Emacs with an intuitive and feature-rich syntax that allows you to have clean and structured task tracking.
This syntax has also been adopted by many Emacs users for note-taking and publishing. The
org-export-dispatch feature allows you to cross-export your org files into a variety of formats, such as LaTeX, HTML and OpenDocument.
Further, Org Mode is highly extensible. Org users have adopted the mode to various programs as well as new features and extensions.
Get Org mode from the ELPA repository. Once it has been installed, you can immediately start utilizing Org mode by creating .org files.
If you are a programmer, you might already be aware of the git version control system, a program that allows you to track changes for a particular set of files. It is, therefore, highly useful in software development where you want multiple versions of a file to easily debug and deploy changes.
Magit is a git client for Emacs. It is a full-featured program that allows you to manage your git repositories from within Emacs. A main feature is allowing you to seamlessly commit files and traverse the commit history as you are editing within the buffer.
Magit is a one-stop-shop for anything git related in Emacs. For this reason alone, Magit is one of the most consequential packages for programmers that use Emacs.
You can get Magit from the MELPA repository.
3. Evil Mode
Evil stands for Extensible Vi Layer, a mode that allows you to adopt Vim style keybindings in Emacs. This is useful if you are already a prolific Vim user before getting into Emacs. It has all of the basic Vi motion keys as well as the additional Vim keys, such as
It is important to note that Evil will not replace all of the default keybindings of Emacs. E vil’s behavior is similar to setting
set -o vi in shell. It only adds a Vi emulation layer above Emacs, so you can still use the default keybindings, such as Alt + x, Ctrl + x and Ctrl + f.
Evil is available in the MELPA respository, and installing it for your Emacs client is relatively simple. Once installed, you only need to insert a couple lines of code to your init.el to start it:
(require 'evil) (evil-mode 1)
4. Focus Mode
Focus is a simple extension for Emacs that highlights the text you are currently working on by actively changing the color of the non-selected text.
Furthermore, Focus intelligently highlights different segments and forms of text. Focus can work with essay-like writing that uses sentences and paragraphs, but it can also work with programming-like writing that uses functions and brackets.
Because of that, Focus can be especially useful for writers and programmers that want the paragraph or code block they are working on to stand out.
Focus is available in the MELPA repository. Once you have installed it, easily activate it by pressing Alt + x and typing
Similar to Focus, Darkroom is a “focus-oriented” extension. However, it is more geared toward writers than programmers. Darkroom creates a distraction-free environment by removing all of the unnecessary information around the Emacs frame, including the menu bars, scroll bars and mode line.
Further, Darkroom centers and contains the text around 80 columns. This is especially useful for composing and proofreading essays, as it directs the eyes on a single segment of the screen, making the text easier to read.
Darkroom can also be customized. Adjust the default margin for the text by invoking
Darkroom is available in the ELPA repository, and the mode can be easily enabled by pressing Alt + x and typing
darkroom-mode in the command buffer.
Congratulations! You have now learned about a few useful Emacs packages that could significantly improve your productive workflow. If you want to learn about some simple tricks to improve your productivity in Linux, check out this article.
Frequently Asked Questions
1. Is MELPA safe to use?
Yes! Only a few select maintainers can add packages to the MELPA archive. To submit a package, the developer must submit a pull request to the maintainers of the archive. After that, the package has to be checked and approved by the maintainers. This process ensures that all of the packages in MELPA are safe for the regular user to use.
2. The MELPA website said the packages it offers are bleeding edge. Could my packages break?
There is little to no chance of this. The packages from MELPA are constantly being built to check whether they are working.
However, if the slim possibility of a package breaking is a concern, MELPA offers a stable branch of their archive that is updated less frequently. The packages in here have been tested with the current version of Emacs. To use the MELPA-Stable repository, update your “init.el” file to:
(require 'package) (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t) (package-initialize)
3. I don’t want this package anymore. How can I uninstall a package in Emacs?
At the bottom of the
list-packages page, you will be able to see the installed packages. You can also search for them by pressing Ctrl + s and typing “installed.”
Once you have picked the package to uninstall, press Enter and click the “Delete” button in the description buffer. Emacs will automatically remove the package in the system.
One thing to note, however, is that this process will not remove any configurations you made in the init.el file. For example, if you have added a configuration for a specific package X, you have to remove that configuration manually.
Our latest tutorials delivered straight to your inbox