Fork me on GitHub
#emacs
<
2017-02-19
>
jmp00:02:57

Hello Emacs Clojurians! I am quite new to programming, Clojure, and Emacs. So I have some embarrassing questions and problems. So here goes my first issue: When I execute cider on emacs it starts a REPL, but it doesn't generate a buffer for me to access the REPL, anyone has experienced this problem and maybe knows how to solve it? Feel free to suggest the simplest answers since, as I mentioned before, I'm incredibly new to this. Thank you all in advance!

dpsutton00:02:12

can you tell me what steps you take when you: > execute cider

dpsutton00:02:28

and what does it mean when it "starts a REPL but it doesn't generate a buffer"

dpsutton01:02:16

@juanmp can you clarify those things for me

jmp01:02:15

For sure! thank you for taking the time. Maybe I'm doing a step wrong but it used to work for me.. So the steps I'm taking are:

jmp01:02:37

do M-x cider-jack-in

dpsutton01:02:54

ok, that sounds right

jmp01:02:54

then it says its starting it. And once it's done there is no buffer to access it

dpsutton01:02:10

can you visit your *Messages* buffer?

dpsutton01:02:02

maybe there's some info in there

dpsutton01:02:23

and you waited the 20 or so seconds that it can take to startup?

jmp01:02:13

'ad-handle-definition: ‘ido-completing-read’ got redefined For information about GNU Emacs and the GNU system, type C-h C-a. Are you sure you want to run `cider-jack-in' without a Clojure project? (y or n) y Starting nREPL server via /usr/local/bin/lein update-in :dependencies conj \[org.clojure/tools.nrepl\ \"0.2.12\"\ \:exclusions\ \[org.clojure/clojure\]\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.14.0\"\] -- repl :headless... nREPL server started on 51408 [nREPL] Establishing direct connection to localhost:51408 ... [nREPL] Direct connection established Connected. One chord is fine. Two chords is pushing it. Three chords and you’re into jazz. -Lou Reed Quit Loading /Users/juan/.emacs.d/recentf...done Cleaning up the recentf list...done (0 removed)'

jmp01:02:35

I cleaned opened emacs and this is what I got when trying to run it

dpsutton01:02:55

do you know how to list your buffers?

jmp01:02:27

i isually use C x C b to see my buffers

dpsutton01:02:41

it should say the type of buffer

dpsutton01:02:50

in the 4th column

dpsutton01:02:06

if you open that up, you can search for repl

dpsutton01:02:12

and perhaps its just not showing you the repl

dpsutton01:02:16

but it may be creating it

jmp01:02:38

hhmm I'm trying to follow this, hold on

jmp01:02:40

Sorry for being so slow. I can't find a way to do your suggestion

jmp01:02:55

This is what I get when doing C x C b usually

dpsutton01:02:03

ok its for sure not creating the repl buffer then

dpsutton01:02:24

i was asking for you to search the mode column for one with "repl"

dpsutton01:02:37

but since there's only 3 its not necessary

jmp01:02:48

Oh I see

dpsutton01:02:49

and you've run cider-jack-in already

jmp01:02:15

When I try to close emacs even it tells me that is running

dpsutton01:02:17

do you have a clojure project?

dpsutton01:02:32

ah, so the process is started

jmp01:02:45

Yeah I do

dpsutton01:02:51

can you try to jack into a clojure project?

jmp01:02:58

Sure thing

qqq01:02:20

1) Are you using boot or leingein? 2) Can you (1) run the repl outside of emacs, and run "M-x cider connect"? <-- this is to binary search "can the repl start" from "can cider connect"

dpsutton01:02:29

im not familiar with jacking in without a project

jmp01:02:43

I'm using leiningen

jmp01:02:55

I've never tried M x cider-connect

qqq01:02:03

okay, if you open a shell and you type in "lein repl"

qqq01:02:07

do you get a repl, or does it fail>

qqq01:02:20

also, as @dpsutton said: you should ahve a project, so create a basic project.clj

jmp01:02:34

lein repl works just fine as I can see

jmp01:02:40

Alright, I'll try that

qqq01:02:25

