Fork me on GitHub
#cider
<
2019-02-03
>
chase-lambert19:02:07

so cider seems to be locking up my emacs completely every now and then. I'm having a hard time figuring out what exactly causes it. It might be when I'm printing a lot of lines. I have to restart Emacs completely and am not sure how to gather more information to seek help from you folks on the matter. any advice?

chase-lambert19:02:33

I may have found one suggestion to use for debugging: "`M-x toggle-debug-on-quit` then hit C-g if it hangs and it will print a backtrace. Sound good?

dpsutton19:02:52

long lines are the bane of emacs. It should try to limit printing extremely long lines automatically. If you do find yourself with some big output you can check the , (comma) menu at the repl prompt and there is an option to clear the repl output and it should speed back up

chase-lambert19:02:19

ooh, this comma menu might come in handy for other uses too

dpsutton19:02:33

it most certainly is

cbowdon19:02:19

I found these problems mostly disappeared when I set the CIDER pretty print variable to true (sorry can’t remember exact name - you should be able to find it in the CIDER custom group)

chase-lambert19:02:54

Now that you mention that I was hoping somebody could look at my cider config portion of my init.el and see if I'm doing something really dumb in there. I think I copy and pasted it when first trying to roll my own config.

chase-lambert19:02:14

(use-package clojure-mode
  :mode (("\\.clj\\'"  . clojure-mode)
	 ("\\.cljs\\'" . clojure-mode)
	 ("\\.cljc\\'" . clojure-mode)
	 ("\\.edn\\'"  . clojure-mode))
  :config
  (add-hook 'clojure-mode-hook #'paredit-mode)
  (setq clojure-verify-major-mode nil))

(use-package cider
  :init
  (add-hook 'cider-mode-hook #'clj-refactor-mode)
  :diminish subword-mode
  :config
  (add-hook 'cider-repl-mode-hook #'paredit-mode)
  (setq nrepl-log-messages t
	cider-repl-use-clojure-font-lock t
	cider-font-lock-dynamically '(macro core function var)
	nrepl-hide-special-buffers t
	cider-repl-scroll-on-output nil
	cider-overlays-use-font-lock t
	cider-invert-insert-eval-p t
	cider-switch-to-repl-after-insert-p nil)
  (define-key cider-repl-mode-map (kbd "RET") #'cider-repl-newline-and-indent)
  (define-key cider-repl-mode-map (kbd "C-<return>") #'cider-repl-return)
  (cider-repl-toggle-pretty-printing))

(use-package cider-eval-sexp-fu)

(use-package clj-refactor
  :diminish clj-refactor-mode
  :config (cljr-add-keybindings-with-prefix "C-c C-m"))

(use-package clojure-mode-extra-font-locking)

(use-package flycheck-joker)

chase-lambert19:02:40

the only thing I'm dead set on in that cider config is the define key portion

dpsutton19:02:39

you are putting cljc and cljs files into clojure-mode rather than clojurec-mode and clojurescript-mode it seems

dpsutton19:02:45

i would turn off the nrepl message logging. unless you are investigating bugs it is just output you don't need

dpsutton19:02:02

also i did you insert and repl functions. I made those changes so its nice to see people using them 🙂

chase-lambert19:02:10

I'll turn off that logging. what about the font-lock-dynamically and pretty printing stuff? I saw mentions of those in some of the cider locking issues on github so maybe should take that off or it's in there to help?

dpsutton19:02:32

yes those can slow things down

dpsutton19:02:36

but only in larger files

chase-lambert19:02:51

alright, i'm going to cut most of this stuff then.

dpsutton19:02:57

you ca nremember those if you find yourself slowing down. this is usually felt in a larger text buffer when adding characters can take a bit longer

chase-lambert19:02:59

so clojure-mode isn't used now for all the clojure files?

dpsutton19:02:13

there are custom ones for cljc and cljs files

dpsutton19:02:19

but this is already handled for you in clojure-mode.el. ( a dependency of CIDER)

dpsutton19:02:21

(progn
  (add-to-list 'auto-mode-alist
               '("\\.\\(clj\\|dtm\\|edn\\)\\'" . clojure-mode))
  (add-to-list 'auto-mode-alist '("\\.cljc\\'" . clojurec-mode))
  (add-to-list 'auto-mode-alist '("\\.cljs\\'" . clojurescript-mode))
  ;; boot build scripts are Clojure source files
  (add-to-list 'auto-mode-alist '("\\(?:build\\|profile\\)\\.boot\\'" . clojure-mode)))

chase-lambert19:02:54

so I can take out that whole :mode section?

chase-lambert19:02:48

and what about these packages:

(use-package cider-eval-sexp-fu)

(use-package clj-refactor
  :diminish clj-refactor-mode
  :config (cljr-add-keybindings-with-prefix "C-c C-m"))

(use-package clojure-mode-extra-font-locking)

chase-lambert19:02:55

am I actually using these?

chase-lambert19:02:10

thanks for your help, I've been wanting to clean this up and keep it as minimal as possible.

dpsutton19:02:52

honestly if you don't know what something is you should toss it

dpsutton19:02:58

build it up as you use it and look for it

dpsutton19:02:07

lots of these might be old and cause problems for you in the future

chase-lambert19:02:03

new and improved:

(use-package clojure-mode
  :config
  (add-hook 'clojure-mode-hook #'paredit-mode)
  (setq clojure-verify-major-mode nil))

(use-package cider
  :config
  (add-hook 'cider-repl-mode-hook #'paredit-mode)
  (define-key cider-repl-mode-map (kbd "RET") #'cider-repl-newline-and-indent)
  (define-key cider-repl-mode-map (kbd "C-<return>") #'cider-repl-return))

(use-package flycheck-joker)

chase-lambert19:02:22

hopefully I didn't cut something crucial.

chase-lambert19:02:24

and now my entire init.el is back under 100 lines and I feel at peace. hahaha. thanks

dpsutton19:02:02

anytime :+1:

chase-lambert19:02:08

what did you mean by you made the changes for the insert and repl functions?

dpsutton20:02:06

cider-invert-insert-eval-p t
    cider-switch-to-repl-after-insert-p nil)
when using the insert commands (C-c C-j [e|d|r]) for insert sexp|defun|region it makes it press return after inserting

dpsutton20:02:16

the standard behavior is to put the form in the repl but not submit it

chase-lambert20:02:40

ahh! I'm adding those back in then.