Update emacs.org

This commit is contained in:
Sakooooo 2023-12-23 13:05:57 +04:00 committed by GitHub
parent a10510ff97
commit b269f5a7a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -180,125 +180,108 @@ 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" '((:eval (sakoline-render
;; sakoline-evil-mode ;; left
(quote ("%e"
sakoline-evil-mode
" "
sakoline-buffer-name
" "
sakoline-buffer-state))
;; right
(quote (sakoline-major-mode
)
)))))
;; ;; begin BUFFER name (defun sakoline-render (left right)
;; " " "Return a string of `window-width' length.
Containing LEFT, and RIGHT aligned respectively."
(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)))
;; sakoline-buffer-name (defvar-local sakoline-buffer-name
'(:eval
(propertize (buffer-name) 'face '(:foreground "#ffffff")))
"Mode line variable that shows the buffer name.")
;; " " (put 'sakoline-buffer-name 'risky-local-variable t)
;; sakoline-buffer-state
;; " "
;; ;; everything under here goes to the right
;; sakoline-major-mode
;; ))
(setq-default mode-line-format (defface sakoline-major-mode-color
'((:eval (sakoline-render '((t :foreground "grey"))
;; left "Major Mode color for sakoline.")
(quote ("%e"
sakoline-evil-mode
" "
sakoline-buffer-name
" "
sakoline-buffer-state))
;; right
(quote (sakoline-major-mode
)
)))))
(defun sakoline-render (left right) (defun sakoline--major-mode-name ()
"Return a string of `window-width' length. "Return Capitalized Major Mode"
Containing LEFT, and RIGHT aligned respectively." (capitalize (symbol-name major-mode)))
(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)))
(defvar-local sakoline-buffer-name (defvar-local sakoline-major-mode
'(:eval '(:eval
(propertize (buffer-name) 'face '(:foreground "#669999"))) (propertize (sakoline--major-mode-name) 'face 'sakoline-major-mode-color)))
"Mode line variable that shows the buffer name.")
(put 'sakoline-buffer-name 'risky-local-variable t) (put 'sakoline-major-mode 'risky-local-variable t)
(defface sakoline-major-mode-color (defface sakoline-evil-visual-color
'((t :foreground "grey")) '((t :background "#6600cc" :foreground "black"))
"Major Mode color for sakoline.") "Evil Visual Color")
(defun sakoline--major-mode-name () (defface sakoline-evil-normal-color
"Return Capitalized Major Mode" '((t :background "#99ff99" :foreground "black"))
(capitalize (symbol-name major-mode))) "Evil Visual Color")
(defvar-local sakoline-major-mode (defface sakoline-evil-insert-color
'(:eval '((t :background "#00cc66" :foreground "black"))
(propertize (sakoline--major-mode-name) 'face 'sakoline-major-mode-color))) "Evil Visual Color")
(put 'sakoline-major-mode 'risky-local-variable t) (defface sakoline-evil-emacs-color
'((t :background "#9900ff" :foreground "black"))
"Evil Visual Color")
(defface sakoline-evil-visual-color (defface sakoline-evil-operator-color
'((t :background "#6600cc" :foreground "black")) '((t :background "#ff3300" :foreground "black"))
"Evil Visual Color") "Evil Visual Color")
(defface sakoline-evil-normal-color (defvar-local sakoline-evil-mode
'((t :background "#99ff99" :foreground "black")) '(:eval (cond
"Evil Visual Color") ((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-evil-insert-color (put 'sakoline-evil-mode 'risky-local-variable t)
'((t :background "#00cc66" :foreground "black"))
"Evil Visual Color")
(defface sakoline-evil-emacs-color (defface sakoline-buffer-state-readonly
'((t :background "#9900ff" :foreground "black")) '((t :foreground "red"))
"Evil Visual Color") "Face for read-only buffer")
(defface sakoline-buffer-state-modified
'((t :foreground "orange"))
"Face for modified buffer")
(defface sakoline-evil-operator-color (defvar-local sakoline-buffer-state
'((t :background "#ff3300" :foreground "black")) '(:eval
"Evil Visual Color") (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)))))
(defvar-local sakoline-evil-mode (put 'sakoline-buffer-state 'risky-local-variable t)
'(: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")))
(put 'sakoline-evil-mode 'risky-local-variable t)
(defface sakoline-buffer-state-readonly
'((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
'(: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)))))
(put 'sakoline-buffer-state 'risky-local-variable t)
#+end_src #+end_src
* Packages * Packages
@ -556,7 +539,7 @@ Should make startup faster, taken from doom-emacs
(agenda . 5))) (agenda . 5)))
(setq dashboard-image-banner-max-height 200) (setq dashboard-image-banner-max-height 200)
(setq dashboard-image-banner-max-width 500) (setq dashboard-image-banner-max-width 300)
(setq dashboard-page-separator "\n\n") (setq dashboard-page-separator "\n\n")
(dashboard-setup-startup-hook)) (dashboard-setup-startup-hook))