网上tabbar的配置很多没有美化,或者美化不到位。
有人在提标签的问题,就贴一个自己的出来。
[code]
(require 'tabbar)
(tabbar-mode)
;; 定义tabbar的分组
(defun tabbar-buffer-groups ()
"Return the list of group names the current buffer belongs to.
Return a list of one element based on major mode."
(list
(cond
((or (get-buffer-process (current-buffer))
;; Check if the major mode derives from `comint-mode' or
;; `compilation-mode'.
(tabbar-buffer-mode-derived-p
major-mode '(comint-mode compilation-mode)))
"Process"
)
((member (buffer-name)
'("*scratch*" "*Messages*"))
"Common"
)
((member (buffer-name)
'("
gtd.org" "
home.org" "
other.org" "
study.org" "
work.org"))
"GTD"
)
((eq major-mode 'dired-mode)
"Dired"
)
((memq major-mode
'(help-mode apropos-mode Info-mode Man-mode))
"Help"
)
((memq major-mode
'(rmail-mode
rmail-edit-mode vm-summary-mode vm-mode mail-mode
mh-letter-mode mh-show-mode mh-folder-mode
gnus-summary-mode message-mode gnus-group-mode
gnus-article-mode score-mode gnus-browse-killed-mode))
"Mail"
)
(t
;; Return `mode-name' if not blank, `major-mode' otherwise.
(if (and (stringp mode-name)
;; Take care of preserving the match-data because this
;; function is called when updating the header line.
(save-match-data (string-match "[^ ]" mode-name)))
mode-name
(symbol-name major-mode))
))))
;; 设置tabbar外观
(set-face-attribute 'tabbar-default nil
:inherit nil
:weight 'normal
:width 'normal
:slant 'normal
:underline nil
:strike-through nil
;; inherit from frame :inverse-video
:stipple nil
:background "gray80"
:foreground "black"
;; :box '(:line-width 2 :color "white" :style nil)
:box nil
:family "Lucida Grande"
)
(set-face-attribute 'tabbar-selected nil
:background "gray95"
:foreground "gray20"
:inherit 'tabbar-default
:box '(:line-width 3 :color "grey95" :style nil))
;; :box '(:line-width 2 :color "white" :style released-button))
(set-face-attribute 'tabbar-unselected nil
:inherit 'tabbar-default
:background "gray80"
:box '(:line-width 3 :color "grey80" :style nil))
(defface tabbar-selected-highlight '((t
:foreground "black"
:background "gray95"))
"Face for selected, highlighted tabs."
:group 'tabbar)
(defface tabbar-unselected-highlight '((t
:foreground "black"
:background "grey75"
:box (:line-width 3 :color "grey75" :style nil)))
"Face for unselected, highlighted tabs."
:group 'tabbar)
(set-face-attribute 'tabbar-button nil
:inherit 'tabbar-default
:box nil)
(set-face-attribute 'tabbar-separator nil
:background "grey50"
:foreground "grey50"
:height 1.0)
;; 定义tabbar快捷键,在Windows上不起作用
(global-set-key (kbd "s-h") 'tabbar-backward-group)
(global-set-key (kbd "s-l") 'tabbar-forward-group)
(global-set-key (kbd "s-j") 'tabbar-backward)
(global-set-key (kbd "s-k") 'tabbar-forward)
[/code]
--
[m [31m※ 来源:·水木社区
http://newsmth.net·[FROM: 14.107.249.*] [m