diff options
Diffstat (limited to 'modally.el')
| -rw-r--r-- | modally.el | 44 |
1 files changed, 28 insertions, 16 deletions
@@ -31,6 +31,12 @@ (require 'modally-faces) ;; FUNCTIONS +(defun modally--seperator () + "Return a propertized separator." + (propertize "┃" 'face (if (mode-line-window-selected-p) + '(t :foreground "#444444") + '(t :foreground "#222222")))) + (defun modally--buffer-name () "Return a propertized buffer name string." (let* ((buffer-face (cond @@ -58,6 +64,7 @@ (format "\s%s" (propertize buffer-name 'face buffer-face)) ))) +;; TODO: make cond into hashmap search (defun modally--major-mode () "Return a propertized major mode string." (let ((mode (string-remove-suffix "-mode" (symbol-name major-mode)))) @@ -66,25 +73,28 @@ "elisp") ((equal mode "lisp-interaction") "lisp") + ((equal mode "messages-buffer") + "messages") (mode))) 'modally-major-mode))) (defun modally--line-column () "Return a propertized line column position." - (format-mode-line - "\sC%C │" - `(,(let ((column (current-column))) - (cond - ((and (>= column (- fill-column 10)) - (< column fill-column)) - 'warning) - ((>= column fill-column) - 'modally-column-error)))))) + (format "%s %s" + (format-mode-line + "\sC%C" + `(,(let ((column (current-column))) + (cond + ((>= column fill-column) 'error) + ((>= column (- fill-column 10)) 'warning))))) + (modally--seperator))) (defun modally--git-branch () "Return a propertized Git branch string." (when-let* ((buffer (buffer-file-name)) (branch (vc-git--symbolic-ref buffer))) - (format "\s%s │" (propertize branch 'face 'modally-git-branch)))) + (format "\s%s %s" + (propertize branch 'face 'modally-git-branch) + (modally--seperator)))) (defun modally--flymake-diagnostics () "Return `flymake-mode' alert counts." @@ -130,10 +140,11 @@ (let ((face (if org-timer-pause-time 'modally-org-timer-pause 'modally-org-timer))) - (format "\s%s │" + (format "\s%s %s" (propertize (modally--approx-time org-timer-mode-line-string) - 'face face))))) + 'face face) + (modally--seperator))))) ;; VARIABLES (defvar modally-display-buffer-name @@ -157,7 +168,8 @@ "Modeline construct to display line & column position.") (defvar modally-display-file-size - '(:eval (format-mode-line "\s%I │")) + '(:eval (format "%s %s" (format-mode-line "\s%I") + (modally--seperator))) "Modeline construct to display file size of buffer.") (defvar modally-display-flymake @@ -191,7 +203,7 @@ modally-display-file-size modally-display-flymake modally-display-major-mode - " ") + " ") "Default modally format for the mode-line.") (setq-default mode-line-right-align-edge 'right-fringe) @@ -227,7 +239,7 @@ "Set modally mode-line." (setq-default mode-line-format modally-format-default) (with-eval-after-load 'keycast - (setq-default keycast-mode-line-insert-after 'modally-display-git-branch)) + (setq-default keycast-mode-line-insert-after 'modally-display-buffer-name)) (modally--set-face)) ;; MODE @@ -237,7 +249,7 @@ :group 'modally :global t :require '(subr-x vc-git flymake cl-lib) - :lighter " MDL" + :lighter " MDLY" (if modally-mode (modally--set-mode-line) (modally--reset-mode-line))) |
