Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can Nyxt be Lisp powered application platform, like Electron or Emacs? #887

Closed
andreyorst opened this issue Aug 7, 2020 · 11 comments
Closed
Labels

Comments

@andreyorst
Copy link

Sorry if this was discussed already somewhere, but yesterday I had crazy thought about possibility of Nyxt to become next Emacs. Not in a sense of being a text editor, but more in a sense of being application platform, that can run various Lisp applications written for it.

For example. Emacs has Magit, which is a Git wrapper, that is integrated with Emacs editor, but you actually can use it just as a Git wrapper alone, e.g. stage hunks, rebase commits, e.t.c. So Magit is like an application, that just happens to run in Emacs. And it uses Emacs' rendering capabilities to provide user interface, read files, resolve conflicts with another applications, like Ediff, or Vdiff. Since Emacs is a EmacsLisp machine, everyhting is written in this language.

Electron in this sense is a similar thing -- you write an application in JavaScript, and it uses Electron capabilities to interact with outer world, e.g. read files, display video, animations, sound, e.t.c. However JS is more versatile, compared to Emacs Lisp, and not limited by a single platform.

And here's Nyxt, which is powered by Common Lisp (which is more powerful than Emacs Lisp, and probably JSI(IRC JS was implemented in CL initially)), and Nyxt can execute Common Lisp, and integrate with SLIME, which makes it a pretty powerful application platform, with rich rendering capabilities of a web browser.

Atom was an ambitious text editor that is quite similar to Emacs (IMO) in a sense, that it can be configured and extended via JS, and mostly everything is a package. With it's slick UI and customizeability it had a decent popularity for being a pretty slow editor at first. And now Electron is used for much much more applications.

Nyxt is quite small (compared to Chromium), and is hackable bynature, which makes it into a good competitor with Electron in my eyes.

@aartaka
Copy link
Contributor

aartaka commented Aug 7, 2020

The main thing stopping Nyxt from being a full-blown application platform is the current inability to execute arbitrary Lisp code stored on the web pages (this stops #769, #565, and some other things from being "just one hack away").

If you have ideas on implementation and control of code execution (because it can make terrible things when used improperly or controlled too loosely), then you're welcome to participate in #838, where this issue is discussed!

@jmercouris
Copy link
Member

Artyom, with regards to executing Lisp originating in the renderer, we have come up with a "first iteration idea". We will have "internal-buffers". Only requests for Lisp evaluation originating from an internal-buffer may be executed.

Internal buffers may not load external resources.

I was working on a draft pull request for this... hopefully available soon :-)

@Ambrevar
Copy link
Member

Ambrevar commented Aug 7, 2020

@andreyorst I think you just revealed our deepest, darkest secret to the public! :) Indeed, the vision (or the dream?) is to turn Nyxt into a hackable development platform. It's a lot of work, but in many ways there is already so much we can do that, say, Emacs can't :)

As you pointed out, Nyxt has many perks compared to Electron:

  • More lightweight (hey, we could even run Nyxt without a web engine with little effort).
  • Bootstrappable, reproducible, and thus much more reliable and trustworthy (correct me if Electron was properly bootstrapped and is reproducible).
  • Better language.
  • Lots of avant-garde concepts and hacking tools, like live hacking, functional configurations, modes, etc.

@Ambrevar
Copy link
Member

Ambrevar commented Aug 7, 2020

@aartaka Also see #745.

@bpostlethwaite
Copy link

Many of these issues mentioned above are now closed. Are we closer to an "Electron-like" app platform?

I'm interested in exploring the idea of using nyxt as a UI for my lisp project (audio synthesis with cl-collider). The JavaScript ecosystem excels at UI and data vis, both of which are difficult or underwhelming with common lisp.

Any pointers on where I'd get started? I've seen I can write parenscript but I'm not sure how one would load custom or prepackaged JS and CSS.

Is it possible at this stage to achieve such a thing? The thought of being able to use d3 and friends powered by a lisp runtime is very tempting.

@Ambrevar
Copy link
Member

Ambrevar commented Apr 6, 2021

I believe the developments in this area are happening in #946.

For external CSS, look at style-mode.lisp: there is apply-style and html-set-style. Note these are unexported and prone to change in the future.

For Javascript we've recently defined a helper I believe. @jmercouris What was it again?

@jmercouris
Copy link
Member

define-bookmarklet, this won't load a file from disc though, I think. I can't remember if I added such a provision or not.

@jmercouris
Copy link
Member

Yes, it appears I added such a provision, you can therefore do: (define-boomarklet my-js-command "my-documentation" "file:///my/path/to/the/file").

@bpostlethwaite
Copy link

I appreciate the pointers, I'll start investigating!

@pdelfino
Copy link
Contributor

pdelfino commented Apr 30, 2022

I thought it was appropriate to introduce this pointer here.

A user said the following in a private conversation after being prompted: Also, if you were a developer of Nyxt (beyond just a user) what would you like to build for yourself?

Integrating the LEM editor and giving it BIDI and opentype abilities.

I know it is a already a goal to build Nyxt's own editor. But this is the closest issue I could find to a feature request for such an editor. I was unsure about opening a new feature about it. But I could do it if you think it is appropriate.

@aadcg
Copy link
Member

aadcg commented May 28, 2023

I believe that Nyxt is already an application platform, but we're continuously improving.

Please try version 3.0.0 if you haven't already.

@aadcg aadcg closed this as not planned Won't fix, can't repro, duplicate, stale May 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

7 participants