Emacs is quite a beast. It’s default keybindings (non-exhaustive) list is formidable. While many of us enthusiasts are able to get around using the defaults (which are found in more places than just Emacs), or just cheat and layer a (arguably superior) input method on top, you’ll often find yourself tweaking the defaults a bit.

This is one of those nice bits about Emacs. You can tweak it almost endlessly. Keybindings can be remapped, or even supplanted. If you wanted to take any binding that mapped to undo, and instead pass it to your own custom function. You can do that. You don’t even need to know what those bindings are ahead of time. Any package that comes along and also adds a map to undo, will instead have it pointed correctly.

My Bindings

My Emacs Custom Bindings (some of)

I tend to break my keybindings down into two general categories: Personal and package. My personal bindings are for things I make myself (functions) and changing around the default bindings to my liking. This tends to be a smaller list, since I’m focusing on just what is available. Packages, since I use use-package, are bound with the package. The reason for this is to ensure that if I add or delete a package from my Emacs configuration, the whole thing is contained in a block of configuration, instead of spread out across multiple files.

(use-package embrace
  :ensure t
  :after (expand-region)
  :bind (("C-c E" . embrace-commander)
	 ("C-c e" . embrace-add)))

This is something I use when I implement the complicated mappings for dired:

(use-package dired
  :bind (:map dired-mode-map
	      ;; Reuse the same dired window
	      ("RET" . dired-find-alternate-file)
	      ("^"   . (lambda()
			 (interactive)
			 (find-alternate-file "..")))
	      ;; Use 'open' to open the file with the user's choice
	      ("E"   . ndegruchy/open-in-external-app)
	      ;; Get the file size(s)
	      ("; d" . dired-get-size)
	      ;; Toggle omit
	      ("; o" . dired-omit-mode)
	      ;; Close the frame, useful when using dired by itself
	      ("; q" . delete-frame))
  :config
  (setq dired-listing-switches "--group-directories-first -alh"
	dired-dwim-target      t)
  (setq-default dired-omit-files-p t)
  (require 'dired-x)
  (require 'dired+)
  (put 'dired-find-alternate-file 'disabled nil)
  :hook (dired-mode . dired-hide-details-mode))

Keeping things organized is awesome, especially if you end up endlessly tweaking, like I do.

Emacs is what you make of it. While the defaults are great and are somewhat useful as-is, you’re going to run into situations where the defined bindings are less than optimal. I actually unbound a couple of keys because the way I type, when I hit M-x, I end up hitting M-z accidentally (my keyboard has a very shallow key travel).

If you do end up adventuring into the den of bindings for Emacs, take the ‘bind-key’ package/elisp with you. It helps make the binding, unbinding and defining of maps easier.

I hope you learn something from this. Customizing Emacs is a fun activity, but it can be a confusing exercise.