Ask HN: If you were rewriting Emacs from scratch, what would you do differently?
251–260 of 340 posts
Re: Ask HN: If you were rewriting Emacs from scratch, what would you do differently?
#252Not using lisp
why the downvotes? This is a reasonable point of view. I sometimes think using lisp for a language is a little like trying to implement comments within json data.
Emacs just cannot be Emacs without Lisp. Emacs is a Lisp machine; it is tightly integrated with Lisp and needs Lisp to operate. Lisp is at its core principal model.
There are a number of different types of applications that are significantly more difficult to achieve with a non-homoiconic language; check out Hyperfiddle/Electric, there are some videos with demos. Why do you think there were so many attempts to re-create something like Org-mode, yet none of them were hugely successful?
For starters - the Lisp REPL has some significant differences; it just doesn't work the same way as a REPL in, e.g., Python. In Lisp, you can send any piece of code without any prelude or ceremony directly to the REPL. That REPL instance can even be on some remote computer, like a spacecraft millions of miles away (I'm not making up this shit, NASA did it at some point)
Anyway, Emacs is Emacs because of Lisp, not because someone on a whim decided to use Lisp instead of, I dunno, Pascal. Trying to build Emacs on top of some non-Lispy language is futile. It won't be Emacs. Sure, it might be to a certain degree even better, but it won't be even "like Emacs".
Re: Ask HN: If you were rewriting Emacs from scratch, what would you do differently?
#253I'd give it a good editor.
Emacs has an amazingly nice editor, especially for writing in plain language. It even supports right-to-left languages and things like Sanskrit. There are frequent posts in /r/emacs about using it for writing. Many novelists use Emacs for writing, some of them are well-known names - Cory Doctorow, Neal Stephenson, Vernor Vinge, Charles Stross, et al.
There are a number of nice packages that help you with writing - spellchecking, thesaurus, dictionaries, translation, definition and etymology lookup, LLM integration, export capabilities, distraction-free modes, various text manipulation tools and more.
The joke that Emacs is an operating system that simply needs a decent editor has not aged well. It's not even funny in the slightest; it's laughable in the face of the joke teller, telling more about them than Emacs and its editing capabilities.
Re: Ask HN: If you were rewriting Emacs from scratch, what would you do differently?
#254I'd make cursors be positioned within the document instead of on the screen. Currently, Emacs does not support off-screen cursors. If you attempt to scroll a cursor off screen, it will move within the document to stay on screen. This behavior is contrary to all modern text editors, and there is no good workaround. I once made a serious effort to start using Emacs, but ultimately stopped because of the annoying cursor…
Re: Ask HN: If you were rewriting Emacs from scratch, what would you do differently?
#255Earlier quoted context omitted.
I'm confused. On the modern devices I've recently used emacs on (including very low-powered raspberry pi devices), all of your three criteria are already true. What kind of HW are you running emacs on where this isn't the case?
Emacs pauses are almost always due to some operation blocking in the main thread. It's pretty annoying and is mostly a consequence to a lot of things effectively being single-threaded. Stock emacs doesn't do this very often, but third party packages that might do expensive tasks often do
b) Use https://github.com/blahgeek/emacs-lsp-booster
c) Tweak GC vars, see: https://emacs-lsp.github.io/lsp-mode/page/performance/
d) Use plists for deserialization (described in the previous link)
e) Learn how to use built-in profiler and don't hesitate to launch it, sometimes simply disabling some minor-mode in specific setting is all it takes
f) Current state of Tree-sitter in Emacs is a mixed bag - for some modes you get huge improvements, for others it's the opposite. YMMV.
Re: Ask HN: If you were rewriting Emacs from scratch, what would you do differently?
#256Earlier quoted context omitted.
For instant startup I recommend daemon mode and emacsclient. Start emacs via emacs --daemon, open windows (in the terminal or otherwise) via `emacsclient` / `emacsclient -nc` (I use aliases for these).
The solution to "this text editor takes too long to start up" is poorly addressed by the solution to "just leave it running in the background all the time".
emacsclient is useful on its own. For example, I use it to edit just about any text, in any input box in any app, delegating the task to Emacs, or when I want to open some URL in Emacs, while browsing a web page in my browser, or to send some selected text to Emacs.
Re: Ask HN: If you were rewriting Emacs from scratch, what would you do differently?
#257Earlier quoted context omitted.
While Emacs is recognisable for its shortcuts, it is hardly a defining feature. Example: Doom Emacs adds Vim shortcuts, and it is still distinctly Emacs. I think of VSCode as “Emacs, but JavaScript instead of Elisp.” That’s one thing I would not choose, in spite of the good things VSCode brings to the table.
Can I hit one key combination to edit the JavaScript corresponding to any vscode command, debug it and possibly modify it however I want? If not, it’s not really comparable to emacs IMO.
What I meant is that the runtime is arbitrarily extensible at runtime.
But I don't assume that people actually do what you describe.
Re: Ask HN: If you were rewriting Emacs from scratch, what would you do differently?
#258Earlier quoted context omitted.
> If you think that "VI is a superior editor than Emacs", I'm afraid you still have a shallow understanding of both. Thank you for your long and thoughtful prose, so fitting for an emacs user. One day, when you value productivity, might I suggest VI.
> Thank you for your long and thoughtful prose, so fitting for an emacs user. Are you hinting at the fact that I used Emacs to help me write that? Sure I did. Why wouldn't I use Emacs for writing, if all the tools I need are at my fingertips? I have a thesaurus, spellchecking, Google Translate and search, dictionaries, etymology lookup, word counter, Flesch-Kincaid reading ease tester, ChatGPT, Anthropic and other mo…
Re: Ask HN: If you were rewriting Emacs from scratch, what would you do differently?
#259Earlier quoted context omitted.
Strategically thinking, after setting the shredder on fire it will be harder to shred the code of the future emacs clones! :D
> Strategically thinking, after setting the shredder on fire it will be harder to shred the code of the future emacs clones! :D The most realistic future is that emacs begins shipping with a self-shredding feature. C-h s
Re: Ask HN: If you were rewriting Emacs from scratch, what would you do differently?
#260Emacs is fine, but buggy as hell. Their version of Lisp is clearly not suited for any large-scale development. (This trickles down hard into user experience, i.e., lack of parallelism or multithreading.)
Emacs is fine, but buggy as hell. That kind of took 180 turn on that one. Ship is fine, but leaks as hell.