Permalink
Browse files

Clojure: Warn about missing nREPL instead of doing stupid things

Looted from @samaaron's emacs-live
  • Loading branch information...
1 parent daf2e05 commit 6ff7ed294e05c269e2433f46e80cb5825ad2178c @magnars magnars committed Jan 11, 2014
Showing with 22 additions and 0 deletions.
  1. +22 −0 setup-clojure-mode.el
View
22 setup-clojure-mode.el
@@ -88,4 +88,26 @@
(goto-char original-point)))
(define-key clojure-mode-map (kbd "C-´") 'live-cycle-clj-coll)
+
+;; Warn about missing nREPL instead of doing stupid things
+
+(defun nrepl-warn-when-not-connected ()
+ (interactive)
+ (message "Oops! You're not connected to an nREPL server. Please run M-x cider or M-x cider-jack-in to connect."))
+
+(define-key clojure-mode-map (kbd "C-M-x") 'nrepl-warn-when-not-connected)
+(define-key clojure-mode-map (kbd "C-x C-e") 'nrepl-warn-when-not-connected)
+(define-key clojure-mode-map (kbd "C-c C-e") 'nrepl-warn-when-not-connected)
+(define-key clojure-mode-map (kbd "C-c C-l") 'nrepl-warn-when-not-connected)
+(define-key clojure-mode-map (kbd "C-c C-r") 'nrepl-warn-when-not-connected)
+(define-key clojure-mode-map (kbd "C-c C-z") 'nrepl-warn-when-not-connected)
+(define-key clojure-mode-map (kbd "C-c C-k") 'nrepl-warn-when-not-connected)
+(define-key clojure-mode-map (kbd "C-c C-n") 'nrepl-warn-when-not-connected)
+
+;; ------------
+
+;; TODO: Loot more stuff from:
+;; - https://github.com/overtone/emacs-live/blob/master/packs/dev/clojure-pack/config/paredit-conf.el
+
+
(provide 'setup-clojure-mode)

0 comments on commit 6ff7ed2

Please sign in to comment.