summaryrefslogtreecommitdiff
path: root/modally.el
diff options
context:
space:
mode:
authorBlake Romero <blake@developercraft.com>2025-10-11 21:38:30 +0100
committerBlake Romero <blake@developercraft.com>2025-10-11 21:38:30 +0100
commit8a579084276b4a0d6c15550b38ff55b941d7f629 (patch)
treea978a1f0039fb5aabc8402aca83bcd566994a84b /modally.el
parent820e13edb1d4d16687289ca01b653af11810bd7e (diff)
Implement a dynamic separator & add messages to major-mode filtering
Diffstat (limited to 'modally.el')
-rw-r--r--modally.el44
1 files changed, 28 insertions, 16 deletions
diff --git a/modally.el b/modally.el
index 782c844..a30ceb0 100644
--- a/modally.el
+++ b/modally.el
@@ -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)))