summaryrefslogtreecommitdiff
path: root/modeline.el
diff options
context:
space:
mode:
Diffstat (limited to 'modeline.el')
-rw-r--r--modeline.el79
1 files changed, 46 insertions, 33 deletions
diff --git a/modeline.el b/modeline.el
index eb30b93..683b09d 100644
--- a/modeline.el
+++ b/modeline.el
@@ -269,21 +269,24 @@ MAP is the local keymap of the text."
(cond ((and buffer-file-name (buffer-modified-p))
(format-mode-line "M" (cond
(active-p
- 'compilation-error)
+ (modus-themes-with-colors
+ `(:foreground
+ ,magenta-intense))
+ )
(t 'mode-line-inactive)))))
;; read-only?
(cond
(buffer-read-only
(format-mode-line "R" (cond
(active-p
- 'modus-themes-fg-cyan-intense)
+ (modus-themes-with-colors
+ `(:foreground ,red-intense)))
(t 'mode-line-inactive)))))
;; narrow?
(cond
((buffer-narrowed-p)
(format-mode-line "N" (cond
- (active-p
- 'compilation-warning)
+ (active-p 'warning)
(t 'mode-line-inactive))))))))
;;;; Buffer position
@@ -297,8 +300,7 @@ MAP is the local keymap of the text."
(modeline-propertize
(propertize
(let* ((current (pdf-view-current-page))
- (total (pdf-info-number-of-pages))
- )
+ (total (pdf-info-number-of-pages)))
(concat
"P."
(number-to-string current)
@@ -468,12 +470,23 @@ This will be displayed in the mode line."
;;;; Major mode
+(declare-function
+ #'modus-themes-with-colors
+ (expand-file-name
+ "modus-themes.el"
+ "/Users/durand/elisp_packages/protesilaos/modus-themes/")
+ (&rest body) t)
+
;;;###autoload
(defun modeline-format-major-mode ()
"The major mode to display in the mode line."
(declare (pure t) (side-effect-free t))
- (let ((face (cond ((modeline-active-window-p) 'doom-modeline-buffer-major-mode)
- ('mode-line-inactive))))
+ (let ((face (cond ((modeline-active-window-p) 'mode-line-active)
+ ('mode-line-inactive)))
+ (mode-string-face
+ (cond
+ ((modeline-active-window-p) 'mode-line-active)
+ ('mode-line-inactive))))
(concat
(modeline-propertize
(format-mode-line '("%m") face)
@@ -482,7 +495,7 @@ This will be displayed in the mode line."
mode-line-major-mode-keymap)
(modeline-spc)
(modeline-propertize
- (format-mode-line global-mode-string face))
+ (format-mode-line global-mode-string mode-string-face))
(modeline-spc))))
;;;; VCS
@@ -496,7 +509,8 @@ This will be displayed in the mode line."
;;;###autoload
(defun modeline-update-vcs-str (&rest _)
- "Update the version control system information to be displayed on the mode line."
+ "Update the version control system information to be displayed
+on the mode line."
(let ((bfn (buffer-file-name)))
(setq
modeline-vcs-str
@@ -504,23 +518,27 @@ This will be displayed in the mode line."
((and vc-mode bfn)
(let* ((backend (vc-backend bfn))
(state (vc-state bfn backend))
- (indicator (cond
- ((memq state '(added edited))
- (format-mode-line
- "* " 'doom-modeline-info))
- ((eq state 'needs-merge)
- (format-mode-line
- "? " 'doom-modeline-info))
- ((eq state 'needs-update)
- (format-mode-line
- "! " 'doom-modeline-warning))
- ((memq state '(removed conflict unregistered))
- (format-mode-line
- "! " 'doom-modeline-urgent))
- (t (format-mode-line
- "@ " 'doom-modeline-info))))
+ (error-faces (list 'removed 'conflict 'unregistered))
+ (face (cond
+ ((memq state '(added edited)) 'warning)
+ ((eq state 'needs-merge) 'compilation-info)
+ ((eq state 'needs-update) 'warning)
+ ((memq state error-faces) 'error)
+ ('success)))
+ (indicator
+ (cond
+ ((memq state '(added edited))
+ (format-mode-line "* " face))
+ ((eq state face)
+ (format-mode-line "? " face))
+ ((eq state face)
+ (format-mode-line "! " face))
+ ((memq state '(removed conflict unregistered))
+ (format-mode-line "! " face))
+ (t (format-mode-line "@ " face))))
(str (cond (vc-display-status
- (substring vc-mode (+ (cond ((eq backend 'Hg) 2)
+ (substring vc-mode
+ (+ (cond ((eq backend 'Hg) 2)
(t 3))
2)))
(t ""))))
@@ -532,12 +550,7 @@ This will be displayed in the mode line."
(concat (substring str 0 (- modeline-vcs-length-max 3))
"..."))
(t str))
- 'face (cond
- ((eq state 'needs-update)
- 'doom-modeline-warning)
- ((memq state '(removed conflict unregistered))
- 'doom-modeline-urgent)
- (t 'doom-modeline-info))))))
+ 'face face))))
(t "")))))
(add-hook 'find-file-hook #'modeline-update-vcs-str)
@@ -574,7 +587,7 @@ This will be displayed in the mode line."
(modeline-propertize
(propertize
current-input-method-title
- 'face (cond ((modeline-active-window-p) 'doom-modeline-input-method)
+ 'face (cond ((modeline-active-window-p) 'compilation-info)
(t 'mode-line-inactive)))
nil
(format "Current input method: %s\nmouse-2: Disable input method\nmouse-3: Describe current input method"