Live data from Hacker News

Show HN: Joyride: script VSCode like Emacs but using Clojure

news.ycombinator.com

21–30 of 46 posts

Re: Show HN: Joyride: script VSCode like Emacs but using Clojure

#21
post #19
post #13

Earlier quoted context omitted.

You mean whether VSCode extensions (1) can insert into the current line; and (2) have state? The answer should be rather obvious, yes.

I assumed the point is whether you can do this from the repl? This is something Emacs is good at, but VSCode doesn't seem to be; in Emacs, you can do something like M-: (insert "FRED") RET and you'll see FRED appear in the current buffer. For good or (more rarely) for ill, the repl runs in the same context as the editing environment. You can use this to interactively develop extensions or just drive the editor from c…

GP said “scripts”. But no, VSCode certainly doesn’t have that level of interactivity. On the other hand, the single-threadedness of Emacs is very annoying though.

Edit: My usage of Emacs has been reduced to mostly just magit and dired since ~2017, so I didn’t realize Emacs 26 added threads. Is it actually widely adopted? Things I do use these days, like package.el, are clearly still blocking.

Re: Show HN: Joyride: script VSCode like Emacs but using Clojure

#22
post #19
post #13

Earlier quoted context omitted.

You mean whether VSCode extensions (1) can insert into the current line; and (2) have state? The answer should be rather obvious, yes.

I assumed the point is whether you can do this from the repl? This is something Emacs is good at, but VSCode doesn't seem to be; in Emacs, you can do something like M-: (insert "FRED") RET and you'll see FRED appear in the current buffer. For good or (more rarely) for ill, the repl runs in the same context as the editing environment. You can use this to interactively develop extensions or just drive the editor from c…

That would be possible with joyride as well. Ask for user input, then evaluate it.

Re: Show HN: Joyride: script VSCode like Emacs but using Clojure

#23
post #21
post #19

Earlier quoted context omitted.

I assumed the point is whether you can do this from the repl? This is something Emacs is good at, but VSCode doesn't seem to be; in Emacs, you can do something like M-: (insert "FRED") RET and you'll see FRED appear in the current buffer. For good or (more rarely) for ill, the repl runs in the same context as the editing environment. You can use this to interactively develop extensions or just drive the editor from c…

GP said “scripts”. But no, VSCode certainly doesn’t have that level of interactivity. On the other hand, the single-threadedness of Emacs is very annoying though. Edit: My usage of Emacs has been reduced to mostly just magit and dired since ~2017, so I didn’t realize Emacs 26 added threads. Is it actually widely adopted? Things I do use these days, like package.el, are clearly still blocking.

This is not correct. Use of the CLJS REPL to insert strings is even demonstrated in the video.

Re: Show HN: Joyride: script VSCode like Emacs but using Clojure

#24
post #9

That looks promising, but I have a feeling that vscode doesn't offer as much options to hook into the editor as emacs does. E.g., one of the first emacs scripts I wrote added the next number to the current line. It contains something like (insert (number-to-string (setq counter (+ 1 counter)))) Is that kind of thing possible too?

> That looks promising, but I have a feeling that vscode doesn't offer as much options to hook into the editor as emacs does.

Agreed on both counts.

But I don't think it's possible to get to Emacs' level of extensibility unless you adopt its philosophies - both legal and technical - from the outset.

The reason I say this is that Emacs isn't just extensible in Emacs Lisp, it's very extensively written in Emacs Lisp. More than that, the code behind all of the functions is a keystroke or three away. If I want to know what 'C-x C-s' does, it's possible to say 'C-h k C-x C-s' and see this:

> C-x C-s runs the command save-buffer (found in global-map), which is an interactive compiled Lisp function in ‘files.el’.

There's more documentation besides, and pressing enter on 'files.el' then takes you to the source code for the save file function. This works for native C code too, provided you have the source installed.

This is very much like what you see in a Smalltalk image or a Lisp machine - the system is all 'of a kind', self-documenting, and fundamentally open by nature.

Web Browser JS environments have some of the interactivity here, but they miss out on the self-documenting part, the use of the extension language as an implementation language, and all the cross linking into the source. I'm not faulting them - these are expensive and time-consuming choices to take - and they are often at odds with the goals of writing a useful browser.

In that perspective, the work here is admirable in that it adds Lisp style scripting to VSCode, but it's destined to never get close to the sort of interactive extensibility and exploration you get in Emacs itself. I'm sure it's easy to run into the wall between the extension language and the implementation language itself.

Before this is taken as too critical, note that I don't mean it that way. This is just an observation about two different design choices based on two different sets of constraints that have led to two different outcomes. Note that both of these outcomes are good and useful points in the design space.

Re: Show HN: Joyride: script VSCode like Emacs but using Clojure

#25

Earlier quoted context omitted.

This is possible, but it's a bit more code. Watch the introductory video that PEZ made where he does something similar.

I made a rough example here which insert the increment number at cursor by looking at the last number in the line: https://gist.github.com/borkdude/08ec3ae2af5963a4a03cd8e0873...

Nice!

Re: Show HN: Joyride: script VSCode like Emacs but using Clojure

#26
post #19

Earlier quoted context omitted.

I assumed the point is whether you can do this from the repl? This is something Emacs is good at, but VSCode doesn't seem to be; in Emacs, you can do something like M-: (insert "FRED") RET and you'll see FRED appear in the current buffer. For good or (more rarely) for ill, the repl runs in the same context as the editing environment. You can use this to interactively develop extensions or just drive the editor from c…

That would be possible with joyride as well. Ask for user input, then evaluate it.

Or do it directly from the REPL.

Re: Show HN: Joyride: script VSCode like Emacs but using Clojure

#27
post #20

Earlier quoted context omitted.

Do you ever sleep? Seriously; your productivity is insane.

Tbh, the last nights have been less about sleep and more about hacking on Joyride. =) But usually I do get sleep. The question we should ask is if borkdude sleeps? He's doing about 100X as much as I do. Maybe there are hundreds of borkdudes.

Both you and borkdude are productivity beasts (of the kindest variety) in my mind :)

Re: Show HN: Joyride: script VSCode like Emacs but using Clojure

#30
post #23
post #21

Earlier quoted context omitted.

GP said “scripts”. But no, VSCode certainly doesn’t have that level of interactivity. On the other hand, the single-threadedness of Emacs is very annoying though. Edit: My usage of Emacs has been reduced to mostly just magit and dired since ~2017, so I didn’t realize Emacs 26 added threads. Is it actually widely adopted? Things I do use these days, like package.el, are clearly still blocking.

This is not correct. Use of the CLJS REPL to insert strings is even demonstrated in the video.

Sorry, I wasn’t clear about it but I was talking about extension capabilities offered by stock VSCode. There’s nothing stopping third party extensions like Joyride from exposing the extension API in an REPL.
Post reply on HN