[Feature] Display mode-line with `variable-pitch' face.

This commit is contained in:
Vincent Zhang 2019-03-04 17:10:02 +07:00
parent 93d335a54f
commit 933f321092
3 changed files with 37 additions and 5 deletions

View file

@ -36,6 +36,7 @@ The `doom-modeline` was designed for minimalism, and offers:
- An indicator for `LSP` state - An indicator for `LSP` state
- An indicator for github notifications - An indicator for github notifications
- An indicator for unread emails with `mu4e-alert` - An indicator for unread emails with `mu4e-alert`
- An indicator for irc notifications with `circe`
- An indicator for buffer position which is compatible with `nyan-mode` - An indicator for buffer position which is compatible with `nyan-mode`
- An indicator for party parrot - An indicator for party parrot
- An indicator for PDF page number - An indicator for PDF page number
@ -149,8 +150,8 @@ Strongly recommend to use
;; Please refer to https://github.com/bbatsov/projectile/issues/657. ;; Please refer to https://github.com/bbatsov/projectile/issues/657.
(setq doom-modeline-buffer-file-name-style 'truncate-upto-project) (setq doom-modeline-buffer-file-name-style 'truncate-upto-project)
;; What executable of Python will be used (if nil nothing will be showed). ;; If non-nil, the mode-line is displayed with the `variable-pitch' face.
(setq doom-modeline-python-executable "python") (setq doom-modeline-enable-variable-pitch nil)
;; Whether show `all-the-icons' or not (if nil nothing will be showed). ;; Whether show `all-the-icons' or not (if nil nothing will be showed).
(setq doom-modeline-icon t) (setq doom-modeline-icon t)
@ -185,8 +186,17 @@ Strongly recommend to use
;; Whether display environment version or not. ;; Whether display environment version or not.
(setq doom-modeline-env-version t) (setq doom-modeline-env-version t)
;; What executable of Python will be used (if nil nothing will be showed).
(setq doom-modeline-python-executable "python")
;; Whether display mu4e notifications or not. Requires `mu4e-alert' package. ;; Whether display mu4e notifications or not. Requires `mu4e-alert' package.
(setq doom-modeline-mu4e t) (setq doom-modeline-mu4e t)
;; Whether display irc notifications or not. Requires `circe' package.
(setq doom-modeline-irc t)
;; Function to stylize the irc buffer names.
(setq doom-modeline-irc-stylize 'identity)
``` ```
## FAQ ## FAQ

View file

@ -86,8 +86,8 @@ Given ~/Projects/FOSS/emacs/lisp/comint.el
file-name => comint.el file-name => comint.el
buffer-name => comint.el<2> (uniquify buffer name)") buffer-name => comint.el<2> (uniquify buffer name)")
(defvar doom-modeline-python-executable "python" (defvar doom-modeline-enable-variable-pitch nil
"What executable of Python will be used (if nil nothing will be showed).") "If non-nil, the mode-line is displayed with the `variable-pitch' face.")
(defvar doom-modeline-icon (display-graphic-p) (defvar doom-modeline-icon (display-graphic-p)
"Whether show `all-the-icons' or not. "Whether show `all-the-icons' or not.
@ -126,6 +126,9 @@ The icons may not be showed correctly in terminal and on Windows.")
"Whether display environment version or not.") "Whether display environment version or not.")
(define-obsolete-variable-alias 'doom-modeline-version 'doom-modeline-env-version "1.7.4") (define-obsolete-variable-alias 'doom-modeline-version 'doom-modeline-env-version "1.7.4")
(defvar doom-modeline-python-executable "python"
"What executable of Python will be used (if nil nothing will be showed).")
(defvar doom-modeline-mu4e t (defvar doom-modeline-mu4e t
"Whether display mu4e notifications or not. Requires `mu4e-alert' package.") "Whether display mu4e notifications or not. Requires `mu4e-alert' package.")
@ -422,6 +425,24 @@ If DEFAULT is non-nil, set the default mode-line for all buffers."
(add-hook 'focus-in-hook #'doom-modeline-focus) (add-hook 'focus-in-hook #'doom-modeline-focus)
(add-hook 'focus-out-hook #'doom-modeline-unfocus)))) (add-hook 'focus-out-hook #'doom-modeline-unfocus))))
;; Display mode-line with `variable-pitch' face
(defun doom-modeline-variable-pitch (&rest _)
(when doom-modeline-enable-variable-pitch
(dolist (face '(mode-line mode-line-inactive))
(let ((faces (face-attribute face :inherit nil)))
(set-face-attribute
face nil :inherit
`(variable-pitch ,@(delq 'unspecified (if (listp faces) faces (list faces)))))))
(with-eval-after-load 'doom-themes
(let ((faces (face-attribute 'doom-modeline-error :inherit nil)))
(set-face-attribute
'doom-modeline-error nil :inherit
`(variable-pitch ,@(delq 'unspecified (if (listp faces) faces (list faces)))))))))
(doom-modeline-variable-pitch)
(advice-add #'load-theme :after #'doom-modeline-variable-pitch)
;; ;;
;; Modeline helpers ;; Modeline helpers

View file

@ -4,7 +4,7 @@
;; Author: Vincent Zhang <seagle0128@gmail.com> ;; Author: Vincent Zhang <seagle0128@gmail.com>
;; Homepage: https://github.com/seagle0128/doom-modeline ;; Homepage: https://github.com/seagle0128/doom-modeline
;; Version: 1.8.0 ;; Version: 1.8.1
;; Package-Requires: ((emacs "25.1") (all-the-icons "1.0.0") (shrink-path "0.2.0") (eldoc-eval "0.1") (dash "2.11.0")) ;; Package-Requires: ((emacs "25.1") (all-the-icons "1.0.0") (shrink-path "0.2.0") (eldoc-eval "0.1") (dash "2.11.0"))
;; Keywords: faces mode-line ;; Keywords: faces mode-line
@ -55,6 +55,7 @@
;; - An indicator for LSP state ;; - An indicator for LSP state
;; - An indicator for github notifications ;; - An indicator for github notifications
;; - An indicator for unread emails with mu4e-alert ;; - An indicator for unread emails with mu4e-alert
;; - An indicator for irc notifications with circe
;; - An indicator for buffer position which is compatible with nyan-mode ;; - An indicator for buffer position which is compatible with nyan-mode
;; - An indicator for party parrot ;; - An indicator for party parrot
;; - An indicator for PDF page number ;; - An indicator for PDF page number