summary refs log tree commit diff
path: root/emacs
diff options
context:
space:
mode:
authornoa@gaiwan.org2024-06-12 22:49:31 +0000
committernoa@gaiwan.org2024-06-12 22:49:31 +0000
commit3342580f6843eaecd2ef3f424e0c8925a8878228 (patch)
tree9fc71a1e798dbd91b4185c981c07c81a776402c3 /emacs
parent95d8c8bde5303dd209fc8e130b3a79e83e2fb300 (diff)
Add documentation for dired configuration
Diffstat (limited to 'emacs')
-rw-r--r--emacs/init.el9
1 files changed, 8 insertions, 1 deletions
diff --git a/emacs/init.el b/emacs/init.el
index 52e06f9..97a4b67 100644
--- a/emacs/init.el
+++ b/emacs/init.el
@@ -516,13 +516,20 @@ and when JID is not in `jabber-activity-banned'."
 	blink-cursor-mode -1
 	blink-cursor-interval 0.7)
 
+;; Dired is a really nice package which, as with a lot of emacs, has some dodgy defaults.  Here we round off some of the sharp edges to make it more enjoyable to use.
 (use-package dired
 	:custom
+	;; By default, dired permanently deletes files.  But i have quite a bit of storage and also make bad decisions regularly, so it seems fitting to make use of the wonderful invention that is the trash.  People who have used systems from the last forty years or so will likely be familiar with this innovation.
+	(delete-by-moving-to-trash t)
+	;; It's not fun to be asked every time whether we want to delete a directory recursively.  It's an understandable default for safety reasons, but because we are not deleting permanently but rather just moving to the trash, it's not such a concern.
 	(dired-recursive-deletes 'always)
+	;; Recursive copying isn't even destructive, so i definitely don't want to be asked about that.
 	(dired-recursive-copies 'always)
+	;; After we delete some files or directories, it makes sense to get rid of any buffers which are looking at those files or directories.
 	(dired-clean-up-buffers-too nil)
-	(delete-by-moving-to-trash t)
+	;; With this set, if we have two dired buffers open next to one another, a rename operation in one will default to the directory shown in the other.  In this way, we can pretend we are using some kind of norton commander like file browser instead of slumming it in emacs.
 	(dired-dwim-target t)
+	;; These are some useful ls switches.  We have to keep -l.  To show dotfiles as well, we use -a.  To sort numbers by number order instead of lumping together ones, twos, and so on, we use -v.  Because we don't have colour, it's nice to have a clear indicator of what is a file and what is a directory, as well as other different things like symlinks which i never remember.  By using -F, a forward slash is appended to every directory.  And to get more easily understandable file sizes, we use -h, which will tell us the file size in kilobytes or megabytes rather than a huge number that means nothing to me.  I won't explain the meaning of the long flag.
 	(dired-listing-switches "-alvFh --group-directories-first"))
 
 ;;; indentation: tabs and whitespace settings