1) type in "lein new foobar" // reates new project, should give you project.clj 2) in foobar/ , type in "lein repl" 3) open up foobar/project.clj in emacs, type in M-x cider connect 4) see if cider connects this way

jmp01:02:20

Still the same issue

jmp01:02:55

I have the clj project open, run the cider jack in after having run the lein repl in foobar and all

dpsutton01:02:59

can you kill your emacs, open it up again fresh, and do the jack in from the project, and show us the messages buffer output?

jmp01:02:15

for sure, a sec

dpsutton01:02:24

also, what version of emacs are you using

qqq01:02:29

this is way overkill; but do you know how to use https://www.liveedu.tv/ ? if you could live stream, we could probably debug this in like 5 mins

dpsutton01:02:04

and are you using the template for emacs from brave clojure?

jmp01:02:11

I reinstalled with brew today so it should be the latest

jmp01:02:45

I did initially, then I realised it was all screwed up so I installed the latest through brew, and it was working fine for a while

dpsutton01:02:37

did you recently try to upgrade your CIDER by any chance?

dpsutton01:02:49

and are you saying that you are following the brave clojure emacs setup?

jmp01:02:38

no no, I did initially, and then a friend who is a clojure developer helped me set it up properly, but i must have screwed it up at some point

dpsutton01:02:13

i've seen people run into issues with that brave clojure setup

dpsutton01:02:19

i'm glad someone helped you get it up and running

dpsutton01:02:35

it's pegged to CIDER version 0.8 and includes the compiled bytecode as well as the el files

dpsutton01:02:40

it's really not a good setup

jmp01:02:46

And I'm trying to get this live edu thing running btw @qqq haha

jmp01:02:58

Yeah exactly, I had issues with the brave clj setup

qqq01:02:42

I'm in a helpful mood -- a number of people spent who knows how much time helpine mget dirac setup; if you can manage to stream your setup, we can probably help you fix it

jmp01:02:39

Almost there with the install! 🙂

jmp01:02:09

Let see if my current connection can handle it

jmp01:02:41

is it working?

dpsutton01:02:52

i can see it

dpsutton01:02:16

ok, can you navigate to the project file that you made?

dpsutton01:02:45

ok, and now m-x cider jack in

qqq01:02:17

project.clj looks good, yeah, as @dpsutton said, try M-x cider-jack-in

dpsutton01:02:27

now can you go to th emessages buffer?

dpsutton01:02:46

super strange

qqq01:02:51

this is weird, it says "connected, Happy ahcking" at the bottom, but no buffer for cider?

dpsutton01:02:17

can you run M-x cider-version

jmp01:02:41

0.14.0 (Berlin)

qqq01:02:48

this is absolutely insane, butwould you mind 1) moving /.emacs.d to /old-emacs 2) running a new emacs, and typing in M-x package-install <RET> cider 3) and trying this in the new emacs? I'm suspecting there's something wrong with the cider install.

dpsutton01:02:01

i would just delete the cider installation

dpsutton01:02:05

do you know how to do that?

jmp01:02:11

go to the package list?

dpsutton01:02:21

we'll need to delete the folder

dpsutton01:02:33

navigate to your .emacs.d/ directory

dpsutton01:02:13

which be default should be ~/.emacs.d/

dpsutton01:02:34

ok and we want to delete the folder under elpa that holds cider

dpsutton01:02:45

hey want to learn something?

jmp01:02:57

sure thing!

dpsutton01:02:05

we're gonna do this in emacs

dpsutton01:02:14

to open up dired, we hit C-x d

dpsutton01:02:54

and let's go to .emacs.d

dpsutton01:02:09

enter again

dpsutton01:02:28

you're using the directory mode of emacs

dpsutton01:02:30

super useful

dpsutton01:02:38

and you can use all the standard emacs shortcuts

dpsutton01:02:42

and searches and everything

jmp01:02:46

oh wow, i didnt know this existed even

dpsutton01:02:53

yeah its awesoem

dpsutton01:02:59

now move down to elpa and press enter

dpsutton01:02:20

ok, i still see the cider readme in there which comes from brave clojure

dpsutton01:02:24

so we want to delete two things

dpsutton01:02:29

the cider directory and that readme

jmp01:02:36

