Show results of evaluating Clojure code in the same format they would be written
in the source code. This is especially useful for results that are
collections and nested collections.
Pretty print results as a comment.
Clojure (CIDER) is missing the incredibly useful function that jumps to the end
of the line and evaluates the last s-expression.
This function is in Emacs Lisp major mode under `SPC m e $` and `SPC m e l`
The function `spacemacs/cider-eval-sexp-end-of-line` is a copy of
`lisp-state-eval-end-of-line` with the last line replaced to call the equivalent
cider function, `cider-eval-last-sexp`.
The same keybindings are added to the Clojure layer as used for elisp.
The keybindings follow the Spacemacs convention for evaluation, as defined in
https://github.com/syl20bnr/spacemacs/blob/master/doc/CONVENTIONS.org#evaluationResolves#4124
Added keybindings for the Sesman REPL session management commands to the Clojure
layer, following the Spacemacs keybinding conventions.
https://docs.cider.mx/cider/0.23/usage/managing_connections.html
Sesman has been a part of CIDER for many versions now and provides session
management for nREPL connections (in fact any connections).
Sesman keybinds are placed in the `SPC m c` menu, providing a cleaner separation
between sending code to the repl and session management.
See issue #12593 and PR #13140 which covers the background for the design of
these additional keybindings.
Formatting the region and defun keybinds have been added, along with formatting
for edn files. Moved to `=` menu to match Spacemacs convention.
Evaluation up to point keybinding has also been added.
Documentation in the README has been updated to complete the description of the
existing Clojure layer, as well as including details specific to the new
keybindings.
Add Spacemacs keybindings to the Clojure layer for all the sesman functions.
Sesman has been a part of CIDER for many versions now and provides session
management for nREPL connections (in fact any connections).
Several keybindings relating to the use of a specific repl been migrated the
`e` evaluation menu and `es` sent-to-repl-buffer sub-menu, providing a cleaner
separation between repl connection and session management and interacting with a
specific repl.
Updated layer documentation and keybindings in README.org file.
Added changes to CHANGELOG.develop
Resolves#12593
The variable clojure-enable-linters can now be set to a list of linters:
'(clj-kondo joker)
or
'(joker squiggly)
or any other combination of the available linters.
In which case, all linters in the list will be active if they are
available to be. In that flycheck is configured so that each linter
in the list has as next-checker the next linter in the list.
The variable can also now be set to:
'joker
If only the newly added joker linter should be used.
This will pull down flycheck-joker and add Joker as a checker for
Clojure modes.
--
Implementation Details
The way it works is that for each Clojure linting mode, clj, cljc,
cljs and edn, a primary linter is chosen based on the order the
user specifies in clojure-enable-linters which support that mode.
It is made the primary linter for flycheck to use by being promoted
to the front of the flycheck-checkers list. All other linters specified
by the user which the mode also supports get added to it as a
next-checker.
Tested with clj-kondo, joker and squiggly. The only issue I saw was that
the way flycheck-clojure works, and the way I currently have setup the
logic for multiple checkers mean that we can't add to a mode multiple
checkers for the same linter. flycheck-clojure has eastwood, kibit and
core.typed. If you have it configured to use eastwood linter, then it
will all work, as eastwood gets added as the next-checker. But if you
have it disabled in flycheck-clojure, there won't be any
flycheck-clojure linters to activate. I'm not sure as of now how to best
support that. Ideally, we would not clubber linters into a single packge
like that, and so the layer would have instead of squiggly: eastwood,
kibit, core.typed. But that's not how flycheck-clojure works. Future
commit might be able to do something smarter about this.
When send form/region/buffer to repl without focus - repl buffer is
not scrolling and result not visible.
Added scrolling to the end of the repl-buffer after eval.
Enhancement to Clojure layer documentation for the clj-kondo linter added via
pul request #12611
Moved instructions to install section as clj-kondo and squiqgly can be added as
Clojure layer variables, just like clj-refactor and sayid.
Changed the install instructions to make them specific and to use clojure layer
variables, which is consistent with other Clojure layer options.
Elaborated on the install instructions to clarify requirements, constraints and
recommended linting tool.
Added credits to the changelog.
Update the existing `SPC m g g` keybinding to use the command
`spacemacs/clj-find-var`. This makes finding a function definition a much
better experience as you dont have to have the REPL running to find a
definition, but when it is you can use a CIDER specific function.
`spacemacs/clj-find-var` is a wrapper that calls `cider-find-var` if the REPL is
running, otherwise it uses `dump-jump-go`.
Wrapper added in #9792
Latest CIDER release uses the following commands for starting the REPL from
within Emacs
`cider-jack-in-clj` to start a Clojure REPL
`cider-jack-in-clj&cljs` to start a Clojure and ClojureScript REPL
`cider-jack-in-cljs` to start a ClojureScript repl
The older aliases are deprecated and are being removed in the latest beta
release of CIDER
`cider-jack-in`
`cider-jack-in-clojurescript`
Keybindings for these jack-in commands have been updated and as there are three
options they have been moved under the repl > jack-in
The top level of the Clojure mode menu has the existing keybindings updated to
use the new commands. A third top-level keybinding `&` has been added for
`cider-jack-in-clj&cljs`
Although the Clojure repl utils (clojure.repl) are including in the user
namespace in Clojure projects, they are not available in your application
namespace.
The existing CIDER function cider-repl-require-repl-utils adds the Clojure
repl utils into the current namespace, so you can use functions such as doc
and source.
This is often a source of confusion for those new to Clojure / CIDER.
Although the Clojure repl utils (clojure.repl) are including in the user
namespace in Clojure projects, they are not available in your application
namespace.
The existing CIDER function cider-repl-require-repl-utils adds the Clojure
repl utils into the current namespace, so you can use functions such as doc
and source.
This is often a source of confusion for those new to Clojure / CIDER.
Interrupt longer running evaluations without having to kill or reset the REPL
connection.
Placed in the evaluate section, as it is specific to the currently running
evaluation.
Adds `SPC m e u` to the Clojure layer to call `cider-undef`, removing an
existing definition from the current namespace.
This provides a Spacemacs style keybinding for the existing Emacs style
keybinding `C-c C-u`
Reverted clojure/post-init-parinfer back to a state before the refactor, which
introduced spacemacs|forall-clojure-modes. That macro deals with modes, not
hooks, therefore we can't use it for add-hook.
Updated documentation for Clojure layer to currently recommended versions of
build tools and `cider-nrepl`, ensuring that connecting to a manually run
Clojure REPL works correctly with the current version of CIDER.
Leiningen version 2.9.0
Boot version 2.8.2
`cider-nrepl` 0.21.1
problem:
some layer packages lists have the open and closing parentheses on the same line
as the first and last listed package, but most seem to have them on a separate
lines.
solution:
put the open and close parentheses on separate lines, except for lists with only
a single package, they are written on the same line as the variable name and
parentheses.
fix the lists indentation
- Add clojure-mode refactorings and which-key prefixes in default layer
configuration.
- Improve discoverability of the refactoring features which are not enabled
by default. When clj-refactor is installed, "SPC mr?" runs
cljr-describe-refactoring
- Refactor out repeated dolist clauses into `forall-clojure-modes` macro
which executes body forms for all clojure derived modes, and adds missing
functionality of parinfer, fancify-symbols and evil-cleverparens to
cider-repl-mode and cider-clojure-interaction-mode.