Fork me on GitHub
#emacs
<
2018-01-10
>
piotr-yuxuan15:01:13

Hi there! I’d like to be able to reformat (empty? [ ]) to (empty? []) (remove unnecessary spaces). I may be blind but I haven’t found yet the proper command to use in Emacs. Is it possible?

chris15:01:22

does cider-format-buffer do what you want?

piotr-yuxuan15:01:15

Neither cider-format-buffer nor cider-format-region do what I described. I’ve just got a mostly empty emacs init.el with bare minimum for Clojure (paredit, cider, expand-region) so I guess it doesn’t come from a setting problem, does it?

piotr-yuxuan15:01:24

fill-region has almost the expected behaviour

mgrbyte15:01:52

cider-format-region and cider-format-buffer work for me fwiw

chris15:01:57

for me, cider-format-* removes the spaces between the [ ], is that not what you're seeing?

piotr-yuxuan15:01:04

Ha! yes indeed, cider-format-* removes the spaces between the [ ]. I didn’t notice it 😕, sorry for that. But the space useless spaces between empty? and [ are still present.

bozhidar20:01:40

@piotr2b Guess you should report this as a cljfmt bug, as this is what CIDER users internally for this command.

bozhidar20:01:15

I such situations I usually just use M-\ and M-SPC.

gfredericks21:01:35

I've dug into the shutdown hooks issue some more and figured out some interesting stuff - the elisp documentation for kill-buffer (which I think is how cider is killing the jvm) states that it issues SIGHUP to any dependent processes - I've confirmed from many directions that a jvm runs shutdown hooks on SIGHUP -- they run if you signal the jvm directly, they run if you signal the lein jvm that spawned it, they run if you signal the bash process that created the lein vm that created the real vm - I've even tried running kill-buffer from the cider nrepl buffer, and even that runs the shutdown hooks - but when I run cider-quit from the cider repl buffer, they get skipped

dpsutton22:01:49

if (! (EQ (symbol, Qsignal) || EQ (symbol, Qexit)))
	    pset_status (p, list2 (Qsignal, make_number (SIGKILL)));

dpsutton22:01:59

looks like emacs way down in the way cider closes sends SIGKILL

dpsutton22:01:47

line 1073 in process.c. called from cider-interaction in cider--close-buffer

gfredericks22:01:12

so it's not kill-buffer then?

dpsutton22:01:23

(when proc (delete-process proc))

dpsutton22:01:37

it deletes the process first. which ironically doesn't clean up after itself?

dpsutton22:01:08

C-h C-f cider--close-buffer and you'll be where i'm looking

gfredericks22:01:39

any guesses on whether this is by design or could be improved?

dpsutton22:01:36

no idea. my guess is that this delete process and then kill the buffer felt more responsible but it seems to do it improperly

dpsutton22:01:02

and the commit from @malabarba is just > Don't try to close a dead connection

gfredericks22:01:23

what's the standard practice in this situation? send a weaker signal and wait a few seconds and then kill it forcibly?

dpsutton22:01:50

i'm not strong in the posix. i have no idea

dpsutton22:01:04

i feel like noise smith or someone might know in general

dpsutton22:01:10

or #clojure i mean

noisesmith22:01:43

this reminds me of issues that come up when running a child jvm under windows (probably not the same issue though)

noisesmith22:01:55

I’ll back burner this and let you know if I remember something important, but honestly I backed away from emacs because it introduces too many interesting problems and almost useful utilities - it was constantly nerd sniping me and I’ve had more free time since I stopped using it

gfredericks22:01:40

you just trolled 700 people at once

noisesmith22:01:49

it seems my tact is running on a 5 minute delay

richiardiandrea22:01:40

but a and almost useful utilities - slipped in there, which is definitely true 😉

richiardiandrea22:01:06

you probably wanted to say "myriad of useful utilities"