oh really? I even reinstalled emacs today, strange

dpsutton01:02:51

navigate down to both of them and press the d key

jmp01:02:15

recursively?

dpsutton01:02:30

same for that text file about cider

dpsutton01:02:38

looking good

jmp01:02:45

this is fantastic, I never have to leave emacs again 🙂

dpsutton01:02:49

to go to the parent folder, hit ^

dpsutton01:02:04

so enter on something to "go" to it, and ^ to go up a level

dpsutton01:02:07

g refreshes

dpsutton01:02:32

ok, let's kill emacs and restart it

dpsutton01:02:40

to make sure there's no trace of old CIDER code laying around

dpsutton01:02:10

yeah kill emacs and it'll kill those child processes

jmp01:02:30

getting some warnings

dpsutton01:02:32

you killed and reopened emacs?

dpsutton01:02:44

that's probably fine

dpsutton01:02:50

it saw some fresh .el files and compiled them

dpsutton01:02:55

and unused vars cause warnings

dpsutton01:02:02

you have to prepend them with an underscore

dpsutton01:02:08

ok, let's install CIDER again

dpsutton01:02:16

M-x list-packages

dpsutton01:02:42

do you know how to search?

dpsutton01:02:02

and then keep hitting C-s until we are on the one we want to isntall

dpsutton01:02:45

i think i see what's going on

jmp01:02:49

this one? says installed

dpsutton01:02:49

you'll see it at the very end

dpsutton01:02:01

because we should have uninstalled it

dpsutton01:02:11

press enter

dpsutton01:02:50

hit that delete button

dpsutton01:02:13

let's kill emacs and open it up once again

dpsutton01:02:20

and we should see a state that thinks CIDER isn't installed

dpsutton01:02:28

cause that was kinda weird

dpsutton01:02:32

let's try to get to a known good state

jmp01:02:13

haha yeah

dpsutton01:02:15

what the heck

dpsutton01:02:19

why is it compiling cider again

qqq01:02:31

I still think we should consider moving /.emacs.d to /old-emacs, staritng from scratch, and just doing M-x package-install <RET> cider 🙂

dpsutton01:02:40

i think qqq may be right

dpsutton01:02:44

something is pretty funky

jmp01:02:49

yeah, it seems so

dpsutton01:02:55

it should definitely not think there's a CIDER installed

jmp01:02:13

So how do we do that? is it just a name change?

dpsutton01:02:47

probably easiest from the cmd line

dpsutton01:02:19

mv .emacs.d old-emacs

jmp01:02:50

alright, done 😄

qqq01:02:02

killall existing emacs

qqq01:02:10

open up emacs from scratch type in M-x package-install <RET> cider

jmp01:02:35

Do I have to do a new install of emacs or just opening my install is fine?

dpsutton01:02:54

nah just reopen emacs

dpsutton01:02:01

you shouldn't ever really need to resinstall emacs

dpsutton01:02:13

its just the ~/.emacs.d tells emacs what to look like

dpsutton01:02:15

and which packages, etc

qqq01:02:42

"by kill existing emacs" I mean "kill -9 any running emacs process which might e using old ~/.emacs.d"

jmp01:02:59

alright, fresh stuff

qqq01:02:00

though I could see how it was interpreted as "uninstall/reinstall emacs"

dpsutton01:02:21

sweet clean slate

jmp01:02:29

no match for cider?

dpsutton02:02:26

(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))

qqq02:02:33

(require 'package)
(add-to-list 'package-archives '("melpa" . "") t)
(package-initialize)

dpsutton02:02:33

eval that code in your scratch buffer

jmp02:02:42

do i just paste it or?

dpsutton02:02:58

M-x eval-buffer

qqq02:02:02

probaly put it in ~/.emacs.d/init.el

dpsutton02:02:05

we need to eval that code

qqq02:02:19

1) put the above in ~/.emacs.d/init.el 2) run M-x eval-buffer 3) run M-x package-install <RET> cider

jmp02:02:19

haha, im useless, what am I doing wrong?

dpsutton02:02:09

you're doing fine

dpsutton02:02:50

try M-x list-packages

dpsutton02:02:55

that'll make sure the list is refreshed

