 ;; Not that I use occur very often, but when I do, I'd like its keybindings the
 ;; same as grep mode's
 (with-eval-after-load 'replace
-  (bind-keys :map occur-mode-map
-             ("M-n" . nil)
-             ("M-p" . nil)
-             ("n"   . occur-next)
-             ("p"   . occur-prev)))
+  (pcase-dolist (`(,key . ,command)
+                 '(("M-n" . nil)
+                   ("M-p" . nil)
+                   ("n"   . occur-next)
+                   ("p"   . occur-prev)))
+    (define-key occur-mode-map (kbd key) command)))
 
 (with-eval-after-load 'compile
-  (bind-keys :map compilation-minor-mode-map
-             ("M-{" . nil)
-             ("M-}" . nil)
-             ("M-n" . nil)
-             ("M-p" . nil)
-             ("{"   . compilation-previous-file)
-             ("}"   . compilation-next-file)
-             ("p"   . compilation-previous-error)
-             ("n"   . compilation-next-error)
-             :map compilation-mode-map
-             ("M-{" . nil)
-             ("M-}" . nil)
-             ("M-n" . nil)
-             ("M-p" . nil)
-             ("{"   . compilation-previous-file)
-             ("}"   . compilation-next-file)
-             ("p"   . compilation-previous-error)
-             ("n"   . compilation-next-error)))
+  (pcase-dolist (`(,key . ,command)
+                 '(("M-{" . nil)
+                   ("M-}" . nil)
+                   ("M-n" . nil)
+                   ("M-p" . nil)
+                   ("{"   . compilation-previous-file)
+                   ("}"   . compilation-next-file)
+                   ("p"   . compilation-previous-error)
+                   ("n"   . compilation-next-error)))
+    (define-key compilation-minor-mode-map (kbd key) command)
+    (define-key compilation-mode-map (kbd key) command)))
 
 ;; Persistent history for all the inferior modes
 (add-hook 'comint-mode-hook

      (apply comment-dwim args)))
  (advice-add 'comment-dwim :around 'comment-dwim-advice))

(use-package bind-key)

;; I hate X mouse bindings
(when (and (display-graphic-p)
           (not (memq (window-system) '(x))))
  (bind-key "<mouse-3>" 'mouse-buffer-menu))

;; tab-bar mode can't be used on macOS, so rebinding it to something useful.
(bind-key "C-x t" 'display-time-world)

;; Completely unbind annoying abbrev, dabbrev, expand, hippie-expand. These
;; ancient completion commands are just too stupid for this day and age
(unbind-key "M-'")
(unbind-key "M-/")
(unbind-key "C-x '")
;; Always use M-g prefix to jump between errors
(unbind-key "C-x `")
;; Must there be 4 bindings to undo?
(unbind-key "C-x u")
(unbind-key "C-_")
(unbind-key "C-/")
(unbind-key "s-z")

;; Bind useful things to keys
(bind-keys ("<backtab>" . align)
           ("C-x f"     . follow-mode)
           ;; Replace default buffer menu with ibuffer
           ("C-x C-b"   . ibuffer)
           ("C-t"       . transpose-sexps)
           ("M-:"       . ielm)
           ("C-x ^"     . nil)
           ("C-{"       . enlarge-window)
           ("C-}"       . shrink-window)
           ("C-c l"     . browse-url-at-point)
           ("C-c n l"   . org-store-link)
           ("C-c n a"   . org-agenda)
           ("C-c n c"   . org-capture))

;; Replace zap-to-char with the hidden zap-up-to-char
(autoload 'zap-up-to-char "misc")

  :after (:any web-mode js2-mode rjsx-mode)
  :hook (sgml-mode nxml-mode web-mode js-jsx-mode js2-jsx-mode rjsx-mode)
  :config
  (define-key emmet-mode-keymap (kbd "C-c C-c w") nil)
  (define-key emmet-mode-keymap (kbd "C-c C-m w") 'emmet-wrap-with-markup)
  (add-hook 'emmet-mode-hook
            (lambda ()
              (when (or (member major-mode '(js-jsx-mode js2-jsx-mode rjsx-mode))
