This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-09-17
Channels
- # announcements (6)
- # beginners (117)
- # calva (22)
- # cider (7)
- # clara (56)
- # clj-kondo (8)
- # cljdoc (3)
- # cljfx (26)
- # clojure (58)
- # clojure-czech (2)
- # clojure-europe (20)
- # clojure-greece (1)
- # clojure-india (7)
- # clojure-nl (11)
- # clojure-uk (100)
- # clojurescript (48)
- # conjure (24)
- # cursive (117)
- # data-science (3)
- # datascript (5)
- # datomic (33)
- # emacs (29)
- # figwheel-main (3)
- # fulcro (12)
- # jobs (1)
- # malli (40)
- # parinfer (4)
- # pathom (1)
- # quil (2)
- # re-frame (17)
- # reagent (20)
- # reitit (1)
- # reveal (97)
- # ring (5)
- # shadow-cljs (11)
- # spacemacs (12)
- # sql (4)
- # tools-deps (18)
- # xtdb (25)
How do I customize my init.el so that it auto-indents the whole file only for clojure/clojurescript files? I tried:
(defun my--clojure-mode-hook ()
(make-local-variable 'before-save-hook)
(add-hook 'before-save-hook
'(lambda ()
(clojure-indent-region (point-min) (point-max)))))
(add-hook 'clojure-mode-hook 'my--clojure-mode-hook)
But it seems to indent files of all typesInstead of trying to make before-save-hook
local you could have your hook always run, but only indent if the current major mode is one of the Clojure major mode (`.clj`, .cljs
, or .cljc
).
So, perhaps something like this:
(add-hook 'before-save-hook
'(lambda ()
(when (derived-mode-p 'clojure-mode)
(clojure-indent-region (point-min) (point-max)))
Hey all, I used to have this great re-mapping for slurp and barf that an old co-worker gave me but I can't for the life of me figure out how to get it back. I could do "slurp forwards" (`sp-forward-slurp-sexp` ) with shift + >
and and "slurp backwards" with shift + <
@njustice I assume you don't want to use the built-in key bindings, SPC k s
and SPC k S
for those slurp commands. I prefer these over the more awkward custom key bindings I used to use.
Edit the .spacemacs file and add one of the following to the dotspaceamcs/user-config
section
The global approach would be
(define-key global-map (kbd "S->") 'sp-forward-slurp-sexp)
For just Clojure mode, then
(define-key clojure-mode-map (kbd "S->") 'sp-forward-slurp-sexp)
These will over-ride any existing key bindings