protorepl

seancorfield 2016-12-08T00:07:34.000148Z

@jasongilman Is there an easy way to get it to treat (some-ns/with-some-thing โ€ฆ) as a โ€œwithโ€ for indentation (which Emacs/Paredit does without configuration it seems)? i.e., I want

(some-ns/with-some-thing [some bindings]
  (the body))
rather than
(some-ns/with-some-thing [some bindings]
                         (the body))
which is what Cmd-Shift-i seems to do.

jasongilman 2016-12-08T00:13:29.000149Z

@seancorfield: in the lisp paredit settings it will let you specify a list of forms for which it will do that indentation.

jasongilman 2016-12-08T00:13:46.000150Z

I think you may be able to give it a regex

seancorfield 2016-12-08T00:17:03.000151Z

Coolโ€ฆ will try that...

seancorfield 2016-12-08T00:20:42.000152Z

:thumbsup::skin-tone-2: Perfect, thank you!

lspector 2016-12-08T04:16:26.000153Z

Thanks @jasongilman. I have now installed the lisp-paredit package and set the settings as described in the page to which you linked, but I am not getting reindentation. This is probably because I didn't do anything in response to your comment that "You have to setup the init file and keymap there," because I don't know exactly what this means. Could you possibly spell out what I have to do for this, and where? I need auto-reindentation, but I do not want any other features of paredit or parinfer.

seancorfield 2016-12-08T04:18:50.000154Z

@lspector There's an Init... option in the menus or you can use the fuzzy command search to find it... Let me fire it up and give you more precise directions!

seancorfield 2016-12-08T04:20:07.000155Z

File > Init Script...

seancorfield 2016-12-08T04:21:01.000156Z

Or Ctrl-Shift-p (Cmd-Shift-p on Mac) and type init and you should see Application: Open Your Init Script

seancorfield 2016-12-08T04:21:58.000157Z

Either of those will open up init.coffee which is Atom's initialization script -- paste the init stuff in there and save. Then repeat for the keymap stuff... File > Keymap...

robert-stuttaford 2016-12-08T04:39:40.000158Z

thank you for asking the questions @lspector and @seancorfield ๐Ÿ™‚ now also a happy user of indentation in Atom. must read through @jasongilmanโ€™s carefully prepared gist more thoroughly...

seancorfield 2016-12-08T05:30:52.000159Z

I just finished setting up my Win10 laptop with Proto REPL per that opinionated setup... and emacs-plus, disable-keybindings, clipboard-plus, git-plus... and some tweaks to the keymap to add more Emacs-y bindings for lisp-paredit since Jason's guide has those keybindings turned off ๐Ÿ™‚

seancorfield 2016-12-08T05:31:14.000160Z

(because they conflict with proto repl -- but I still want slurp / barf etc)

seancorfield 2016-12-08T05:35:07.000161Z

Tonight I shut down Emacs on both machines. Tomorrow I'll only use Proto REPL and see how I get along.

๐Ÿ˜ฎ 1
2
robert-stuttaford 2016-12-08T05:59:26.000162Z

๐Ÿ˜ฎ i can have slurp and barf? i see some yak shaving in my future

seancorfield 2016-12-08T07:25:38.000163Z

'atom-text-editor[data-grammar~="clojure"],
 atom-text-editor[data-grammar~="lisp"],
 atom-text-editor[data-grammar~="newlisp"],
 atom-text-editor[data-grammar~="racket"],
 atom-text-editor[data-grammar~="scheme"]':
  'ctrl-alt-}':         'lisp-paredit:barf-forwards'
  'ctrl-alt-)':         'lisp-paredit:slurp-forwards'
  'ctrl-alt-(':         'lisp-paredit:slurp-backwards'
  'ctrl-alt-{':         'lisp-paredit:barf-backwards'

seancorfield 2016-12-08T07:26:10.000164Z

