25 ms·
A community-driven port of Emacs to Rust
- purplezooey 8y agoAnybody else remember when it was Eight Megs and Constantly Swapping... good times..
- pmiller2 8y agoNice operating system, but it really needs a good editor, amirite? ;) In all seriousness, see https://news.ycombinator.com/item?id=14826070 https://news.ycombinator.com/item?id=14826070 and http://wiki.c2.com/?EmacsAsOperatingSystem http://wiki.c2.com/?EmacsAsOperatingSystem
- TeMPOraL 8y ago> Nice operating system, but it really needs a good editor, amirite? ;) You're rite :). True Emacs enlightenment comes when you realize that this is not a joke - that Emacs really is a kind of OS, and that it offers a much better experience than traditional OSes for any task that's mostly about text (whether linear or 2D). Which is quite a lot of tasks, actually.
- komali2 8y agoI'm playing around with emacs, slowly trying to get it to feature parity with vscode to see if I could one day use it as a main editor. One thing I'm constantly surprised by is how slow random stuff is in emacs. Maybe my setup is fucked? But simple stuff like holding my "scroll down one line" macro is not smooth at all, the time it takes to get from launch to accepting commands is way higher than vscode, scrolling with the mousewheel is gross, and worst of all, there's input delay on text input. Maybe it's the chrome effect - vscode seems faster because it's hogging my ram? I wish I had checked the memory usage before posting this. It's a shame because I like the idea of emacs, but I simply can't seem to get it anywhere near as good as vscode.
- mrob 8y agoI put some serious effort into trying to use Emacs a few years ago and had the same experience. It's not so bad in the default configuration, but by the time you've installed enough LISP code to reach feature parity with modern editors it slows down annoyingly. Eclipse is noticeably faster.
- mgalgs 8y ago> Eclipse is noticeably faster. You definitely had something misconfigured then... Not saying that's your problem, emacs could do a lot more to be friendlier to newcomers. I'm just saying, don't be so quick to judge it until you've gotten with your local emacs nerd to see what's wrong with your setup.
- komali2 8y agoAre you an emacs nerd willing to peek? Maybe it's just spacemacs by definition is fucky, but my machine is a beast so I feel like other people would be complaining about slow spacemacs if that were the case and I can't find much of that out there. init.el and .spacemacs: https://github.com/komali2/Configs/tree/master/emacs https://github.com/komali2/Configs/tree/master/emacs
- throwaway427 8y agoYeah it's spacemacs. Any soup to nuts emacs distribution like this is going to be slow. I experience it all the time in doom. You don't have anything misconfigured. Features like helm, ivy, projectile, etc cost. Linters and autocomplete can really make emacs jank. All this stuff is configured out the gate in these distributions.
- zeveb 8y agoI've found that prelude, at least, isn't too bad, as long as it's not running on my phone. I really like spacemacs (I'd love to get back to using vi keybindings in emacs), but man is it slow. Awfully cool, though.
- m463 8y agomaybe that should be: Exa Megs And Constantly Swapping or Escape Meta Alt Control Shift
- NinoScript 8y agoWhat a nice job they’re doing. I wish them luck
- hu3 8y ago"Rust has a fantastic learning curve." Is this some kind of typo?
- justinpombrio 8y agoIt's very smooth after you climb the initial brick wall :-). EDIT: Let me say something of substance. There's a steep learning curve for getting past Rust's borrow checker. But the language documentation and compiler error messages are the best I've seen of any language. I wouldn't say that Rust is an easy language to pick up, but it's surprisingly easy to learn for what it does.
- wwright 8y agoMuch better than C++’s “climbing the stairs to Moria”
- deleted 8y ago[deleted]
- gpm 8y agoI doubt it. Rust's learning curve is much better than C/C++ (assuming your target is "reasonably competent at writing code other people would want to use" and not "can make a linked list").
- hu3 8y agoEasier than C/C++ doesn't mean much and certainly doesn't grant a language "fantastic learning curve" status.
- saagarjha 8y agoC isn't really that complicated; it just makes it a lot easier to make mistakes.
- smt88 8y ago> easier to make mistakes That sounds like a core part of the definition of "steep learning curve"
- melling 8y agoMuch of Emacs is written in its own version of Lisp. There has been some effort to use Scheme, using GNU Guile https://www.emacswiki.org/emacs/GuileEmacs https://www.emacswiki.org/emacs/GuileEmacs Emacs with a better Lisp option would be a big improvement. With a faster Lisp, perhaps less of Emacs would need to be written in C/Rust.
- cnasc 8y agoMinor correction: guile Emacs doesn’t replace Emacs lisp with scheme. It just uses guile as a backend for Emacs lisp.
- microcolonel 8y agoMinor addition, Guile Emacs does allow you to use Scheme in addition to elisp, AFAIK.
- armitron 8y agoMinor addition, Guile Emacs is a dead project since not a single person from the core Emacs development group cares enough about it to work on it. Emacs Lisp is getting better all the time feature-wise, is portable to all main operating systems (good luck running Guile on Windows and macOS without issues) has enormous user base and is rock solid.
- na85 8y agoCan't speak for Windows but Guile runs on my mac just fine.
- girzel 8y agoWhat would make most sense is just to have it Lisp all the way down. SBCL, top to bottom!
- z3phyr 8y agoThat should be the goal. To please rms, one can always use a GPL language implementation too..
- euske 8y agoDoes it have unexec? cf. http://emacshorrors.com/posts/unexecute.html http://emacshorrors.com/posts/unexecute.html
- geofft 8y agoWait, what's the reason for preventing a dumped and reloaded emacs from being re-dumped?
- tedunangst 8y agoAs linked, it's mostly incompatible with ASLR. If you were to undump to a different address, all the pointers break.
- geofft 8y agoWhy doesn't that affect the initial dump/unexec? (Or in other words - if the answer is that ASLR is turned off for either initial exec or reexec, why not keep it turned off so that a third exec works?)
- tedunangst 8y agoOh, it does. Sorry, I missed the point about the double dump. No clue about that. I'm happy not knowing.
- lokedhs 8y agoEmacs has finally gotten rid of unexec. It's replaced by the portable dumper which which essentially serialised the state of the application using its own format.
- testcross 8y agoIf I remember correctly, the same kind of hack is used by atom to allow fast startup.
- gpm 8y agoAssuming this issue is up to date - yes, but it's on the todo list to remove: https://github.com/remacs/remacs/issues/105 https://github.com/remacs/remacs/issues/105
- xvilka 8y agoHopefully one day NeoVim will follow their example.
- aasasd 8y agoThe “Porting Elisp primitive functions” section in the readme is impressive for a passerby. Rust code looks like OOP magic instead of C's straightforward struct-juggling: https://github.com/remacs/remacs/blob/master/README.md#porting-elisp-primitive-functions https://github.com/remacs/remacs/blob/master/README.md#porti...
- brians 8y agoCan you expand on that? The rust example looks like pattern matching and dispatch into a standard library. The C looks like some macros and tests, and dispatch into a standard library. But I’m much more comfortable with ML than with C; What do you see that is magic?
- aasasd 8y agoWell, I'm not sure what the “y.atan2(x)” thing is reasoned to be in Rust, but it sure doesn't look like C's manual unboxing and plain function calls. Not magic, I guess―just looks pretty much like good old OOP, which I'm being told it's not. I suppose the “Same(x)” thing caught me by surprise―dunno, though, if it's built-in magical syntax or again something OOPy: in Python, ‘Some’ would likely be a class implementing a special method ‘__match__’.
- steveklabnik 8y agoMethod calls are syntax sugar in Rust; it compiles to the same code as atan2(y, x). The only difference is it will auto ref for you in the method style. You can call it either way if you prefer. Those are just regular floats, not objects. Some is an enum constructor that’s in the prelude, so it’s just automatically imported. It’s a library type, nothing specially built into the language.
- oblio 8y agoIt's not OOP, it's pattern matching, which is functional more than anything. The other thing is generics (Option<EmacsDouble>) which is not necessarily OOP either and the option type itself which is functional (https://en.wikipedia.org/wiki/Option_type https://en.wikipedia.org/wiki/Option_type).
- girzel 8y ago> Code written in Rust easily interoperates with C. This means we can port to Rust incrementally, and having a working Emacs at each step of the process. This seems really important, and crucial to preventing the project from getting stuck at the pie-in-the-sky stage. Start it going, and dog-food it as it comes!
- smt88 8y agoPartial/staged rewrites have become the only way to rewrite many mature projects. Facebook (PHP/Hack), Firefox (whatever/Rust), and large web projects (JS/TypeScript) could only be rewritten piecemeal.
- caymanjim 8y agoWhy? Other than an academic exercise, what's the point? One could make plenty of arguments for why Rust is a better language than C, but...if it ain't broke, etc. This seems like an enormous exercise with little if any payoff, and unless the core Emacs community decides to jump on board, it's just a pointless fracturing.
- dmitriid 8y agoOh. Emacs is broken. For example: “Internally, Emacs still belives it’s a text program, and we pretend Xt is a text terminal, and we pretend GTK is an Xt toolkit.” [1] If this fork removes all the legacy cruft and hacks, it’s only for the better. [1] https://m.facebook.com/notes/daniel-colascione/buttery-smooth-emacs/10155313440066102/ https://m.facebook.com/notes/daniel-colascione/buttery-smoot...
- tedunangst 8y agoWhat is it about rust that makes it impossible to pretend Xt is a text terminal?
- dmitriid 8y agoWow. If any program had ”we have to pretend to be a deprecated system that pretends to be an even more deprecated system that pretends to be an obsolete system to prevent Emacs from flickering”, HN would crucify it. With Emacs? Oh, it’s perfect!
- Latteland 8y agoIt's actually important that emacs is a text program and also has a gui version. All the time I use a program on the command line that needs me to edit something, so it pops up a textmode (vt100 ui forever) emacs that I can edit a file in. Sometimes in other contexts this can happen where it's an xwindows gui. When I'm on a windows machine I can do either also.
- dmitriid 8y ago
- josteink 8y agoAFAIK GNU Emacs is written using a completely 100% FOSS GPLed stack, preferring GNU components over others when alternatives exist. So how does Rust play into this? Is the Rust-stack “compatible”? For this to succeed long term they will have to get their changes mainlined, and it would be a shame if anything as petty as licensing or political over GNU/non-GNU should stop it.
- Athas 8y agoI don't think this is the objective. It would certainly never happen - for political reasons, there is no way Emacs would ever depend on a non-GNU compiler.
- omeid2 8y ago> as petty as licensing or political over GNU/non-GNU should stop it For any substantial project, licensing is a matter of make it or break, for philosophical and economic reasons. If you think one's philosophy of life or economic approach is pity, you're out of your damn mind.
- piinbinary 8y agoI just downloaded and built that. I was presently surprised to find that it "just worked." It picked up my .emacs, my color theme, my extensions and all the associated data. The only observable difference between it and real emacs was that it ran significantly slower. Presumably that will go away with time. Great work!
- rcthompson 8y agoI'm surprised there would be a significant speed difference. My understanding is that they're mostly rewriting the C parts in Rust, which shouldn't change the speed much. Maybe byte-compilation is disabled for remacs or something? Or perhaps some debug options are enabled by default?
- jaccarmac 8y agoByte-compilation isn't disabled. The slowness is due to a couple things. First is the bindgen layer between Rust and C slowing down certain calls. Porting so far has been wide rather than deep, so Rust code ends up having to call C sooner rather than later. In addition most of the ported functions have been rewritten in a pretty naive style that doesn't take full advantage of Rust. There was some discussion in Gitter or issues about this a couple weeks back, but I cannot seem to find it tonight. Apologies.
- rcthompson 8y agoThis is something I've been wondering about. Porting from C to Rust one function at a time sounds nice, but presumably the end result would be a Rust program with an identical program structure to the original C, which as a result doesn't take very much advantage of Rust's features. Is the goal to port all the way to Rust and then refactor to actually make the code Rust-ish?
- jaccarmac 8y agoYep! Even now it's not quite as bad as identical program structure. I mean, the high-level is fairly similar, but even now individual functions can look significantly different. Emacs' C is already largely written in a high-level, macro-rich style to deal with Lisp objects (tagged pointers). So Rust already gives wins there w.r.t. more explicit types and From/Into impls over macros. And over the last couple weeks there has been discussion about replacing xml.c with a native Rust backend for XML parsing.
- lprd 8y agoI'm a vim user but I would really love to take a peek into the emacs realm (also interested in Rust development). Is this a good project to start with? Also, I use vim-plug to manage my plugins, is there an equivalent in the emacs world? Any tips or recommendations are welcome :)
- midgetjones 8y agohttp://spacemacs.org/ http://spacemacs.org/
- zaiste 8y agoThere is also Doom Emacs [1] which provides Vim experience out-of-the-box. It also comes with a fantastic theme. I've been using Vi/Vim for more than two decades now. Doom made me feel at home. I used to envy Emacs all these nice features such as Org Mode, Magit and even the ability to use Lisp to configure your environment. Now it's the best of both worlds. I just wish Emacs' onboarding process / cohesiveness was as good as in VS Code. It would be a dream come true. ;) PS. I've recorded a short Doom screencast for newcomers [2] [1]: https://github.com/hlissner/doom-emacs https://github.com/hlissner/doom-emacs [2]: https://www.youtube.com/watch?v=rCMh7srOqvw https://www.youtube.com/watch?v=rCMh7srOqvw
- lprd 8y agoThis looks really interesting. How does it compare to something like spacemacs? I'm confused by all the different "flavors" of emacs. I think I would prefer something like doom to spacemacs since, from the looks of it, you stay inside the terminal. If I want a gui, I'll just use VS Code. Thank you for the recommendations!
- rgoulter 8y ago> Is this a good project to start with? Probably not. You'd be better off looking at an Emacs distribution to see what's available. Sacha Chua's Visual Guide to Emacs is excellent. http://sachachua.com/blog/series/a-visual-guide-to-emacs/ http://sachachua.com/blog/series/a-visual-guide-to-emacs/ There's also an awesome list for it. https://github.com/emacs-tw/awesome-emacs https://github.com/emacs-tw/awesome-emacs I'd suggest looking at Magit or Org-Mode. These are often cited as "killer features"/"gateway drugs" for Emacs. > ... what's the equivalent of vim-plug ... I liked the discussion on straight.el's readme: https://github.com/raxod502/straight.el/blob/develop/README.md https://github.com/raxod502/straight.el/blob/develop/README....
- pzone 8y agoGreat to see this project still going strong!
- chalst 8y agoHow does compile time compare for GNU Emacs vs remacs?
- qubex 8y agoWhen did the word ‘porting’ lose its notion of reusing similar code on another architecture and become synonymous with “rewriting in another language”? This isn't a port at all. It represents a more major bifurcation than does even a traditional ‘fork’. It's very imprecise use of language.
- ses1984 8y agoCan't port be used to mean both changing platforms or languages? You have a project. You want to change one thing about it, and as little else as possible. If you're porting to platforms maybe that's pretty easy these days, porting to languages is harder and you'll have to make more incidental changes along the way.
- alexozer 8y agoI've taken "porting" to equally mean either. Besides, porting to another language is in a good sense "porting to another platform".
- qubex 8y agoThat’s why I was very specific in mentioning ‘architecture’ in my original question. What you’re mentioning is more akin to the definition of a platform.
- deleted 8y ago[deleted]