
Emacs As Operating System - fogus
http://c2.com/cgi/wiki?EmacsAsOperatingSystem
======
TeMPOraL
Friend gave me this link once: [http://www.informatimago.com/linux/emacs-on-
user-mode-linux....](http://www.informatimago.com/linux/emacs-on-user-mode-
linux.html) \- Emacs standing alone on a Linux Kernel.

BTW. you can get a pretty good Emacs-as-an-OS feel with the combo of Emacs,
Conkeror [0] and StumpWM [1]. They are all extremely extensible (via Emacs
Lisp, JavaScript and Common Lisp, respectively) and can be even made to talk
to each other.

[0] - [http://conkeror.org/](http://conkeror.org/)

[1] - [http://www.nongnu.org/stumpwm/](http://www.nongnu.org/stumpwm/)

~~~
jlgreco
> _BTW. you can get a pretty good Emacs-as-an-OS feel with the combo of Emacs,
> Conkeror [0] and StumpWM [1]._

This sort of setup is exactly what makes me, a Vim user, think I may have made
a mistake by not picking up Emacs instead.

~~~
krichman
I love Vim so much but I sure wish it had a proper scripting language without
requiring me to recompile the whole binary to get partial functionality.

Has anyone used Vile? I tried to compile it once and it looked to be quite
onerous to fix all of Clang's whinging. Evil?

~~~
jlgreco
I think evil mode in emacs is probably the best bet. However I've messed
around with elisp a bit in the past though and I can't say I am thrilled
enough with it to make the jump. I wish one of the projects to get Emacs going
with a scheme would get off the ground...

If mzscheme/racket scripting support for Vim were given the love that python
support is getting instead, that would please me immensely. It seems _nobody_
is using that though.

------
lispm
there are all kinds of random shitty pages on c2.com.

Emacs is an editor extensible in Lisp. Nothing more. Just like Autocad is a
cad program extensible in Lisp. Autocad is also no Lisp OS. Just like
Quicksilver is a publishing program extensible in Lisp. It's still no OS. Just
like Audacity is a sound editor extensible in Lisp. Still no OS.

An OS is Movitz. Written in Lisp. Runs on Intel and talks to the hardware.
Talks to the graphics card. Keyboard. Network card.

Please, not every shitty Lisp interpreter which can print to the screen and
take user input is an operating system. Not every Lisp program which can send
mail is an operating system.

How do you know that some Lisp is actually an operating system? A good rule of
thumb is this: Is the network stack talking to the ethernet interface written
in Lisp? Is the file system and the block level interface to the disk written
in Lisp? Is the routine which formats the disk written in Lisp? Is the routine
which puts a file system onto a blank disk written in Lisp? If that's the
case, then you have a winner. Then it looks like it is a Lisp OS.

~~~
fhd2
Considering that you can't even write an OS kernel in pure C (Linux has a lot
of inline asm IIRC), writing one in Lisp seems like a fairly unrealistic,
slightly weird dream.

But "Operating System" is being used ambiguously. Can Emacs be an OS kernel?
Um, no. Can Emacs be a shell/UI replacement? Yes, I think so. The discussion
appears to be partly about that.

~~~
klibertp
> writing one OS in Lisp seems like a fairly unrealistic, slightly weird
> dream.

It's not - it actually was done[1]. There were OSes written in other high-
level languages, like Smalltalk and Forth (which may not be "high-level", but
at least it's higher level than C).

[1]
[http://en.wikipedia.org/wiki/Lisp_machine](http://en.wikipedia.org/wiki/Lisp_machine)

~~~
jfb
I'm not sure I'd classify Forth as higher level than C; in many ways, it
operates on abstractions more akin to assembler. In every way, it's really,
really strange.

~~~
JulianMorrison
Agreed. Typeless, completely unsafe, treats RAM as a contiguous byte array
with a dictionary growing one way and data stack growing the other, allows
using the return stack as scratch space... it's very asm-ish.

~~~
evincarofautumn
It is a very good way of managing complexity, though, at the level you would
write a program in assembly. And higher-level stack languages (such as Factor)
bring that same degree of complexity management to application-land.

------
VLM
Technically these guys are all talking about emacs as a CLI not as an OS. I
don't think they're calling for reimplementing the e1000e network card driver
in elisp as much as commenting out a getty on /dev/ttyWhatever and replacing
it with a screen/tmux connection to an emacs session or a zillion other ways.

------
samograd
Now that we've learned from 'Emacs as Operating System', how about we move
into the future.

As the saying goes, "Emacs is a great OS but it's got a crappy text editor".

"Firefox/Chrome is a great OS but it's got a really crappy text editor that
has about as much power as Notepad(TM)"

How about we figure out how to embed a real text editor into the edit fields
of web pages?[1]

Oh, and if it only worked under Linux, I don't see a problem with that.

[1] [http://emacs.1067599.n5.nabble.com/An-Emacs-plug-in-for-a-
br...](http://emacs.1067599.n5.nabble.com/An-Emacs-plug-in-for-a-browser-
Firefox-td191685.html)

~~~
kaonashi
That's kind of the direction Lighttable seems to be going. The entire editor
runs inside node-webkit, so you can have a browser window running inside your
editor.

~~~
samograd
No, I want a real editor inside my browser.

~~~
samograd
Firemacs is decent, but still has a few hangups:

    
    
        https://github.com/kazu-yamamoto/Firemacs
    

It's the closest thing to a real editor on the I've been able to find.

------
gavinpc
This article was interesting:

[http://tkf.github.io/2013/06/04/Emacs-is-
dead.html](http://tkf.github.io/2013/06/04/Emacs-is-dead.html)

The lack of multi-threading is #1 on his list, and it seems to me for good
reason. If one of my emacs buffers locks up (which can happen for any number
of reasons), the whole session is hosed.

Notwithstanding that, one thing I'd love to see is an FTP client mode
something like FileZilla.

~~~
hollerith
>If one of my emacs buffers locks up (which can happen for any number of
reasons), the whole session is hosed.

I have used Emacs every non-vacation day for the last 22 years, starting with
version 18 and extending through version 24, on over a dozen computers, on
Linux, OS X and a proprietary Unix, in text mode and with a GUI. I think I
understand Emacs internals pretty well, and I cannot imagine what you mean by
"if one of my Emacs buffers locks up".

~~~
LukeShu
go-mode (at least used to) have a bug in the auto-indent code that would
occasionally throw it into an infinite loop. This should only affect the
buffer with the code being indented. I should be able to switch buffers,
switch to another frame, and edit other code. I should be able to kill the
buffer. However, I can't, as the lisp is stuck trying to parse go code that
can't be parsed. Now, my Emacs session, which may include several unsaved
files, my IRC sessions, and connections to remote hosts, must be killed.

~~~
hollerith
Now I see: great grandparent's "emacs buffer locks up" refers to the (multi-
threaded) way he (and probably you) wish Emacs worked, not the way it actually
works.

Typing control-G does not get you out of the infinite loop?

~~~
gavinpc
Both this and problems like LukeShu mentioned. For example, I had a problem
where org-mode would hang in certain cases when using \mdash with pretty-
entites turned on. Or csharp-mode would hang when editing around preprocessor
directives. Emacs becomes non-responsive in such cases. It would be cool if I
could just close that buffer, like a browser tab that had crashed.

This and the fact that all async processing has to be done through OS jobs (or
something like that) make it unsuitable as a replacement for many kinds of
app.

~~~
xyzzy123
When you're using zenirc and Gnus all day as well as editing, network issues
also block emacs. Which is why I stopped doing that.

------
fspeech
I think the Emacs as OS feeling particularly rings true for those using
Windows. It certainly makes Windows a lot more usable for me.

With dynamic languages the ability to run REPL inside an editor is also a huge
plus. In Emacs the way you can interact with text is pretty much unlimited.
For example, with the right modes you can pretty much free form evaluate any
expression anywhere in the editor. One has to use it to experience the power.

------
toolslive
The SELF guys
[http://en.wikipedia.org/wiki/Self_%28programming_language%29](http://en.wikipedia.org/wiki/Self_%28programming_language%29)
had the same dream, but used a different strategy. They wanted to replace
underlying components by a rewrite in SELF, one component at a time. Until the
only thing left was a SELF system.

~~~
agumonkey
I think the SqueakVM was developped in the same way. Can't remember where I
read this. </remembering in progress>

------
erez
emacs the Operating system is both the idea of the LISP machine and the
situation that since it is extremely extensible, you can use it as a shell,
for irc or mail, read pdf and view images, listen to music and do anything
that doesn't require a modern web browser, or video player.

For me that was the situation for a while, nothing but Firefox and emacs. I
even used it for IM and Twitter. All I needed was for it to render the web and
I could ditch anything but it.

~~~
kjs3
No, it really isn't. A Lisp OS (like Genera) is about extensibility down
toward bare metal, not up towards applications. As you point out, if all you
want to do is live your whole computing life inside of Emacs and hacking about
with Lisp, people have been doing that for years (decades) without an
underlying Lisp OS. Having a Lisp OS is being able to live inside that
environment and being able to say things like "I'm going to add a new queuing
scheme to networking" or "I wonder what happens if I change how the GC
subsystem works" and the ability to do that is in the environment, in Lisp,
all the way down.

------
davidw
Once upon a time people made fun of Emacs for being bloated:

Eight Megs And Constantly Swapping

I think those people would have fainted at the thought of some of the Java
IDE's these days.

~~~
bitwize
To be fair, Emacs still doesn't have anything quite like the extensive support
for things like refactoring that Eclipse does. Not without bulky kluges like
CEDET, anyway.

~~~
fhd2
Well, you can turn Emacs into an IDE, but then you have an IDE, which seems to
inevitably include slowness and bloatedness. That's what CEDET is, basically,
I couldn't bear using it.

I don't find it hard to live without auto completion and friendly refactoring
wizards. regex replace and grep/sed do the job for me. I might be wasting a
bunch of seconds here and there, but I'm quite sure I'm saving more than that
in loading/hanging time.

~~~
davidw
The major difference seems to be that those Java IDE's hook directly into the
compiler, so they "know about" the language's syntax and libraries in a way
that Emacs likely never will.

That's a nice thing in some ways, but my guess is that when you try and edit,
say, Erlang or something else, those big IDE's are just going to sputter and
flail because they're outside their comfort zone. Emacs is more of a rugged
jeep in that, ok, it doesn't know all the methods for all the classes in Java,
but throw some Erlang, Tcl, Ruby, ASM, or whatever else at it, and it'll
handle it ok, just as it does a decent job for Java, C, Perl or whatever else.

~~~
klibertp
When I write Erlang and I hit ":" after a module name, I immediately see a
list of functions with arity and docs, thanks to Distel. The same is true when
I hit a "." when writing JavaScript, thanks to js2. It's the same for Python,
too, thanks to elpy.

There is a great support for refactoring too - for Python it's Rope and it
works quite well. It's a bit slow to start sometimes, but that's equally true
for "bloated Java IDEs".

I don't think there's anything my teammate can do in his PyCharm which I can't
in my Emacs. And if there is something like that, and it's useful, then I'm
sure it will come to Emacs soon enough.

To summarize: Emacs is an editor for _programmers_ and can be programmed (with
3rd party or your own scripts) to have any feature you'd like. Setting up an
Emacs environment which is on par with other IDEs takes a bit of work, but is
possible.

------
goldfeld
"What's more, it's about the most portable operating system ever."

So browsers and ECMAScript are the new EMACS. Looks about right.

~~~
agumonkey
Emacs as text editor with hackable presentation and interpreter. Browsers as
hypertext with hackable presentation and interpreter.

------
tadfisher
More like "Emacs as default shell", as Emacs is next to worthless without all
those userspace utilities.

~~~
gosub
Emacs as default init, shell, window manager and "desktop" environment. Emacs
has a reimplementation of almost all basic shell commands [1][2], in eshell.
You get a unix style shell that works in windows too.

[1]
[http://www.gnu.org/software/emacs/manual/html_mono/eshell.ht...](http://www.gnu.org/software/emacs/manual/html_mono/eshell.html#Built_002dins)

[2]
[http://www.masteringemacs.org/articles/2010/12/13/complete-g...](http://www.masteringemacs.org/articles/2010/12/13/complete-
guide-mastering-eshell/)

------
jms
Emacs is used as an operating system (interface), by blind users! Emacspeak
adds speech syntheses and more to Emacs, and can do better than traditional
screen readers in many ways due to being able to easily access the underlying
lisp states easily.

My father has difficulty seeing, and spends most of his computer time within
Emacs, occasionally switching to Gnome (for certain websites) or a speech
enabled console.

------
latk
The most amazing discovery I made was a minor mode that put a battery
indicator into the status line. Emacs as OS – effectively true.

------
gprasanth
Whoa anyone can edit the text? What site is this?

~~~
hga
It's the original wiki! See
[http://en.wikipedia.org/wiki/Wiki#History](http://en.wikipedia.org/wiki/Wiki#History)

------
ableal
This made more sense in the days when 80 column by 25 lines were all that one
could see into a computer, and BSD Unix shells had no sensible response to
arrow keys ...

In those days, having three or four Emacs buffers where one could have a
couple of files being edited, a shell session, and the output of the compiler
was considered a blessing.

The rest of the "OS" moniker referred to things such as email and NNTP clients
written in Elisp. It was really possible to start the day in Emacs and never
leave, and I saw some people do it, although it was never quite my cup of tea.
Fortunately, megapixel displays and window systems soon came to the rescue.

------
tytso
The main reason why emacs can't be an operating system (or at least a decent
one) is that it doesn't support multi-threading. And even if you added multi-
threading to emacs, the fact that all of the elisp code out there has no
locking and doesn't expect other threads to be modifying various data
structures and buffers out from under them, means that it really can't be done
at all in any kind of practical way.

~~~
LukeShu
No multi-tasking doesn't mean it can't be an OS, just not a decent OS. DOS was
not a multi-tasking OS. Prior to ITS, the MIT AI Lab (which RMS was a member
of) were opposed to multi-tasking OSs. Lack of that feature doesn't make it
not an OS.

------
konceptz
Forgive me for this but...

Now if only Emacs as an OS had a good editor.

~~~
DennisP
evil-mode

------
wprl
I miss emacs more than I like Sublime Text… never really liked it as an OS
though (bash is better).

------
kjs3
Those of us who actually used Genera on a Symbolics Lisp Machine really,
really hope that anyone who contemplates this sets their sights a helluva lot
higher than GNU Emacs. All of this mythologizing GNU Emacs as something more
than a pale imitation created on hardware with a tiny fraction of the
expressive power of the real thing is like watching some cargo cult culture
talk about how they're going to build a real airplane out of bark and vines.

~~~
malandrew
FYI:

[http://www.cliki.net/VLM_on_Linux](http://www.cliki.net/VLM_on_Linux)

[http://www.ugcs.caltech.edu/~weel/lispm.php](http://www.ugcs.caltech.edu/~weel/lispm.php)

[http://thepiratebay.sx/torrent/3769989/Symbolics_Open_Genera...](http://thepiratebay.sx/torrent/3769989/Symbolics_Open_Genera_2.0_for_Alpha_-
_complete_package_with_Lisp)

~~~
kjs3
I'm waaaay ahead of you here, but thanks for putting the links up for those
who aren't in the know.

And before someone cranks one of these up and nit-picks some functionality GNU
Emacs has that this doesn't, do try and remember that serious development of
Genera for all practical purposes ended before Stallman released the first
public release of GNU Emacs.

~~~
malandrew
Awesome. I'm trying to get the Open Genera on OS X now and I'm running into
problems getting the ES40 emulator built and compiled for OS X.

How are you running OpenGenera?

