mirror of
https://github.com/correl/doom-modeline.git
synced 2024-11-27 11:09:52 +00:00
Fix lint errors.
This commit is contained in:
parent
8dc1ea02e2
commit
ad01172070
2 changed files with 293 additions and 296 deletions
|
@ -33,7 +33,7 @@ In `init.el`,
|
||||||
(use-package doom-modeline
|
(use-package doom-modeline
|
||||||
:ensure t
|
:ensure t
|
||||||
:defer t
|
:defer t
|
||||||
:init (add-hook 'after-init-hook #'+doom-modeline|init))
|
:init (add-hook 'after-init-hook #'doom-modeline-init))
|
||||||
```
|
```
|
||||||
|
|
||||||
This package requires the fonts included with `all-the-icons` to be installed.
|
This package requires the fonts included with `all-the-icons` to be installed.
|
||||||
|
|
433
doom-modeline.el
433
doom-modeline.el
|
@ -1,4 +1,4 @@
|
||||||
;;; doom-modeline.el --- modeline from DOOM Emacs. -*- lexical-binding: t; -*-
|
;;; doom-modeline.el --- A minimal modeline from DOOM Emacs. -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; Copyright (C) 2018 Vincent Zhang
|
;; Copyright (C) 2018 Vincent Zhang
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
||||||
;; URL: https://github.com/seagle0128/doom-modeline
|
;; URL: https://github.com/seagle0128/doom-modeline
|
||||||
;; Version: 0.1.0
|
;; Version: 0.1.0
|
||||||
;; Package-Requires: ((emacs "24.4") (dash "2.11.0") (all-the-icons "1.0.0") (projectile "0.10.0") (shrink-path "0.2.0") (eldoc-eval "0.1"))
|
;; Package-Requires: ((emacs "24.4") (dash "2.11.0") (all-the-icons "1.0.0") (projectile "0.10.0") (shrink-path "0.2.0") (eldoc-eval "0.1"))
|
||||||
;; Keywords: modeline, mode-line
|
;; Keywords: modeline mode-line doom
|
||||||
|
|
||||||
;; This file is not part of GNU Emacs.
|
;; This file is not part of GNU Emacs.
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
;; 1. A match count panel (for evil-search, iedit and evil-substitute)
|
;; 1. A match count panel (for evil-search, iedit and evil-substitute)
|
||||||
;; 2. An indicator for recording a macro
|
;; 2. An indicator for recording a macro
|
||||||
;; 3. Local python/ruby version in the major-mode
|
;; 3. Local python/ruby version in the major-mode
|
||||||
;; 4. A customizable mode-line height (see +doom-modeline-height)
|
;; 4. A customizable mode-line height (see doom-modeline-height)
|
||||||
;; 5. An error/warning count segment for flycheck
|
;; 5. An error/warning count segment for flycheck
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -52,35 +52,35 @@
|
||||||
(require 'eldoc-eval)
|
(require 'eldoc-eval)
|
||||||
|
|
||||||
(eval-and-compile
|
(eval-and-compile
|
||||||
(defun doom--resolve-hooks (hooks)
|
(defun doom-modeline--resolve-hooks (hooks)
|
||||||
(cl-loop with quoted-p = (eq (car-safe hooks) 'quote)
|
(cl-loop with quoted-p = (eq (car-safe hooks) 'quote)
|
||||||
for hook in (doom-enlist (doom-unquote hooks))
|
for hook in (doom-modeline-enlist (doom-modeline-unquote hooks))
|
||||||
if (eq (car-safe hook) 'quote)
|
if (eq (car-safe hook) 'quote)
|
||||||
collect (cadr hook)
|
collect (cadr hook)
|
||||||
else if quoted-p
|
else if quoted-p
|
||||||
collect hook
|
collect hook
|
||||||
else collect (intern (format "%s-hook" (symbol-name hook)))))
|
else collect (intern (format "%s-hook" (symbol-name hook)))))
|
||||||
|
|
||||||
(defun doom-enlist (exp)
|
(defun doom-modeline-enlist (exp)
|
||||||
"Return EXP wrapped in a list, or as-is if already a list."
|
"Return EXP wrapped in a list, or as-is if already a list."
|
||||||
(if (listp exp) exp (list exp)))
|
(if (listp exp) exp (list exp)))
|
||||||
|
|
||||||
(defun doom-unquote (exp)
|
(defun doom-modeline-unquote (exp)
|
||||||
"Return EXP unquoted."
|
"Return EXP unquoted."
|
||||||
(while (memq (car-safe exp) '(quote function))
|
(while (memq (car-safe exp) '(quote function))
|
||||||
(setq exp (cadr exp)))
|
(setq exp (cadr exp)))
|
||||||
exp)
|
exp)
|
||||||
|
|
||||||
(defvar doom--transient-counter 0))
|
(defvar doom-modeline--transient-counter 0))
|
||||||
|
|
||||||
(defmacro add-transient-hook! (hook &rest forms)
|
(defmacro doom-modeline-add-transient-hook! (hook &rest forms)
|
||||||
"Attaches transient forms to a HOOK.
|
"Attaches transient forms to a HOOK.
|
||||||
HOOK can be a quoted hook or a sharp-quoted function (which will be advised).
|
HOOK can be a quoted hook or a sharp-quoted function (which will be advised).
|
||||||
These forms will be evaluated once when that function/hook is first invoked,
|
These forms will be evaluated once when that function/hook is first invoked,
|
||||||
then it detaches itself."
|
then it detaches itself."
|
||||||
(declare (indent 1))
|
(declare (indent 1))
|
||||||
(let ((append (eq (car forms) :after))
|
(let ((append (eq (car forms) :after))
|
||||||
(fn (intern (format "doom-transient-hook-%s" (cl-incf doom--transient-counter)))))
|
(fn (intern (format "doom-transient-hook-%s" (cl-incf doom-modeline--transient-counter)))))
|
||||||
`(when ,hook
|
`(when ,hook
|
||||||
(fset ',fn
|
(fset ',fn
|
||||||
(lambda (&rest _)
|
(lambda (&rest _)
|
||||||
|
@ -93,7 +93,7 @@ then it detaches itself."
|
||||||
((symbolp ,hook)
|
((symbolp ,hook)
|
||||||
(add-hook ,hook #',fn ,append))))))
|
(add-hook ,hook #',fn ,append))))))
|
||||||
|
|
||||||
(defmacro add-hook! (&rest args)
|
(defmacro doom-modeline-add-hook! (&rest args)
|
||||||
"A convenience macro for `add-hook'. Takes, in order:
|
"A convenience macro for `add-hook'. Takes, in order:
|
||||||
1. Optional properties :local and/or :append, which will make the hook
|
1. Optional properties :local and/or :append, which will make the hook
|
||||||
buffer-local or append to the list of hooks (respectively),
|
buffer-local or append to the list of hooks (respectively),
|
||||||
|
@ -102,14 +102,14 @@ then it detaches itself."
|
||||||
hooks will be resolved by appending -hook to each symbol.
|
hooks will be resolved by appending -hook to each symbol.
|
||||||
3. A function, list of functions, or body forms to be wrapped in a lambda.
|
3. A function, list of functions, or body forms to be wrapped in a lambda.
|
||||||
Examples:
|
Examples:
|
||||||
(add-hook! 'some-mode-hook 'enable-something)
|
(doom-modeline-add-hook! 'some-mode-hook 'enable-something)
|
||||||
(add-hook! some-mode '(enable-something and-another))
|
(doom-modeline-add-hook! some-mode '(enable-something and-another))
|
||||||
(add-hook! '(one-mode-hook second-mode-hook) 'enable-something)
|
(doom-modeline-add-hook! '(one-mode-hook second-mode-hook) 'enable-something)
|
||||||
(add-hook! (one-mode second-mode) 'enable-something)
|
(doom-modeline-add-hook! (one-mode second-mode) 'enable-something)
|
||||||
(add-hook! :append (one-mode second-mode) 'enable-something)
|
(doom-modeline-add-hook! :append (one-mode second-mode) 'enable-something)
|
||||||
(add-hook! :local (one-mode second-mode) 'enable-something)
|
(doom-modeline-add-hook! :local (one-mode second-mode) 'enable-something)
|
||||||
(add-hook! (one-mode second-mode) (setq v 5) (setq a 2))
|
(doom-modeline-add-hook! (one-mode second-mode) (setq v 5) (setq a 2))
|
||||||
(add-hook! :append :local (one-mode second-mode) (setq v 5) (setq a 2))
|
(doom-modeline-add-hook! :append :local (one-mode second-mode) (setq v 5) (setq a 2))
|
||||||
Body forms can access the hook's arguments through the let-bound variable
|
Body forms can access the hook's arguments through the let-bound variable
|
||||||
`args'."
|
`args'."
|
||||||
(declare (indent defun) (debug t))
|
(declare (indent defun) (debug t))
|
||||||
|
@ -120,7 +120,7 @@ Body forms can access the hook's arguments through the let-bound variable
|
||||||
(:append (setq append-p t))
|
(:append (setq append-p t))
|
||||||
(:local (setq local-p t))
|
(:local (setq local-p t))
|
||||||
(:remove (setq hook-fn 'remove-hook))))
|
(:remove (setq hook-fn 'remove-hook))))
|
||||||
(let ((hooks (doom--resolve-hooks (pop args)))
|
(let ((hooks (doom-modeline--resolve-hooks (pop args)))
|
||||||
(funcs
|
(funcs
|
||||||
(let ((val (car args)))
|
(let ((val (car args)))
|
||||||
(if (memq (car-safe val) '(quote function))
|
(if (memq (car-safe val) '(quote function))
|
||||||
|
@ -141,7 +141,7 @@ Body forms can access the hook's arguments through the let-bound variable
|
||||||
forms)))
|
forms)))
|
||||||
`(progn ,@(nreverse forms)))))
|
`(progn ,@(nreverse forms)))))
|
||||||
|
|
||||||
(defmacro def-modeline-segment! (name &rest forms)
|
(defmacro doom-modeline-def-segment! (name &rest forms)
|
||||||
"Defines a modeline segment and byte compiles it."
|
"Defines a modeline segment and byte compiles it."
|
||||||
(declare (indent defun) (doc-string 2))
|
(declare (indent defun) (doc-string 2))
|
||||||
(let ((sym (intern (format "doom-modeline-segment--%s" name))))
|
(let ((sym (intern (format "doom-modeline-segment--%s" name))))
|
||||||
|
@ -151,25 +151,25 @@ Body forms can access the hook's arguments through the let-bound variable
|
||||||
`(let (byte-compile-warnings)
|
`(let (byte-compile-warnings)
|
||||||
(byte-compile #',sym))))))
|
(byte-compile #',sym))))))
|
||||||
|
|
||||||
(defsubst doom--prepare-modeline-segments (segments)
|
(defsubst doom-modeline--prepare-modeline-segments (segments)
|
||||||
(cl-loop for seg in segments
|
(cl-loop for seg in segments
|
||||||
if (stringp seg)
|
if (stringp seg)
|
||||||
collect seg
|
collect seg
|
||||||
else
|
else
|
||||||
collect (list (intern (format "doom-modeline-segment--%s" (symbol-name seg))))))
|
collect (list (intern (format "doom-modeline-segment--%s" (symbol-name seg))))))
|
||||||
|
|
||||||
(defmacro def-modeline! (name lhs &optional rhs)
|
(defmacro doom-modeline-def-modeline! (name lhs &optional rhs)
|
||||||
"Defines a modeline format and byte-compiles it. NAME is a symbol to identify
|
"Defines a modeline format and byte-compiles it. NAME is a symbol to identify
|
||||||
it (used by `doom-modeline' for retrieval). LHS and RHS are lists of symbols of
|
it (used by `doom-modeline' for retrieval). LHS and RHS are lists of symbols of
|
||||||
modeline segments defined with `def-modeline-segment!'.
|
modeline segments defined with `doom-modeline-def-segment!'.
|
||||||
Example:
|
Example:
|
||||||
(def-modeline! minimal
|
(doom-modeline-def-modeline! minimal
|
||||||
(bar matches \" \" buffer-info)
|
(bar matches \" \" buffer-info)
|
||||||
(media-info major-mode))
|
(media-info major-mode))
|
||||||
(doom-set-modeline 'minimal t)"
|
(doom-modeline-set-modeline 'minimal t)"
|
||||||
(let ((sym (intern (format "doom-modeline-format--%s" name)))
|
(let ((sym (intern (format "doom-modeline-format--%s" name)))
|
||||||
(lhs-forms (doom--prepare-modeline-segments lhs))
|
(lhs-forms (doom-modeline--prepare-modeline-segments lhs))
|
||||||
(rhs-forms (doom--prepare-modeline-segments rhs)))
|
(rhs-forms (doom-modeline--prepare-modeline-segments rhs)))
|
||||||
`(progn
|
`(progn
|
||||||
(defun ,sym ()
|
(defun ,sym ()
|
||||||
(let ((lhs (list ,@lhs-forms))
|
(let ((lhs (list ,@lhs-forms))
|
||||||
|
@ -192,7 +192,7 @@ error if it doesn't exist."
|
||||||
(when (functionp fn)
|
(when (functionp fn)
|
||||||
`(:eval (,fn)))))
|
`(:eval (,fn)))))
|
||||||
|
|
||||||
(defun doom-set-modeline (key &optional default)
|
(defun doom-modeline-set-modeline (key &optional default)
|
||||||
"Set the modeline format. Does nothing if the modeline KEY doesn't exist. If
|
"Set the modeline format. Does nothing if the modeline KEY doesn't exist. If
|
||||||
DEFAULT is non-nil, set the default mode-line for all buffers."
|
DEFAULT is non-nil, set the default mode-line for all buffers."
|
||||||
(-when-let* ((modeline (doom-modeline key)))
|
(-when-let* ((modeline (doom-modeline key)))
|
||||||
|
@ -201,7 +201,7 @@ DEFAULT is non-nil, set the default mode-line for all buffers."
|
||||||
(buffer-local-value 'mode-line-format (current-buffer)))
|
(buffer-local-value 'mode-line-format (current-buffer)))
|
||||||
modeline)))
|
modeline)))
|
||||||
|
|
||||||
(defun doom-project-root ()
|
(defun doom-modeline-project-root ()
|
||||||
"Get the path to the root of your project.
|
"Get the path to the root of your project.
|
||||||
If STRICT-P, return nil if no project was found, otherwise return
|
If STRICT-P, return nil if no project was found, otherwise return
|
||||||
`default-directory'."
|
`default-directory'."
|
||||||
|
@ -212,25 +212,25 @@ If STRICT-P, return nil if no project was found, otherwise return
|
||||||
;; modeline configs
|
;; modeline configs
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(defun +doom-modeline-eldoc (text)
|
(defun doom-modeline-eldoc (text)
|
||||||
(concat (when (display-graphic-p)
|
(concat (when (display-graphic-p)
|
||||||
(+doom-modeline--make-xpm
|
(doom-modeline--make-xpm
|
||||||
(face-background 'doom-modeline-eldoc-bar nil t)
|
(face-background 'doom-modeline-eldoc-bar nil t)
|
||||||
+doom-modeline-height
|
doom-modeline-height
|
||||||
+doom-modeline-bar-width))
|
doom-modeline-bar-width))
|
||||||
text))
|
text))
|
||||||
|
|
||||||
;; Show eldoc in the mode-line with `eval-expression'
|
;; Show eldoc in the mode-line with `eval-expression'
|
||||||
(defun +doom-modeline--show-eldoc (input)
|
(defun doom-modeline--show-eldoc (input)
|
||||||
"Display string STR in the mode-line next to minibuffer."
|
"Display string STR in the mode-line next to minibuffer."
|
||||||
(with-current-buffer (eldoc-current-buffer)
|
(with-current-buffer (eldoc-current-buffer)
|
||||||
(let* ((str (and (stringp input) input))
|
(let* ((str (and (stringp input) input))
|
||||||
(mode-line-format (or (and str (or (+doom-modeline-eldoc str) str))
|
(mode-line-format (or (and str (or (doom-modeline-eldoc str) str))
|
||||||
mode-line-format))
|
mode-line-format))
|
||||||
mode-line-in-non-selected-windows)
|
mode-line-in-non-selected-windows)
|
||||||
(force-mode-line-update)
|
(force-mode-line-update)
|
||||||
(sit-for eldoc-show-in-mode-line-delay))))
|
(sit-for eldoc-show-in-mode-line-delay))))
|
||||||
(setq eldoc-in-minibuffer-show-fn #'+doom-modeline--show-eldoc)
|
(setq eldoc-in-minibuffer-show-fn #'doom-modeline--show-eldoc)
|
||||||
|
|
||||||
(eldoc-in-minibuffer-mode +1)
|
(eldoc-in-minibuffer-mode +1)
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ If STRICT-P, return nil if no project was found, otherwise return
|
||||||
;; anzu and evil-anzu expose current/total state that can be displayed in the
|
;; anzu and evil-anzu expose current/total state that can be displayed in the
|
||||||
;; mode-line.
|
;; mode-line.
|
||||||
(when (featurep 'evil-anzu)
|
(when (featurep 'evil-anzu)
|
||||||
(add-transient-hook! #'evil-ex-start-search (require 'evil-anzu))
|
(doom-modeline-add-transient-hook! #'evil-ex-start-search (require 'evil-anzu))
|
||||||
|
|
||||||
(setq anzu-cons-mode-line-p nil
|
(setq anzu-cons-mode-line-p nil
|
||||||
anzu-minimum-input-length 1
|
anzu-minimum-input-length 1
|
||||||
|
@ -256,35 +256,35 @@ If STRICT-P, return nil if no project was found, otherwise return
|
||||||
(add-hook 'iedit-mode-end-hook #'anzu--reset-status))
|
(add-hook 'iedit-mode-end-hook #'anzu--reset-status))
|
||||||
|
|
||||||
|
|
||||||
;; Keep `+doom-modeline-current-window' up-to-date
|
;; Keep `doom-modeline-current-window' up-to-date
|
||||||
(defvar +doom-modeline-current-window (frame-selected-window))
|
(defvar doom-modeline-current-window (frame-selected-window))
|
||||||
(defun +doom-modeline|set-selected-window (&rest _)
|
(defun doom-modeline-set-selected-window (&rest _)
|
||||||
"Sets `+doom-modeline-current-window' appropriately"
|
"Set `doom-modeline-current-window' appropriately."
|
||||||
(-when-let* ((win (frame-selected-window)))
|
(-when-let* ((win (frame-selected-window)))
|
||||||
(unless (minibuffer-window-active-p win)
|
(unless (minibuffer-window-active-p win)
|
||||||
(setq +doom-modeline-current-window win))))
|
(setq doom-modeline-current-window win))))
|
||||||
|
|
||||||
(add-hook 'window-configuration-change-hook #'+doom-modeline|set-selected-window)
|
(add-hook 'window-configuration-change-hook #'doom-modeline-set-selected-window)
|
||||||
(add-hook 'focus-in-hook #'+doom-modeline|set-selected-window)
|
(add-hook 'focus-in-hook #'doom-modeline-set-selected-window)
|
||||||
(advice-add #'handle-switch-frame :after #'+doom-modeline|set-selected-window)
|
(advice-add #'handle-switch-frame :after #'doom-modeline-set-selected-window)
|
||||||
(advice-add #'select-window :after #'+doom-modeline|set-selected-window)
|
(advice-add #'select-window :after #'doom-modeline-set-selected-window)
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Variables
|
;; Variables
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(defvar +doom-modeline-height 29
|
(defvar doom-modeline-height 29
|
||||||
"How tall the mode-line should be (only respected in GUI emacs).")
|
"How tall the mode-line should be (only respected in GUI emacs).")
|
||||||
|
|
||||||
(defvar +doom-modeline-bar-width 3
|
(defvar doom-modeline-bar-width 3
|
||||||
"How wide the mode-line bar should be (only respected in GUI emacs).")
|
"How wide the mode-line bar should be (only respected in GUI emacs).")
|
||||||
|
|
||||||
(defvar +doom-modeline-vspc
|
(defvar doom-modeline-vspc
|
||||||
(propertize " " 'face 'variable-pitch)
|
(propertize " " 'face 'variable-pitch)
|
||||||
"TODO")
|
"TODO")
|
||||||
|
|
||||||
(defvar +doom-modeline-buffer-file-name-style 'truncate-upto-project
|
(defvar doom-modeline-buffer-file-name-style 'truncate-upto-project
|
||||||
"Determines the style used by `+doom-modeline-buffer-file-name'.
|
"Determines the style used by `doom-modeline-buffer-file-name'.
|
||||||
Given ~/Projects/FOSS/emacs/lisp/comint.el
|
Given ~/Projects/FOSS/emacs/lisp/comint.el
|
||||||
truncate-upto-project => ~/P/F/emacs/lisp/comint.el
|
truncate-upto-project => ~/P/F/emacs/lisp/comint.el
|
||||||
truncate-upto-root => ~/P/F/e/lisp/comint.el
|
truncate-upto-root => ~/P/F/e/lisp/comint.el
|
||||||
|
@ -294,126 +294,123 @@ relative-to-project => lisp/comint.el
|
||||||
file-name => comint.el")
|
file-name => comint.el")
|
||||||
|
|
||||||
;; externs
|
;; externs
|
||||||
(defvar anzu--state nil)
|
(setq anzu--state nil)
|
||||||
(defvar evil-mode nil)
|
(setq evil-mode nil)
|
||||||
(defvar evil-state nil)
|
(setq evil-state nil)
|
||||||
(defvar evil-visual-selection nil)
|
(setq evil-visual-selection nil)
|
||||||
(defvar iedit-mode nil)
|
(setq iedit-mode nil)
|
||||||
(defvar all-the-icons-scale-factor)
|
|
||||||
(defvar all-the-icons-default-adjust)
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Custom faces
|
;; Custom faces
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(defgroup +doom-modeline nil
|
(defgroup doom-modeline nil
|
||||||
""
|
""
|
||||||
:group 'doom)
|
:group 'doom)
|
||||||
|
|
||||||
(defface doom-modeline-buffer-path
|
(defface doom-modeline-buffer-path
|
||||||
'((t (:inherit mode-line-emphasis :bold t)))
|
'((t (:inherit mode-line-emphasis :bold t)))
|
||||||
"Face used for the dirname part of the buffer path."
|
"Face used for the dirname part of the buffer path."
|
||||||
:group '+doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
(defface doom-modeline-buffer-file
|
(defface doom-modeline-buffer-file
|
||||||
'((t (:inherit mode-line-buffer-id)))
|
'((t (:inherit mode-line-buffer-id)))
|
||||||
"Face used for the filename part of the mode-line buffer path."
|
"Face used for the filename part of the mode-line buffer path."
|
||||||
:group '+doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
(defface doom-modeline-buffer-modified
|
(defface doom-modeline-buffer-modified
|
||||||
'((t (:inherit error :background nil :bold t)))
|
'((t (:inherit error :background nil :bold t)))
|
||||||
"Face used for the 'unsaved' symbol in the mode-line."
|
"Face used for the 'unsaved' symbol in the mode-line."
|
||||||
:group '+doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
(defface doom-modeline-buffer-major-mode
|
(defface doom-modeline-buffer-major-mode
|
||||||
'((t (:inherit mode-line-emphasis :bold t)))
|
'((t (:inherit mode-line-emphasis :bold t)))
|
||||||
"Face used for the major-mode segment in the mode-line."
|
"Face used for the major-mode segment in the mode-line."
|
||||||
:group '+doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
(defface doom-modeline-highlight
|
(defface doom-modeline-highlight
|
||||||
'((t (:inherit mode-line-emphasis)))
|
'((t (:inherit mode-line-emphasis)))
|
||||||
"Face for bright segments of the mode-line."
|
"Face for bright segments of the mode-line."
|
||||||
:group '+doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
(defface doom-modeline-panel
|
(defface doom-modeline-panel
|
||||||
'((t (:inherit mode-line-highlight)))
|
'((t (:inherit mode-line-highlight)))
|
||||||
"Face for 'X out of Y' segments, such as `+doom-modeline--anzu', `+doom-modeline--evil-substitute' and
|
"Face for 'X out of Y' segments, such as `doom-modeline--anzu', `doom-modeline--evil-substitute' and
|
||||||
`iedit'"
|
`iedit'"
|
||||||
:group '+doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
(defface doom-modeline-info
|
(defface doom-modeline-info
|
||||||
`((t (:inherit success :bold t)))
|
`((t (:inherit success :bold t)))
|
||||||
"Face for info-level messages in the modeline. Used by `*vc'."
|
"Face for info-level messages in the modeline. Used by `*vc'."
|
||||||
:group '+doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
(defface doom-modeline-warning
|
(defface doom-modeline-warning
|
||||||
`((t (:inherit warning :bold t)))
|
`((t (:inherit warning :bold t)))
|
||||||
"Face for warnings in the modeline. Used by `*flycheck'"
|
"Face for warnings in the modeline. Used by `*flycheck'"
|
||||||
:group '+doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
(defface doom-modeline-urgent
|
(defface doom-modeline-urgent
|
||||||
`((t (:inherit error :bold t)))
|
`((t (:inherit error :bold t)))
|
||||||
"Face for errors in the modeline. Used by `*flycheck'"
|
"Face for errors in the modeline. Used by `*flycheck'"
|
||||||
:group '+doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
;; Bar
|
;; Bar
|
||||||
(defface doom-modeline-bar '((t (:inherit highlight)))
|
(defface doom-modeline-bar '((t (:inherit highlight)))
|
||||||
"The face used for the left-most bar on the mode-line of an active window."
|
"The face used for the left-most bar on the mode-line of an doom-modeline--active window."
|
||||||
:group '+doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
(defface doom-modeline-eldoc-bar '((t (:inherit shadow)))
|
(defface doom-modeline-eldoc-bar '((t (:inherit shadow)))
|
||||||
"The face used for the left-most bar on the mode-line when eldoc-eval is
|
"The face used for the left-most bar on the mode-line when eldoc-eval is
|
||||||
active."
|
active."
|
||||||
:group '+doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
(defface doom-modeline-inactive-bar '((t (:inherit warning :inverse-video t)))
|
(defface doom-modeline-inactive-bar '((t (:inherit warning :inverse-video t)))
|
||||||
"The face used for the left-most bar on the mode-line of an inactive window."
|
"The face used for the left-most bar on the mode-line of an inactive window."
|
||||||
:group '+doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
(defface doom-modeline-persp '((t ()))
|
(defface doom-modeline-persp '((t ()))
|
||||||
"The face used for persp number."
|
"The face used for persp number."
|
||||||
:group '+doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
(defface doom-modeline-eyebrowse '((t ()))
|
(defface doom-modeline-eyebrowse '((t ()))
|
||||||
"The face used for eyebrowse."
|
"The face used for eyebrowse."
|
||||||
:group '+doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
(defface doom-modeline-bracket '((t (:inherit shadow)))
|
(defface doom-modeline-bracket '((t (:inherit shadow)))
|
||||||
"The face used for brackets around the project."
|
"The face used for brackets around the project."
|
||||||
:group '+doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Bootstrap
|
;; Bootstrap
|
||||||
;;
|
;;
|
||||||
|
|
||||||
;; Show version string for multi-version managers like rvm, rbenv, pyenv, etc.
|
;; Show version string for multi-version managers like rvm, rbenv, pyenv, etc.
|
||||||
(defvar-local +doom-modeline-env-version nil)
|
(defvar-local doom-modeline-env-version nil)
|
||||||
(defvar-local +doom-modeline-env-command nil)
|
(defvar-local doom-modeline-env-command nil)
|
||||||
(add-hook! '(focus-in-hook find-file-hook) #'+doom-modeline|update-env)
|
(doom-modeline-add-hook! '(focus-in-hook find-file-hook) #'doom-modeline-update-env)
|
||||||
(defun +doom-modeline|update-env ()
|
(defun doom-modeline-update-env ()
|
||||||
(when +doom-modeline-env-command
|
(when doom-modeline-env-command
|
||||||
(let* ((default-directory (doom-project-root))
|
(let* ((default-directory (doom-modeline-project-root))
|
||||||
(s (shell-command-to-string +doom-modeline-env-command)))
|
(s (shell-command-to-string doom-modeline-env-command)))
|
||||||
(setq +doom-modeline-env-version (if (string-match "[ \t\n\r]+\\'" s)
|
(setq doom-modeline-env-version (if (string-match "[ \t\n\r]+\\'" s)
|
||||||
(replace-match "" t t s)
|
(replace-match "" t t s)
|
||||||
s)))))
|
s)))))
|
||||||
|
|
||||||
;; Only support python and ruby for now
|
;; Only support python and ruby for now
|
||||||
|
|
||||||
;; TODO torgeir
|
;; TODO torgeir
|
||||||
(add-hook! 'python-mode-hook (setq +doom-modeline-env-command "python --version 2>&1 | cut -d' ' -f2"))
|
(doom-modeline-add-hook! 'python-mode-hook (setq doom-modeline-env-command "python --version 2>&1 | cut -d' ' -f2"))
|
||||||
(add-hook! 'ruby-mode-hook (setq +doom-modeline-env-command "ruby --version 2>&1 | cut -d' ' -f2"))
|
(doom-modeline-add-hook! 'ruby-mode-hook (setq doom-modeline-env-command "ruby --version 2>&1 | cut -d' ' -f2"))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Modeline helpers
|
;; Modeline helpers
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(defsubst active ()
|
(defsubst doom-modeline--active ()
|
||||||
(eq (selected-window) +doom-modeline-current-window))
|
(eq (selected-window) doom-modeline-current-window))
|
||||||
|
|
||||||
;; Inspired from `powerline's `pl/make-xpm'.
|
;; Inspired from `powerline's `pl/make-xpm'.
|
||||||
(defmemoize +doom-modeline--make-xpm (color height width)
|
(defmemoize doom-modeline--make-xpm (color height width)
|
||||||
"Create an XPM bitmap."
|
"Create an XPM bitmap."
|
||||||
(propertize
|
(propertize
|
||||||
" " 'display
|
" " 'display
|
||||||
|
@ -439,36 +436,36 @@ active."
|
||||||
(if (eq idx len) "\"};" "\",\n")))))
|
(if (eq idx len) "\"};" "\",\n")))))
|
||||||
'xpm t :ascent 'center))))
|
'xpm t :ascent 'center))))
|
||||||
|
|
||||||
(defun +doom-modeline-buffer-file-name ()
|
(defun doom-modeline-buffer-file-name ()
|
||||||
"Propertized `buffer-file-name' based on `+doom-modeline-buffer-file-name-style'."
|
"Propertized `buffer-file-name' based on `doom-modeline-buffer-file-name-style'."
|
||||||
(propertize
|
(propertize
|
||||||
(pcase +doom-modeline-buffer-file-name-style
|
(pcase doom-modeline-buffer-file-name-style
|
||||||
('truncate-upto-project (+doom-modeline--buffer-file-name 'shrink))
|
('truncate-upto-project (doom-modeline--buffer-file-name 'shrink))
|
||||||
('truncate-upto-root (+doom-modeline--buffer-file-name-truncate))
|
('truncate-upto-root (doom-modeline--buffer-file-name-truncate))
|
||||||
('truncate-all (+doom-modeline--buffer-file-name-truncate t))
|
('truncate-all (doom-modeline--buffer-file-name-truncate t))
|
||||||
('relative-to-project (+doom-modeline--buffer-file-name-relative))
|
('relative-to-project (doom-modeline--buffer-file-name-relative))
|
||||||
('relative-from-project (+doom-modeline--buffer-file-name-relative 'include-project))
|
('relative-from-project (doom-modeline--buffer-file-name-relative 'include-project))
|
||||||
('file-name (propertize (file-name-nondirectory buffer-file-name)
|
('file-name (propertize (file-name-nondirectory buffer-file-name)
|
||||||
'face
|
'face
|
||||||
(let ((face (or (and (buffer-modified-p)
|
(let ((face (or (and (buffer-modified-p)
|
||||||
'doom-modeline-buffer-modified)
|
'doom-modeline-buffer-modified)
|
||||||
(and (active)
|
(and (doom-modeline--active)
|
||||||
'doom-modeline-buffer-file))))
|
'doom-modeline-buffer-file))))
|
||||||
(when face `(:inherit ,face))))))
|
(when face `(:inherit ,face))))))
|
||||||
'help-echo buffer-file-truename))
|
'help-echo buffer-file-truename))
|
||||||
|
|
||||||
(defun +doom-modeline--buffer-file-name-truncate (&optional truncate-tail)
|
(defun doom-modeline--buffer-file-name-truncate (&optional truncate-tail)
|
||||||
"Propertized `buffer-file-name' that truncates every dir along path.
|
"Propertized `buffer-file-name' that truncates every dir along path.
|
||||||
If TRUNCATE-TAIL is t also truncate the parent directory of the file."
|
If TRUNCATE-TAIL is t also truncate the parent directory of the file."
|
||||||
(let ((dirs (shrink-path-prompt (file-name-directory buffer-file-truename)))
|
(let ((dirs (shrink-path-prompt (file-name-directory buffer-file-truename)))
|
||||||
(active (active)))
|
(doom-modeline--active (doom-modeline--active)))
|
||||||
(if (null dirs)
|
(if (null dirs)
|
||||||
(propertize "%b" 'face (if active 'doom-modeline-buffer-file))
|
(propertize "%b" 'face (if doom-modeline--active 'doom-modeline-buffer-file))
|
||||||
(let ((modified-faces (if (buffer-modified-p) 'doom-modeline-buffer-modified)))
|
(let ((modified-faces (if (buffer-modified-p) 'doom-modeline-buffer-modified)))
|
||||||
(let ((dirname (car dirs))
|
(let ((dirname (car dirs))
|
||||||
(basename (cdr dirs))
|
(basename (cdr dirs))
|
||||||
(dir-faces (or modified-faces (if active 'doom-modeline-project-root-dir)))
|
(dir-faces (or modified-faces (if doom-modeline--active 'doom-modeline-project-root-dir)))
|
||||||
(file-faces (or modified-faces (if active 'doom-modeline-buffer-file))))
|
(file-faces (or modified-faces (if doom-modeline--active 'doom-modeline-buffer-file))))
|
||||||
(concat (propertize (concat dirname
|
(concat (propertize (concat dirname
|
||||||
(if truncate-tail (substring basename 0 1) basename)
|
(if truncate-tail (substring basename 0 1) basename)
|
||||||
"/")
|
"/")
|
||||||
|
@ -476,54 +473,54 @@ If TRUNCATE-TAIL is t also truncate the parent directory of the file."
|
||||||
(propertize (file-name-nondirectory buffer-file-name)
|
(propertize (file-name-nondirectory buffer-file-name)
|
||||||
'face (if file-faces `(:inherit ,file-faces)))))))))
|
'face (if file-faces `(:inherit ,file-faces)))))))))
|
||||||
|
|
||||||
(defmemoize +doom-file-relative-name (filename directory)
|
(defmemoize doom-modeline-file-relative-name (filename directory)
|
||||||
(file-relative-name filename directory))
|
(file-relative-name filename directory))
|
||||||
|
|
||||||
(defun +doom-modeline--buffer-file-name-relative (&optional include-project)
|
(defun doom-modeline--buffer-file-name-relative (&optional include-project)
|
||||||
"Propertized `buffer-file-name' showing directories relative to project's root only."
|
"Propertized `buffer-file-name' showing directories relative to project's root only."
|
||||||
(let ((root (doom-project-root))
|
(let ((root (doom-modeline-project-root))
|
||||||
(active (active)))
|
(doom-modeline--active (doom-modeline--active)))
|
||||||
(if (null root)
|
(if (null root)
|
||||||
(propertize "%b" 'face (if active 'doom-modeline-buffer-file))
|
(propertize "%b" 'face (if doom-modeline--active 'doom-modeline-buffer-file))
|
||||||
(let* ((modified-faces (if (buffer-modified-p) 'doom-modeline-buffer-modified))
|
(let* ((modified-faces (if (buffer-modified-p) 'doom-modeline-buffer-modified))
|
||||||
(relative-dirs (file-relative-name (file-name-directory buffer-file-truename)
|
(relative-dirs (file-relative-name (file-name-directory buffer-file-truename)
|
||||||
(if include-project (concat root "../") root)))
|
(if include-project (concat root "../") root)))
|
||||||
(relative-faces (or modified-faces (if active 'doom-modeline-buffer-path)))
|
(relative-faces (or modified-faces (if doom-modeline--active 'doom-modeline-buffer-path)))
|
||||||
(file-faces (or modified-faces (if active 'doom-modeline-buffer-file))))
|
(file-faces (or modified-faces (if doom-modeline--active 'doom-modeline-buffer-file))))
|
||||||
(if (equal "./" relative-dirs) (setq relative-dirs ""))
|
(if (equal "./" relative-dirs) (setq relative-dirs ""))
|
||||||
(concat (propertize relative-dirs 'face (if relative-faces `(:inherit ,relative-faces)))
|
(concat (propertize relative-dirs 'face (if relative-faces `(:inherit ,relative-faces)))
|
||||||
(propertize (file-name-nondirectory buffer-file-truename)
|
(propertize (file-name-nondirectory buffer-file-truename)
|
||||||
'face (if file-faces `(:inherit ,file-faces))))))))
|
'face (if file-faces `(:inherit ,file-faces))))))))
|
||||||
|
|
||||||
(defmemoize +doom-abbreviate-file-name (file-name)
|
(defmemoize doom-modeline-abbreviate-file-name (file-name)
|
||||||
(abbreviate-file-name file-name))
|
(abbreviate-file-name file-name))
|
||||||
|
|
||||||
(defmemoize +doom-shrink-path-file-mixed (project-root file-name)
|
(defmemoize doom-modeline-shrink-path-file-mixed (project-root file-name)
|
||||||
(shrink-path-file-mixed project-root
|
(shrink-path-file-mixed project-root
|
||||||
(file-name-directory file-name)
|
(file-name-directory file-name)
|
||||||
file-name))
|
file-name))
|
||||||
|
|
||||||
(defun +doom-modeline--buffer-file-name (truncate-project-root-parent)
|
(defun doom-modeline--buffer-file-name (truncate-project-root-parent)
|
||||||
"Propertized `buffer-file-name'.
|
"Propertized `buffer-file-name'.
|
||||||
If TRUNCATE-PROJECT-ROOT-PARENT is t space will be saved by truncating it down
|
If TRUNCATE-PROJECT-ROOT-PARENT is t space will be saved by truncating it down
|
||||||
fish-shell style.
|
fish-shell style.
|
||||||
Example:
|
Example:
|
||||||
~/Projects/FOSS/emacs/lisp/comint.el => ~/P/F/emacs/lisp/comint.el"
|
~/Projects/FOSS/emacs/lisp/comint.el => ~/P/F/emacs/lisp/comint.el"
|
||||||
(let* ((project-root (doom-project-root))
|
(let* ((project-root (doom-modeline-project-root))
|
||||||
(file-name-split (shrink-path-file-mixed project-root
|
(file-name-split (shrink-path-file-mixed project-root
|
||||||
(file-name-directory buffer-file-truename)
|
(file-name-directory buffer-file-truename)
|
||||||
buffer-file-truename))
|
buffer-file-truename))
|
||||||
(active (active)))
|
(doom-modeline--active (doom-modeline--active)))
|
||||||
(if (null file-name-split)
|
(if (null file-name-split)
|
||||||
(propertize "%b" 'face (if active 'doom-modeline-buffer-file))
|
(propertize "%b" 'face (if doom-modeline--active 'doom-modeline-buffer-file))
|
||||||
(pcase-let ((`(,root-path-parent ,project ,relative-path ,filename) file-name-split))
|
(pcase-let ((`(,root-path-parent ,project ,relative-path ,filename) file-name-split))
|
||||||
(let ((modified-faces (if (buffer-modified-p) 'doom-modeline-buffer-modified)))
|
(let ((modified-faces (if (buffer-modified-p) 'doom-modeline-buffer-modified)))
|
||||||
(let ((sp-faces (or modified-faces (if active 'font-lock-comment-face)))
|
(let ((sp-faces (or modified-faces (if doom-modeline--active 'font-lock-comment-face)))
|
||||||
(project-faces (or modified-faces (if active 'font-lock-string-face)))
|
(project-faces (or modified-faces (if doom-modeline--active 'font-lock-string-face)))
|
||||||
(relative-faces (or modified-faces (if active 'doom-modeline-buffer-path)))
|
(relative-faces (or modified-faces (if doom-modeline--active 'doom-modeline-buffer-path)))
|
||||||
(file-faces (or modified-faces (if active 'doom-modeline-buffer-file))))
|
(file-faces (or modified-faces (if doom-modeline--active 'doom-modeline-buffer-file))))
|
||||||
(let ((sp-props `(,@(if sp-faces `(:inherit ,sp-faces)) ,@(if active '(:weight bold))))
|
(let ((sp-props `(,@(if sp-faces `(:inherit ,sp-faces)) ,@(if doom-modeline--active '(:weight bold))))
|
||||||
(project-props `(,@(if project-faces `(:inherit ,project-faces)) ,@(if active '(:weight bold))))
|
(project-props `(,@(if project-faces `(:inherit ,project-faces)) ,@(if doom-modeline--active '(:weight bold))))
|
||||||
(relative-props `(,@(if relative-faces `(:inherit ,relative-faces))))
|
(relative-props `(,@(if relative-faces `(:inherit ,relative-faces))))
|
||||||
(file-props `(,@(if file-faces `(:inherit ,file-faces)))))
|
(file-props `(,@(if file-faces `(:inherit ,file-faces)))))
|
||||||
(concat (propertize (if truncate-project-root-parent
|
(concat (propertize (if truncate-project-root-parent
|
||||||
|
@ -540,12 +537,12 @@ Example:
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
||||||
(def-modeline-segment! buffer-default-directory
|
(doom-modeline-def-segment! buffer-default-directory
|
||||||
"Displays `default-directory'. This is for special buffers like the scratch
|
"Displays `default-directory'. This is for special buffers like the scratch
|
||||||
buffer where knowing the current project directory is important."
|
buffer where knowing the current project directory is important."
|
||||||
(let ((face (if (active) 'doom-modeline-buffer-path)))
|
(let ((face (if (doom-modeline--active) 'doom-modeline-buffer-path)))
|
||||||
(concat (if (display-graphic-p) " ")
|
(concat (if (display-graphic-p) " ")
|
||||||
(+doom-maybe-icon-octicon
|
(doom-modeline-maybe-icon-octicon
|
||||||
"file-directory"
|
"file-directory"
|
||||||
:face face
|
:face face
|
||||||
:v-adjust -0.05
|
:v-adjust -0.05
|
||||||
|
@ -555,50 +552,50 @@ buffer where knowing the current project directory is important."
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(def-modeline-segment! buffer-info
|
(doom-modeline-def-segment! buffer-info
|
||||||
"Combined information about the current buffer, including the current working
|
"Combined information about the current buffer, including the current working
|
||||||
directory, the file name, and its state (modified, read-only or non-existent)."
|
directory, the file name, and its state (modified, read-only or non-existent)."
|
||||||
(concat
|
(concat
|
||||||
(cond (buffer-read-only
|
(cond (buffer-read-only
|
||||||
(concat (+doom-maybe-icon-octicon
|
(concat (doom-modeline-maybe-icon-octicon
|
||||||
"lock"
|
"lock"
|
||||||
:face 'doom-modeline-warning
|
:face 'doom-modeline-warning
|
||||||
:v-adjust -0.05)
|
:v-adjust -0.05)
|
||||||
" "))
|
" "))
|
||||||
((buffer-modified-p)
|
((buffer-modified-p)
|
||||||
(concat (+doom-maybe-icon-faicon
|
(concat (doom-modeline-maybe-icon-faicon
|
||||||
"floppy-o"
|
"floppy-o"
|
||||||
:face 'doom-modeline-buffer-modified
|
:face 'doom-modeline-buffer-modified
|
||||||
:v-adjust -0.0575)
|
:v-adjust -0.0575)
|
||||||
" "))
|
" "))
|
||||||
((and buffer-file-name
|
((and buffer-file-name
|
||||||
(not (file-exists-p buffer-file-name)))
|
(not (file-exists-p buffer-file-name)))
|
||||||
(concat (+doom-maybe-icon-octicon
|
(concat (doom-modeline-maybe-icon-octicon
|
||||||
"circle-slash"
|
"circle-slash"
|
||||||
:face 'doom-modeline-urgent
|
:face 'doom-modeline-urgent
|
||||||
:v-adjust -0.05)
|
:v-adjust -0.05)
|
||||||
" "))
|
" "))
|
||||||
((buffer-narrowed-p)
|
((buffer-narrowed-p)
|
||||||
(concat (+doom-maybe-icon-octicon
|
(concat (doom-modeline-maybe-icon-octicon
|
||||||
"fold"
|
"fold"
|
||||||
:face 'doom-modeline-warning
|
:face 'doom-modeline-warning
|
||||||
:v-adjust -0.05)
|
:v-adjust -0.05)
|
||||||
" ")))
|
" ")))
|
||||||
(if buffer-file-name
|
(if buffer-file-name
|
||||||
(+doom-modeline-buffer-file-name)
|
(doom-modeline-buffer-file-name)
|
||||||
"%b")))
|
"%b")))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(def-modeline-segment! buffer-info-simple
|
(doom-modeline-def-segment! buffer-info-simple
|
||||||
"Display only the current buffer's name, but with fontification."
|
"Display only the current buffer's name, but with fontification."
|
||||||
(propertize
|
(propertize
|
||||||
"%b"
|
"%b"
|
||||||
'face (cond ((and buffer-file-name (buffer-modified-p))
|
'face (cond ((and buffer-file-name (buffer-modified-p))
|
||||||
'doom-modeline-buffer-modified)
|
'doom-modeline-buffer-modified)
|
||||||
((active) 'doom-modeline-buffer-file))))
|
((doom-modeline--active) 'doom-modeline-buffer-file))))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(def-modeline-segment! buffer-encoding
|
(doom-modeline-def-segment! buffer-encoding
|
||||||
"Displays the encoding and eol style of the buffer the same way Atom does."
|
"Displays the encoding and eol style of the buffer the same way Atom does."
|
||||||
(concat (pcase (coding-system-eol-type buffer-file-coding-system)
|
(concat (pcase (coding-system-eol-type buffer-file-coding-system)
|
||||||
(0 "LF ")
|
(0 "LF ")
|
||||||
|
@ -611,71 +608,71 @@ directory, the file name, and its state (modified, read-only or non-existent)."
|
||||||
" "))
|
" "))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(def-modeline-segment! major-mode
|
(doom-modeline-def-segment! major-mode
|
||||||
"The major mode, including process, environment and text-scale info."
|
"The major mode, including process, environment and text-scale info."
|
||||||
(propertize
|
(propertize
|
||||||
(concat (format-mode-line mode-name)
|
(concat (format-mode-line mode-name)
|
||||||
(when (stringp mode-line-process)
|
(when (stringp mode-line-process)
|
||||||
mode-line-process)
|
mode-line-process)
|
||||||
(when +doom-modeline-env-version
|
(when doom-modeline-env-version
|
||||||
(concat " " +doom-modeline-env-version))
|
(concat " " doom-modeline-env-version))
|
||||||
(and (featurep 'face-remap)
|
(and (featurep 'face-remap)
|
||||||
(/= text-scale-mode-amount 0)
|
(/= text-scale-mode-amount 0)
|
||||||
(format " (%+d)" text-scale-mode-amount)))
|
(format " (%+d)" text-scale-mode-amount)))
|
||||||
'face (if (active) 'doom-modeline-buffer-major-mode)))
|
'face (if (doom-modeline--active) 'doom-modeline-buffer-major-mode)))
|
||||||
|
|
||||||
|
|
||||||
(defun +doom-maybe-icon-octicon (&rest args)
|
(defun doom-modeline-maybe-icon-octicon (&rest args)
|
||||||
(when (display-graphic-p)
|
(when (display-graphic-p)
|
||||||
(apply 'all-the-icons-octicon args)))
|
(apply 'all-the-icons-octicon args)))
|
||||||
|
|
||||||
(defun +doom-maybe-icon-faicon (&rest args)
|
(defun doom-modeline-maybe-icon-faicon (&rest args)
|
||||||
(when (display-graphic-p)
|
(when (display-graphic-p)
|
||||||
(apply 'all-the-icons-faicon args)))
|
(apply 'all-the-icons-faicon args)))
|
||||||
|
|
||||||
(defun +doom-maybe-icon-material (&rest args)
|
(defun doom-modeline-maybe-icon-material (&rest args)
|
||||||
(when (display-graphic-p)
|
(when (display-graphic-p)
|
||||||
(apply 'all-the-icons-material args)))
|
(apply 'all-the-icons-material args)))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(def-modeline-segment! vcs
|
(doom-modeline-def-segment! vcs
|
||||||
"Displays the current branch, colored based on its state."
|
"Displays the current branch, colored based on its state."
|
||||||
(when (and vc-mode buffer-file-name)
|
(when (and vc-mode buffer-file-name)
|
||||||
(let* ((backend (vc-backend buffer-file-name))
|
(let* ((backend (vc-backend buffer-file-name))
|
||||||
(state (vc-state buffer-file-name backend)))
|
(state (vc-state buffer-file-name backend)))
|
||||||
(let ((face 'mode-line-inactive)
|
(let ((face 'mode-line-inactive)
|
||||||
(active (active))
|
(doom-modeline--active (doom-modeline--active))
|
||||||
(all-the-icons-default-adjust -0.1))
|
(all-the-icons-default-adjust -0.1))
|
||||||
(concat (if (display-graphic-p) " ")
|
(concat (if (display-graphic-p) " ")
|
||||||
(cond ((memq state '(edited added))
|
(cond ((memq state '(edited added))
|
||||||
(if active (setq face 'doom-modeline-info))
|
(if doom-modeline--active (setq face 'doom-modeline-info))
|
||||||
(+doom-maybe-icon-octicon
|
(doom-modeline-maybe-icon-octicon
|
||||||
"git-compare"
|
"git-compare"
|
||||||
:face face
|
:face face
|
||||||
:v-adjust -0.05))
|
:v-adjust -0.05))
|
||||||
((eq state 'needs-merge)
|
((eq state 'needs-merge)
|
||||||
(if active (setq face 'doom-modeline-info))
|
(if doom-modeline--active (setq face 'doom-modeline-info))
|
||||||
(+doom-maybe-icon-octicon "git-merge" :face face))
|
(doom-modeline-maybe-icon-octicon "git-merge" :face face))
|
||||||
((eq state 'needs-update)
|
((eq state 'needs-update)
|
||||||
(if active (setq face 'doom-modeline-warning))
|
(if doom-modeline--active (setq face 'doom-modeline-warning))
|
||||||
(+doom-maybe-icon-octicon "arrow-down" :face face))
|
(doom-modeline-maybe-icon-octicon "arrow-down" :face face))
|
||||||
((memq state '(removed conflict unregistered))
|
((memq state '(removed conflict unregistered))
|
||||||
(if active (setq face 'doom-modeline-urgent))
|
(if doom-modeline--active (setq face 'doom-modeline-urgent))
|
||||||
(+doom-maybe-icon-octicon "alert" :face face))
|
(doom-modeline-maybe-icon-octicon "alert" :face face))
|
||||||
(t
|
(t
|
||||||
(if active (setq face 'font-lock-doc-face))
|
(if doom-modeline--active (setq face 'font-lock-doc-face))
|
||||||
(+doom-maybe-icon-octicon
|
(doom-modeline-maybe-icon-octicon
|
||||||
"git-branch"
|
"git-branch"
|
||||||
:face face
|
:face face
|
||||||
:v-adjust -0.05)))
|
:v-adjust -0.05)))
|
||||||
" "
|
" "
|
||||||
(propertize (substring vc-mode (+ (if (eq backend 'Hg) 2 3) 2))
|
(propertize (substring vc-mode (+ (if (eq backend 'Hg) 2 3) 2))
|
||||||
'face (if active face))
|
'face (if doom-modeline--active face))
|
||||||
" ")))))
|
" ")))))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(defun +doom-ml-icon (icon &optional text face voffset)
|
(defun doom-modeline-icon (icon &optional text face voffset)
|
||||||
"Displays an ICON with FACE, followed by TEXT. Uses
|
"Displays an ICON with FACE, followed by TEXT. Uses
|
||||||
`all-the-icons-material' to fetch the icon."
|
`all-the-icons-material' to fetch the icon."
|
||||||
(concat (if vc-mode " " " ")
|
(concat (if vc-mode " " " ")
|
||||||
|
@ -683,12 +680,12 @@ directory, the file name, and its state (modified, read-only or non-existent)."
|
||||||
(concat
|
(concat
|
||||||
(when (display-graphic-p)
|
(when (display-graphic-p)
|
||||||
(all-the-icons-material icon :face face :height 1.1 :v-adjust (or voffset -0.2)))
|
(all-the-icons-material icon :face face :height 1.1 :v-adjust (or voffset -0.2)))
|
||||||
(if text +doom-modeline-vspc)))
|
(if text doom-modeline-vspc)))
|
||||||
(when text
|
(when text
|
||||||
(propertize text 'face face))
|
(propertize text 'face face))
|
||||||
(if vc-mode " " " ")))
|
(if vc-mode " " " ")))
|
||||||
|
|
||||||
(def-modeline-segment! flycheck
|
(doom-modeline-def-segment! flycheck
|
||||||
"Displays color-coded flycheck error status in the current buffer with pretty
|
"Displays color-coded flycheck error status in the current buffer with pretty
|
||||||
icons."
|
icons."
|
||||||
(when (boundp 'flycheck-last-status-change)
|
(when (boundp 'flycheck-last-status-change)
|
||||||
|
@ -696,35 +693,35 @@ icons."
|
||||||
('finished (if flycheck-current-errors
|
('finished (if flycheck-current-errors
|
||||||
(let-alist (flycheck-count-errors flycheck-current-errors)
|
(let-alist (flycheck-count-errors flycheck-current-errors)
|
||||||
(let ((sum (+ (or .error 0) (or .warning 0))))
|
(let ((sum (+ (or .error 0) (or .warning 0))))
|
||||||
(+doom-ml-icon "do_not_disturb_alt"
|
(doom-modeline-icon "do_not_disturb_alt"
|
||||||
(number-to-string sum)
|
(number-to-string sum)
|
||||||
(if .error 'doom-modeline-urgent 'doom-modeline-warning)
|
(if .error 'doom-modeline-urgent 'doom-modeline-warning)
|
||||||
-0.25)))
|
-0.25)))
|
||||||
(+doom-ml-icon "check" nil 'doom-modeline-info)))
|
(doom-modeline-icon "check" nil 'doom-modeline-info)))
|
||||||
('running (+doom-ml-icon "access_time" nil 'font-lock-doc-face -0.25))
|
('running (doom-modeline-icon "access_time" nil 'font-lock-doc-face -0.25))
|
||||||
('no-checker (+doom-ml-icon "sim_card_alert" "-" 'font-lock-doc-face))
|
('no-checker (doom-modeline-icon "sim_card_alert" "-" 'font-lock-doc-face))
|
||||||
('errored (+doom-ml-icon "sim_card_alert" "Error" 'doom-modeline-urgent))
|
('errored (doom-modeline-icon "sim_card_alert" "Error" 'doom-modeline-urgent))
|
||||||
('interrupted (+doom-ml-icon "pause" "Interrupted" 'font-lock-doc-face)))))
|
('interrupted (doom-modeline-icon "pause" "Interrupted" 'font-lock-doc-face)))))
|
||||||
;; ('interrupted (+doom-ml-icon "x" "Interrupted" 'font-lock-doc-face)))))
|
;; ('interrupted (doom-modeline-icon "x" "Interrupted" 'font-lock-doc-face)))))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(defsubst doom-column (pos)
|
(defsubst doom-modeline-column (pos)
|
||||||
(save-excursion (goto-char pos)
|
(save-excursion (goto-char pos)
|
||||||
(current-column)))
|
(current-column)))
|
||||||
|
|
||||||
(def-modeline-segment! selection-info
|
(doom-modeline-def-segment! selection-info
|
||||||
"Information about the current selection, such as how many characters and
|
"Information about the current selection, such as how many characters and
|
||||||
lines are selected, or the NxM dimensions of a block selection."
|
lines are selected, or the NxM dimensions of a block selection."
|
||||||
(when (and (active) (or mark-active (eq evil-state 'visual)))
|
(when (and (doom-modeline--active) (or mark-active (eq evil-state 'visual)))
|
||||||
(let ((reg-beg (region-beginning))
|
(let ((reg-beg (region-beginning))
|
||||||
(reg-end (region-end)))
|
(reg-end (region-end)))
|
||||||
(propertize
|
(propertize
|
||||||
(let ((lines (count-lines reg-beg (min (1+ reg-end) (point-max)))))
|
(let ((lines (count-lines reg-beg (min (1+ reg-end) (point-max)))))
|
||||||
(cond ((or (bound-and-true-p rectangle-mark-mode)
|
(cond ((or (bound-and-true-p rectangle-mark-mode)
|
||||||
(eq 'block evil-visual-selection))
|
(eq 'block evil-visual-selection))
|
||||||
(let ((cols (abs (- (doom-column reg-end)
|
(let ((cols (abs (- (doom-modeline-column reg-end)
|
||||||
(doom-column reg-beg)))))
|
(doom-modeline-column reg-beg)))))
|
||||||
(format "%dx%dB" lines cols)))
|
(format "%dx%dB" lines cols)))
|
||||||
((eq 'line evil-visual-selection)
|
((eq 'line evil-visual-selection)
|
||||||
(format "%dL" lines))
|
(format "%dL" lines))
|
||||||
|
@ -736,9 +733,9 @@ lines are selected, or the NxM dimensions of a block selection."
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(defun +doom-modeline--macro-recording ()
|
(defun doom-modeline--macro-recording ()
|
||||||
"Display current Emacs or evil macro being recorded."
|
"Display current Emacs or evil macro being recorded."
|
||||||
(when (and (active) (or defining-kbd-macro executing-kbd-macro))
|
(when (and (doom-modeline--active) (or defining-kbd-macro executing-kbd-macro))
|
||||||
(let ((sep (propertize " " 'face 'doom-modeline-panel)))
|
(let ((sep (propertize " " 'face 'doom-modeline-panel)))
|
||||||
(concat sep
|
(concat sep
|
||||||
(propertize (if (bound-and-true-p evil-this-macro)
|
(propertize (if (bound-and-true-p evil-this-macro)
|
||||||
|
@ -746,12 +743,12 @@ lines are selected, or the NxM dimensions of a block selection."
|
||||||
"Macro")
|
"Macro")
|
||||||
'face 'doom-modeline-panel)
|
'face 'doom-modeline-panel)
|
||||||
sep
|
sep
|
||||||
(+doom-maybe-icon-octicon "triangle-right"
|
(doom-modeline-maybe-icon-octicon "triangle-right"
|
||||||
:face 'doom-modeline-panel
|
:face 'doom-modeline-panel
|
||||||
:v-adjust -0.05))
|
:v-adjust -0.05))
|
||||||
sep)))
|
sep)))
|
||||||
|
|
||||||
(defsubst +doom-modeline--anzu ()
|
(defsubst doom-modeline--anzu ()
|
||||||
"Show the match index and total number thereof. Requires `anzu', also
|
"Show the match index and total number thereof. Requires `anzu', also
|
||||||
`evil-anzu' if using `evil-mode' for compatibility with `evil-search'."
|
`evil-anzu' if using `evil-mode' for compatibility with `evil-search'."
|
||||||
(setq anzu-cons-mode-line-p nil)
|
(setq anzu-cons-mode-line-p nil)
|
||||||
|
@ -767,9 +764,9 @@ lines are selected, or the NxM dimensions of a block selection."
|
||||||
(format " %s+ " total))
|
(format " %s+ " total))
|
||||||
(t
|
(t
|
||||||
(format " %s/%d " here total))))
|
(format " %s/%d " here total))))
|
||||||
'face (if (active) 'doom-modeline-panel))))
|
'face (if (doom-modeline--active) 'doom-modeline-panel))))
|
||||||
|
|
||||||
(defsubst +doom-modeline--evil-substitute ()
|
(defsubst doom-modeline--evil-substitute ()
|
||||||
"Show number of matches for evil-ex substitutions and highlights in real time."
|
"Show number of matches for evil-ex substitutions and highlights in real time."
|
||||||
(when (and evil-mode
|
(when (and evil-mode
|
||||||
(or (assq 'evil-ex-substitute evil-ex-active-highlights-alist)
|
(or (assq 'evil-ex-substitute evil-ex-active-highlights-alist)
|
||||||
|
@ -783,12 +780,12 @@ lines are selected, or the NxM dimensions of a block selection."
|
||||||
(if pattern
|
(if pattern
|
||||||
(format " %s matches " (how-many pattern (car range) (cdr range)))
|
(format " %s matches " (how-many pattern (car range) (cdr range)))
|
||||||
" - "))
|
" - "))
|
||||||
'face (if (active) 'doom-modeline-panel))))
|
'face (if (doom-modeline--active) 'doom-modeline-panel))))
|
||||||
|
|
||||||
(defun doom-themes--overlay-sort (a b)
|
(defun doom-modeline-themes--overlay-sort (a b)
|
||||||
(< (overlay-start a) (overlay-start b)))
|
(< (overlay-start a) (overlay-start b)))
|
||||||
|
|
||||||
(defsubst +doom-modeline--iedit ()
|
(defsubst doom-modeline--iedit ()
|
||||||
"Show the number of iedit regions matches + what match you're on."
|
"Show the number of iedit regions matches + what match you're on."
|
||||||
(when (and iedit-mode iedit-occurrences-overlays)
|
(when (and iedit-mode iedit-occurrences-overlays)
|
||||||
(propertize
|
(propertize
|
||||||
|
@ -801,45 +798,45 @@ lines are selected, or the NxM dimensions of a block selection."
|
||||||
(if this-oc
|
(if this-oc
|
||||||
(- length
|
(- length
|
||||||
(length (memq this-oc (sort (append iedit-occurrences-overlays nil)
|
(length (memq this-oc (sort (append iedit-occurrences-overlays nil)
|
||||||
#'doom-themes--overlay-sort)))
|
#'doom-modeline-themes--overlay-sort)))
|
||||||
-1)
|
-1)
|
||||||
"-")
|
"-")
|
||||||
length))
|
length))
|
||||||
'face (if (active) 'doom-modeline-panel))))
|
'face (if (doom-modeline--active) 'doom-modeline-panel))))
|
||||||
|
|
||||||
(def-modeline-segment! matches
|
(doom-modeline-def-segment! matches
|
||||||
"Displays: 1. the currently recording macro, 2. A current/total for the
|
"Displays: 1. the currently recording macro, 2. A current/total for the
|
||||||
current search term (with anzu), 3. The number of substitutions being conducted
|
current search term (with anzu), 3. The number of substitutions being conducted
|
||||||
with `evil-ex-substitute', and/or 4. The number of active `iedit' regions."
|
with `evil-ex-substitute', and/or 4. The number of doom-modeline--active `iedit' regions."
|
||||||
(let ((meta (concat (+doom-modeline--macro-recording)
|
(let ((meta (concat (doom-modeline--macro-recording)
|
||||||
(+doom-modeline--anzu)
|
(doom-modeline--anzu)
|
||||||
(+doom-modeline--evil-substitute)
|
(doom-modeline--evil-substitute)
|
||||||
(+doom-modeline--iedit))))
|
(doom-modeline--iedit))))
|
||||||
(or (and (not (equal meta "")) meta)
|
(or (and (not (equal meta "")) meta)
|
||||||
(if buffer-file-name " %I "))))
|
(if buffer-file-name " %I "))))
|
||||||
|
|
||||||
;; TODO Include other information
|
;; TODO Include other information
|
||||||
(def-modeline-segment! media-info
|
(doom-modeline-def-segment! media-info
|
||||||
"Metadata regarding the current file, such as dimensions for images."
|
"Metadata regarding the current file, such as dimensions for images."
|
||||||
(cond ((eq major-mode 'image-mode)
|
(cond ((eq major-mode 'image-mode)
|
||||||
(cl-destructuring-bind (width . height)
|
(cl-destructuring-bind (width . height)
|
||||||
(image-size (image-get-display-property) :pixels)
|
(image-size (image-get-display-property) :pixels)
|
||||||
(format " %dx%d " width height)))))
|
(format " %dx%d " width height)))))
|
||||||
|
|
||||||
(def-modeline-segment! bar
|
(doom-modeline-def-segment! bar
|
||||||
"The bar regulates the height of the mode-line in GUI Emacs.
|
"The bar regulates the height of the mode-line in GUI Emacs.
|
||||||
Returns \"\" to not break --no-window-system."
|
Returns \"\" to not break --no-window-system."
|
||||||
(if (display-graphic-p)
|
(if (display-graphic-p)
|
||||||
(+doom-modeline--make-xpm
|
(doom-modeline--make-xpm
|
||||||
(face-background (if (active)
|
(face-background (if (doom-modeline--active)
|
||||||
'doom-modeline-bar
|
'doom-modeline-bar
|
||||||
'doom-modeline-inactive-bar)
|
'doom-modeline-inactive-bar)
|
||||||
nil t)
|
nil t)
|
||||||
+doom-modeline-height
|
doom-modeline-height
|
||||||
+doom-modeline-bar-width)
|
doom-modeline-bar-width)
|
||||||
""))
|
""))
|
||||||
|
|
||||||
(defun +doom-modeline-eyebrowse-number ()
|
(defun doom-modeline-eyebrowse-number ()
|
||||||
(when (and (bound-and-true-p eyebrowse-mode)
|
(when (and (bound-and-true-p eyebrowse-mode)
|
||||||
(< 1 (length (eyebrowse--get 'window-configs))))
|
(< 1 (length (eyebrowse--get 'window-configs))))
|
||||||
(let* ((num (eyebrowse--get 'current-slot))
|
(let* ((num (eyebrowse--get 'current-slot))
|
||||||
|
@ -849,17 +846,17 @@ Returns \"\" to not break --no-window-system."
|
||||||
(when num (int-to-string num)))))
|
(when num (int-to-string num)))))
|
||||||
str)))
|
str)))
|
||||||
|
|
||||||
(defun +doom-window-bottom-left-p ()
|
(defun doom-modeline-window-bottom-left-p ()
|
||||||
(let* ((edges (window-edges))
|
(let* ((edges (window-edges))
|
||||||
(minibuffer-edges (window-edges (minibuffer-window))))
|
(minibuffer-edges (window-edges (minibuffer-window))))
|
||||||
(and (eq 0 (car edges))
|
(and (eq 0 (car edges))
|
||||||
(eq (nth 3 edges)
|
(eq (nth 3 edges)
|
||||||
(cadr minibuffer-edges)))))
|
(cadr minibuffer-edges)))))
|
||||||
|
|
||||||
(def-modeline-segment! persp-number
|
(doom-modeline-def-segment! persp-number
|
||||||
"The persp number."
|
"The persp number."
|
||||||
(when (featurep 'persp-mode)
|
(when (featurep 'persp-mode)
|
||||||
(when (+doom-window-bottom-left-p)
|
(when (doom-modeline-window-bottom-left-p)
|
||||||
(-when-let* ((persp (get-current-persp)))
|
(-when-let* ((persp (get-current-persp)))
|
||||||
(propertize
|
(propertize
|
||||||
(concat
|
(concat
|
||||||
|
@ -869,7 +866,7 @@ Returns \"\" to not break --no-window-system."
|
||||||
(persp-name persp)
|
(persp-name persp)
|
||||||
(persp-names-current-frame-fast-ordered))))
|
(persp-names-current-frame-fast-ordered))))
|
||||||
"."
|
"."
|
||||||
(or (+doom-modeline-eyebrowse-number) "1")
|
(or (doom-modeline-eyebrowse-number) "1")
|
||||||
" ")
|
" ")
|
||||||
'face 'doom-modeline-persp)))))
|
'face 'doom-modeline-persp)))))
|
||||||
|
|
||||||
|
@ -877,16 +874,16 @@ Returns \"\" to not break --no-window-system."
|
||||||
(advice-add #'window-numbering-install-mode-line :override #'ignore)
|
(advice-add #'window-numbering-install-mode-line :override #'ignore)
|
||||||
(advice-add #'window-numbering-clear-mode-line :override #'ignore)
|
(advice-add #'window-numbering-clear-mode-line :override #'ignore)
|
||||||
|
|
||||||
(def-modeline-segment! window-number
|
(doom-modeline-def-segment! window-number
|
||||||
(if (bound-and-true-p window-numbering-mode)
|
(if (bound-and-true-p window-numbering-mode)
|
||||||
(propertize (format " %s " (window-numbering-get-number-string))
|
(propertize (format " %s " (window-numbering-get-number-string))
|
||||||
'face (if (active)
|
'face (if (doom-modeline--active)
|
||||||
'doom-modeline-bar
|
'doom-modeline-bar
|
||||||
'doom-modeline-inactive-bar))
|
'doom-modeline-inactive-bar))
|
||||||
""))
|
""))
|
||||||
|
|
||||||
(declare-function eyebrowse--get 'eyebrowse)
|
(declare-function eyebrowse--get 'eyebrowse)
|
||||||
(def-modeline-segment! workspace-number
|
(doom-modeline-def-segment! workspace-number
|
||||||
"The current workspace name or number. Requires `eyebrowse-mode' to be
|
"The current workspace name or number. Requires `eyebrowse-mode' to be
|
||||||
enabled."
|
enabled."
|
||||||
(if (and (bound-and-true-p eyebrowse-mode)
|
(if (and (bound-and-true-p eyebrowse-mode)
|
||||||
|
@ -903,23 +900,23 @@ enabled."
|
||||||
;; Mode lines
|
;; Mode lines
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(def-modeline! main
|
(doom-modeline-def-modeline! main
|
||||||
(workspace-number bar matches " " buffer-info " %l:%c %p " selection-info)
|
(workspace-number bar matches " " buffer-info " %l:%c %p " selection-info)
|
||||||
(buffer-encoding major-mode vcs flycheck))
|
(buffer-encoding major-mode vcs flycheck))
|
||||||
|
|
||||||
(def-modeline! minimal
|
(doom-modeline-def-modeline! minimal
|
||||||
(bar matches " " buffer-info)
|
(bar matches " " buffer-info)
|
||||||
(media-info major-mode))
|
(media-info major-mode))
|
||||||
|
|
||||||
(def-modeline! special
|
(doom-modeline-def-modeline! special
|
||||||
(bar matches " " buffer-info-simple " %l:%c %p " selection-info)
|
(bar matches " " buffer-info-simple " %l:%c %p " selection-info)
|
||||||
(buffer-encoding major-mode flycheck))
|
(buffer-encoding major-mode flycheck))
|
||||||
|
|
||||||
(def-modeline! project
|
(doom-modeline-def-modeline! project
|
||||||
(bar buffer-default-directory)
|
(bar buffer-default-directory)
|
||||||
(major-mode))
|
(major-mode))
|
||||||
|
|
||||||
(def-modeline! media
|
(doom-modeline-def-modeline! media
|
||||||
(bar " %b ")
|
(bar " %b ")
|
||||||
(media-info major-mode))
|
(media-info major-mode))
|
||||||
|
|
||||||
|
@ -928,28 +925,28 @@ enabled."
|
||||||
;;
|
;;
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +doom-modeline|init ()
|
(defun doom-modeline-init ()
|
||||||
"Set the default modeline."
|
"Set the default modeline."
|
||||||
(doom-set-modeline 'main t)
|
(doom-modeline-set-modeline 'main t)
|
||||||
|
|
||||||
;; This scratch and messages buffer is already created and doesn't get a
|
;; This scratch and messages buffer is already created and doesn't get a
|
||||||
;; modeline.
|
;; modeline.
|
||||||
(with-current-buffer "*Messages*"
|
(with-current-buffer "*Messages*"
|
||||||
(doom-set-modeline 'main))
|
(doom-modeline-set-modeline 'main))
|
||||||
(with-current-buffer "*scratch*"
|
(with-current-buffer "*scratch*"
|
||||||
(doom-set-modeline 'main)))
|
(doom-modeline-set-modeline 'main)))
|
||||||
|
|
||||||
(defun +doom-modeline|set-special-modeline ()
|
(defun doom-modeline-set-special-modeline ()
|
||||||
"Set the special modeline."
|
"Set the special modeline."
|
||||||
(doom-set-modeline 'special))
|
(doom-modeline-set-modeline 'special))
|
||||||
|
|
||||||
(defun +doom-modeline|set-media-modeline ()
|
(defun doom-modeline-set-media-modeline ()
|
||||||
"Set the media modeline."
|
"Set the media modeline."
|
||||||
(doom-set-modeline 'media))
|
(doom-modeline-set-modeline 'media))
|
||||||
|
|
||||||
(add-hook 'image-mode-hook #'+doom-modeline|set-media-modeline)
|
(add-hook 'image-mode-hook #'doom-modeline-set-media-modeline)
|
||||||
(add-hook 'org-src-mode-hook #'+doom-modeline|set-special-modeline)
|
(add-hook 'org-src-mode-hook #'doom-modeline-set-special-modeline)
|
||||||
(add-hook 'circe-mode-hook #'+doom-modeline|set-special-modeline)
|
(add-hook 'circe-mode-hook #'doom-modeline-set-special-modeline)
|
||||||
|
|
||||||
(provide 'doom-modeline)
|
(provide 'doom-modeline)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue