Prologue
Five years ago I described an Emacs extension called ‘Sunrise Commander’ (just is Slovak langugage, sorry). It is an extension for the built-in file manager ‘Dired’. And today we'll talk about another extension, with a similar name - ‘Diredc’.
Dired orthodoxly?
We'll quote from the earlier article mentioned above:Wikipedia teaches us:
Orthodoxy (from Greek ortho - correct, true, and doxa - thought, teaching, celebration) or orthodoxy is the quality of adhering firmly to a particular (usually original/older/main) school of thought (e.g., in economics), doctrine, belief, or faith (in the latter case, thus the quality of being strictly believed and/or orthodox).
In computer terminology, the term orthodox file manager is used a lot. So long-established - by design, principle and control. Clearly, we are talking about managers, also called commanders, which are more or less based on Norton Commander. Everyone knows NC, in our world it is followed by e.g. Midnight Commander, Gnome Commander, Krusader, Necromancer, Tux Commander, Ghost Commander, Sunflower Commander, Double Commander… and maybe there will be some more that (with a few exceptions) will be called
Sunrise Commander has served me well, but with the comming of new versions of Emacs (v. 31 in my case), I've encountered a few ‘bugs’, such as Sunrise's buffer suddenly becoming dired's buffer. And a few others. And unfortunately, nobody actively develops Sunrise Commander anymore (AFAIK). But it was at that point that I encountered diredc.
Diredc
We'll paraphrase a few thoughts from the author's site:
This package extends Emacs' dired-mode with features found in almost all file managers, as well as some unique features:
- ◦ durable dedicated two-pane design,
- ◦ similar look-and-feel to Midnight Commander,
- ◦ intelligent restoration of manually changed windows configuration,
- ◦ clean and complete diredc/dired termination,
- ◦ navigable directory history backwards, forwards, or to a direct history entry,
- ◦ quick file preview mode inspired by and similar to Midnight Commander's mode,
- ◦ customizable exclusion criteria to suppress unwanted files (e.g. binaries),
- ◦ optional display of magit status buffers for repository roots,
- ◦ additional information about the current file in the minibuffer (optional) - e.g. output from getfattr, getfacl, stat, exif,
- ◦ excellent configurability,
- ◦ swapping panels (including history entries),
- ◦ managing the recycle bin according to the XFreeDesktop standard,
- ◦ restoring deleted files to their original location,
- ◦ emptying the Recycle Bin along with its management,
- ◦ displaying summary information about the Recycle Bin,
- ◦ navigating ‘up’ n× parent directories,
- ◦ running asynchronous processes for files - processes run even after Emacs exits,
- ◦ quick shell window - there are several shell types to choose from.
There is no point in describing the program as such - it would be rewriting the documentation. In principle, it is no different from other two-panel file managers. Unlike Sunrise Commander, it tries to use two and only two dired buffers; if there are more, it will offer the option to select the active ones, but also to keep or delete all of them or the unused ones. Of course, it uses keyboard shortcuts and terminology from the Emacs world, which is just as well, and for me the reason why I don't use other, albeit excellent, managers like Double Commander or Gnome Commander (otherwise Double Commander can also be pretty much bent with Emacs keyboard shortcuts, it even supports shortcuts entered as a sequence of keystrokes... but it's still not Emacs of course 😉).
I'll also add that the ‘quick shell window’ allows you to use bash, fish, (my favourite) eshell,…

Fig. 0: 2-pane classics
But a subjective blog entry should be about something else - after all, this is an interesting topic for discussion in terms of whether blogging makes sense in the age of AI - and indeed it will.
How the F-keys were stolen from us
I remembered a good old joke:
Sixties. The Union of Soviet Socialist Republics. Moscow.
Ivan bought a car, brought it home and parked it nicely in front of his apartment building. The next day he looks out the window in the morning and Zaporozhets (famous soviet brand) is nowhere to be seen.
So he went to report it to the militia.
When the militiaman interrogates him, he sternly says:
- ‘Grazhdanin, look at this wall! What do you see?’
- ‘Well... a picture of Vladimir Ilyich Lenin.’ Ivan answers truthfully.
- ‘And what, Grazhdanin, is on that picture? Take a good look!’
- ‘Lenin, surrounded by his closest friends (comrades).’
- ‘And what else do you see? What is Comrade Lenin holding in his hand?’
- ‘A cap.’ Ivan says.
- ‘Well, there we have it! Vladimir Ilyich Lenin, surrounded by his closest friends and holding his cap in his hand… And you!? You leave your car standing in the street!’
Who stole the F-keys - that is, the F1 - F12 function keys - from us, and when?
We don't know the guilty party, but it was certainly one of the ‘usual suspects’, such as Microsoft or Apple. We don't know the time either.
And the theft was that they introduced strange (todays) standards that messed up the ergonomics and warped the fingers.
So for example: the F1
key is a perfectly positioned key - next to ESC
, easy to reach, separated. Reason dictates to put a frequently used function there. So I have undo there. And not some help! How often does one need a hint to usurp such a lucrative place?
Or someone - ‘the usual suspect’ - decided that the frequently used cut, copy and paste functions, kill and yank - well, just put them with a modifier on the bottom line, let the carpal tunnel be on the rise, especially for those who don't press Ctrl with their palm! But I always put them on F2
, F3
and F4
.
F5
and F6
are usually associated with bookmarks and jumping to them, F7
and F8
for moving around Emacs buffers, the classic F9
is compilation (but for example in LaTeX it's a rendered preview, in diredc it's history...), F10
is menu, F11
is ‘fullscreen’ and F12
is Caps Lock
! Indeed that Caps Lock
, which again has a lucrative place in the basic keyboard row and is rarely used, unless one contributes to shouted discussions ☺. In place of Caps Lock
, I prefer the Hyper
modifier. Because there are never enough modifiers in Emacs.
Why I don't use ‘use-package’
use-package is a macro in Emacs that simplifies the configuration and management of packages, allowing them to be loaded only when needed and keeping the configuration clear. It helps improve startup time and neatly organizes package settings.
That sounds like a great thing. And it certainly is.
It's just that I have configuration files from the days when use-package didn't exist and I don't want to rebuild them. I just managed to copy them from ~/.emacs
to ~/.emacs.d/init.el
😃.
I'll end this lament by stating that I always kept the initialization file fairly small, and used a set of hooks to load extensions when they were needed.
For example:
(add-hook 'tcl-mode-hook (lambda() (load-file "/home/richard/.emacs.d/load-tcl-hooks.el")))
So the extensions for e.g. the above Tcl language only started when I needed them. And this is the analogy I have for other file types (c, ino, sh, org, tex,…) or other situations such as launching a file manager or RSS reader.
(defun diredc-start() "Start diredc" (interactive) (load "~/.emacs.d/load-diredc-hooks.el") (diredc))
What's interesting in the "hook" for diredc?
For example, loading some other extensions. We'll talk more about diredc-tabs.el later.(load-file "~/.emacs.d/vendor/dired-preview/dired-preview.el") (load-file "~/.emacs.d/vendor/diredc-tabs/diredc-tabs. el")
Or file associations (if you don't want XDG), custom functions like:
- ◦ merging tagged PDFs,
- ◦ sending multiple PDFs to the program at once,
- ◦ resizing images,
- ◦ unmounting the attached disk,
- ◦ ‘detoxing’ files (replacing spaces _, diacritics with characters without... ),
- ◦ quickly collapsing directories,
- ◦ entering and removing passwords for PDF files,
- ◦ encrypting and decrypting files with ccrypt,
- ◦ better copying/archiving with rsync,
- ◦ and others…
diredc-tabs.el
Sunrise Commander had an extension called sunrise-x-tabs, which added the familiar tabs to quickly navigate between selected directories.
Diredc has a handy history, but it doesn't quite serve the same purpose.
That's why I've reprogrammed similar functionality in Elisp. The point of it is to have a user-defined list of directories for both left and right windows that can be switched between very quickly. So I defined o.i. these functions, and assigned keyboard shortcuts to them:
| function | command | shortcut | |-------------------------------------------------------------+----------------------------------------+------------| | puts the current directory in the left window into list | diredc-tabs-create-tab-left-pane | C-F7 | | puts the current directory in the right window into list | diredc-tabs-create-tab-right-pane | C-F8 | | switches between directories in the left window | diredc-tabs-switch-left-pane-tab | F7 | | switches between directories in the right window | diredc-tabs-switch-right-pane-tab | F8 | | removes the current directory in the left window from list | diredc-tabs-delete-tab-left-pane | F12 F7 | | removes the current directory in the right window from list | diredc-tabs-delete-tab-right-pane | F12 F8 | | removes all directories from the list for the left window | diredc-tabs-reset-left-pane-tabs-list | | | removes all directories from the list for the right window | diredc-tabs-reset-right-pane-tabs-list | |
During these operations, both the current list and the selected directory are output in the Emacs echo area.
If the diredc-tabs-switch-left-pane-tab
and diredc-tabs-switch-right-pane-tab
functions are called with the universal modifier, or their keyboard shortcut follows C-u
(so it is a combo of C-u F7
), the list of relevant directories is displayed at the bottom and can be searched between them by typing part of the name/path and navigating to them. I chose this solution instead of the popup functionality, in which the candidates cannot be narrowed down by any framework (whereas here it is independent, depending on what the user is using, e.g. ivy, ido, helm, fido,…)

Fig 1: Selecting ‘tabs’ from the list, along with dynamic narrowing.
What about history?
Diredc has the property, that it remembers its history for each window. That list is created when the diredc-hist-find-alternate-file
function is called, which is triggered with a pass inside the directory structure.
In my functions, I've handled this so, that when a directory is changed, a copy of it is still saved in a growing list (I've limited it to 300 entries), and this is then retrieved and used - again, a functionality with dynamically narrowing candidate selection - when selecting a directory from the history.
A small detail is the editing of the modeline, as seen in the pictures, from which I removed unnecessary information.
Some small tips
I am using package delight for replacing mode names with icons in the modeline:
(delight 'dired-mode "💾" t) (delight 'all-the-icons-dired-mode " 🔳" t) (add-hook 'dired-mode-hook 'all-the-icons-dired-mode)
Also I am using all-the-icons-dired-mode for showing file/folder icons. Here is a way, how to uses a exact icon on exact folder (name).
(push '("docs" all-the-icons-faicon "book" :height 1.0 :v-adjust -0.1) all-the-icons-dir-icon-alist) (push '("bin" all-the-icons-faicon "code" :height 1.0 :v-adjust -0.1) all-the-icons-dir-icon-alist) (push '("tlac_front" all-the-icons-octicon "gear":v-adjust 0.0) all-the-icons-dir-icon-alist) (push '("tmp" all-the-icons-fileicon "test-dir" :height 0.9) all-the-icons-dir-icon-alist)
If someone gets a gzip message about ignoring a directory when trying to compress it with the built-in dired-do-compress, then re-setting it will help (other algorithms can be added this way too):
(setq dired-compress-file-suffixes nil) (add-to-list 'dired-compress-file-suffixes '("\\. tar\\.gz\“‘ ”’ ‘gzip -dc %i | tar -xzf -’)) (add-to-list 'dired-compress-files-alist '("\\.tar.gz\\'" . "tar -czf - %i | gzip -c9 > %o")) (add-to-list 'dired-compress-files-alist '("\\.tgz\\'" . "tar -cf - %i | gzip -c9 > %o")) (add-to-list 'dired-compress-files-alist '("\\.zip\\'" . "zip %o -r --filesync %i")))
I'm using a more concise view (switching with M-t
) to display the files (again due to the openness of the source):
(add-to-list 'diredc-display-listing-switches-list '("long, group, K sizes" . '-oL --group-directories-first --time-style=long-iso'))
Hook for cleaner output
(add-hook 'dired-mode-hook 'dired-hide-details-mode)
For opening files according to XDG, using .desktop definitions:
(openwith-mode t)
Function for calling the history look strange, but work for me. The reason for first deleting windows, thern restoring it is, that original diredc funcion diredc-hist-select
let me two windows, but not side-by-side, but one under other. The same approach I used for functions inside diredc-tabs.el.
(defun diredc-history-select () "An interactive function to call diredc history function properly." (interactive) (delete-other-windows) (restore-diredc-hist-list) (diredc-hist-select) (diredc-recover) (diredc-other-window))
Function for couting the usage in directory:
(defun diredc-du () "Calculate du -sb and display it as message." (interactive) (let* ((adresar (buffer-substring-no-properties (point) (line-end-position))) (velkost-adresara (string-to-number (shell-command-to-string (format "du -sb \"%s\"" adresar)))) (velkost-jednotka (cond ((< velkost-adresara 1024) "B") ((< velkost-adresara (* 1024 1024)) "KB") (t "MB"))) (velkost-formatovana (cond ((< velkost-adresara 1024) velkost-adresara) ((< velkost-adresara (* 1024 1024)) (/ velkost-adresara 1024.0)) (t (/ velkost-adresara (* 1024 1024.0)))))) (message "Size of directory %s is %.2f %s" (propertize adresar 'face 'bold) velkost-formatovana velkost-jednotka)))
Epilogue
The great thing about free software is that it can be studied and modified. And you can learn a lot in the process. Even if they are only small changes, their impact is substantial. I've been using free software for 20 years, and I'm still fascinated by it.
If we dreamed of a world where, for example, Microsoft Office was free software, how long would it take for enthusiasts to start modifying and improving it?
‘Happy hacking!’Gitlab link: diredc-tabs.el