2009-06-29

emacs tab bar

> > Again, not sure exactly what you're referring to. I have never seen
> > tabs in the MacPorts built version of Emacs.
>
> From http://aquamacs.org/features.shtml:
>
> "Aquamacs Emacs can organize the files that you're editing in tabs.
> This preserves screen space but allows you to keep track of all those
> open files easily. You've probably seen the tabs in Safari, Firefox or
> the OS X Terminal program."
>
> See also http://aquamacs.org/images/aquamacs-screenshot.pngtoo.
> Aquamacs tabs are similar to firefox tabs.

The tabs in Aquamac Emacs is based on the tabbar.el module.

tabs in emacs is quite different from tabs in firefox or any modern app's tabs.

The bottom reason for this is that emacs doesn't do tabs, instead, it has buffers. You can have many windows (what emacs calls frames), and each window can access any buffer. However, tabs in modern apps does not work like that. In modern apps, each windows has a set of tabs. You could move a tab from one window to another in some (such as Firefox version 3 or later), but in general, you don't have a set of tabs that any set of windows can access or display.

in practice, this means when you use tabs in emacs, it's quite different. Tabs in emacs is merely just a prettified GUI for accessing buffers.

See this page on emacswiki:
http://www.emacswiki.org/emacs/TabBarMode

the following section is largely written by me. I don't like some of the minor editing that made it as is today, but here's the section as it is, which still largely correct:

The tabbar.el is extensively modified and used by AquamacsEmacs to be as close to modern UI’s tab bar as possible. (see AquamacsEmacs’s official website screenshot for a look. You can also try to get the source code from AquamacsEmacs, but it may not work with standard emacs.)

Note that tabbar mode as implemented in Emacs is a bit different than tabs in web browsers or IDEs. In a web browser, each window may have several tabs, and each window’s tabs stay with that window. Namely, you cannot have Window A’s tab jump to window B, unless you drag it over (Firefox 3 support this, for example. Safari 3.2 does not.). However, the tabs implemented in emacs with tabbar mode is more like a GUI-based display of buffer listing, displayed on top of the window. In particular, tabs does not stick to a particular emacs’s Frame, and conversely, each Emacs Frame can display a tab that is also shown in another Emacs Frame.

Also, emacs’s tabbar mode’s tab can be hidden, as if showing only the current “page” of a tab set, called a “group”. By default, tabs are grouped by major mode. So, for example, if current buffer is in html-mode, all the tabs shown are other buffers in html-mode. If there are no other html-mode buffers, then you will have only one tab, even if you have lots other buffers. All your dired buffers, C-mode buffers, java-buffers, etc, are in other tab group and is hidden. You have to click on a special tab widget to switch to them, or use keyboard shortcut to switch tab or tab group.

What is considered as a tab group can be customized. You could set it up so every buffer is of the same group.

Tab bar mode is implemented using a special emacs display area at the top of Emacs Window, not Emacs Frame. (For example, if you split a window into 3 panes, each will have a tab bar). Some other modes also use this area. For example Info, Dired, Slime, ERC, ruler-mode, etc. So that when switching to these modes, the tabs will not shown. You can get the tabs back by typing “M-x tabbar-local-mode”.

Xah
∑ http://xahlee.org/

No comments:

Post a Comment