I am trying to set up the emacs to have auto-Indentation for clojure code.
Until now unsuccessful. What is the command to set into the config file for that?
Here is a sample emacs config for what i consider the "minimal" usable emacs config for Clojure. I say minimal in that I'm not willing to work without good code completion, jump to definition, project aware file handling etc:
from this example which you can clone to ~/.emacs.d:
This is just a hilight, see the init file in the example project for the context, look at the project for recent versions, etc. don't just copy these:
(use-package clojure-mode
:ensure t
:config
(add-hook 'clojure-mode-hook 'yas-minor-mode))
(use-package cider
:ensure t
:config (progn (add-hook 'clojure-mode-hook 'cider-mode)
(add-hook 'clojure-mode-hook 'cider-turn-on-eldoc-mode)
(add-hook 'cider-repl-mode-hook 'subword-mode)
(setq cider-annotate-completion-candidates t
cider-prompt-for-symbol nil)))
;; clojure refactor library
;; https://github.com/clojure-emacs/clj-refactor.el
(use-package clj-refactor
:ensure t
:config (progn (setq cljr-suppress-middleware-warnings t)
(add-hook 'clojure-mode-hook (lambda ()
(clj-refactor-mode 1)
(cljr-add-keybindings-with-prefix "C-c C-m")))))
there is also some code to add to ~/.lein/profiles.clj:
{:user {:plugins [[cider/cider-nrepl "0.10.0-SNAPSHOT"]
[refactor-nrepl "1.1.0"]]
:dependencies [[acyclic/squiggly-clojure "0.1.3-SNAPSHOT"]]}}
(require 'package) (add-to-list 'package-archives '("melpa-stable" . "http://melpa-stable.milkbox.net/packages/") t). and under(defvar my-packagesalsoclojure-modewhich i think brings per default indentation? but its still everything unindented if i am working on a .clj file, so i should set the indentation manually with tab. - user4813927To make tab complete, without losing the ability to manually indent, you can add this to your config: (global-set-key (kbd "TAB") #'company-indent-or-complete-common). So i added this line to my init.el, but there is still no indentation. - user4813927