Hello, since i am learning Clojure and using it for about a year now, i want to considering using Emacs and not renew by intellij/cursive license. Since last week i am into it sinc last week and just using it but without much setup to just rmember the shortcuts fast. Now i am wondering, what do i really need to get a decent Clojure experiance, i guess clojure-mode, and cider - But all configurations i found where kinda complicated and overwhelmed me with my limited wisdom.
It's quite possible to do Clojure effectively with mainly just Emacs + CIDER. I wouldn't worry about anything. When you see something cool then just figure it out then.
Likely you'll want to use magit but for other features just look around when you think you need something.
Over the years I've ended up with these: green-phosphor-theme, rainbow-delimiters, mic-paren, cider, magit, tramp-term, company, highlight-symbol, projectile, wgrep, iedit, dired-x, dired-sidebar, git-gutter, diminish, exec-path-from-shell, helm-projectile, avy, flycheck, flycheck-clj-kondo, demap, and run-command.
But it's a journey that never ends. Some packages get deprecated and new better options appear.
Since clj-kondo is cool and useful for learning too, I'd add that also soon.
This is roughly what it looks like after all the customizations.
i use this config https://github.com/jackrusher/dotemacs i don't find it too complex and you could probably extract the important parts manually if you don't feel like switching. to your list of clojure-mode and cider i would add expand-region (see the config readme) and smartparens. there's a lot more but that's what i consider critical for clojure. (for cljs i'd add either lsp or eglot.)
When I started with Clojure within Emacs, I started from what was suggested as starting config in Brave Clojure, then I built up mine from there. Brave Clojure intro to Emacs https://www.braveclojure.com/basic-emacs/ Emacs config https://github.com/flyingmachine/emacs-for-clojure/
I use https://github.com/doomemacs/doomemacs and crib heavily from @ericdallo’s https://github.com/ericdallo/dotfiles/tree/master/.config/doom
Thx for all the Answers 🙂 it took me now some time but i think i am almost happy with the setup DoomEmacs is not my cup of tea, i copied together now and looked up the settings for i saw in your configurations. Rainbow-delimiter is exactly what i was searching for 🙂 The last thing i would like to have is the lsp working, so far not succesful with eglot. It is running but for some reason i dont get suggestions from it.
> DoomEmacs is not my cup of tea I still would suggest to learn at least a bit of it - knowing how Doom modules (and Spacemacs layers) are structured may give you some great ideas to borrow from them. Doom, even when used without any of its modules, still is very nice - it slashes the startup time, simplifies managing dependencies, adds some extremely nice macros that remove ton of (otherwise needed) boilerplate from your config.
I don't understand what it can remove. Can you point out to some sample of what it improves?
I see. 👍 Looks like it won't help me enough to consider it. I have approximately 15 hooks altogether, and all of them use a named function. I would like to have my own named functions anyway. Pretty much most of them are global too.
I have about 1.2K lines of elisp of which approximately half of it is config. I recently rewrote it in use-package because this stuff mostly predates it (10+ years old).
My point of view was anyway that stuff can be adopted in Emacs also slowly, without a need to jump into systems. This helps me to for example learn systems one by one, and decide if it makes sense or not. And perhaps I'll even remember to use it later ...
@ag FWIW, remove-hook can remove anonymous functions from hooks
yes, you can, but for that you have to repeat the entire body of the anonymous function, precisely, or it won't remove it.
Not if you use it interactively
Simplest example? When you do something like
(add-hook 'foo-hook (lambda (x) ...))
it's then not possible to remove the hook (without repeating the body) or dynamically change the hook function, so it's considered a bad practice, so you always need to:
(defun foo-h () ...)
(add-hook 'foo-hook #'foo-h)
Doom's add-hook! macro allows you to introduce new hooks like this:
(add-hook! foo
(defun foo-h () ...))
Heh, not a big deal you may say. But there's more. It allows you to bind more than one function, i.e., :
(add-hook! foo
#'foo-h
#'foo-baz-h)
Or bind to multiple hooks:
(add-hook! (foo bar zap)
#'foo-h
#'bar-h)
That's just one helpful macro. There are tons of small helpers that simplify hooks, advising, keymapping, etc. Check out this snippet:
(map! :map org-mode-map
:n "C-c i" #'foo
:i "C-c i" #'bar
"SPC" #'zap)
It says - for org-mode, if you're using Evil, in normal state bind 'C-c i' to one function, in insert state to another, and bind "SPC" (regardless of the state) to some function as well. How something like that would look like in vanilla?
(progn
(general-define-key :keymaps (backquote (org-mode-map)) "SPC" #'zap)
(general-define-key :states 'insert :keymaps (backquote (org-mode-map)) "C-c f" #'bar)
(general-define-key :states 'normal :keymaps (backquote (org-mode-map)) "C-c i" #'foo))
Now, imagine (even without using Evil), if you need to bind the same key in multiple keymaps, or conditionally, or after specific package has loaded. That can get noisy pretty quickly.