jmp02:02:27

oh that did it 😄

dpsutton02:02:28

now just search for cider again

qqq02:02:42

woot, is cider installed?

dpsutton02:02:45

and try jacking in again from the project file

qqq02:02:06

1) open up that project.clj file (this sets the directory to the correct place) 2) type in M-x cider-jack-in

qqq02:02:42

if the above fails, reformat the OS and do a clean install form a iso blesed with holy water

qqq02:02:56

okay hang on, we need to setup lein

qqq02:02:10

can you open up a terminal and type in "which lein" ? (emacs can't find lein)

jmp02:02:31

just on root?

jmp02:02:45

returns: /usr/local/bin/lein

qqq02:02:52

okay 1 sec

qqq02:02:33

(setenv "PATH" (concat "/usr/local/bin/:" (getenv "PATH"))
(setq exec-path (cons "/usr/local/bin/" exec-path))
^^ add those two lines do you ~/.emacs.d/init.el, and then do "M-x eval-buffer" again

jmp02:02:38

is there any quick way to access the init file?

qqq02:02:56

given the barebones emacs.d/init.el we ahve at the moment, no

qqq02:02:14

C-x C-f ~/.emacs.d/init.el

jmp02:02:44

oh, it's empty

qqq02:02:55

ehh, tha's weird, why is it empty

jmp02:02:06

i don't think there is an init file

jmp02:02:14

it said new file when i tried to access it

jmp02:02:18

or something of the sort

jmp02:02:07

There was no init.el on my .emacs.d folder

dpsutton02:02:20

that's no big deal

dpsutton02:02:26

that's why we moved the old stuff

dpsutton02:02:29

so there wouldn't be one

dpsutton02:02:46

but once you get lein visible to emacs it should work

jmp02:02:57

so just saving this as the init should be fine?

dpsutton02:02:59

we're just making sure there's nothing wrong with a good working example

dpsutton02:02:05

yeah that'll be fine

qqq02:02:08

you need to run M-x eval-buffer

qqq02:02:20

this runs the (setq exec-path .... ) line, which adds the lein path

jmp02:02:35

oh alright, yeah that makes sense now

qqq02:02:54

err wait

qqq02:02:56

M=x eval buffer failed

qqq02:02:59

we're missing a ")" on the first line

qqq02:02:05

my bad, it should end with 3 )'s, not 2 )'s

qqq02:02:31

good, run M-x eval buffer again

qqq02:02:51

now switch back to project.clj

qqq02:02:07

1) M-x eval buffer seems to ahve succeeded 2) siwtch back to project.clj 3) run M-x cider-jack-in

qqq02:02:38

appears it found lein, now let's just wait

jmp02:02:47

success!

jmp02:02:03

Damn guys, that was awesome!

dpsutton02:02:07

we're not done yet

qqq02:02:10

okay, so there's cider middleware problems

dpsutton02:02:15

i think you're still poisoned with brave clojure

jmp02:02:23

oh really?

dpsutton02:02:23

can you open up a dired directory to ~

dpsutton02:02:34

no big deal

qqq02:02:37

see the big red "WARNING ... ." -- so we are connected ot the lein repl, but cider isn't properly loaded yet

dpsutton02:02:47

i'm guessing we have that lein profiles junk laying around

qqq02:02:12

@dpsutton: actually, I think the issue is just we don't ahve cider middleware -- it says: we need 0.15.0 -- we have (nil)

dpsutton02:02:26

and it gets that by asking the backend

qqq02:02:35

unfortunately, I use boot, so my usefulness may be ending

dpsutton02:02:41

but when you load 0.15 like we did, it specifies th ecorrect middleware

dpsutton02:02:49

unless you manually specify a different version

dpsutton02:02:54

like 0.8 in a lein profiles file

qqq02:02:58

@juanmp: what precisely are you trying to do? perhaps we can point you at the right template on github you can clone

dpsutton02:02:07

let's finish this out

dpsutton02:02:16

can you open that dired buffer to your home directory?

qqq02:02:26

@dpsutton: you're saying that emacs/cider has the ability to tell lein to install the correct version of cider-middleware?

dpsutton02:02:28

C-c d [enter] ~

