tabbar.elの設定

20100425tabbar

■概要
tabbar.elを使うことによりタブブラウザの様にバッファを切り替えることができる。
タブバー左にある不要なボタンを消すための設定を調べるのに時間がかかってしまったのでメモメモ。



■問題点
現状の設定ではC-x C-fで開いたバッファが残ってしまう。



■入手先
Browse EMHACKS Files on SourceForge.net
http://sourceforge.net/projects/emhacks/files/



■参考
EmacsWiki: Tab Bar Mode
http://www.emacswiki.org/cgi-bin/wiki/TabBarMode

Amit's Thoughts: Emacs: buffer tabs
http://amitp.blogspot.com/2007/04/emacs-buffer-tabs.html



■設定

;; グループ化せずに*scratch*以外のタブを表示
(require 'cl)
 (when (require 'tabbar nil t)
    (setq tabbar-buffer-groups-function
	  (lambda (b) (list "All Buffers")))
    (setq tabbar-buffer-list-function
          (lambda ()
            (remove-if
             (lambda(buffer)
               (find (aref (buffer-name buffer) 0) " *"))
             (buffer-list))))
    (tabbar-mode))

;; 左に表示されるボタンを無効化
(setq tabbar-home-button-enabled "")
(setq tabbar-scroll-left-button-enabled "")
(setq tabbar-scroll-right-button-enabled "")
(setq tabbar-scroll-left-button-disabled "")
(setq tabbar-scroll-right-button-disabled "")

;; 色設定
 (set-face-attribute
   'tabbar-default-face nil
   :background "gray90") ;バー自体の色
  (set-face-attribute ;非アクティブなタブ
   'tabbar-unselected-face nil
   :background "gray90"
   :foreground "black"
   :box nil)
  (set-face-attribute ;アクティブなタブ
   'tabbar-selected-face nil
   :background "black"
   :foreground "white"
   :box nil)

;; 幅設定
  (set-face-attribute
   'tabbar-separator-face nil
   :height 0.7)

;; Firefoxライクなキーバインドに
(global-set-key [(control tab)]       'tabbar-forward)
(global-set-key [(control shift tab)] 'tabbar-backward)