reddit / emacs

Starting emacs without any Elisp and only the C-core?

GlomaldGlumpf · 2022-03-31 00:24
Would it be possible to start Emacs without any of the Elisp code (only the C core) and gradually import pieces of Elisp bit by bit? If yes: would the interface be usable at all? Could you see windows/buffers?
ieure · 2022-03-31 00:35
I don't know for sure, but I suspect not. Emacs is mostly Lisp code, the C bits are pretty minimal. You'd have build it from source to even try. Pretty sure there'd be no UI or way to interactively load in any Lisp. I might be wrong, though.
Alan_Shutko · 2022-03-31 00:47
You could try doing it by running [temacs](https://www.gnu.org/software/emacs/manual/html_node/elisp/Building-Emacs.html) which is done during the build. I do not think it would be usable in any way.
deerpig · 2022-03-31 01:23
To paraphrase William James, when asked about his brother James' impenetrable prose; the question of if you can do this is less interesting than why you would want to do it in the first place.
holgerschurig · 2022-03-31 05:13
Yes, this is possible. Study the build system of the Emacs source repository on how to do this. Basically, the pure C Emacs binary is started and reads in lots of elisp libraries. And then it dumps a part of it's memory contents. That is when bundled together, and you get your final Emacs. So, you certainly can start the C part of Emacs, and load elisp at will from there. You probably cannot use it for editing, as the loading is done in batch mode. But hey, all of Emacs is source, you can mold it to your liking. So ultimately the answer to both questions is "yes".
404cn · 2022-03-31 06:10
Maybe you need uemacs
sunnyata · 2022-03-31 08:20
> his brother James' impenetrable prose James James?
arthurno1 · 2022-03-31 09:53
> I do not think it would be usable in any way. It is usable. You can load everything as in normal Emacs. It is just slower. Emacs is temacs + loaded lisp libraries dumped together as a binary image. Nowadays, since the "portable dumper" the memory dump is not even in the same binary but in it's own binary blob.
arthurno1 · 2022-03-31 09:59
@ /u/ieure > I don't know for sure, but I suspect not. Emacs is mostly Lisp code, the C bits are pretty minimal. You'd have build it from source to even try. ~ 1200 lisp primitives in C is hardly minimal :). > Pretty sure there'd be no UI or way to interactively load in any Lisp. I might be wrong, though. Ya, that is wrong. temacs is the "executable application" part of Emacs. If you are in emacs source folder, try this (or adjust paths to your working dir): src/temacs -l lisp/startup.el& See what happens :). Edit: When I run just temacs, without any arguments, I still get an entire Emacs loaded :). I didn't know myself it worked that way. PS: Since you have blocked me, for me unknown reasons, I can't post an answer to anything below your comments, it has to be this way. If you have some problem with me, you can talk to me instead. I don't remember we have argued something impolitely?
deerpig · 2022-03-31 10:16
Doh! You are correct, that should be William and Henry James.
arthurno1 · 2022-03-31 10:29
> Would it be possible to start Emacs without any of the Elisp code (only the C core) and gradually import pieces of Elisp bit by bit? You can try this, assuming you are in Emacs top source directory: src/temacs -l lisp/startup.el& Study startup.el.
GlomaldGlumpf · 2022-03-31 11:25
Whoops! I have no idea how to even block people I must have done it by accident. I’ll check the settings when I’m at my desktop and see if I can undo it. I can see your answer (obviously), this is super helpful!
GlomaldGlumpf · 2022-03-31 11:27
What’s that?
404cn · 2022-03-31 11:28
https://github.com/torvalds/uemacs
arthurno1 · 2022-03-31 11:34
Is not you, is ieure :-). By the way, no problems, thank you for the answer. Thought I was impolite to you or something.
Alan_Shutko · 2022-03-31 11:42
There is a lot of lisp that gets loaded in load up.el. You won’t get very far if it is empty.
agumonkey · 2022-03-31 11:42
just tried it, even raw temacs embeds some elisp it seems
arthurno1 · 2022-03-31 12:07
> There is a lot of lisp that gets loaded in load up.el. Yes, in startup.el and elsewhere. > You won’t get very far if it is empty. Of course not, but temacs is not really empty, you have all those lisp primitives, like cons, car, cdr etc implemented in C which are available, and more. You can of course load libraries with it, otherwise it would be hard to create Emacs dump. If you load startup.el, you get your "standard" Emacs: src/temacs -l lisp/startup.el&
rswgnu · 2022-04-02 04:21
Emacs without Lisp is as useful as Russia with Putin. Not to compare the two, apparently one still functions.