Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

diff between frame and window in emacs [closed]

Tags:

emacs

I just started to use EMACS, it's amazing.

So I had this question, what's the difference between a window and a frame ?

my understanding is :

  1. you can press a 'q' to quit a frame not a window.
  2. frame is composed of a series of windows
  3. frame will contain a subset of all buffers.
  4. frame is more like the concept of project while window is the for each file.

3 and 4 are not correct seemingly, as when I try to jump between frames I still saw all the buffers.

so are my understanding correct? or I am not doing it in a correct way ?

is there project like function for EMACS to organize buffers into different projects, so that when I jump between buffers, I only saw the buffers localize to that project?

can some one talk more about the project concept in EMACs related with the frame and window?

like image 787
zinking Avatar asked Apr 25 '12 03:04

zinking


People also ask

What is an Emacs frame?

A frame is a screen object that contains one or more Emacs windows (see Windows). It is the kind of object called a “window” in the terminology of graphical environments; but we can't call it a “window” here, because Emacs uses that word in a different way.

What is a window in Emacs?

29.1 Basic Concepts of Emacs Windows. A window is an area of the screen that can be used to display a buffer (see Buffers). Windows are grouped into frames (see Frames). Each frame contains at least one window; the user can subdivide a frame into multiple, non-overlapping windows to view several buffers at once.

How do I close a frame in Emacs?

Typing C-x C-c closes all the frames on the current display, and ends the Emacs session if it has no frames open on any other displays (see Exiting). To close just the selected frame, type C-x 5 0 (that is zero, not o ).

How do I open a Emacs window?

To open a new frame, select Make New Frame from the Files menu or press C-x 5 2 (for make-frame). Emacs makes a new frame containing the current buffer and puts it on top of the current frame.


1 Answers

This is a bit confusing, but it's all due to history. Emacs was first created back in the days of text terminals, before the GUI was common. All you had was lines of monospaced text, usually around 80 columns by 24 rows. Emacs had the ability to split the screen into multiple windows, so you could see more than one file at once.

Then graphical terminals and the GUI came along, and "window" came to mean the GUI variety. But Emacs had dozens of functions and variables with "window" in their names, which dealt with its split-screen type of window. Renaming those functions would break all the Emacs Lisp code that used them. Therefore, when Emacs gained a GUI interface, its designers decided that it would be easier to come up with a new term to mean "GUI window", and keep "window" to mean "old-style Emacs window". The new term they came up with was "frame" (because frames are what surround windows).

So when Emacs talks about a "frame", it means the same thing that other programs would call a "window". In Emacs, a frame is basically a terminal emulator that can be resized on demand. Each frame acts pretty much like an Emacs running in a text terminal; the frame can contain one or more old-style Emacs windows.

However, all the frames of a single Emacs process are linked. Any buffer can be displayed in any window of any frame, and you can have the same buffer displayed in multiple windows and/or frames at the same time.

You can find more details in the chapter of the Emacs manual on "Frames".

So your (3) is not correct; every buffer is available in every frame. (4) is not really correct either; it's up to you how many frames and/or windows you want to use. Personally, I normally use 1 frame with 1 or 2 windows. I occasionally use a second frame if I want more space to display one file while working on 1 or 2 other files.

like image 178
cjm Avatar answered Sep 24 '22 02:09

cjm