Emacs GUI Library
andreyor.st
andreyor.st
However! There is one big thing you lose. I enjoy using a TUI for certain things, either on low-resource devices, or an actual vintage terminal, and so on. And it is currently the case that programs written for Emacs almost always degrade smoothly from the graphical display to the terminal, which makes Emacs apps like ement.el, nov.el, or mastodon.el the absolute best TUIs available for their respective tasks. That's something I'd dearly hate to lose.
You could sort of work around that by defining abstract widgets and providing both GUI and TUI implementations, but that constrains the GUIs a lot, and gives you something possibly not much better than what we have now.
but, yeah, that kind of thing always sounds great in theory, but is always ridiculously hard to get right in practice
I was just thinking this myself. I was thinking about a small, limited-vocabulary (widgets) GUI toolkit (implemented without web technologies) inside of Emacs that could still be navigated with a keyboard. GUI windows would be differentiated from buffer windows, and so functions that are defined for one of them couldn't be enabled on the other. Packages could implement their functionality in either type of window, or both, depending on their purpose.
> I enjoy using a TUI for certain things, either on low-resource devices, or an actual vintage terminal, and so on. [...] That's something I'd dearly hate to lose.
In the imaginary implementation I described above those would still work, they would be buffer-interface-only packages. They wouldn't have to be re-implemented nor updated to keep working properly.
> You could sort of work around that by defining abstract widgets and providing both GUI and TUI implementations, but that constrains the GUIs a lot [...]
It doesn't have to be that way. If GUIs and buffers are defined as different types of interface paradigms that can be used and modified within Emacs, then GUIs could be completely different from their buffer counterparts and vice versa. Packages that wouldn't make sense having on a terminal wouldn't have to implement a buffer interface for it. And not every package would have to implement its own GUI interface either if there's no need for it; buffers are a very simple data model with a vast amount of tooling for them that can all (in theory) work in tandem, so they would still be an attractive baseline for any developer looking to extend the functionality of their editor.
(def-frame
(vertical-split (
(horizontal-split (
(scrollview (tree-list))
(scrollview (editor-buffer)))
(mode-line)
(minibuffer))))
Plus the actual data with a reactive flow, of course. And, yes, not a Lisp programmer. I hope I put enough parentheses there.Yes, it's not like running an actual browser, but this is so much better than anything I expected.
https://macowners.club/posts/using-xwidgets-on-macos/ gave me a quick and nice overview of how it looked.
The author sees the fact that emacs UIs are textual as a negative, but it's the reason I love it, the reason I've been using it for 20 years and I dare say the reason some have been using it twice as long. Ditching terminal support and replacing emacs TUIs with GUIs would not be progress, and if that's what you want I doubt modifying emacs is going to be a rewarding way of trying to achieve it. Just use vscode.
(Anything that removes terminal support from emacs will be a fork.)
GNU/Emacs already has tons of features that don't work in terminal and it's not a fork. GUI has:
- better fonts and better colors
- childframe support, nice for posframes
- viewing images and pdfs
- SVG support
- icons and emojis
- etc.
It makes sense for `emacs -nw` and I don't think there’s many Emacs users who are advocating for ditching terminal support. But it looks like a hack in the GUI.
Not only the uniformity in use, but also the uniformity in how you extend would be lost.
For a settings buffer, maybe it doesn't matter. However macros working everywhere in your editor as a default is quite powerful.
Pixel Fold & Tablet 5G + living in Emacs on Android at the cafe, beach and golf resort is totally do-able ;)
https://www.reddit.com/r/emacs/comments/ugxfi2/fyi_i_install...
Graphical debuggers are one of the most important tools developers have gotten in the last few decades compared to the TUI and command line era. There exist packages like dap-mode for emacs which do an admirable job in simulating more graphical workflows, but they are limited by the capacities that Emacs has.
If you want to put Emacs on the same footing with modern IDEs I don't think you get around to at some point getting it to a modern GUI system.
Maybe I'm in the minority on this, but I'm not interested in emacs being on the same footing with modern IDEs. I'm happy with what it is, and would be sad if it didn't exist as it does today. (I only ever use emacs without -nw by accident)
Limited by emacs or by developer time?
I also have moved from a workflow in Emacs where I split my buffer and have things side by side, to one where I make new frames and then flip to the frames. This is easier on my eyes as I can have a large window for larger fonts, and I don't have to deal with wrapping in both Windows.
I love Emacs but I agree with the poster about how everything as text can have its drawbacks. I'd love to see a NeoEmacs that addresses some of these issues
What are the top 3 or 5 things or so you think a NeoEmacs should solve/improve?
#+CAPTION: This is the caption for the next figure link (or table)
#+NAME: fig:SED-HR4049
[[./img/a.jpg]]
[0] https://orgmode.org/manual/Images.htmlI believe the Nyxt browser project is eventually looking to add editing support. If they manage to do that robustly it might be just what you’re looking for.
It makes a lot of sense, since Emacs does its own tiling, and one is usually familiar with the keystrokes already, and then you don't have tiling in tiling.
So I keep meaning to go back and try this again, or something similar, but I recall it having issues with a lot of my commonly used applications back when I tried it.
When I get in the tiling mood, I use regolith, which is a nice packaging up of i3 in with the gnome environment. I'd love to have something like that, but built around emacs.
(The crazy thing is I'd probably end up editing source code in CLion inside that... since the CLion Rust plugin is superior to anything I can get in emacs)
I love how this is written, as if there wasn't a time that running emacs in the terminal was the only way to run emacs.
It's 2023, and emacs still sucks in exactly the same way as it did when I first used it in 1995, and when I last used it for everyday coding in 2009-2010. Every time I tried to buff emacs with extra functionality, I found it constantly breaking. I would post to mailing lists about code changes I had to make to get modes working, and I found that other users treated it as a totally normal part of the user experience to have to rewrite some code to get things working in your setup. Comments like this let me know that it happens even to the emacs gurus; they just don't mind it as much and (presumably) can fix it faster than the rest of us.
Emacs doesn't need a GUI library. It needs a rewrite with a different architecture for modern times, and people who love emacs should keep trying despite the many past failures.
Correction: emacs doesn't need anything. It can continue in its present form for decades, but I think it would be nice if it had a bigger, brighter future that might bring me back to it someday.
Because I'm doing non-trivial (but probably not extensive) work on a server that does not have windowing.
Tramp is a hassle for some use cases, especially if you use SSH FIDO to authenticate; either you need set up the session somewhere and use SSH channel multiplexing from a session you established previously, and some protected environments limit the number of channels per SSH connection (often, to one).
Handling a text terminal emulator is a lower common denominator for sure than elisp to fulfill those functions.
I'd also like to point out that emacs has been praised by those with issues with their eyesight for its textual interface working with screen readers far better in practice. Other applications inevitably break their accessibility far more often, because their programming model makes it more expensive to do and keep in good order.
I don't mean to suggest this is how "text editors oughta be," but it's good at least one editor is this way, in regard to its relationship to UI elements and text.
> Because I'm doing non-trivial (but probably not extensive) work on a server that does not have windowing.
Indeed, of the ~7 machines I work on regularly, 5 of them are via ssh and need no GUI. `emacs -nw` is so much quicker and efficient than having to deal with an X server (or equivalent). And the GUI provides me with really no benefit.
One of the last straws for me was that when scrolling down, the cursor moved to stay on the screen. This is one of the quirks of it being a TUI originally. (There is of course a package to for this functionality, but I found it would break frequently.)
Point being that I suspect this is very much a learned behavior and you can grow to like either way. Not that one is superior to the other.
As I move through the document, I already have the location of the cursor origin saved in a register and can jump there, or any of several other locations with a single keypress.
I've always considered the mouse & menu system to be an emergency backup for beginners who have hit a wall. They will probably never be first class citizens.
What editor do you use?
Perhaps, but ideally you'd want your on-ramp experience (or your gateway experience) to be smooth, rather than a full cold-turkey.
I was attracted to emacs because I like writing lisp and I hoped that the high level of customizability would let me smooth over any rough edges. But even though Sublime is not very flexile at all, it’s closer to what I want than I was able to script emacs to be.
I mean, to each their own, but saying this like it's bad is just baffling to me.
Org mode, in particular, is a real pain to script. It's a tree based workflow, but behind the scenes it is all text parsing. There's no "node" structure. When you compare it with Leo[1], the elisp to manage org mode nodes is horrible.
Nevertheless, I am not in favor of this post's primary thesis. The fact that you can attempt forward-sexp in a Magit buffer is a good thing. One of the joys with Emacs is utilizing commands from one Emacs package in another without either author intending it. I, for one, would be very upset if the Magit buffer disabled forward-sexp without a good reason.
But I feel like this is one of the strongest things about org mode and something that keeps it really apart from similar tools.
Rather than being forced to think in "org" and manipulate its "objects", you just manipulate text, and if you happen to shape that text into something org recognizes, then it knows how to work with it.
This is amazingly inviting because you never feel "stuck" like you converted something to the wrong type of thing and now can't get it back, or whatever. Instead if you make a mistake you just.. change it to what it should be. It feels very fluid and you learn it quickly because you're not presented with trying to fit your thoughts into someone else's abstractions. You just write what you want and progressively learn more and more how to naturally shape your work into something that org can help you with.
Having manipulated nodes in both Leo and Org mode, the former is one to two orders of magnitude easier (no exaggeration!), and I did not find anything lacking in it compared to text parsing org nodes in elisp.
I'm not arguing that text parsing should not work, or not be available. But there really should be a solid, robust API to do simple things like:
1. Move a node from one place to another.
2. Get the body of the node (sans any children, drawers, and other metadata).
3. Traverse nodes in whatever order you want (DFS, BFS, random, etc).
The underlying implementations of these functions can handle the text parsing. I shouldn't have to do it every time.
That way the TUI and a more GUI based Emacs could evolve separately without one being hamstrung by the other.
what if there is no WM?
I do most of my work on a cloud machine where i run emacs in screen, for example
https://www.gnu.org/software/emacs/manual/html_node/tramp/Qu...
;; Update [redacted]
(defun [redacted] ()
(interactive)
(find-file "/ssh:[me]@[host]|sudo:[host]:[file]"))I do think regarding things as "text" goes a long way to underestimating what can be done with it. As easy to think of it as serialized symbols, where the symbols can have specific meaning. At this point, the power seems a bit more manifest. If you are lucky (and someone else has put in the work), then you can use familiar "textual" symbol manipulations and that will keep meaning in the other domain that is being represented.
Or did I try something wrong?
But the author isn't trying to stage a region, let alone a subline one. He's trying to stage a whole hunk and says its only working if point is at the start of the line.
Subline staging makes sense for some changes. In that, if it does subline indications of what changed, I would expect I could accept one of the changes, but not the others. That said, I agree it is likely a limitation of git, as much as of magit. And, again, I can't imagine this comes up that often.
This is a genuine question coming from a place of relative ignorance, mind you. I haven't touched VSCode since the dark ages so I don't really know what it adds to the experience.
For those questioning the judgement of having a GUI toolkit in emacs, the answer is simply that the role and scope of emacs has long left behind being a mere text editor. For folks who like the "Lisp Machine that is emacs" I'm surprised the idea of having a modern GUI capability is so looked down upon. I think lots of folks would like a portable lisp machine with a "real" GUI. I mean, if it doesn't impact the closed loop coding and editing experience that folks are used to, what's the harm?
I had some personal projects that I would have liked to, perhaps, do in Lisp. But a requirement was that it be cross platform. I wanted to share my applications with others, and cross platform is a requirement.
And I'm lazy, I do not want to "mess with it", I want it to "just work".
I considered Pharo, but (when I looked), their raw drawing model was still very, very primitive. It was nowhere near what the Browser Canvas model or Java2d is like with their transformations and clipping and paths and what not. The Pharo model was little more than global coordinate line drawing. Plus, they keep redoing their widget toolset. GUIs are really not Pharos drive. Just enough to do another browser is their drive.
Flutter wasn't ready for the desktop yet, friend of mine is a big fan of Flutter right now. But, boy, are (were) Flutter builds slow. You're supposed to be able to a bunch of hot reloading, but that only goes so far.
The Electron style solutions just seemed overwhelming with the scope of browser frameworks (I'm not a front end dev, and I do find the front end world utterly overwhelming). Plus it's huge, the dev turnaround seemed slow when building your project, etc. Serious consideration, people have great success with it, but I chose not to.
I went with JavaFX as I'm a Java person already. Release sizes on par with Electron style apps, but my Clean/Build dev turn arounds are < 10s. I've tested it across Mac/Ubuntu/Windows, and it all seems to work. (JavaFX does not support Wayland, so I don't know what the real impact of that is.)
I did not consider Clojure, but did look at potentially using ABCL, but I honestly just didn't want to have to redo the bindings for everything from CL to JavaFX (and back). It would have been a hybrid model, and likely "the worst of both worlds". Maybe that's not true, that was just my sense.
And there's really no other decent Lispy -> cross platform GUI solution. I'm sure it could be done, but just a lot of work. I like Lisp, but I like getting stuff done more.
So, if eMacs had a rendering model and a decent GUI toolset, I could very well given it serious consideration for my dabblings and madness.
Have you looked at racket/gui?
[0] be sure to review lisp culture of homoiconicity, so not to add too many layers, a bit like M-x customize.. but be a bit crazy too :)
Got curious what this guy uses for the site, but couldn't find a public repo for it with a few minutes of digging. Mostly you couldn't really tell what static site generator someone uses unless it's one that supports themes, and they use one of the popular ones.
[1]: https://andreyor.st/posts/2020-06-05-managing-background-pro...
I do something similar for my blog, except Pelican is my backend.
https://andreyor.st/posts/2022-10-16-my-blogging-setup-with-...
I have not tested it on modern Emacs, but it was fun to write. (It basically finds the largest size that each slide can be displayed in, and displays it at that size. And it of course syntax highlights code blocks with Emacs.)
Do you have a good copyleft alternative that its maintainers can't just turn into closed source, or one that is fully open source and isn't injected with telemetry?