[HN Gopher] Emacs standing alone on a Linux Kernel
       ___________________________________________________________________
        
       Emacs standing alone on a Linux Kernel
        
       Author : signa11
       Score  : 105 points
       Date   : 2023-04-19 08:45 UTC (1 days ago)
        
 (HTM) web link (informatimago.free.fr)
 (TXT) w3m dump (informatimago.free.fr)
        
       | wkdneidbwf wrote:
       | this is both cool and exactly why i don't want to use emacs.
        
       | FullyFunctional wrote:
       | In 1989 when I was part-time IT staff at Arhus University, CS.
       | Dept. we had to turn down a professor who requested doing exactly
       | this with his Sun workstation (it might have been possible, but
       | we didn't have the resources to support it).
       | 
       | My only requirement for my first personal PC (T1800, 386/sx, 4
       | _MiB_ , monochrome) was that it could run True Emacs (on Linux) -
       | I could certainly have used this, but `exec emacs` achieves
       | nearly the same.
        
         | Y_Y wrote:
         | Fortunately I don't work at universities much any more, but I
         | found IT to be even less accommodating than at a megacorps. My
         | department luckily realised this early on and classed all
         | computers as "experiment equipment" and had our own techs to
         | any necessary admin.
        
         | hestefisk wrote:
         | DAIMI! Did you code in TRINE?
        
         | anthk wrote:
         | Well, back in the day you could run Emacs and a Scheme
         | interpreter (MIT Scheme) as a textinfo format under an i386
         | just fine. No X, of course.
        
       | abudabi123 wrote:
       | Emacs on seL4kernel with Plan9userspace and remote desktop to
       | disposable Mac or Linux shortlived desktopui should be very
       | secure for the researcher.
        
         | hprotagonist wrote:
         | unless you have a hankering for benson&hedges cigarettes.
        
           | froh wrote:
           | /me (from outside the loop): "huh?"
        
             | nescioquid wrote:
             | Sounds like a reference to The Cuckoo's Egg (fun read).
        
       | teddyh wrote:
       | Before GRUB, (i.e. with LILO), you could easily do this at any
       | time by just booting with the added kernel parameter
       | "init=/usr/bin/emacs".
        
         | planede wrote:
         | You can configure additional kernel parameters just fine with
         | GRUB.
        
           | teddyh wrote:
           | Yep, I was thinking of initramfs on /boot vs. direct root fs
           | mounting, not GRUB vs. LILO.
        
         | ilyt wrote:
         | I mean, that works and always worked, bootloader really have
         | nothing to do with it (as commandline can be baked into kernel
         | image even if bootloader wouldn't support setting it)
        
           | teddyh wrote:
           | True; what I was thinking of was not GRUB or LILO, but the
           | fact that setting the init process from a kernel command line
           | is less useful for hacks like these if the initial root file
           | system is only an initramfs images from /boot, and does not
           | contain Emacs.
        
       | UniverseHacker wrote:
       | I can't believe nobody posted this quote yet:
       | 
       | "Emacs is a great operating system, lacking only a decent text
       | editor"
        
         | jb1991 wrote:
         | It probably was not posted because it's untrue. No point in
         | posting inaccuracies. Emacs is a great text editor.
        
           | UniverseHacker wrote:
           | "decent" or "great" are personal emotional responses, they
           | cannot be true or false
        
           | [deleted]
        
           | smitty1e wrote:
           | Jokes are the unit tests of our understanding. Sure, the gag
           | "fails", but it makes the point of the general usability of
           | the infamous Lisp-machine-in-editor-drag.
        
             | [deleted]
        
       | hestefisk wrote:
       | Eight megabytes and constantly swapping
        
         | krylon wrote:
         | That joke hasn't aged terribly well, emacs on my desktop is
         | currently at 269MiB. "Eventually Mallocs All Computer Storage"
         | still applies, though.
        
       | Ruq wrote:
       | I'd just like to interject for a moment. What you're referring to
       | as Linux, is in fact, Emacs/Linux, or as I've recently taken to
       | calling it, Emacs plus Linux. Linux is not an operating system
       | unto itself, but rather another free component of a fully
       | functioning Emacs system made useful by Emacs.
       | 
       | Many computer users run a modified version of the Emacs system
       | every day, without realizing it. Through a peculiar turn of
       | events, the version of Emacs which is widely used today is often
       | called Linux, and many of its users are not aware that it is
       | basically the Emacs system, developed by the Emacs Project.
       | 
       | There really is a Linux, and these people are using it, but it is
       | just a part of the system they use. Linux is the kernel: the
       | program in the system that allocates the machine's resources to
       | the other programs that you run. The kernel is an essential part
       | of an operating system, but useless by itself; it can only
       | function in the context of a complete operating system. Linux is
       | normally used in combination with the Emacs operating system: the
       | whole system is basically Emacs with Linux added, or Emacs/Linux.
       | All the so-called Linux distributions are really distributions of
       | Emacs/Linux!
        
         | ppezaris wrote:
         | sorry if i'm out of the loop, but i've heard what you describe
         | as GNU/Linux, not Emacs/Linux. did emacs change to be the
         | branding label of things like the compiler, the ----
         | 
         | just saw that you're probably making a joke, as i just found
         | this :) https://www.gnu.org/gnu/linux-and-gnu.en.html
        
         | jamesgill wrote:
         | 2023 is finally the year of the Emacs operating system on the
         | desktop.
        
           | ddalex wrote:
           | Does it come with a text editor ?
        
             | kristopolous wrote:
             | Sure but it's a real bitch to learn though
        
             | nequo wrote:
             | It does:
             | 
             | https://github.com/emacs-evil/evil
        
         | red_phone wrote:
         | Absolutely genius.
        
           | anthk wrote:
           | You joke, but an Emacs with framebuffer support and with
           | everything statically build would be Stallman's dream: a
           | next-gen LISP Machine.
        
             | bheadmaster wrote:
             | Even better - compile Emacs as a kernel module, and run it
             | in ring 0. ELisp would give it memory safety, so memory
             | protection would not even be necessary. System calls have
             | never been so cheap!
        
       | pjmlp wrote:
       | I guess in such configuration 8 MB should be enough.
        
       | trashface wrote:
       | Been a long time since I used emacs (had to stop, it was hurting
       | my pinky) but I did use M-x shell a lot, I always thought it ran
       | bash but from this description I understand emacs has its own
       | shell?!
        
         | excircul wrote:
         | M-x shell does run bash (or whatever is your user's shell)
         | 
         | M-x eshell is a shell implemented completely in Emacs Lisp and
         | integrates with Emacs really nicely
        
       | Y_Y wrote:
       | While this is a bit silly, I'd love to emacs as a DE option
       | alongside KDE, Gnome etc.
        
         | bigfishrunning wrote:
         | You can! https://github.com/ch11ng/exwm
        
       | pierpa wrote:
       | Next: Emacs on bare metal.
        
         | dingosity wrote:
         | Or a CPU that executes e-lisp as it's machine code.
        
       | bigdict wrote:
       | I don't get it. It's Emacs installed on Linux. So what?
        
         | photonbeam wrote:
         | People joke about emacs being an operating system, here emacs
         | is the whole userland
        
           | JadedEngineer wrote:
           | IIRC a single-thread, slow userland that is. Emacs is the
           | only CLI program I've ever run that would take a second or
           | two to render when quickly switching tmux panes. I'll never
           | get the "use emacs for everything" mantra.
        
             | forty wrote:
             | Weird, I haven't used Emacs for that long and I really feel
             | why I'd want to use Emacs for everything. I don't mostly
             | because it seems annoying to setup the slack integration +
             | SSO and that kind of thing. But I'd definitely want to
             | write all my texts in (evil) Emacs, have all my to-
             | do/Gitlab task/slack reminder /etc in org mode and review
             | Gitlab PRs without ever opening a browser, etc
        
             | dingosity wrote:
             | because it does what i want my computer to do.
             | 
             | sure, VI would be faster, but i would have to use vi.
        
               | q7xvh97o2pDhNrh wrote:
               | vim is also pretty slow these days.
               | 
               | Even after I did the usual toil of analyzing startup
               | times and trimming my vimrc, its speed/responsiveness
               | correlates inversely with the size of the text file
               | that's open. And we're not talking about some
               | artifically-constructed benchmark -- just an extra-long
               | ordinary text file (or log file, or code file) sitting
               | around will be enough to make vim start to feel slow.
               | 
               | Maybe we're all just getting old, and the dream of "one
               | text editor for everything" is becoming one of those
               | quaint old notions of yesteryear.
        
               | JadedEngineer wrote:
               | > Maybe we're all just getting old, and the dream of "one
               | text editor for everything" is becoming one of those
               | quaint old notions of yesteryear.
               | 
               | I mean, that's only ever been a dream in the emacs
               | community. Vim might have toy plugins for other stuff,
               | but by and large people use it to edit period. As it
               | should be, isn't the whole UNIX philosophy to do one
               | thing well? If I want email or a text browser in the CLI
               | (I don't) I'll use dedicated, better, faster programs,
               | each on a tmux pane that I can use instantly with a
               | keyboard shortcut, rather than wait for a slow emacs
               | buffer to load.
        
           | ihatepython wrote:
           | Wouldn't that be kind of bloated?
        
             | HopenHeyHi wrote:
             | This is actually smaller: https://busybox.net
             | 
             | https://re-ws.pl/2020/11/busybox-based-linux-distro-from-
             | scr...
        
               | anthk wrote:
               | Uhm. On the 2.4 era, you could boot a Linux floppy to
               | play Nethack on it: NeHaBoDi.
               | 
               | https://nehabodi.sourceforge.net/
               | 
               | I wonder if I could do the same with Slashem.
        
         | pama wrote:
         | Other than emacs, the only available command on that Linux
         | system is mount. Not even a shell.
        
           | bigdict wrote:
           | Then how are the commands in the code listings executed?
        
             | ertian wrote:
             | eshell (emacs' shell) has it's own versions of common shell
             | commands, written in elisp.
        
               | bigdict wrote:
               | eshell only makes an appearance in step 5, the rest are
               | regular sh/bash commands.
        
             | samus wrote:
             | Emacs' `dired` mode might or might not be able to produce a
             | directory listing by itself. However, the author admits
             | that
             | 
             | > Of course, quite a number of syscalls are missing from
             | emacs (not available as elisp primitives), so as it is, it
             | would be hard enough to do EVERYTHING with emacs, but this
             | is a starting point.
        
         | tenebrisalietum wrote:
         | The Linux kernel, when it boots, will perform all its setup,
         | then launch a program.
         | 
         | That program has traditionally been `/sbin/init` which launches
         | all background things that need to be running, including your
         | `getty`'s for console login, your `sshd` for SSH login, and
         | your `gdm`'s or what not for GUI login.
         | 
         | Lately it's `systemd` which does the same in a less simple but
         | more flexible/featureful manner.
         | 
         | Here, there is literally no other process running but Emacs -
         | it's your "login shell."
         | 
         | This is the first step in replacing `systemd` with `emacs`, and
         | it will take less space and be easier to use. /s
        
           | HeckFeck wrote:
           | Finally, I get to write my init scripts in Emacs Lisp!
        
             | samus wrote:
             | You know, .emacs bankruptcy is a thing...
             | 
             | https://www.emacswiki.org/emacs/DotEmacsBankruptcy
        
       | zokier wrote:
       | Do you actually need mounted rootfs to run emacs though?
        
       | lisper wrote:
       | > Another, more realistic, alternative would be to use a Common-
       | Lisp implementation with a FFI and portable Hemlock.
       | 
       | Now there is an intriguing idea...
        
       ___________________________________________________________________
       (page generated 2023-04-20 23:01 UTC)