Emacs Frame and buffer

来源:互联网 发布:淘宝拍卖翡翠手镯不错 编辑:程序博客网 时间:2024/06/05 16:53

One of the most universally features of Emacs is the ability to edit multiple buffers at once and to display more than one buffer using windows and frames.

Conceptually, Emacs is different from most applications in two important ways. First, its window terminology is different. Second, Emacs buffers are not tied to windows or frames, unlike most applications.

Frame: a separate GUI window

window: a portion of the current Emacs display.

但是框架跟窗口都是用来显示buffer.一般我们都会把文件跟窗口关联起来。一般我们还是比较喜欢只用一个Emacs frame然后通过C-x b进行buffer互切。


How many buffers are active in Emacs

1:the buffer list C-x C-b

2: The buffer menu(active buffers and commands for navigating them)

3: buffer Pop-up menu (hold down Ctrl and click left mouse button)


when you start Emacs,it generate two buffers

*Messages* :accumulate messages from its startup and from the mini-buffer.

*scratch*  :just a temporary scratch-pad where you can type, but wont save unless using C-x C-w


C-x b  The default buffer is the buffer that most recently disappeared.


deleting buffers

Deleting doesn't put you at risk of losing changes, if you have changed(associated with a file). Emacs ask if you will save the change

1:delete a buffer is such a basic operation that is on the Emacs tool-bar, the X symbol

2:C-x k  for kill-buffer, Emacs show the buffer name, type another name if the one being displayed is not you want to delete.

3:M-x kill-some-buffers  Emacs ask you about deleting each buffer.


Saving Multiple Buffers

C-x C-s  saving buffer,也就时相当于保存修改到所关联的file

C-x s    save-some-buffers  y for yes, n for no, ! no more asking . save this buffer and no more.


Read-only buffers

The file you just want to browse through Emacs, to prevent touching the keyboard accidentally from happening

C-x C-q  you'll notice percent signs(%%)appear on the left side. asterisks(**)indicate modification. this command toggles the buffer's read-only status.


Working with the Buffer list

C-x C-b -> buffer list then you can use a set of one-character command to work with the buffers listed.

d or k  D appears in the first column, then press X (execute) to delete. if connected with files. Emacs will ask you first.

u       unmark the buffer, such as D will disappear.

s       S appears in the first column, this is to save buffer. you can repeat this command, then press X to execute.

%       buffer's status from read-write to read-only

1       display the buffer in a full-screen window

q       quit buffer list

Windows

as you add more windows, the older ones shrink. The screen is like a pie, you can cut it into many pieces. but the more pieces you cut, the smaller they have to be.


Creating Horizontal Windows

C-x 2 for split-window-vertically

C-x 4 f   C-x C-f

C-x 4 b  C-x b


Creating Vertical or side-by-side windows

C-x 3 split the window vertically.当你这么做以后,因为空间变小了,一行并不能够放下以前的东西,这个时候会有个箭头表示后面还有。

C-x < 看右边的东西

C-x > 看左边的东西


Move Between Windows

C-x o o stands for other.进行切换,如果现在一个屏中有很多个buffer,他会按照从左向右,从上到下,进行切换。


Enlarging and shrinking windows

因为在你分屏的时候都是均分的,所以会造成你想工作的区域也越来越小。

C-x ^ make window taller

C-x } make window wider

C-x { shrink-window

C-u C-x 后面跟上面[^{}]中任何一个,然后它的变化将是以4行或4列为单位

Frame

C-x 5 2  make-frame,Emacs will make a new frame containing the current buffer.

创建的它一般会放在当前buffer的上面,但是如果它完全覆盖了当前的buffer,你可以在.emacs进行设置,让他们分开(tell them apart)。Subsequent Frame

Frame name : 默认开启时叫Emacs@system name, 如果创建了multiple frame,Frame name display buffer name as their title.

C-x 5 b  move to a buffer and put it in a new frame.

C-x 5 o  move between Frames

C-x 5 0  delete-frame  delete current frame

C-x 5 f  find-file-other-frame

C-x 5 b  swith-to-buffer-other-frame