 ;; 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

  :interpreter ("node" . js2-mode)
  :config
  (when (fboundp 'sp-kill-whole-line)
    (bind-key "C-k" 'sp-kill-whole-line js2-mode-map)))

(use-package rjsx-mode
  :mode ("\\.jsx?\\'" "\\.mjs\\'"))

(use-package json-mode
  :config
  (unbind-key "C-c C-f" json-mode-map)
  (add-hook 'json-mode-hook (lambda ()
                              (when (not (key-binding "C-c f"))
                                (bind-key "C-c f" 'json-pretty-print-buffer 'json-mode-map)))))

(use-package polymode
  ;; :after rjsx-mode

              (add-minor-mode 'dired-hide-details-mode "")
              ;; Add binding to open file in native app
              (when (memq (window-system) '(mac ns))
                (define-key dired-mode-map (kbd "z")
                  (lambda ()
                    (interactive)
                    (let ((file-name (dired-get-file-for-visit)))
                      (start-process "default-app" nil "open" file-name))))))))

(use-package shrink-path)

