spacemacs

Spacemacs docs: http://develop.spacemacs.org/doc/DOCUMENTATION.html http://develop.spacemacs.org/layers/+lang/clojure/README.html https://practicalli.github.io/spacemacs/
jumar 2020-06-15T06:28:19.438Z

You can just SPC b m

Yehonathan Sharvit 2020-06-15T07:02:22.439100Z

Currently, in order to eval an expression in my Cider REPL buffer I have to be in insert mode. Is there a way to eval an expression in normal mode?

jumar 2020-06-15T07:27:17.439300Z

It works for me just fine. How do you eval expressions?

Yehonathan Sharvit 2020-06-15T07:30:15.439500Z

I have to go into insert mode and press Ctrl-Enter

Yehonathan Sharvit 2020-06-15T07:30:39.439700Z

when I am in normal mode, pressing Ctrl-Enter has no effect

Yehonathan Sharvit 2020-06-15T07:31:22.439900Z

In insert mode, Enter works also

jumar 2020-06-15T07:32:17.440100Z

Ah, I thought you're talking about clojure buffer. How about just calling cider-eval-last-sexp? And what's your use case for evaling expression in normal mode in the REPL buffer?

jumar 2020-06-15T07:32:37.440300Z

(Basically anything that works in the standard buffer should work in the repl buffer too)

Yehonathan Sharvit 2020-06-15T07:33:01.440500Z

When I press arrow key up I am able to traverse the history of commands evaled in the REPL

Yehonathan Sharvit 2020-06-15T07:33:08.440700Z

I am in normal mode

Yehonathan Sharvit 2020-06-15T07:33:51.440900Z

cider-eval-last-sexp works in the REPL buffer but it is a bit weird as it doesn’t create a new line in the REPL

Yehonathan Sharvit 2020-06-15T07:34:49.441100Z

What I could do is use arrow key up in insert mode (with Ctrl-UP )

Yehonathan Sharvit 2020-06-15T07:35:42.441300Z

But quite often I need to go to the buffer REPL for a brief moment, re-execute the previous expression and move back to the previous REPL

Yehonathan Sharvit 2020-06-15T07:36:03.441500Z

For instance, I run (reset) from component

jumar 2020-06-15T09:58:03.441700Z

If you really care about getting the same thing as if pressing Enter manually you could also use cider-send-last-sexp-to-repl (`, s e` ) - but it's a bit weird in the REPL itself since it duplicates the expression. the ,e w might be interesting too

flefik 2020-06-15T11:54:59.441900Z

issn’t it , e f?

jumar 2020-06-15T13:11:44.442100Z

By , e w I meant cider-eval-last-sexp-and-replace

practicalli-john 2020-06-15T13:45:58.442400Z

@viebel RET in the REPL buffer using Evil normal state should evaluate the current expression. If you have to change to insert mode then perhaps something is incorrect with your setup. C-k and C-j in the REPL buffer in Evil insert state will scroll through REPL buffer history. These keys are very common for scrolling through lists in Spacemacs (e.g. helm lists) Is there something stopping you from just evaluating the code in the source code buffers? I find the REPL buffer experience quite limited, especially as it requires switching namespaces or require namespace or provide fully qualified names.

2020-06-15T13:52:50.444200Z

I take it its possible to set functionality on a per projectile basis? things like:

(setq clojure-indent-style 'align-arguments)
(setq clojure-indent-style 'always-indent)
i'll follow up in this thread when i figure out how.

practicalli-john 2020-06-15T14:23:07.444400Z

I assume this would be done in a .dir-locals.el file if its on per projectile basis

practicalli-john 2020-06-15T14:25:05.444600Z

Not dissimilar to this I guess https://practicalli.github.io/spacemacs/clojure-projects/monorepo-nested-projects.html

practicalli-john 2020-06-15T14:26:27.444800Z

or defining default aliases to include for deps.end projects as in this article https://practicalli.github.io/blog/posts/cider-jack-in-to-clojure-cli-projects-from-spacemacs/

Yehonathan Sharvit 2020-06-15T16:07:43.445200Z

@jr0cket usually I eval expressions from source code buffers. But from time to time, I need to eval expressions form the REPL buffer

Yehonathan Sharvit 2020-06-15T16:09:00.445400Z

@jr0cket any idea why RET doesn’t work? I just noticed that \ RET works.

Yehonathan Sharvit 2020-06-15T16:11:45.445600Z

RET is bound to evil-ret

practicalli-john 2020-06-15T16:37:01.446200Z

Are you on an older version of CIDER or Spacemacs? I am using CIDER 0.25.0 (Bergamo) and updated Spacemacs and packages a few days ago.

practicalli-john 2020-06-15T16:38:27.446400Z

Otherwise maybe there is something in your dotspacemacs/user-config in .spacemacs that configures CIDER to behave differently. I believe you can configure multi-line support, but I think that only affects what RET does in Evil insert (so you can have mutiple lines).

practicalli-john 2020-06-15T16:40:36.446600Z

I am assuming you are just jumping to the REPL to run the (reset) function, you can set up CIDER to drive components when refreshing the repl, so everything would be done in an existing keybinding. If that makes sense, I'll try dig out the code...

Yehonathan Sharvit 2020-06-15T16:42:02.446800Z

I am very eager to learn how to let CIDER drive components when it’s required…

practicalli-john 2020-06-15T16:43:22.447Z

This is what I've learnt so far, its not extensively tested, but should get you close https://practicalli.github.io/spacemacs/clojure-repl/component-lifecycle.html Let me know if the .dir-locals.el setup works for you and if you have better examples of using component to share 🙂