dharmatech · 2022-09-30 09:26
Have there ever been any efforts at offering a graphics API in Emacs?
I.e. something like the HTML/JS browser canvas but in Emacs and programmed in Emacs Lisp of course.
If it was powerful enough, the rest of Emacs' UI could be defined in terms of it.
If there are previous threads or discussions around the web about this, feel free to link below. Thanks!
[deleted] · 2022-09-30 11:40
[deleted]
arthurno1 · 2022-09-30 14:01
> Have there ever been any efforts at offering a graphics API in Emacs?
If there was an effort, I have no idea, but Emacs does not have a 2D drawing API you can use to draw over an Emacs window, however you have [librsvg](https://gitlab.gnome.org/GNOME/librsvg) in Emacs; i.e. [SVG](https://www.gnu.org/software/emacs/manual/html_node/elisp/SVG-Images.html) which you can use for vector drawing.
> If it was powerful enough, the rest of Emacs' UI could be defined in terms of it.
Yes, sure. But Emacs has a very minimal GUI. Emacs does not implement its own low-level platform independent library. Instead, Emacs has bindings to such libraries (Cairo, Win32, Gtk etc) and does GUI drawing via those. Low level functions like drawing rectangles, ellipses and such are not exposed to elisp. Instead, for those few minimal things Emacs needs, it calls into such functions internally.
You could, at least in theory, do lots of GUI stuff in Emacs itself already with SVG (org PNGs). See for example [svg-lib by N. Rougier](https://github.com/rougier/svg-lib) for doing stuff like buttons, toolbars and some other gui elements. You can do pop-up menus with child frames.
Someone with lots of time in their hands, could implement a menubar and menu/submenus and scrollbars with child frames too, so in theory yes, you could already make Emacs GUI without external GUI library such as Gtk.
GreenSubstantial4469 · 2022-09-30 14:46
emacs-ng isn’t exactly what you wanted, but it’s extremely similar.
dharmatech · 2022-09-30 14:52
>emacs-ng
Thank you for the reference to emacs-ng. Looks interestring!
dharmatech · 2022-09-30 14:54
Thank you for the reference to svg-lib. Looks very interesting!
wasamasa · 2022-10-01 17:41
There has been some discussion on emacs-devel on this topic with no clear concensus. So far I've seen whoever suggested it failing to convince Eli Zaretskii about how exactly it would work (there are no specific proposals addressing how the display engine would need to change) and the benefits it would bring to Emacs.
https://lists.gnu.org/archive/html/emacs-devel/2021-10/msg01463.html
https://lists.gnu.org/archive/html/emacs-devel/2021-11/msg01094.html
I'm sure there's been more discussion, but I cannot find it currently.
dharmatech · 2022-10-01 21:05
Interesting discussion. Thank you!