In the pursuit of an optimized Emacs setup, I focused on enhancing defaults and minimizing the number of installed packages to maintain simplicity and efficiency: The initial step involved creating minimal-emacs.d, a project that has resonated with the Emacs community, providing a foundational template for many users’ init.el and early-init.el vanilla Emacs configuration.
Next, I experimented with hundreds of Emacs packages, carefully selecting the most valuable ones that, ideally, leverage built-in Emacs functions. (This is why I chose corfu over company, eglot over lsp-mode, and flymake over flycheck, etc.)
In this article, I will share the Emacs packages I recommend for software development and general text editing. Please share the Emacs packages you use in the comments!
Before we dive in, please consider sharing this article on your website/blog, Mastodon, Reddit, X, or your preferred social media platforms. Sharing it will help fellow Emacs users discover better ways to manage code folding.
Where can I find the third-party packages listed below?
The following Emacs packages installed whether from MELPA or ELPA.
Category: Code completion
- corfu: A completion framework that integrates with the built-in completion system in Emacs. For example, it can complete Python code when using the eglot package and a Python language server such as Pylsp.
- prescient: Provides smart completion suggestions based on history and context. For example, it can enable fuzzy completion with Corfu/Cape or anticipate your next input based on previous selections.
- cape: A completion-at-point extension for various completion frameworks in Emacs, enhancing Corfu.
- nerd-icons-corfu: Integrates Nerd Icons with the Corfu completion framework, enhancing the appearance of completion candidates.
Category: Better minibuffer
- vertico: minimalistic vertical completion UI. (EDIT: There is also built-in alternative to vertico:
fido-vertical-mode. However, the author prefers vertico because it provides more features and is faster.) - marginalia: Enhances the display of completion candidates in the minibuffer.
- embark: Enhances minibuffer completion and interaction with various Emacs commands and actions.
- consult: Provides intelligent search and navigation commands, powered by the Emacs completion function, completing-read.
Category: Software development (General)
- apheleia: A package that runs code formatters asynchronously without moving the cursor. Apheleia supports formatting many languages. It formats code after saving, applying changes only if the buffer is unmodified, preventing latency and cursor jumps.
- yasnippet and yasnippet-snippets: A template system for Emacs that allows for easy insertion of code snippets, improving coding efficiency. (The author is also using ultyas to share the same code snippets in Emacs and Vim and ultisnips-mode, a major mode for editing Ultisnips *.snippet files)
- rainbow-delimiters: Provides a minor mode that highlights parentheses, brackets, and braces according to their nesting depth, with each level displayed in a distinct color. This makes it easier to identify matching delimiters, navigate code structure, and understand which statements are at a given depth.
- Dumb-jump: A go to definition functionality for 50+ programming languages without requiring a language server. It works by using simple heuristics and regular expression searches to locate the definitions of functions, variables, and symbols across project files. Unlike more sophisticated language-aware tools, dumb-jump does not parse code semantically, which makes it lightweight and fast, but sometimes less precise (For greater precision, install a language server and enable Eglot; it will replace dumb-jump in the buffers where it is active.). It integrates with popular navigation packages like
xref, allowing implementations with minimal configuration. users to jump to definitions or references. - evil-matchit: Despite its name, this package is fully compatible with vanilla Emacs and does not require evil-mode. It provides efficient code navigation by allowing you to jump between matching syntactic text objects, such as HTML tags, conditional blocks (if/then/else), and paired parentheses. This accelerates code traversal and editing across a wide array of programming and markup languages.
- eglot (built-in): An LSP client that provides features like code completion, diagnostics, formatting, and more, powered by language servers. For example, it can be used to add Python code completion using the language server Pylsp. There are many language servers available for many other programming languages. (Alternative: lsp-mode)
- flymake (built-in): An on-the-fly syntax checking system that works well with eglot. (Alternative: flycheck)
- paren (built-in): Matching parenthesis highlighting. (Modes: show-paren-mode or show-paren-local-mode).
- treesit (built-in): This package provides a way to work with tree-sitter, a syntax code parser that performs syntax highlighting, code navigation, and structural editing across various programming languages.
highlight-symbol: Highlight occurrences of symbols in your code.(The author is now using built-in functions to toggle symbol highlighting in Emacs )
Category: Version Control
- diff-hl: Displays version control (e.g., git, svn…) diff information in the fringe of your Emacs window. It delegates the heavy lifting to Emacs built-in
vcframework, allowing it to automatically support any version control system Emacs recognizes, including Git, Mercurial, Subversion, Bazaar, Fossil, and Jujutsu. - magit: Provides a comprehensive interface to the Git version control system.
- git-modes: Provides Emacs major modes for managing Git configuration files, such as
.gitattributes,.gitconfig, and.gitignore.
Category: Indentation and whitespace
- indent-bars: Provides indentation guide-bars.
- dtrt-indent: Automatically adjusts indentation based on the surrounding context in code files, improving code readability.
- stripspace: Ensures that Emacs removes trailing whitespace before saving a buffer. Ensure that the column is restored.
(Read: “Emacs: Maintaining proper indentation in indentation-sensitive programming languages“, an article that highlights Emacs packages and Elisp code snippets to enhance indentation.)
Category: Code Folding
- outline-indent: Enables code folding based on indentation levels. This package is useful for editing indentation-based text files, such as YAML, Python, and other indented text files.
- kirigami: The kirigami Emacs package offers a unified interface for opening and closing folds across a diverse set of major and minor modes in Emacs, including
outline-mode,outline-minor-mode,outline-indent-minor-mode,org-mode,markdown-mode,vdiff-mode,vdiff-3way-mode,hs-minor-mode,hide-ifdef-mode,origami-mode,yafolding-mode,folding-mode, andtreesit-fold-mode. With Kirigami, folding key bindings only need to be configured once. After that, the same keys work consistently across all supported major and minor modes, providing a unified and predictable folding experience. - treesit-fold: Provides intelligent code folding by using the structural understanding of the built-in tree-sitter parser. Unlike traditional folding methods that rely on regular expressions or indentation, treesit-fold uses the actual syntax tree of the code to accurately identify foldable regions such as functions, classes, comments, and documentation strings. This allows for faster and more precise folding behavior that respects the grammar of the programming language, ensuring that fold boundaries are always syntactically correct even in complex or nested code structures.
- hideshow (built-in): Provides
hs-minor-mode, a minor mode that parses buffer syntax to accurately detect the start and end of blocks. It is the best folding mode for C-style languages, or anything using braces {} and explicit block structures like sh/Bash shell scripts. - outline (built-in): Provides
outline-modeandoutline-minor-mode, which relies on hierarchical headings to determine collapsible sections. It is effective for structured text and the authors default choice for Elisp, Lisp, Markdown, Diff, and configuration files. (Related article: “Customizing the ellipsis in outline to use a more visually appealing indicator for folded sections, such as ▼“)
(Read: “Emacs: The Definitive Guide to Code Folding” to properly configure code folding in Emacs.)
Category: Session management / persist and restore
- easysession: A lightweight Emacs session manager that can persist and restore file editing buffers, indirect buffers/clones, Dired buffers, the tab-bar, and the Emacs frames (with or without the Emacs frames size, width, and height).
- saveplace (built-in): Persist and restore your current cursor position.
- savehist (built-in): Persist and restore your Emacs command history.
- persist-text-scale: Provides
persist-text-scale-mode, which ensures that all adjustments made withtext-scale-increaseandtext-scale-decreaseare persisted and restored across sessions. As a result, the text size in each buffer remains consistent, even after restarting Emacs.
Category: Themes
- ef-themes: A collection of light and dark themes for GNU Emacs whose goal is to provide colorful themes.
- modus-themes: Highly accessible themes for GNU Emacs, conforming with the highest standard for color contrast between background and foreground values.
- doom-themes: An megapack of popular themes, including aesthetic extensions for popular packages (e.g., Tomorrow Night/Day, Solarized, Gruvbox…).
- tomorrow-night-deepblue-theme: A blue color theme for Emacs inspired by the Tomorrow Night color scheme.
Category: Vim emulation
- evil: An extensible vi layer for Emacs, providing a modal editing experience similar to Vim.
- evil-collection: A collection of Emacs packages that integrate with Evil mode to provide consistent keybindings across multiple modes.
- evil-surround: Enhances text object handling in Evil mode, allowing for easier manipulation of surrounding characters.
- evil-commentary: Comment or uncomment text in Normal or Visual mode by pressing
gc. - goto-chg: Navigate to the most recent edit in the buffer using
goto-last-changeorgoto-last-change-reverse. Commonly used in Evil mode for the motionsg;andg,, as well as for the last-change register.. - vim-tab-bar: Provides a tab-bar interface reminiscent of Vim.
evil-snipe: Provides enhanced search and jump functionality for Evil mode.(EDIT: The author replaced this package with the avy package)vdiff: Provides a visual interface for comparing two versions of a file that is similar to the Vim editor.(EDIT: The author is now uses the built-in ediff package. The vdiff package suffer from performance issues, and contain known bugs that undermine their reliability.)
Category: Terminal Emulators
- vterm: A terminal emulator for Emacs, written in C.
Category: Undo/Redo
- undo-fu: An advanced undo/redo system that enhances the default undo behavior in Emacs.
- undo-fu-session: Integrates with undo-fu to provide session management for undo history.
Category: Elisp
- aggressive-indent: Automatically keeps your code indented as you type. The author mainly uses this package with Elisp.
- compile-angel: Speed up Emacs by ensuring all libraries are byte-compiled and native-compiled. Byte-compilation reduces the overhead of loading Emacs Lisp code at runtime, while native compilation optimizes performance by generating machine code specific to your system.
- Paredit: A minor mode that enforces balanced parentheses while editing Lisp code. (In addition to Paredit, the author uses enhanced-evil-paredit.)
- page-break-lines-mode: Provides a minor mode that visually replaces ASCII form-feed characters (typically
^L) with horizontal lines to make page breaks easier to see, without altering the underlying text. - elisp-autofmt: Provides an automatic code formatter for Emacs Lisp. It includes the
elisp-autofmt-modeminor mode, along withelisp-autofmt-bufferandelisp-autofmt-regioncommands to format the entire buffer or selection. - easy-escape: Improves the readability of Emacs Lisp regular expressions through syntax highlighting and character composition. Specifically, it hides double backslashes before regexp special characters
()|, renders other doubled backslashes as single ones, and highlights them with a distinct face. - elisp-refs: An advanced code search for Emacs Lisp. It identifies references to functions, macros, variables, specials, and symbols by parsing the code instead of relying on plain text search.
- package-lint: Provides real-time evaluation of Emacs Lisp package metadata and formatting. It assists in identifying packaging errors, verifying required headers, and ensuring adherence to standard archive guidelines directly within the buffer.
Category: File Manager
- dired (built-in): File manager. (EDIT: The author is also using the built-in modes dired-hide-details-mode and dired-omit-mode.)
- nerd-icons-dired: Enhances Dired mode with icons from Nerd Fonts, improving file browsing.
Category: Org
- org (built-in): A powerful mode for organizing notes, tasks, and project planning within Emacs.
- org-roam: An Org mode extension that transforms Emacs into a non-hierarchical, bidirectional note-taking system (inspired by tools like Roam Research and Obsidian). It allows building a personal knowledge base by creating links between notes, visualizing the connections through a node graph, and quickly querying your database. (Alternatives: org-node and denote)
- org-appear: Improves the visibility of Org mode elements in the buffer by automatically toggling visibility based on context.
- toc-org: Automatically generates a table of contents for Org mode documents.
org-bullets: Replace org-mode leading stars with UTF-8 bullets(EDIT: The author is now using the org-ibullets fork. Another excellent alternative is org-modern)
Category: Buffers
- bufferfile: Delete or rename buffer file names with their associated buffers.
- buffer-terminator: A package that automatically and safely kills buffers to help maintain a clean and efficient workspace, while also improving Emacs’ performance by reducing the number of open buffers, thereby decreasing the number of active modes, timers, and other processes associated with those buffers.
- nerd-icons-ibuffer: Enhances the built-in
ibufferinterface by displaying recognizable icons next to buffer names. It uses the nerd-icons library to automatically assigns specific glyphs based on a buffer’s major mode, file extension, or underlying system process, such as displaying a Python logo for .py scripts or a folder icon for Dired views. - buffer-guardian: Automatically saves Emacs buffers without requiring manual intervention. By default, it triggers a save when the user switches to another buffer, switches to another window or frame, Emacs loses focus, or the minibuffer is opened. Beyond standard file buffers, buffer-guardian also manages specialized editing buffers such as org-src and edit-indirect. Additional features, disabled by default, include periodic or idle-time saving of all buffers, automatic exclusion of remote, nonexistent, or large files, and support for custom exclusion rules via regular expressions or predicate functions.
Category: Other packages
- expand-region: Expands the selected region in code, making it easier to select logical blocks of code or text.
- wgrep: Allows for in-buffer editing of grep results, improving the usability of search results. It can be used to modify the occurrences returned by the Embark package
embark-exportfunction. (Built-in alternative in Emacs >= 31:grep-change-to-grep-edit-modewhich enablesgrep-edit-modefor editing grep buffers) - inhibit-mouse: Disables mouse support within Emacs, encouraging keyboard-centric navigation and editing. This can be beneficial for some users who prefer a more traditional text editor experience.
- helpful: An enhanced alternative to the built-in help system that provides richer, context-aware information about symbols, functions, variables, and macros. In contrast to the default describe-* commands, Helpful presents a unified, navigable buffer that integrates documentation strings, source code, keybindings, references, and even interactive examples, thereby offering a more comprehensive and efficient environment for exploring Emacs internals.
- quick-fasd: Offers fast access to files and directories based on your history and usage patterns, optimizing file navigation.
- dir-config: Automatically find and evaluate .dir-config.el Elisp files to configure directory-specific settings.
- which-key (built-in): Displays available keybindings in a popup, helping users learn and remember key combinations in Emacs.
- quick-sdcv: Bring the Stardict’s dictionary functionality directly into your Emacs workflow. This will turn Emacs into a dictionary.
- golden-ratio: Automatic resizing of Emacs windows to the golden ratio.
- diminish: This package implements hiding or abbreviation of the mode line displays (lighters) of minor-modes.
- hyperbole: Provides a comprehensive, programmable hypertext and information management system for Emacs that allows users to link, organize, and navigate information without requiring a specialized markup language. At its core, it relies on implicit and explicit buttons, which are context-sensitive text areas that execute specific actions when activated, such as jumping to a file, opening a URL, or running a custom script. Designed to integrate deeply with the Emacs ecosystem, it enhances everyday workflows by providing tools for contact management, outliner hierarchies like the Koutliner, and global window configuration, effectively transforming standard plain text into an interconnected web of actionable data.
- gcmh: Gcmh (Garbage Collector Magic Hack) optimizes Emacs’ garbage collection behavior by adjusting the garbage collection threshold dynamically. During active use, it raises the threshold to reduce the frequency of garbage collections and minimize interruptions. When Emacs becomes idle, it lowers the threshold and triggers a collection, reclaiming memory at a convenient time.
- project.el (built-in): A package for managing and navigating projects, providing utilities for project-based operations like searching, switching, and file management within defined project directories. (Alternative to project.el: projectile)
- ace-window: A package for selecting a window to switch to.
- treemacs: A file and project explorer for Emacs that provides a visually structured tree layout similar to file browsers in modern IDEs. It integrates well with various Emacs packages such as
projectile,lsp-mode,evil, allowing users to navigate their project structure efficiently. - xclip: Enables copy and paste between Emacs running in a terminal and the system GUI clipboard.
- flyspell-mode (built-in): An interface for spell-checking text using external programs like
ispell,aspell, orhunspellfor checking and correcting spelling in buffers. (Faster alternative: jinx) hl-todo: highlight TODO, FIXME…(Alternatively, you can use this Elisp function that can highlight codetags such as TODO or FIXME)
Category: Miscellaneous file types
- markdown-mode: Provides major mode support for editing Markdown files.
- markdown-toc: Automatically generates and manages a table of contents for Markdown files, making navigation easier.
- csv-mode: Provides a major mode that enhances the experience of editing Comma-Separated Value files. Its most impactful feature is the ability to align fields into visually distinct, vertically synchronized columns, which instantly renders dense, delimited text into a readable table format.
jinja2-mode: Major mode for editing Jinja2 template files with syntax highlighting and proper indentation support.(unmaintained)- flymake-ansible-lint: Provides on-the-fly syntax checking for Ansible playbooks and roles, ensuring code quality.
- flymake-bashate: Integrates bashate for syntax checking of Bash scripts in real-time within Emacs. (Emacs also offers a built-in Flymake backend for ShellCheck.)
- combobulate: A package that provides structured editing and navigation capabilities across many programming languages. Rather than relying on conventional major modes that use fragile imperative logic and regular expressions to interpret code structure, Combobulate leverages the Emacs tree-sitter library. Tree-sitter maintains a concrete syntax tree of the source code, giving Combobulate precise and reliable insight into code structure, which allows for more accurate editing and movement operations.
- web-mode: An emacs major mode for editing web templates aka HTML files embedding parts (CSS/JavaScript) and blocks (pre rendered by client/server side engines). It is compatible with many template engines: PHP, JSP, ASP, Django, Twig, Jinja, Mustache, ERB, FreeMarker, Velocity, Cheetah, Smarty, CTemplate, Mustache, Blade, ErlyDTL, Go Template, Dust.js, Google Closure (soy), React/JSX, Angularjs, ejs, Nunjucks…
- php-mode: An Emacs major mode for editing PHP scripts.
- go-mode: An Emacs major mode for editing the Go programming language.
- nix-mode: An Emacs major mode for editing Nix expressions.
- jenkinsfile-mode: A major mode for editing Jenkins declarative pipeline syntax.
- hcl-mode: An Emacs major mode for editing Nix expressions.
- crontab-mode: A major mode for crontab.
- nginx-mode: An Emacs major mode for editing Nginx config files.
- vimrc-mode: A major mode that enables syntax highlighting for *.vim and .vimrc files.
- haskell-mode: A major mode for editing, developing and debugging Haskell programs.
lua-mode: Provides major mode support for editing Lua files.(EDIT: The author is now using the built-in lua-ts-mode.)php-mode: Provides major mode support for editing PHP files.(EDIT: The author is now using the built-in php-ts-mode.)dockerfile-mode: Provides syntax highlighting and editing support for Dockerfile files.(EDIT: The author is now using the built-in dockerfile-ts-mode.)yaml-mode: Provides major mode support for editing YAML files, complete with syntax highlighting and formatting commands.(EDIT: The author is now using the built-in yaml-ts-mode.)
Alternative package managers
- straight.el: This package manager focuses on stability and reproducibility by building packages directly from Git clones. It operates using a synchronous model that blocks the editor until all startup tasks are complete.
- Elpaca: This package manager uses an asynchronous architecture that prevents the Emacs user interface from freezing during package operations. It features a robust queuing system for automatic dependency resolution, which removes the requirement for users to manually order their configuration. It provide a more flexible and modern workflow than straight.el.