Next: , Up: Concepts   [Index]


1.5.3.1 Buffer

In Emacs, all files are buffers, but not all buffers are files.

Emacs uses these buffers for more than just editing text. It can also act like an I/O device and talk to another process, such as a shell like bash or even Python.

Almost all of Emacs’s own commands act on buffers. So when you tell Emacs to, for example, search & replace it will actually search and replace on a buffer – maybe the active buffer you’re writing in, or perhaps a temporary duplicate – and not an internal data structure like you might think.

In Emacs, the buffer is the data structure.

This is an extremely powerful concept because the very same commands you use to move around and edit in Emacs are almost always the same ones you use behind-the-scenes in elisp. So once you memorize Emacs’s own user commands, you can use them in a simple function call to mimic what you’d do by hand.