logo
Kurashizu Blogwhere ideas flow
  • Home
  • News
  • Blog
  • About
  • Home
  • News
  • Blog
  • About

© 2026 Kurashizu. All rights reserved.

Admin·New Post·Service Status
Powered by Cloudflare·01.11.26
← Back to news

My Emacs Configuration (Dired)

Original article
eugene-andrienko.com|28 points|6 comments|by meysamazad|Jul 24, 2026

My Emacs Configuration: Mastering Dired

Dragon's notes | 📅 05 Jul 2026 | 🏷️ #emacs

This article is a continuation of my series exploring my Emacs setup. If you missed the earlier entries, you can find them here:

  • My Emacs configuration (common parts)
  • Why and how I ditched use-package?

Rather than providing a dry list of configuration settings—which is common in many blog posts—I want to dive into my daily habits and the specific workflows I employ while using Dired.

What is Dired? For those unfamiliar, Dired is an Emacs package that functions as a high-powered file manager. It treats directories as standard Emacs buffers, allowing you to manipulate your files and folders using the same keyboard shortcuts and editing habits you use for text.


🛠️ The Preamble: My Evolution

I have always leaned toward a minimalist computing environment. My journey toward Dired looked something like this:

Initially, I relied on the command line bash and zsh for almost everything. While efficient, I craved more interactivity. I wanted to move or copy files between directories without typing repetitive cp commands or to view two directories simultaneously (similar to the dual-pane view in Midnight Commander).

However, I needed even more—specifically, the ability to preview images. Midnight Commander couldn't provide the plugin flexibility I found in tools like Far. Since Dired comes bundled with nearly every Emacs distribution, I decided to give it a shot. I haven't looked back since.


🚀 Invoking Dired

I generally access Dired through a few different pathways depending on the context:

1. Project-Based Navigation

When working within a project, I use specific hotkeys to jump to directories:

  • C-x p d: Jump to a specific catalog within the project.
    • Example: To open my configuration folder, I type C-x p d configs RET.
  • C-x p D: Open the project's root directory immediately.

2. Contextual Access

If I am currently editing a blog post and need to manage its associated assets (like images), I use: C-x C-j →\rightarrow→ Opens the Org file and image buffer.

Figure 2: Dired buffer opening after C-x C-j

3. General & Remote Access

I have rebound the default C-x d to C-x C-d for better ergonomics:

(keymap-global-set "C-x C-d" 'dired)

This is my go-to for local folders or remote servers via TRAMP. For instance, to access a bin folder on a remote server: C-x C-d /ssh:username@server.example.com:~/bin ∧\wedge∧

Note: Upon entering the colon, GnuPG prompts for my private key password to decrypt ~/.authinfo.gpg, which stores the server credentials.

4. System Integration

I have configured Emacs to act as my system's default file manager. For example, in Librewolf, clicking the folder icon in the "Downloads" menu triggers an Emacs frame to open the corresponding Dired buffer. (See my previous guide: Emacs Dired as a default file manager).


📂 File Operations

Managing files in Dired is intuitive. While the m key is the standard for marking files, there are far more sophisticated methods available.

Marking Strategies

KeybindingAction
* sMark all files and directories
* .Mark files with a specific extension
% mMark files matching a regular expression
UUnmark all files
tToggle marks

Practical Examples

Example A: Deleting specific formats If my cursor is on a .webp file, I can quickly delete all such files using the sequence: * . →\rightarrow→ RET →\rightarrow→ D →\rightarrow→ y →\rightarrow→ RET. (Note: These are separate commands; the extension is pre-selected if the cursor is already on a matching file).

Example B: Batch Conversion I personally dislike WEBP as a corporate format, so I convert them to JPG using GraphicsMagick:

  1. Press * . to select WEBP files.
  2. Use M-n to cycle through my saved special commands.
  3. Select the ? .jpg command and press Enter.

Example C: The Power of Regexp The % m command is where Dired truly outshines the CLI or Midnight Commander. I can select files using complex patterns. For example, to find files starting with e6f and ending in .webp or a 3-letter extension variant:

^e6f.+\.webp\.?\([a-z]\{3\}\)?

In mathematical terms, the selection logic follows: Selection={f∈Files∣f matches Regexp}\text{Selection} = \{ f \in \text{Files} \mid f \text{ matches } \text{Regexp} \}Selection={f∈Files∣f matches Regexp}


🚩 Marks vs. Flags

It is important to distinguish between marking and flagging. Dired allows you to do both simultaneously:

  • Marks (Purple): Used for copying or moving files.
  • Flags (Red): Used specifically for deletion (triggered by the d key).

This separation allows me to mark a set of files for backup while simultaneously flagging others for removal, each visually distinct in the buffer.

There are, of course, many more keybindings...