dpsutton02:02:33

it does every time

dpsutton02:02:47

cider tells clojure what deps it needs

qqq02:02:58

interesting; time for me to watch + learn

jmp02:02:09

oh. so what's the next step then?

dpsutton02:02:30

open up a dired buffer to your home directory

dpsutton02:02:38

C-c d [enter] ~

jmp02:02:17

C-c d is undefined?

dpsutton02:02:27

we want a dired buffer

dpsutton02:02:34

and just your home directory

dpsutton02:02:43

we're looking for ~/.lein

dpsutton02:02:51

search for lein

dpsutton02:02:12

hit enter on profiles

qqq02:02:03

@dpsutton: unless juanmp has lein configs we want to save; could we just do "rm -rf ~/.lein" and rerun everthing? this should remove all the "old config" ?

dpsutton02:02:25

just delete that lein directory

dpsutton02:02:30

i hate the brave clojure setup so much

dpsutton02:02:39

so cider says load this stuff

dpsutton02:02:48

and lein profiles says hey this is ultimately what you want

jmp02:02:54

so just delete the lein directory?

dpsutton02:02:56

so we end up with cider middleware from two years ago

dpsutton02:02:02

yeah delete the ~/.lein directory

dpsutton02:02:11

and so cider says, hey backend, i'm 0.15, who are you

dpsutton02:02:20

and that backend is so old it doesn't respond to that command

dpsutton02:02:35

so that's why the frontend says, "I'm 15 and i don't recognize who's on teh back end. things will probably break"

qqq02:02:51

this conversation is 1% progress and 99% "how to remove brave clojure setup"

jmp02:02:18

hahaha yeah

jmp02:02:35

should i just delete it?

dpsutton02:02:46

delete wht?

jmp02:02:52

the .lein folder?

dpsutton02:02:54

the ~.lein directory

dpsutton02:02:07

then let's kill that cider connection and try one more time

dpsutton02:02:26

i belive that jacking in will work this time

dpsutton02:02:22

that's a dired buffer!

dpsutton02:02:25

welcome to the emacs way!

dpsutton02:02:49

do you remember what we pasted into the scratch buffer earlier?

dpsutton02:02:14

and you can see the error message its saying and we know how to fix that

dpsutton02:02:29

"i don't know what lein is" "well, my good OS, it's located right here"

qqq02:02:23

top line missing a )

qqq02:02:30

we need 3 )'s not 2)'s on top line

jmp02:02:35

right haha

dpsutton02:02:00

and after we show that CIDER works and you had a faulty init previously, I want to recommend a good init for ya

jmp02:02:39

so now i eval this buffer

jmp02:02:44

should i try now?

dpsutton02:02:46

and then jack in

jmp02:02:35

no horrible message of death!

jmp02:02:46

you guys are wizards

qqq02:02:56

@dpsutton: this is amazing, how did you infer that ~/.lein was the problem? I would have never guessed that

dpsutton02:02:58

nah, we've just seen a few errors

jmp02:02:00

very patient wizards i'll add

dpsutton02:02:18

this is the second person i've dealt with with brave clojure problems

jmp02:02:25

haha oh god

dpsutton02:02:26

that lein profiles middleware is seriously out of date

qqq02:02:27

i.e. how do you go from "want 0.15.0, saw (nil)" to "brave clojure fucked up ~/.lein"

dpsutton02:02:38

because he mentioned brave earlier

dpsutton02:02:08

but yeah, when i see a middleware mismatch and i've heard brave i have a good idea of where the problem is

jmp02:02:22

I have to message the brave clojure guy about this

dpsutton02:02:30

got a recommendation for you for a smooth solid and professional emacs setup

dpsutton02:02:43

bbatsov is an awesome dude and also just happens to be the maintainer of CIDER

jmp02:02:24

oh nice!

jmp02:02:49

You guys are awesome. If you ever come to Stockholm hit me up, I owe you both a beer!

dpsutton02:02:01

happy coding

dpsutton02:02:13

there's a #cider channel here as well if you ever have specific cider questions

jmp02:02:29

Awesome, I'll join right away! 😄

jmp02:02:53

