Live data from Hacker News

Why Emacs has buffers

masteringemacs.org

21–30 of 88 posts

Re: Why Emacs has buffers

#21
> Emacs is not bifurcated, but a lapse of judgment 40 years ago could’ve made it so: a complex, string-fiddly world for Serious Programmers; and a safe, boring, but disjointed, world that “users” are expected to use. That’s how most editors and IDEs work, and you have to pay the piper if you want to join the Serious Programmers... But not so in Emacs. You see, in Emacs, the buffer you see and interact with on your screen is the string.

Can someone expand on this? I don't understand it.

Re: Why Emacs has buffers

#22
post #7

Earlier quoted context omitted.

If I may, I'd like to mention a text editor that I am making as an example of relevant skeuomorphism. It's called Tentacle Typer. It makes regular ol' .txt files in mostly the traditional way, but you write text documents as an eldritch tentacle monster with a magic mechanical typewriter inside a steampunk sandbox. https://twitter.com/LeapJosh/status/1469737611824713739

As a person who collects text editors: Wow. Thanks for sharing.

My pleasure. I hope it earns a place in your collection when I'm ready to release. (Trying my best for a demo this month.)

I think one of the coolest features is that you learn different spells depending on what you write.

For example, if you write horror you'll learn spookier spells than if you write romance or technobabble.

https://twitter.com/LeapJosh/status/1519398797079625733 and then you create rituals using those spells powered by yet more writing.

Re: Why Emacs has buffers

#23

For those (like me) being stuck on "skeuomorphic" in the second sentence: > A skeuomorph is a derivative object that retains ornamental design cues (attributes) from structures that were necessary in the original. Skeuomorphs are typically used to make something new feel familiar in an effort to speed understanding and acclimation. They employ elements that, while essential to the original object, serve no pragmatic…

The classic example being the Banana shaped phone receiver icon on android and ios. There are People alive today only know that shape as the call icon and never use that type of land line.

Re: Why Emacs has buffers

#24
post #3

For those (like me) being stuck on "skeuomorphic" in the second sentence: > A skeuomorph is a derivative object that retains ornamental design cues (attributes) from structures that were necessary in the original. Skeuomorphs are typically used to make something new feel familiar in an effort to speed understanding and acclimation. They employ elements that, while essential to the original object, serve no pragmatic…

So, onomatopoeia for the UI?

Not quite? Skeuomorphism is the usage of design elements that in the past were necessary. Many people know the word now due to the UI interface trend in the early 2000s. Skeuomorphism has meaning outside of UIs though. You can see it in your daily life. Common examples are laminate doors that have fake joinery, rivet patterns on a ceramic flower pot, or the lattice of a French window.

Re: Why Emacs has buffers

#25
post #21

> Emacs is not bifurcated, but a lapse of judgment 40 years ago could’ve made it so: a complex, string-fiddly world for Serious Programmers; and a safe, boring, but disjointed, world that “users” are expected to use. That’s how most editors and IDEs work, and you have to pay the piper if you want to join the Serious Programmers... But not so in Emacs. You see, in Emacs, the buffer you see and interact with on your sc…

If Emacs had

    (defun kill-paragraph (string cursor)
        ...) ; resulting in a new string/cursor
its use would look nothing like the equivalent editing operation, and the user and Emacs Lisp worlds would be nearly incommensurate. You might as well have a plugin system!

Re: Why Emacs has buffers

#26
post #23

For those (like me) being stuck on "skeuomorphic" in the second sentence: > A skeuomorph is a derivative object that retains ornamental design cues (attributes) from structures that were necessary in the original. Skeuomorphs are typically used to make something new feel familiar in an effort to speed understanding and acclimation. They employ elements that, while essential to the original object, serve no pragmatic…

The classic example being the Banana shaped phone receiver icon on android and ios. There are People alive today only know that shape as the call icon and never use that type of land line.

At the moment of posting, I am alive, and not only know the shape as that of the handset I grew up using, but have such a phone in my kitchen.

Re: Why Emacs has buffers

#27
post #12
post #11

The C source for Emacs buffer: https://github.com/emacs-mirror/emacs/blob/master/src/buffer...

Pretty neat for a piece of software that's been around for 37 years.

The git history goes quite far back too. The first version and the current version look quite different.

https://github.com/emacs-mirror/emacs/commit/1ab256cb9997cf1...

Re: Why Emacs has buffers

#28
post #21

> Emacs is not bifurcated, but a lapse of judgment 40 years ago could’ve made it so: a complex, string-fiddly world for Serious Programmers; and a safe, boring, but disjointed, world that “users” are expected to use. That’s how most editors and IDEs work, and you have to pay the piper if you want to join the Serious Programmers... But not so in Emacs. You see, in Emacs, the buffer you see and interact with on your sc…

If Emacs had (defun kill-paragraph (string cursor) ...) ; resulting in a new string/cursor its use would look nothing like the equivalent editing operation, and the user and Emacs Lisp worlds would be nearly incommensurate. You might as well have a plugin system!

To expand on some of the implicit knowledge here: it's helpful to know that Emacs user-level commands are just Lisp functions bound to keys (e.g. one could bind kill-paragraph to C-M-k). The command an end-user binds to use interactively is the exact same command that a programmer would use when writing a program.

If things were bifurcated, then as morelisp notes there would be one suite of functions for complex string manipulation, and there would be some binding of keys to commands, and there would be some glue code between them which would have to be written for anything exposed to the user. Which means someone would have to write that glue, someone would have to make choices about it, someone would have to maintain it. That would have required quite a lot of activation energy to move from being a user to being a programmer, as Mr. Petersen points out in his excellent entry.

Instead, in Emacs users can program and programmers can use. Famously, secretaries learned to program Emacs without any guidance or prompting! There is no artificial boundary between user and developer. This is very similar to how Excel enables business users to develop solutions, to be honest, but an order of magnitude more powerful (because Emacs exposes so much more to the user-programmer than does Excel).

Re: Why Emacs has buffers

#30
Small correction:

> Emacs is not bifurcated, but a lapse of judgment 40 years ago could’ve made it so

Emacs uses a gap buffer because TECO used a gap buffer (before it became Emacs, it was just gene ciccarelli’s TECO init file) and that decision goes back 60 years

Post reply on HN