From 2f55e58187367ad15c2f6253acb7abedbc447bcc Mon Sep 17 00:00:00 2001 From: Peng Li Date: Sun, 17 May 2015 00:11:13 +0800 Subject: [PATCH] =?utf8?q?emacs:=20add=20new=20powerline=20theme=20accordi?= =?utf8?q?ng=20to=20https://skalldan.wordpress.com/2012/05/13/emacs-?= =?utf8?q?=E3=81=AE=E3=83=A2=E3=83=BC=E3=83=89=E3=83=A9=E3=82=A4=E3=83=B3?= =?utf8?q?=E3=82=92=20-powerline-=E9=A2=A8=E3=81=AB=E3=82=AB=E3=82=B9?= =?utf8?q?=E3=82=BF=E3=83=9E=E3=82=A4=E3=82=BA/?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- emacs.d/config/my-powerline.el | 129 +++++++++++++++++++++++++++++++++++++++++ emacs.d/init.el | 8 ++- 2 files changed, 135 insertions(+), 2 deletions(-) create mode 100644 emacs.d/config/my-powerline.el diff --git a/emacs.d/config/my-powerline.el b/emacs.d/config/my-powerline.el new file mode 100644 index 0000000..65f849e --- /dev/null +++ b/emacs.d/config/my-powerline.el @@ -0,0 +1,129 @@ + + + + +(setq ns-use-srgb-colorspace nil) + +(load-theme 'cyberpunk t) + +;; Powerline +(defun arrow-right-xpm (color1 color2) + "Return an XPM right arrow string representing." + (format "/* XPM */ +static char * arrow_right[] = { +\"12 18 2 1\", +\". c %s\", +\" c %s\", +\". \", +\".. \", +\"... \", +\".... \", +\"..... \", +\"...... \", +\"....... \", +\"........ \", +\"......... \", +\"......... \", +\"........ \", +\"....... \", +\"...... \", +\"..... \", +\".... \", +\"... \", +\".. \", +\". \"};" color1 color2)) + +(defun arrow-left-xpm (color1 color2) + "Return an XPM right arrow string representing." + (format "/* XPM */ +static char * arrow_right[] = { +\"12 18 2 1\", +\". c %s\", +\" c %s\", +\" .\", +\" ..\", +\" ...\", +\" ....\", +\" .....\", +\" ......\", +\" .......\", +\" ........\", +\" .........\", +\" .........\", +\" ........\", +\" .......\", +\" ......\", +\" .....\", +\" ....\", +\" ...\", +\" ..\", +\" .\"};" color2 color1)) + +;;(defconst color1 "#666666") ; gray40 +;;(defconst color2 "#999999") ; gray60 + +;;j;(defconst color1 "#4682b4") +;;(defconst color2 "#ff6347") + +(defconst color1 "#6b8e23") +(defconst color2 "#eedd82") + +;;(set-face-attribute 'mode-line-color-2 nil +;; :foreground "#171717" +;; :bold t +;; :background color2) + + + +(defvar arrow-right-0 (create-image (arrow-right-xpm "None" color1) 'xpm t :ascent 'center)) +(defvar arrow-right-1 (create-image (arrow-right-xpm color1 color2) 'xpm t :ascent 'center)) +(defvar arrow-right-2 (create-image (arrow-right-xpm color2 "None") 'xpm t :ascent 'center)) +(defvar arrow-left-1 (create-image (arrow-left-xpm color2 color1) 'xpm t :ascent 'center)) +(defvar arrow-left-2 (create-image (arrow-left-xpm "None" color2) 'xpm t :ascent 'center)) + +(display-time) + +(setq-default mode-line-format + (list + '("-" + mode-line-mule-info + mode-line-modified + minor-mode-alist) + '(:eval (concat (propertize " " 'display arrow-right-0))) + '(:eval (concat (propertize " %m " 'face 'mode-line-color-1) + (propertize " " 'display arrow-right-1))) + '(:eval (concat (propertize " %b " 'face 'mode-line-color-2) + (propertize " " 'display arrow-right-2))) + ;; Justify right by filling with spaces to right fringe - 16 + ;; (16 should be computed rahter than hardcoded) + '(:eval (propertize " " 'display '((space :align-to (- right-fringe 17))))) + '(:eval (concat (propertize " " 'display arrow-left-2) + (propertize " %p " 'face 'mode-line-color-2))) + '(:eval (concat (propertize " " 'display arrow-left-1) + (propertize "%4l:%2c " 'face 'mode-line-color-1))) + )) + + +(make-face 'mode-line-color-1) +(set-face-attribute 'mode-line-color-1 nil + :foreground "#fffacd" + :bold t + :background color1) + +(make-face 'mode-line-color-2) +(set-face-attribute 'mode-line-color-2 nil + :foreground "#fffacd" + :bold t + :background color2) + +(set-face-attribute 'mode-line nil + :foreground "#fffacd" + :background "#171717" + :box nil) +(set-face-attribute 'mode-line-inactive nil + :foreground "#fffacd" + :background "#171717") + + + +(provide 'my-powerline) diff --git a/emacs.d/init.el b/emacs.d/init.el index 05f6fc2..386fe2b 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -8,7 +8,6 @@ ;(add-to-list 'default-frame-alist '(font . "Source Code Pro for Powerline-12:weight:light" )) (add-to-list 'default-frame-alist '(font . "Source Code Pro for Powerline-12" )) -(display-time-mode t) (put 'set-goal-column 'disabled nil) (setq vc-follow-symlinks t) @@ -16,7 +15,7 @@ (setq ring-bell-function 'ignore) (setq resize-mini-windows t) -(setq ns-use-srgb-colorspace nil) + (add-to-list 'auto-mode-alist '("emacs\\'" . emacs-lisp-mode)) (fringe-mode 0) @@ -205,7 +204,12 @@ ;; (add-to-list 'load-path "~/.emacs.d/config") (require 'init-color-theme) +;(require 'my-powerline) +;(require 'init-my-theme-2) + + +(toggle-frame-fullscreen) -- 2.11.0