Update emacs.org
This commit is contained in:
parent
4a04a880e1
commit
d35a67f9c6
1 changed files with 95 additions and 82 deletions
|
@ -181,112 +181,125 @@ Should make startup faster, taken from doom-emacs
|
||||||
#+end_src
|
#+end_src
|
||||||
* Custom Modeline
|
* Custom Modeline
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(setq mode-line-format nil)
|
(setq mode-line-format nil)
|
||||||
|
|
||||||
(kill-local-variable 'mode-line-format)
|
(kill-local-variable 'mode-line-format)
|
||||||
|
|
||||||
(force-mode-line-update)
|
(force-mode-line-update)
|
||||||
|
|
||||||
(setq-default mode-line-format
|
;; (setq-default mode-line-format
|
||||||
`("%e"
|
;; `("%e"
|
||||||
sakoline-evil-mode
|
;; sakoline-evil-mode
|
||||||
|
|
||||||
;; begin BUFFER name
|
;; ;; begin BUFFER name
|
||||||
" "
|
;; " "
|
||||||
|
|
||||||
sakoline-buffer-name
|
;; sakoline-buffer-name
|
||||||
|
|
||||||
" "
|
;; " "
|
||||||
sakoline-buffer-state
|
;; sakoline-buffer-state
|
||||||
" "
|
;; " "
|
||||||
;; everything under here goes to the right
|
;; ;; everything under here goes to the right
|
||||||
;; make sure to change the padding to make it look good
|
;; sakoline-major-mode
|
||||||
(:eval (sakoline-padding-right 'mode-line 20))
|
|
||||||
sakoline-major-mode
|
;; ))
|
||||||
|
|
||||||
))
|
(setq-default mode-line-format
|
||||||
|
'((:eval (sakoline-render
|
||||||
|
;; left
|
||||||
|
(quote ("%e"
|
||||||
|
sakoline-evil-mode
|
||||||
|
" "
|
||||||
|
sakoline-buffer-name
|
||||||
|
" "
|
||||||
|
sakoline-buffer-state))
|
||||||
|
;; right
|
||||||
|
(quote (sakoline-major-mode
|
||||||
|
)
|
||||||
|
)))))
|
||||||
|
|
||||||
(defvar-local sakoline-buffer-name
|
(defun sakoline-render (left right)
|
||||||
'(:eval
|
"Return a string of `window-width' length.
|
||||||
(propertize (buffer-name) 'face '(:foreground "#669999")))
|
Containing LEFT, and RIGHT aligned respectively."
|
||||||
"Mode line variable that shows the buffer name.")
|
(let ((available-width
|
||||||
|
(- (window-total-width)
|
||||||
|
(+ (length (format-mode-line left))
|
||||||
|
(length (format-mode-line right))))))
|
||||||
|
(append left
|
||||||
|
(list (format (format "%%%ds" available-width) ""))
|
||||||
|
right)))
|
||||||
|
|
||||||
(put 'sakoline-buffer-name 'risky-local-variable t)
|
(defvar-local sakoline-buffer-name
|
||||||
|
'(:eval
|
||||||
|
(propertize (buffer-name) 'face '(:foreground "#669999")))
|
||||||
|
"Mode line variable that shows the buffer name.")
|
||||||
|
|
||||||
(defface sakoline-major-mode-color
|
(put 'sakoline-buffer-name 'risky-local-variable t)
|
||||||
'((t :foreground "grey"))
|
|
||||||
"Major Mode color for sakoline.")
|
|
||||||
|
|
||||||
(defun sakoline--major-mode-name ()
|
(defface sakoline-major-mode-color
|
||||||
"Return Capitalized Major Mode"
|
'((t :foreground "grey"))
|
||||||
(capitalize (symbol-name major-mode)))
|
"Major Mode color for sakoline.")
|
||||||
|
|
||||||
(defvar-local sakoline-major-mode
|
(defun sakoline--major-mode-name ()
|
||||||
'(:eval
|
"Return Capitalized Major Mode"
|
||||||
(propertize (sakoline--major-mode-name) 'face 'sakoline-major-mode-color)))
|
(capitalize (symbol-name major-mode)))
|
||||||
|
|
||||||
(put 'sakoline-major-mode 'risky-local-variable t)
|
(defvar-local sakoline-major-mode
|
||||||
|
'(:eval
|
||||||
|
(propertize (sakoline--major-mode-name) 'face 'sakoline-major-mode-color)))
|
||||||
|
|
||||||
(defface sakoline-evil-visual-color
|
(put 'sakoline-major-mode 'risky-local-variable t)
|
||||||
'((t :background "#6600cc" :foreground "black"))
|
|
||||||
"Evil Visual Color")
|
|
||||||
|
|
||||||
(defface sakoline-evil-normal-color
|
(defface sakoline-evil-visual-color
|
||||||
'((t :background "#99ff99" :foreground "black"))
|
'((t :background "#6600cc" :foreground "black"))
|
||||||
"Evil Visual Color")
|
"Evil Visual Color")
|
||||||
|
|
||||||
(defface sakoline-evil-insert-color
|
(defface sakoline-evil-normal-color
|
||||||
'((t :background "#00cc66" :foreground "black"))
|
'((t :background "#99ff99" :foreground "black"))
|
||||||
"Evil Visual Color")
|
"Evil Visual Color")
|
||||||
|
|
||||||
(defface sakoline-evil-emacs-color
|
(defface sakoline-evil-insert-color
|
||||||
'((t :background "#9900ff" :foreground "black"))
|
'((t :background "#00cc66" :foreground "black"))
|
||||||
"Evil Visual Color")
|
"Evil Visual Color")
|
||||||
|
|
||||||
(defface sakoline-evil-operator-color
|
(defface sakoline-evil-emacs-color
|
||||||
'((t :background "#ff3300" :foreground "black"))
|
'((t :background "#9900ff" :foreground "black"))
|
||||||
"Evil Visual Color")
|
"Evil Visual Color")
|
||||||
|
|
||||||
(defvar-local sakoline-evil-mode
|
(defface sakoline-evil-operator-color
|
||||||
'(:eval (cond
|
'((t :background "#ff3300" :foreground "black"))
|
||||||
((eq evil-state 'visual) (propertize " VISUAL " 'face 'sakoline-evil-visual-color ))
|
"Evil Visual Color")
|
||||||
((eq evil-state 'normal) (propertize " NORMAL " 'face 'sakoline-evil-normal-color ))
|
|
||||||
((eq evil-state 'insert) (propertize " INSERT " 'face 'sakoline-evil-insert-color ))
|
|
||||||
((eq evil-state 'emacs) (propertize " EMACS " 'face 'sakoline-evil-emacs-color ))
|
|
||||||
((eq evil-state 'operator) (propertize " OPERATOR " 'face 'sakoline-evil-operator-color))
|
|
||||||
"Get current evil mode state")))
|
|
||||||
|
|
||||||
(put 'sakoline-evil-mode 'risky-local-variable t)
|
(defvar-local sakoline-evil-mode
|
||||||
|
'(:eval (cond
|
||||||
|
((eq evil-state 'visual) (propertize " VISUAL " 'face 'sakoline-evil-visual-color ))
|
||||||
|
((eq evil-state 'normal) (propertize " NORMAL " 'face 'sakoline-evil-normal-color ))
|
||||||
|
((eq evil-state 'insert) (propertize " INSERT " 'face 'sakoline-evil-insert-color ))
|
||||||
|
((eq evil-state 'emacs) (propertize " EMACS " 'face 'sakoline-evil-emacs-color ))
|
||||||
|
((eq evil-state 'operator) (propertize " OPERATOR " 'face 'sakoline-evil-operator-color))
|
||||||
|
"Get current evil mode state")))
|
||||||
|
|
||||||
(defface sakoline-buffer-state-readonly
|
(put 'sakoline-evil-mode 'risky-local-variable t)
|
||||||
'((t :foreground "red"))
|
|
||||||
"Face for read-only buffer")
|
|
||||||
(defface sakoline-buffer-state-modified
|
|
||||||
'((t :foreground "orange"))
|
|
||||||
"Face for modified buffer")
|
|
||||||
|
|
||||||
(defvar-local sakoline-buffer-state
|
(defface sakoline-buffer-state-readonly
|
||||||
'(:eval
|
'((t :foreground "red"))
|
||||||
(cond
|
"Face for read-only buffer")
|
||||||
(buffer-read-only
|
(defface sakoline-buffer-state-modified
|
||||||
(propertize ">:("
|
'((t :foreground "orange"))
|
||||||
'face 'sakoline-buffer-state-readonly
|
"Face for modified buffer")
|
||||||
'help-echo "buffer is read only"))
|
|
||||||
((buffer-modified-p)
|
|
||||||
(propertize "!!!"
|
|
||||||
'face 'sakoline-buffer-state-modified)))))
|
|
||||||
|
|
||||||
(put 'sakoline-buffer-state 'risky-local-variable t)
|
(defvar-local sakoline-buffer-state
|
||||||
|
'(:eval
|
||||||
|
(cond
|
||||||
|
(buffer-read-only
|
||||||
|
(propertize ">:("
|
||||||
|
'face 'sakoline-buffer-state-readonly
|
||||||
|
'help-echo "buffer is read only"))
|
||||||
|
((buffer-modified-p)
|
||||||
|
(propertize "!!!"
|
||||||
|
'face 'sakoline-buffer-state-modified)))))
|
||||||
|
|
||||||
(defun sakoline-padding-right (face reserve)
|
(put 'sakoline-buffer-state 'risky-local-variable t)
|
||||||
"Return empty space using FACE and leaving RESERVE space on the right."
|
|
||||||
(unless reserve
|
|
||||||
(setq reserve 20))
|
|
||||||
(when (and window-system (eq 'right (get-scroll-bar-mode)))
|
|
||||||
(setq reserve (- reserve 3)))
|
|
||||||
(propertize " "
|
|
||||||
'display `((space :align-to (- (+ right right-fringe right-margin) ,reserve)))
|
|
||||||
'face face))
|
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
* Packages
|
* Packages
|
||||||
|
|
Loading…
Reference in a new issue