diff options
author | William Carroll <wpcarro@gmail.com> | 2017-07-01T19·50-0400 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2017-07-01T20·21-0400 |
commit | 296fe1b8f671e4fda2fc6b37b63dcbba399b21aa (patch) | |
tree | d9223fe13edcf8f861582d348a950bf62f1f5b25 /emacs | |
parent | e812876dd3350aefd1e2a0fee962519cd398f252 (diff) |
Stylizes tabbar; extends emacs config
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/wc-doom-functions.el | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/emacs/wc-doom-functions.el b/emacs/wc-doom-functions.el new file mode 100644 index 000000000000..4c35a24b5bc0 --- /dev/null +++ b/emacs/wc-doom-functions.el @@ -0,0 +1,46 @@ +(defun make-xpm-bar (color height width) + "Create an XPM bitmap of a bar." + (propertize + " " 'display + (let ((data (make-list height (make-list width 1))) + (color (or color "None"))) + (create-image + (concat + (format "/* XPM */\nstatic char * percent[] = {\n\"%i %i 2 1\",\n\". c %s\",\n\" c %s\"," + (length (car data)) + (length data) + color + color) + (apply #'concat + (cl-loop with idx = 0 + with len = (length data) + for dl in data + do (cl-incf idx) + collect + (concat "\"" + (cl-loop for d in dl + if (= d 0) collect (string-to-char " ") + else collect (string-to-char ".")) + (if (eq idx len) "\"};" "\",\n"))))) + 'xpm t :ascent 'center)))) + +(defun my-tabbar-display-tab (tab) + (let ((label (if tabbar--buffer-show-groups + (format "[%s]" (tabbar-tab-tabset tab)) + (format "%s" (tabbar-tab-value tab)))) + (bar-color "#51afef") + (bar-height 25) + (bar-width 3) + (selected-p (eq tab (tabbar-selected-tab (tabbar-current-tabset))))) + (concat (when (and (display-graphic-p) selected-p) + (make-xpm-bar bar-color bar-height bar-width)) + " " + (if tabbar-auto-scroll-flag + label + (tabbar-shorten + label (max 1 (/ (window-width) + (length (tabbar-view + (tabbar-current-tabset))))))) + " "))) + +(setq tabbar-tab-label-function #'my-tabbar-display-tab) |