News for hackers. Stuff that matters.
Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by pjmlp on Tuesday November 08, 2022 @02:20PM (#33523082)
Emacs is a survivor from the days of Lisp Machines, hardly a UNIX.

"Evolution of Emacs Lisp"

https://dl.acm.org/doi/abs/10.1145/3386324

Also the UNIX "philosophy" besides its quote on a book, has been hardly a thing on commercial UNIXes.

Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by anthk on Tuesday November 08, 2022 @02:59PM (#33523496)
I was about to say that. Emacs not just the LISP machines. Emacs' comes from ITS, an OS praised by RMS, basically the anithesis of Unix. Everything was hackable and shareable. No perms.

The closest in philosophy may be Guix(SD), but, for that, the Unix utilities should be converted into optional tools and make Scheme both the command line prompt shell, the configuration tool and the API.

Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by thrown_22 on Tuesday November 08, 2022 @03:06PM (#33523584)
I've ran chsh on top of a (virtual) Guix(SD) installation. It was rather nice but is still _not_ a lisp machine: https://www.youtube.com/watch?v=o4-YnLpLgtk
Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by AnimalMuppet on Tuesday November 08, 2022 @03:05PM (#33523572)
> Emacs is a survivor from the days of Lisp Machines, hardly a UNIX.

So? Did the author claim otherwise? Not that I could see. Does the OS of origin negate any of the author's claims about Emacs? No, it doesn't. Emacs on Unix gave the author a tool that fit their workflow and their mindset. Who cares what OS it originated on?

> Also the UNIX "philosophy" besides its quote on a book, has been hardly a thing on commercial UNIXes.

The UNIX philosophy, as quoted by the author, was supported by every commercial OS I have ever seen. (They added some other stuff, but they all provided the environment where the philosophy could play out well.)

Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by pjmlp on Tuesday November 08, 2022 @03:09PM (#33523623)
Given the architecture of commercial UNIXes, and the plethora of options in every command, hardly.
Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by anthk on Tuesday November 08, 2022 @03:12PM (#33523655)
No. Emacs' a huge REPL with zillions of ELISP modules for lots of cases.

Emacs and its grandpa ITS (and Emacs for ITS) are very different beasts.

Get SIMH and emulate ITS on it. https://gunkies.org/wiki/Installing_ITS_on_SIMH

Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by whartung on Tuesday November 08, 2022 @03:40PM (#33524007)
The funny thing is that I put vi more in the "UNIX Philosophy" camp.

Specifically, as a user of vi, especially with normal vi (vs vim), a routine workflow for me is !command some block of text, or the entire file to some utility or another.

And the idea here is that with little effort, the entirety of the UNIX environment (at least the CLI tools environment) is at my beck and call. I've munged gobs of text through most any utility imaginable. I've use vi as an interactive pipeline. Running data through one sequence, then running it through another, or a 3rd. It's like an interactive pipeline debugger with undo.

It's not that emacs can not do it, of course it can. You can run a region through a shell command as easily as anything.

But, folks don't. Rather they rely on the extensive, emacs universe to solve those problems. There's lisp for that. Like the Java and JavaScript eco-systems, where "everything" gets rewritten into that world, the drive has been to port the essential utilities into the whole of emacs, rather than having it work with the system surrounding it. There's all sorts of good reasons for this, but at the same time, all of those routines and such are cut off from "unix". While its straightforward to leverage grep, sort, awk, et al from within emacs, it's less so the other way around. I'm sure it's possible, but it's not trivial.

In a world of composite solution development, a monolith stands out because it acts more as an unscalable tower rather than a thing to touch for enlightenment.

Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by anthk on Tuesday November 08, 2022 @04:01PM (#33524241)
nvi, entr, xargs, awk, sed, perl...
Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by gw98 on Tuesday November 08, 2022 @04:26PM (#33524534)
Completely agree with this.

Unix is centred around composing lots of individual tools that do one job well. Emacs is the antithesis of this. It's closer to Visual Studio.

Honestly in the 30 years I've been using Unixes I have never needed anything but vi/vim with a few lines of configuration, mostly to satisfy some of the newer fussier language indent requirements (yaml, python). Most of the non trivial data processing is done with external tools (sed, grep, awk etc) where the knowledge and power is reusable for other tasks external to editing things!

Only on Windows have I had to leverage anything more complicated.

Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by agumonkey on Tuesday November 08, 2022 @04:57PM (#33524871)
I think there's strange rotation. Emacs being based on lisp is all about composing lots of individual bits. Unix too.
Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by gw98 on Tuesday November 08, 2022 @05:08PM (#33524991)
Indeed. But it's a nested abstraction.
Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by ParetoOptimal on Tuesday November 08, 2022 @06:14PM (#33525569)
> Unix is centred around composing lots of individual tools that do one job well. Emacs is the antithesis of this. It's closer to Visual Studio.

Only if you consider emacs as a tool rather than a tool-maker.

Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by pjmlp on Wednesday November 09, 2022 @02:47AM (#33528532)
Emacs is a Lisp machine with a text editor as sample application.
Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by __d on Tuesday November 08, 2022 @08:14PM (#33526456)
I think it's a common misconception that Emacs is not a collection of simple tools.

There are two major differences: Emacs' "shell" is the ELisp interpreter, not (eg) bash; and, Unix uses the whitespace-separated text stream as its common language, and Emacs uses the text buffer.

There are analogous tools in both environments, although in Emacs, most of the "little language"-driven tools use ELisp instead, giving simpler cooperation.

There's a lot of truth in the "Unix is just a device driver collection for Emacs" model though: there's little need for most of the Unix toolset if you're adept at Emacs.

I think there's a much more interesting discussion to be had in comparing the relative merits of text streams (Unix) vs text buffers (Emacs) as a unifying abstraction for a suite of programmer's tools.

Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by gw98 on Wednesday November 09, 2022 @02:36AM (#33528464)
I'm well aware of how Emacs works.

mg probaly fits better. It's just an editor. One small component.

Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by MichaelCollins on Wednesday November 09, 2022 @01:58AM (#33528293)
> Unix is centred around composing lots of individual tools that do one job well.

By this standard, the Unix philosophy has never been realized.

Even when the tools work as advertised, they're hardly doing it well. How do you delete a file called -foo? `rm -- -foo`. Do you know what -- is? It's kludge! It's kludge that needs to exist because Unix's entire paradigm of argument passing is legacy crap.

And historically, the tools didn't even work as advertised. Before GNU came along, there used to be all kinds of hidden landmines in common Unix utilities, like tools which silently truncated long output lines because they were using static buffers instead of dynamic memory allocation. GNU's style guide specifically warns against doing this, because it used to be the Unix status quo. Things like this get left out of the romantic tales of Unix's history, leading newbies to view Unix with rose tinted glasses.

As for "doing one thing", nobody even knows what that means. What is the difference between one thing and two things? Should rm not be able to remove directories because rmdir exists? That's subjective, what qualifies as "one thing" is inherently subjective.

Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by gw98 on Wednesday November 09, 2022 @02:42AM (#33528501)
Oh completely agree. But the philosophy is spot on. I've applied it to many problems over the years successfully outside the domain of Unix. The reality is however less than ideal.
Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by bbarnett on Wednesday November 09, 2022 @03:09AM (#33528653)
Agree, but don't like your rm example.

rm -- just means end of args, and it can conveniently be left off. That's not a kludge, it's a feature.

A feature that many command line utils (GNU grep) support.

Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by legends2k on Wednesday November 09, 2022 @06:20PM (#33539613)
It's kludge since you are special casing for some files and not for others e.g. rm abc vs rm -- -xyz. If Unix utilities had a different form of specifying args which didn't meddle/overlap with file names this kludge wouldn't have to exist.
Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by bbarnett on Thursday November 10, 2022 @07:14AM (#33545322)
But it isn't a kludge, you are supposed to use it for all files, you are just granted the option of not.
Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by sgbeal on Wednesday November 09, 2022 @09:02AM (#33531710)
> How do you delete a file called -foo?

rm ./-foo

Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by legends2k on Wednesday November 09, 2022 @06:44PM (#33539869)
Yeah, but still kludge because we don't do that for all files, do we? If it didn't start with a minus, we'd just drop it. So there's no one true way, as we'd like to think.
Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by gw98 on Thursday November 10, 2022 @05:57PM (#33554826)
I have never felt the desire to, or accidentally created files with minus at the start.
Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by legends2k on Wednesday November 09, 2022 @06:28PM (#33539699)
Thanks for your answer. Never realised the overlap between rm and rmdir. Actually the philosophy is a nice guideline but blindly holding on to it for the heck of it is childish. Your comment made me realise that.
Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by BlueTemplar on Tuesday November 08, 2022 @04:43PM (#33524702)
Why vi vs vim ? (I have no experience with vi, only vim.)
Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by jrumbut on Tuesday November 08, 2022 @05:07PM (#33524971)
In vim there are a lot of emacs-like plug-ins that reimplement functionality found elsewhere.

You can still use the vi style workflow though.

Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by shagie on Tuesday November 08, 2022 @05:48PM (#33525361)
vim is the improved version of vi, which is the visual interface to ex, which is the extended editor ed... the one true editor ( https://www.gnu.org/fun/jokes/ed-msg.txt )

You will not infrequently find vim and vi links to the same executable.

    /usr/bin % ls -l ex vi vim
    lrwxr-xr-x  1 root  wheel        3 Aug 24 03:59 ex -> vim
    lrwxr-xr-x  1 root  wheel        3 Aug 24 03:59 vi -> vim
    -rwxr-xr-x  1 root  wheel  5155568 Aug 24 03:59 vim
The difference between which way you have argv[0] slightly changes the functionality... but it's the same thing.

ed remains its own thing.

    /bin % ls -l ed
    -rwxr-xr-x  1 root  wheel  235296 Aug 24 03:59 ed
THE MIGHTY ED HAS SPOKEN!!!

?

Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by mrlemke on Tuesday November 08, 2022 @06:07PM (#33525515)
To expand on shagie's answer, vi is a separate utility except when it's not (f.g. Linux vi is usually a minimal vim build running in vi-compatible mode). For a more pure taste of vi, install nvi or use vi on *BSD.
Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by jrumbut on Tuesday November 08, 2022 @05:05PM (#33524953)
Exactly, because of bad habits developed elsewhere I sometimes find myself puzzling (as an example) "how do I remove HTML tags in vim?" rather than "how do I remove HTML tags? OK, now do that in vim."
Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by bigbillheck on Tuesday November 08, 2022 @07:46PM (#33526239)
That paper is about 'emacs lisp', not emacs itself, which came out of systems running on various PDPs.
Re:Unix as a tool forge (and how Emacs fits in Unix philosophy) by pjmlp on Wednesday November 09, 2022 @02:48AM (#33528542)
Yes, and most of them predate UNIX.