(my keymap is way bigger than that, but that's the relevant portion @robert-stuttaford )

seancorfield 2016-12-08T07:27:30.000165Z

I have 233 lines in my keymap so far ๐Ÿ™‚

robert-stuttaford 2016-12-08T07:47:40.000166Z

thanks, Sean!

robert-stuttaford 2016-12-08T07:48:00.000167Z

we have a public holiday coming up. i can see what iโ€™m going to be doing with it ๐Ÿค“

seancorfield 2016-12-08T08:05:21.000168Z

Which public holiday is that?

seancorfield 2016-12-08T08:05:55.000169Z

If you want to know more about my entire Proto-REPL-as-Emacs configuration so far, DM me ๐Ÿ™‚

robert-stuttaford 2016-12-08T08:34:30.000170Z

Day of Reconciliation https://en.wikipedia.org/wiki/Day_of_Reconciliation

1
robert-stuttaford 2016-12-08T08:34:40.000172Z

i very probably will DM you ๐Ÿ™‚

jasongilman 2016-12-08T12:37:17.000174Z

@seancorfield: I'm excited to hear how it goes. Let me know how the experiment works out for you.

lspector 2016-12-08T14:11:38.000175Z

Thanks again @jasongilman, but alas I'm still not getting re-indentation. FYI on my mac the Init Script... and Keymap... items are in the Atom menu, not the File menu, but I found them, pasted in the text from your gist, saved, quit, and restarted... but still, command-shift-i (and the variants that I tried) don't re-indent anything. I guess maybe some other setting is getting in the way? FWIW IMHO it would be fabulous if this could somehow be made to work out of the box, without configuration, since I think it is a crucial feature.

jasongilman 2016-12-08T17:57:20.000176Z

@lspector: I would recommend turning on the atom keybindings inspector. Cmd-. Will do that. Then you can press a keybindings and it will tell you which command it's running.

jasongilman 2016-12-08T17:58:29.000177Z

I agree it would be nice to be built in. For now I'm relying on paredit. I think it would be a good thing for Parinfer to handle as well. I'm considering doing something with zprint.

lspector 2016-12-08T19:52:51.000178Z

@jasongilman: After Cmd-., shift-cmd-I shows jason:indent-top-sexp

lspector 2016-12-08T19:53:21.000179Z

but doesn't reindent the block it's in.

jasongilman 2016-12-08T20:38:43.000180Z

@lspector: at that point I would throw in some console.log statements into the associated code in your init script. After doing that restart atom, open up the dev tools to show the console and then trigger the command.

jasongilman 2016-12-08T20:39:27.000181Z

Somewhat ironic that I'm telling you to use println style debugging to debug the fancy visualization tool.

jasongilman 2016-12-08T20:39:51.000182Z

If you can't find the code in your init script then that's the problem ๐Ÿ˜

lspector 2016-12-08T20:48:56.000183Z

Thank for this @jasongilman. I do see the code for jason:indent-top-sexp in my init.coffee, but I'm not exactly sure how to print anything (it's not Clojure ๐Ÿ˜•), and I think I've learned that the on-ramp is a little too steep for me at the moment. So I'm going to step back from this now but I appreciate your efforts to help and I hope to return at some point, because this looks like a great environment.

jasongilman 2016-12-08T20:54:09.000184Z

That's reasonable. Thanks for giving it a try and providing feedback.

seancorfield 2016-12-08T21:21:33.000185Z

Having a weird / annoying issue with adding newlines (I think itโ€™s a Parinfer issue?): if my cursor | is as shown (f (a b)|) and I press enter, it adds a newline below and jumps to that, it does not insert a newline between the two closing parens. What am I missing here?

seancorfield 2016-12-08T21:22:20.000186Z

Iโ€™m used to pressing enter and it leaving my code like this:

(f (a b)
   |)

shaun-mahood 2016-12-08T21:22:43.000187Z

I get the same thing with parinfer on Cursive - I think it's just how it works (though I just started using it yesterday).

seancorfield 2016-12-08T21:23:35.000188Z

Ohโ€ฆ if I start typing after newline, Parinfer adjust the parens around my code! That will take some getting used to!

fellshard 2016-12-08T21:23:56.000189Z

Yeah, parinfers are actually really good about that

shaun-mahood 2016-12-08T21:23:58.000190Z

Yeah, totally different result than I first expected too.

fellshard 2016-12-08T21:24:08.000191Z

I believe they call that 'indent mode' vs. 'parens mode'?

fellshard 2016-12-08T21:24:23.000192Z

So it determines parentheses wrapping based on indentation

fellshard 2016-12-08T21:24:45.000194Z

Which also implies you could construct sexps using indentation alone if you really wanted ๐Ÿ˜‰

fellshard 2016-12-08T21:25:04.000195Z

"because python is hip right?"

seancorfield 2016-12-08T21:28:30.000196Z

Iโ€™ll see how I get along with itโ€ฆ Iโ€™m so used to pareditโ€™s way of doing thingsโ€ฆ Iโ€™ve already noticed that deleting a ) causes it to just move somewhere else (seems to slurp in paredit parlance?).

seancorfield 2016-12-08T21:29:44.000197Z

I am finding the Git integration in Atom to be sub-par, compared to magit in Emacs. Even with git-plus installed.

seancorfield 2016-12-08T21:31:19.000198Z

I put my keymap etc up on GitHub https://github.com/seancorfield/proto-repl-setup (for @robert-stuttaford mostly)

๐Ÿ‘ 1
seancorfield 2016-12-08T21:31:57.000200Z

I canโ€™t put my config.cson up there because it differs between Mac and Windows (Boot location plus a few other things)

seancorfield 2016-12-08T21:32:26.000201Z

(and Iโ€™m now using git to keep my setup in sync between my machines)

fellshard 2016-12-08T21:33:37.000202Z

Yeah, it'll use the indentation of subsequent lines to predict where it has to land

fellshard 2016-12-08T21:35:25.000203Z

If you've ever used Haskell or ML, very similar intuition / rules to that, except here you just draw a line straight up from the first character in the current line and see what sexp it would fall in

fellshard 2016-12-08T21:36:38.000204Z

(first line
    |    (second line)
    (third line
    |  (fourth line))
    (fifth line))

fellshard 2016-12-08T21:36:51.000205Z

Which is in line with how the clojure standard formatting tends to go

fellshard 2016-12-08T21:38:18.000206Z

If you line up and add a newline between the right closing parens and newline, it should (iirc) indent the next line appropriately to have the new sub-expression be slurped at the expected point

fellshard 2016-12-08T21:41:35.000207Z

(map (fn [x] (and (seq? x)โคถ) s)
should leave you with
(map (fn [x] (and (seq? x)
       |) s)

fellshard 2016-12-08T21:41:45.000208Z

'pre-slurped' I guess

fellshard 2016-12-08T21:42:41.000209Z

Though I'm guessing slurp and barf are probably better for keyboard use anyway

lspector 2016-12-08T22:40:31.000210Z

Just a "FWIW unsolicited opinionated opinion" following up @shaun-mahood: I find much that parinfer does unexpected, and as a 30+ year lisper (and lisp teacher for most of that), I actually find it really problematic, even more so than strict mode paredit. Both are really clever and I'm sure some people love them. But I'm sad that Nightcode now uses parinfer and doesn't let you turn it off, and I hope that this doesn't befall other great tools in the Clojure world.

jasongilman 2016-12-08T22:55:33.000211Z

If any of you are Parinfer opposed then you could use paredit exclusively. There's nothing Proto repl requires with Parinfer. My opinionated setup uses it because that's what I like.

shaun-mahood 2016-12-08T23:05:26.000212Z

@lspector: I have no horse in the parinfer race yet, I did all my parens manually up until Tuesday this week ๐Ÿ™‚ @sekao: ^ Any chance you could follow up on this with @lspector and maybe allow parinfer to be turned off in Nightcode?

seancorfield 2016-12-08T23:05:51.000213Z

Iโ€™m starting to like some of what Parinfer does but Iโ€™m getting into a mess with it more often than I would like ๐Ÿ™‚

shaun-mahood 2016-12-08T23:06:25.000214Z

I've found that I don't think about parens as much, but I think about indentation a lot, lot more.

๐Ÿ‘ 1
lspector 2016-12-08T23:23:24.000215Z

@shaun-mahood: @sekao and I have discussed this, and apparently parinfer is baked into the latest Nightcode pretty hard, for reasons that make good sense relative to what's happening there... but alas, that still doesn't make it usable for me.

shaun-mahood 2016-12-08T23:24:44.000216Z

@lspector: Too bad, it's such a good editor for starting Clojure (it was my first) - are you teaching Clojure currently?

lspector 2016-12-08T23:25:03.000217Z

@jasongilman: Good to hear. To be clear, I find strict paredit to be problematic too, but it looks like you allow unstrict usage, which is great.

lspector 2016-12-08T23:27:22.000218Z

@shaun-mahood: I agree, Nightcode was pretty great for beginners and I did teach with earlier versions. I'm on sabbatical at the moment so not teaching ๐Ÿ˜€. But I'll be supervising someone else teaching a Clojure-based course in the spring, and resuming my Clojure based courses next fall.

shaun-mahood 2016-12-08T23:29:13.000219Z

@lspector: Awesome - any exciting genetic programming during your sabbatical? I really enjoyed your talk at last years Conj

lspector 2016-12-08T23:29:56.000220Z

@shaun-mahood: FWIW I'm constantly trying and retrying all of the options I can find, and I switch pretty regularly. Most recently, I've used a modified version of Gorilla REPL (https://github.com/benfb/gorilla-repl)

lspector 2016-12-08T23:31:46.000222Z

Thanks @shaun-mahood! Yeah, the sabbatical is all genetic programming all the time ๐Ÿ˜€. https://www.hampshire.edu/news/2016/10/16/spector-receives-nsf-grant-to-propel-computer-programs-modeling-biological-evolution

๐Ÿ‘ 1