When posing questions on this site, people sometimes talk about "windows" when they mean "frames," and "buffers" or "files" when they mean "windows." So:

Q: What is the difference between a buffer, a file, a window, and a frame?

(I'm posing this question in the spirit of this Q&A combo: to promote correct use of the terms.)

Emacs predates contemporary window-based operating systems, so its terminology also predates the current terms. Unfortunately, it means that new users and experienced users sometimes have trouble making themselves understood to each other, since they're using the terms in different ways.

In brief:

  • "Frames" are to Emacs what "windows" are to everything else
  • "Windows" are subdivisions of frames (think "window panes")
  • "Buffers" hold the contents you display/edit in windows
  • When we "open a file," we are, technically, opening a buffer that "visits" that file

The following annotated screenshot illustrates these points.

annotated screenshot

  • This Emacs session has two frames (blue outline) -- what, for most other programs, we would call "windows."
  • There are a total of three Emacs windows (red outline) open: one in the left frame, and two in the right frame.
  • The single window in the left frame is displaying the scratch buffer. It is not connected to (i.e., visiting) any file.
  • The top window in the right frame is displaying the buffer example.org, which is, in turn, visiting the file ~/path/to/example.org.
  • The bottom window in the right frame is displaying the indirect buffer example2, which has the same contents as the buffer example.org in the top window.

So here's the summary:

  • frames are what you call "windows" in basically all of your other software
  • windows are divisions of frames
  • buffers hold the stuff that you display in windows
  • buffers may or may not be visiting (i.e., be associated with) a file

I would point readers to (1) The glossaries of Emacs Wiki and (2) the Emacs manual for such information.

Also to the EmacsWiki Newbie page, which has lots of good introductory information about such things. And to the Emacs manual in general, which also introduces such things well: C-h r then i followed by typing whatever you want to learn about, e.g., window.

The EmacsWiki page linked from its glossary for entry window includes this graphic, which shows a frame with 3 windows, and indicates the menu bar for the current buffer and the mode lines of the windows. The 3 buffers shown in the windows are named *Help*, drews-lisp-20, and shrink-fit.el.

Emacs frame, windows, and window parts

(There are other combinations of things that could be asked about, BTW, if one really wants to ask such questions.)

  • 1
    +1 Pointing readers to the glossaries and the Emacs manual is the right answer for such standard answers so as to avoid misleading new users. – Emacs User Apr 29 '16 at 1:28

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.