I think it's bedtime for me, 3:35 am trying to fix emacs haha

dpsutton02:02:00

that's rough

jmp02:02:10

haha anything for a good time clojuring tomorrow tho 🙂

dpsutton02:02:11

emacs is amazing because its a lisp interpreter/editor from the 70s

dpsutton02:02:24

emacs is terrible because its a lisp interpreter/editor from the 70s

jmp02:02:02

fair enough

jmp02:02:33

but @qqq and @dpsutton you both rule, thank you so much for your time and patience. And now you know you have free beers in Stockholm!

dpsutton02:02:41

appreciated

qqq02:02:46

have fun 🙂

dpsutton02:02:47

this community is awesome

jmp02:02:00

Thanks guys! have a great evening

qqq03:02:50

I'm using lispy, evil, and evil-lispy. Anyone have good recommendations for: (1) "rainbow () [] {}'s" and (2) not sure what this is called -- but when I move the cursor over a )]}, I want it to show me the corresponding {[(

dpsutton03:02:13

for 2, it's built in: (show-paren-mode 1)

jmp03:02:34

oh btw, any auto complete package for the mini buffer?

qqq03:02:48

@dpsutton : rainbow-delimiters is beautiful

qqq03:02:22

show-paren-mode is not what I had in mind but definitely answers my question

qqq03:02:33

(i.e. what I used to use in paredit seemed a bit more "subtle" compared to show-paren-mode, which seems very glaring)

dpsutton03:02:19

i use it quite a bit in making sure i'm in the right form

dpsutton03:02:24

not sure what lispy does

qqq03:02:58

(setq show-paren-delay 0.0) ;; default of 0.125 is infuriating

qqq03:02:01

feels laggy

qqq07:02:03

Short Question: How do I do "find and insert sexp?" Longer Question: I have a number of *.cljs files. In some of these files, I have lines that look like:

(def-foo :student
  [:age :gender :name])
(def-foo :dog: 
  [:favorite-toy :age :gender])
