emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Tabs


From: Juri Linkov
Subject: Tabs
Date: Sat, 31 Aug 2019 23:45:07 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

There is a long story of several attempts to implement tabs in Emacs.
Finally now a complete implementation is available for these
etc/TODO tasks:

  ** "Perspectives" are named persistent window configurations.  We have
  had the window configuration mechanism in GNU Emacs since the
  beginning but we have never developed a good user interface to take
  advantage of them.  Eclipse's user interface seems to be good.
  Perspectives also need to interact with the tabs.

  ** Having tabs above a window to switch buffers in it.

Frame-local tabs represent window configurations.
Window-local tabs represent window buffers.

Using such data structures means there is no need in special handling
of saving tabs in the desktop file - both persistence of frame tabs
and persistence of window tabs is already supported by the existing
code in master, because frame tabs are implemented as presentation of
window configurations in the frame parameter saved by frameset as
window states, and window tabs are implemented as presentation of
window buffers already saved by frameset.

Also both implementation of frame tabs and implementation of
window tabs doesn't require using hooks - frame-local tabs for
window-configuration switching doesn't rely on hooks and
window-local tabs for switching window-buffers doesn't use hooks:
window-configuration-change-hook is not used, no hook
window-size-change-functions, no buffer-list-update-hook, no
post-command-hook is used, none of the hooks.

All this makes the implementation as simple as possible,
providing only code for displaying and manipulating the already
existing data structures of window configurations and window buffers
represented in the new display elements tab-bar and tab-line
based on the existing elements tool-bar and header-line.

The prefix '-bar' in tab-bar is by analogy with frame tool-bar, menu-bar.
The prefix '-line' in tab-line is by analogy with window header-line, mode-line.

The tab-bar is located above the tool-bar like in web browsers.
The tab-line is located above the header-line
that is more related to the current buffer.

Frame-local horizontal interface elements are in this order:
--- menu-bar ---
--- tab-bar ---
--- tool-bar ---

Window-local horizontal interface elements are in this order:
--- tab-line ---
--- header-line ---
--- mode-line ---

The implementation of the tab-bar replicates the existing tool-bar.
The implementation of the tab-line replicates the existing header-line.

Tabs on the frame tab-bar represent window configurations.
Tabs on the window tab-line represent window buffers: previous on the
left side from the current tab (current-buffer) and next on the right.

Clicking on the tab in the tab-bar selects its window configuration.
Clicking on the tab in the tab-line selects its window buffer.
Clicking on the close button closes the clicked tab.

Keybindings for the tab-bar:
  C-TAB     - switches to the next frame tab;
S-C-TAB     - switches to the previous frame tab.
Clicking on the plus sign adds a new window configuration tab to the tab-bar.

Keybindings for the tab-line:
C-x <left>  - switches to the previous window tab;
C-x <right> - switches to the next window tab.
Clicking on the plus sign adds a new buffer tab to the tab-line.

'C-x 6 2' creates a new frame-local tab;
'C-x 6 b' switches to buffer in another frame-local tab;
'C-x 6 f' and 'C-x 6 C-f' edit file in another frame-local tab.

I invite everyone to try the new branch named 'feature/tabs'
and to report all found problems.

Authors of all packages that currently had no choice other than to
misuse the header-line for displaying window tabs are welcome now to
adapt their packages for displaying window tabs on the new dedicated
tab-line that doesn't conflict with the header-line anymore.
For example, I tried just to replace header-line-format with
tab-line-format in the package awesome-tabs and the result
shows two separate rows - tab-line and header-line of Info buffer:

PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]