Add tabbar properly

git-svn-id: http://photonzero.com/dotfiles/trunk@84 23f722f6-122a-0410-8cef-c75bd312dd78
This commit is contained in:
michener 2011-03-23 08:43:50 +00:00
parent b25bf524eb
commit ee165a5f86
14 changed files with 4323 additions and 1942 deletions

View file

@ -5,7 +5,9 @@
(add-to-list 'load-path "~/.emacs.d")
(add-to-list 'load-path "~/.emacs.d/auto-complete")
(add-to-list 'load-path "~/.emacs.d/icicles")
(add-to-list 'load-path "~/.emacs.d/aquamacs-tabbar")
(add-to-list 'load-path "~/.emacs.d/tabbar")
(fset 'yes-or-no-p 'y-or-n-p)
(require 'icicles)
(icy-mode 1)
@ -14,10 +16,17 @@
(require 'vimpulse)
(require 'color-theme)
(require 'color-theme-autoloads)
(require 'aquamacs-tabbar)
(require 'tabbar)
;(require 'highlight-symbol)
(require 'auto-complete-config)
;; Hack to get *Messages* in viper-mode.
;; ;; (must be done after loading viper)
;; ;; Futzing with fundamental-mode doesn't seem to help.
(save-excursion
(set-buffer "*Messages*")
(viper-change-state-to-vi))
(add-to-list 'ac-dictionary-directories "~/.emacs.d/auto-complete/dict")
@ -70,6 +79,7 @@
(vimpulse-map "gp" 'tabbar-backward-tab)
(vimpulse-map "gw" 'vimpulse-search-forward-for-symbol-at-point)
(vimpulse-map "gK" 'kill-buffer-and-window)
(vimpulse-map "gc" 'kill-buffer-and-window)
;(define-key viper-insert-global-user-map "\C-d" 'delete-char))
(add-hook 'window-setup-hook 'delete-other-windows)
@ -77,7 +87,7 @@
; Basic frame defaults
(let ((background-color "#2F2F2F")
(foreground-color "LightGrey")
(fname "Inconsolata-15")
(fname "Inconsolata-18")
(fheight 45)
(fwidth 115))
@ -103,3 +113,28 @@
(when (and (featurep 'vc-hooks)
(not (memq (vc-backend file) '(nil SVN))))
ad-do-it)))
;; add a buffer modification state indicator in the tab label,
;; and place a space around the label to make it looks less crowd
(defadvice tabbar-buffer-tab-label (after fixup_tab_label_space_and_flag activate)
(setq ad-return-value
(if (and (buffer-modified-p (tabbar-tab-value tab))
(buffer-file-name (tabbar-tab-value tab)))
(concat " " (concat ad-return-value "+ "))
(concat " " (concat ad-return-value " ")))))
;; called each time the modification state of the buffer changed
(defun ztl-modification-state-change ()
(tabbar-set-template tabbar-current-tabset nil)
(tabbar-display-update))
;; first-change-hook is called BEFORE the change is made
(defun ztl-on-buffer-modification ()
(set-buffer-modified-p t)
(ztl-modification-state-change))
(defun ztl-on-buffer-demodification ()
(set-buffer-modified-p nil)
(ztl-modification-state-change))
(add-hook 'after-save-hook 'ztl-modification-state-change)
;; this doesn't work for revert, I don't know
(add-hook 'after-revert-hook 'ztl-on-buffer-demodification)
(add-hook 'first-change-hook 'ztl-on-buffer-modification)