now, if I just wanted to jump to the definition of (def-foo :student ... or (def-foo :dog, I could do this via etags however, that's not what I wnat what I want is: (1) find me the def and (2) grab+insert the entire sexp of the def what is the ideal way to achieve this ?

qqq07:02:13

s/ideal/simplest

dpsutton07:02:10

there's a cider eval last and replace

qqq07:02:35

there's a search component involved

dpsutton07:02:36

so if you were in code writing (foo :dog), you could eval and replace and it would replace that sexp with its value

qqq07:02:03

so my cursor is over 🐶 and at this point, I want to insert the entire sexp (def-foo :dog [....]) inplace

dpsutton07:02:25

that seems very specific to what you're doing

qqq07:02:39

yeah, I'm tryint fo gireu out pieces to patch it together

dpsutton07:02:44

i'm not sure how any generic package could know that :dog in your case referred to the code

qqq07:02:06

right right, I expect this to be an elisp solution, not an cider solution

qqq07:02:29

so for example, one can imagine that I have a helm-projectile setup, which has all of def-foo indezed

qqq07:02:50

so when my cursor is over

:dog 
, I hit some key combo, and this helm thingy pops up, with only (def-foo from my current project

qqq07:02:00

then I type in

:dog 
... and ti narrows to one choice

qqq07:02:11

then, I bind the action to "grab entire sexp and insert it here" instead of "jump to definition"

dpsutton07:02:28

well, emacs has notion of thing at point

dpsutton07:02:36

so it's easy to know what's under your cursor

qqq07:02:44

ah, so (thing-at-point) would give me

:dog

dpsutton07:02:45

tought part will be connecting it to code aware

dpsutton07:02:04

but there's cider stuff that you could mabe call from your own elisp code

qqq07:02:13

actually I think elisp is good enough to "parse sexp" for cljs, i.e. as long as I'm only using () [] {} , elisp should grab the sexp correctly

dpsutton07:02:12

especially if they all have the same form of (def-foo

dpsutton07:02:22

will they all be in the same file?

qqq07:02:41

they all do, as I'm writing the code 🙂 no, not in the same file, but in the same helm-pojectile project

dpsutton07:02:03

well, sounds like you've got some straight forward text search and replacement then

dpsutton07:02:12

emacs is super useful

qqq07:02:25

yeah, I just need to study helm-projectile a bit more

qqq07:02:38

thanks for the discussion

dpsutton07:02:06

i did something like this a little bit

dpsutton07:02:10

for renaming a bunch of tests

dpsutton07:02:22

the searching stuff in emacs is kinda weird

qqq07:02:21

helm-projectile-ag solves the "search part"

qqq07:02:43

literally the function I need so the remaining part is "how to change action from "go to loc" to "extract and insert sexp""

andrea.crotti08:02:14

Helm projectile does also replacement

andrea.crotti08:02:52

Just 'r' instead of 's' as the last key of the command

andrea.crotti08:02:13

Otherwise cljr also has that but not for Clojurescript

qqq08:02:30

@andrea.crotti : I think what you said is important

qqq08:02:33

but I don't know how to use it

qqq08:02:39

when do I press "r" ?

andrea.crotti08:02:01

Just check the helm projectile functions

andrea.crotti08:02:10

There is one for replacing

andrea.crotti08:02:46

it's just projectile-replace the command anyway

andrea.crotti08:02:32

or cljr-rename-symbol which would be even smarter, but only works with .clj files

qqq09:02:55

@andrea.crotti: I appreciate your effort to help me. I'm not sure we're solving the same problem. Can you briefly, in 2-3 sentences, tell me what problem you're solving?

andrea.crotti09:02:29

ah right I thought you needed simple symbol replacement @qqq

andrea.crotti09:02:55

I think then maybe you should look at the smartparens functions

qqq09:02:01

no, this is not what I want. So I have my own sorta-spec thing, where I define a number of "specs" with:

(def-spec :student ... )
(def-spec :dog ...)
(def-spec :car ...)
then, when I'm writing code, I want to be able to put my cursor over
:student
hit some key, then have it find the (def-spec student ... ) entire sexp -- and insert the entire sexp in place (this helps me write out the data with the spec in hand)

qqq09:02:44

so if we had:

(def-spec :student [:name :age :gender])
and I had a cursor over
:student
I want to hit some key, and have (def-spec :student [:name :age :gender]) inserted inline, which I'll then fill in the parameters for.

qqq09:02:03

right now, using helm-etags-select, I can do the "jump to where this is defined part"

andrea.crotti09:02:13

you could also otherwise generate a yasnippet snippet on the fly

qqq09:02:23

the part I'm missing is changing the helm action from "jump to file/line" to (1) grab the entire sexp (2) insert the sexp

andrea.crotti09:02:25

and then just use that

qqq09:02:47

so the spec is not necessairly on one line, so I need a way to grab the entire symbolic expression

qqq09:02:13

generaing yasnippet on the fly seems weird --= since "if I get the full expression for wriing the yasnippet, why not just insert it in place instead"

andrea.crotti09:02:38

well it makes it much easier to fill it in

qqq09:02:44

ah, true

qqq09:02:47

clever 🙂

qqq09:02:04

oh man, tabbing through the fields, this is insane

andrea.crotti09:02:35

and I think as mentioned above you could use the smartparens functions I guess

andrea.crotti09:02:46

to get the sexp, it does all the parsing you need for you

qqq09:02:55

no, what smarparens func

qqq09:02:08

I have no smart parens under C-h f

qqq09:02:13

is this a new package?

andrea.crotti09:02:58

@qqq smartparens h 20170209… installed 669 Automatic insertion, wrapping and paredit-like navigation with user defined pairs.

andrea.crotti09:02:23

(defvar sp-smartparens-bindings '(
                                  ("C-M-f" . sp-forward-sexp)
                                  ("C-M-b" . sp-backward-sexp)
                                  ("C-M-d" . sp-down-sexp)
                                  ("C-M-a" . sp-backward-down-sexp)
                                  ("C-S-d" . sp-beginning-of-sexp)
                                  ("C-S-a" . sp-end-of-sexp)
                                  ("C-M-e" . sp-up-sexp)
                                  ("C-M-u" . sp-backward-up-sexp)
                                  ("C-M-n" . sp-next-sexp)
                                  ("C-M-p" . sp-previous-sexp)
                                  ("C-M-k" . sp-kill-sexp)
                                  ("C-M-w" . sp-copy-sexp)
                                  ("M-<delete>" . sp-unwrap-sexp)
                                  ("M-<backspace>" . sp-backward-unwrap-sexp)
                                  ("C-<right>" . sp-forward-slurp-sexp)
                                  ("C-<left>" . sp-forward-barf-sexp)
                                  ("C-M-<left>" . sp-backward-slurp-sexp)
                                  ("C-M-<right>" . sp-backward-barf-sexp)
                                  ("M-D" . sp-splice-sexp)
                                  ("C-M-<delete>" . sp-splice-sexp-killing-forward)
                                  ("C-M-<backspace>" . sp-splice-sexp-killing-backward)
                                  ("C-S-<backspace>" . sp-splice-sexp-killing-around)
                                  ("C-]" . sp-select-next-thing-exchange)
                                  ("C-M-]" . sp-select-next-thing)
                                  ("C-M-SPC" . sp-mark-sexp)
                                  ("M-F" . sp-forward-symbol)
                                  ("M-B" . sp-backward-symbol)
                                  )
  "Alist containing the default smartparens bindings.")

andrea.crotti09:02:35

one of those should help surely

qqq09:02:03

oh wait, smartparens is a package filling similar need are paredit/lispy?

andrea.crotti09:02:12

yeah same thing

qqq09:02:17

duh, in this case I should just use lispy (which is already installed)

qqq09:02:17

one thing that I like about evil-paredit more than evil-lispy -- is that evil-paredit when yanking/deleting, kept things balanced, evil-lispy doesn't seem to achieve this by default for me

qqq09:02:25

anyone ahve advice on how the above?

pesterhazy11:02:49

Check out lispyville qqq

pesterhazy11:02:20

It does exactly that

qqq11:02:11

was not a fan of lispyville when I tried it last night

qqq11:02:30

@pesterhazy: trying again now, do you perchance have a lispyvile binding which makes [ insert [] ?

qqq11:02:39

the default lispy thing is to have it move sexp left or something

pesterhazy11:02:59

I'm actually using it only for the balancing-parentheses behavior

pesterhazy11:02:07

I don't even enable lispy-mode

qqq11:02:25

evil-paredit is excellent for that

pesterhazy11:02:54

balancing parentheses when using dd is such an essential feature I'm surprised it's not a default

qqq11:02:13

what's most infuriating is that in evil mode, I can get unbalanced

qqq11:02:20

then when I try to balance: ( --> we give you blanced ()

qqq11:02:24

) -> we move you to right sexp

qqq11:02:28

so it stays unbalanced 🙂

pesterhazy11:02:45

never happened to me?

pesterhazy11:02:21

evil-paredit is an interesting pointer

pesterhazy11:02:30

it's such a crowded space

pesterhazy11:02:52

afaik structural editing tools have two jobs

pesterhazy11:02:27

1st is to keep parens balanced by rebinding constructive (like () and destructive (like dd) actions

pesterhazy11:02:13

2nd is to provide additional keybinds (or as with lispy rebind existing ones) to operate on s-exps

pesterhazy11:02:50

now even pure emacs allows you to navigate and manipulate sexps to a certain extend

pesterhazy11:02:24

there's mark-sexp and kill-sexp for example

pesterhazy11:02:56

but to have 1 and 2 you need an additional package

pesterhazy11:02:32

the main structural editing packages are paredit, smartparens and lispy

pesterhazy11:02:47

unfortunately, using evil-mode makes things more complicated still

pesterhazy11:02:28

because evil supports different editing primitives (like dd) and because it has vastly different keybindings

pesterhazy11:02:05

does that sound like a correct summary?

danielgrosse11:02:54

I just try to get into emacs and clojure, but stuck at using java classes. When I import e.g. java.awt and load the file in cider, a classNotFoundException is thrown. When I open the project in intellij, the classes are found. What do I have to do, that emacs or leiningen knows the classes location?

pesterhazy11:02:30

does that happen with other classes @danielgrosse ?

pesterhazy11:02:19

I seem to remember that AWT is not shipped with (some packages of) the openjdk