;; -*-no-byte-compile: t; -*- ;;; Tabbar.el --- Display a tab bar in the header line ;; Copyright (C) 2003, 2004, 2005 David Ponce ;; Author: David Ponce ;; Maintainer: David Ponce ;; Created: 25 February 2003 ;; Keywords: convenience ;; Revision: $Id: tabbar.el,v 1.7 2009/03/02 21:02:34 davidswelt Exp $ (defconst tabbar-version "2.0") ;; This file is not part of GNU Emacs. ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as ;; published by the Free Software Foundation; either version 2, or (at ;; your option) any later version. ;; This program is distributed in the hope that it will be useful, but ;; WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program; see the file COPYING. If not, write to ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth ;; Floor, Boston, MA 02110-1301, USA. ;;; Commentary: ;; ;; This library provides the Tabbar global minor mode to display a tab ;; bar in the header line of Emacs 21 and later versions. You can use ;; the mouse to click on a tab and select it. Also, three buttons are ;; displayed on the left side of the tab bar in this order: the ;; "home", "scroll left", and "scroll right" buttons. The "home" ;; button is a general purpose button used to change something on the ;; tab bar. The scroll left and scroll right buttons are used to ;; scroll tabs horizontally. Tabs can be divided up into groups to ;; maintain several sets of tabs at the same time (see also the ;; chapter "Core" below for more details on tab grouping). Only one ;; group is displayed on the tab bar, and the "home" button, for ;; example, can be used to navigate through the different groups, to ;; show different tab bars. ;; ;; In a graphic environment, using the mouse is probably the preferred ;; way to work with the tab bar. However, you can also use the tab ;; bar when Emacs is running on a terminal, so it is possible to use ;; commands to press special buttons, or to navigate cyclically ;; through tabs. ;; ;; These commands, and default keyboard shortcuts, are provided: ;; ;; `tabbar-mode' ;; Toggle the Tabbar global minor mode. When enabled a tab bar is ;; displayed in the header line. ;; ;; `tabbar-local-mode' (C-c ) ;; Toggle the Tabbar-Local minor mode. Provided the global minor ;; mode is turned on, the tab bar becomes local in the current ;; buffer when the local minor mode is enabled. This permits to ;; see the tab bar in a buffer where the header line is already ;; used by another mode (like `Info-mode' for example). ;; ;; `tabbar-mwheel-mode' ;; Toggle the Tabbar-Mwheel global minor mode. When enabled you ;; can use the mouse wheel to navigate through tabs of groups. ;; ;; `tabbar-press-home' (C-c ) ;; `tabbar-press-scroll-left' (C-c ) ;; `tabbar-press-scroll-right' (C-c ) ;; Simulate a mouse-1 click on respectively the "home", "scroll ;; left", and "scroll right" buttons. A numeric prefix argument ;; value of 2, or 3, respectively simulates a mouse-2, or mouse-3 ;; click. ;; ;; `tabbar-backward' (C-c ) ;; `tabbar-forward' (C-c ) ;; Are the basic commands to navigate cyclically through tabs or ;; groups of tabs. The cycle is controlled by the ;; `tabbar-cycle-scope' option. The default is to navigate ;; through all tabs across all existing groups of tabs. You can ;; change the default behavior to navigate only through the tabs ;; visible on the tab bar, or through groups of tabs only. Or use ;; the more specialized commands below. ;; ;; `tabbar-backward-tab' ;; `tabbar-forward-tab' ;; Navigate through the tabs visible on the tab bar. ;; ;; `tabbar-backward-group' (C-c ) ;; `tabbar-forward-group' (C-c ) ;; Navigate through existing groups of tabs. ;; ;; ;; Core ;; ---- ;; ;; The content of the tab bar is represented by an internal data ;; structure: a tab set. A tab set is a collection (group) of tabs, ;; identified by an unique name. In a tab set, at any time, one and ;; only one tab is designated as selected within the tab set. ;; ;; A tab is a simple data structure giving the value of the tab, and a ;; reference to its tab set container. A tab value can be any Lisp ;; object. Each tab object is guaranteed to be unique. ;; ;; A tab set is displayed on the tab bar through a "view" defined by ;; the index of the leftmost tab shown. Thus, it is possible to ;; scroll the tab bar horizontally by changing the start index of the ;; tab set view. ;; ;; The visual representation of a tab bar is a list of valid ;; `header-line-format' template elements, one for each special ;; button, and for each tab found into a tab set "view". When the ;; visual representation of a tab is required, the function specified ;; in the variable `tabbar-tab-label-function' is called to obtain it. ;; The visual representation of a special button is obtained by ;; calling the function specified in `tabbar-button-label-function', ;; which is passed a button name among `home', `scroll-left', or ;; `scroll-right'. There are also options and faces to customize the ;; appearance of buttons and tabs (see the code for more details). ;; ;; When the mouse is over a tab, the function specified in ;; `tabbar-help-on-tab-function' is called, which is passed the tab ;; and should return a help string to display. When a tab is ;; selected, the function specified in `tabbar-select-tab-function' is ;; called, which is passed the tab and the event received. ;; ;; Similarly, to control the behavior of the special buttons, the ;; following variables are available, for respectively the `home', ;; `scroll-left' and `scroll-right' value of `