平衡点
2014/06/02
_ Elscreen から Tabbar へ移行
Elscreen に特に不満があるわけではないのだけれど.
# source: scheme (unless (locate-library "tabbar") (el-get 'sync '(tabbar))) (require 'tabbar nil 'noerror) ;; 有効化 (tabbar-mode 1) ;; キーバインド: C-o で screen 風 <-- elscreen の挙動に似せる (global-unset-key (kbd "C-o") ) (global-set-key (kbd "C-o n") 'tabbar-forward) (global-set-key (kbd "C-o p") 'tabbar-backward) ;; elscreen で新たに screen を作成した場合には *scratch* で開いていたので, ;; それっぽくしてみた. (global-set-key (kbd "C-o c") (lambda()(interactive)(switch-to-buffer "*scratch*"))) (global-set-key (kbd "C-o C-c") (lambda()(interactive)(switch-to-buffer "*scratch*"))) (global-set-key (kbd "C-o k") (lambda()(interactive)(kill-buffer))) ;; C-o number で tab 移動 (require 'cl) (defun my:tabbar-select-tab-by-number (n) "Select Nth tab." (interactive "p") (let* ((tabset (tabbar-current-tabset t)) (tab (tabbar-selected-tab tabset)) previous) (when (and tabset (numberp n) (<= 1 n)) (while (setq previous (tabbar-tab-next tabset tab t)) (setq tab previous)) (loop for i from 1 below n do (setq tab (tabbar-tab-next tabset tab)) unless (tabbar-tab-next tabset tab) return nil) (tabbar-click-on-tab tab)))) (loop for i from 1 to 9 for fn = (intern (format "my:tabbar-select-tab-%d" i)) do (fset fn `(lambda () (interactive) (my:tabbar-select-tab-by-number ,i))) (global-set-key (read-kbd-macro (format "C-o %d" i)) fn)) ;; タブ上でマウスホイールを使わない (tabbar-mwheel-mode nil) ;; button 無効化 (dolist (btn '( ; tabbar-buffer-home-button tabbar-scroll-left-button tabbar-scroll-right-button)) (set btn (cons (cons "" nil) (cons "" nil)))) ;; Group 無効化 (setq tabbar-buffer-groups-function nil) ;; 表示設定 (defvar my:tabbar-include-buffer-regex (format ".*%s.*" (regexp-opt '("*scratch*"))) "Regexps match buffers always included tabs") (defvar my:tabbar-exclude-buffer-regex (format "%s.*" (regexp-opt '(" *" "*"))) "Regexps match buffers always hide tabs") (setq tabbar-buffer-list-function (lambda () (remove-if (lambda (buffer) (and (not (string-match my:tabbar-include-buffer-regex (buffer-name buffer))) (string-match my:tabbar-exclude-buffer-regex (buffer-name buffer)))) (buffer-list)))) ;; 省略表示 (setq tabbar-auto-scroll-flag nil) ;; tab と tab の間の幅 (setq tabbar-separator '(1.2))
とりあえず, 今のところ不満は無い. tabbar-buffer-list-function が頭悪いので, なんとかしたいのだけれど.