;;; -*- lexical-binding: t; -*- ;;; Commentary: ;;; Note this currently requires many of the previous modules to be loaded ;;; to function properly. ;;; Code: ;;;; remove mode-line-clutter (define-minor-mode minor-mode-blackout-mode "Hides minor modes from the mode line." t) (catch 'done (mapc (lambda (x) (when (and (consp x) (equal (cadr x) '("" minor-mode-alist))) (let ((original (copy-sequence x))) (setcar x 'minor-mode-blackout-mode) (setcdr x (list "" original))) (throw 'done t))) mode-line-modes)) (global-set-key (kbd "C-c ,") 'minor-mode-blackout-mode) (defface bd/underline-shadow `((t :inherit shadow :underline t)) "Shadow with an underline.") (defvar-local bd/buffer-identification-mode-line '(:eval (format "%s " (propertize (buffer-name) 'face 'bd/underline-shadow))) "Formats the modeline-buffer-name.") (defvar-local bd/modeline-buffer-file-state-icon '(:eval (cond (buffer-read-only (propertize " L " 'face `(:foreground ,(ef-themes-get-color-value 'warning)))) ((and buffer-file-name (buffer-modified-p)) (propertize " S " 'face `(:foreground ,(ef-themes-get-color-value 'warning)))) ((and buffer-file-name ;; Avoid freezing while connection is lost (not (file-remote-p buffer-file-name)) (not (file-exists-p buffer-file-name))) (propertize " ? " 'face `(:foreground ,(ef-themes-get-color-value 'err)))) (t ""))) "Formats the file modification status.") ;;;; pos (column-number-mode) (setopt mode-line-position-column-line-format '(" %l:%c ")) (defvar-local bd/line-position '(:eval (when (mode-line-window-selected-p) ;; remove the percentage (cdr mode-line-position)))) ;;;; git (defun git-vc-modeline () (mapconcat 'concat (cdr (split-string vc-mode "[:-]")) "-")) (defvar-local bd/vc-mode-line '(:eval (when (and vc-mode (not (eq major-mode 'magit-status-mode))) ; fix to avoid bug which occurs in magit buffer (don't remember) (format " %s " (propertize (git-vc-modeline) 'face 'shadow)))) "Formats the checked out git repository.") (dolist (construct '(bd/time-mode-line bd/buffer-identification-mode-line bd/vc-mode-line bd/line-position)) (put construct 'risky-local-variable t)) ;; set elements; move modeline to top (setq-default mode-line-format (list mode-line-front-space bd/buffer-identification-mode-line mode-line-modes bd/modeline-buffer-file-state-icon bd/vc-mode-line bd/line-position)) (provide 'bd--modeline) ;;; bd-modeline ends here