This commit is contained in:
Vincent Zhang 2018-10-01 16:24:09 +08:00
commit 8d6aba5b4d

View file

@ -189,7 +189,10 @@ Given ~/Projects/FOSS/emacs/lisp/comint.el
"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.")
(defface doom-modeline-inactive-bar '((t (:inherit warning :inverse-video t))) (defface doom-modeline-inactive-bar `((t (:background
,(face-foreground 'mode-line-inactive)
:foreground
,(face-background 'mode-line-inactive))))
"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.")
(defface doom-modeline-evil-emacs-state '((t (:inherit doom-modeline-warning))) (defface doom-modeline-evil-emacs-state '((t (:inherit doom-modeline-warning)))
@ -241,7 +244,7 @@ active.")
`(let (byte-compile-warnings) `(let (byte-compile-warnings)
(byte-compile #',sym)))))))) (byte-compile #',sym))))))))
(defsubst doom-modeline--prepare-segments (segments) (defun doom-modeline--prepare-segments (segments)
"Prepare mode-line `SEGMENTS'." "Prepare mode-line `SEGMENTS'."
(let (forms it) (let (forms it)
(dolist (seg segments) (dolist (seg segments)
@ -249,7 +252,7 @@ active.")
(push seg forms)) (push seg forms))
((symbolp seg) ((symbolp seg)
(cond ((setq it (cdr (assq seg doom-modeline-fn-alist))) (cond ((setq it (cdr (assq seg doom-modeline-fn-alist)))
(push (list it) forms)) (push (list :eval (list it)) forms))
((setq it (cdr (assq seg doom-modeline-var-alist))) ((setq it (cdr (assq seg doom-modeline-var-alist)))
(push it forms)) (push it forms))
((error "%s is not a defined segment" seg)))) ((error "%s is not a defined segment" seg))))
@ -273,19 +276,20 @@ active.")
(rhs-forms (doom-modeline--prepare-segments rhs))) (rhs-forms (doom-modeline--prepare-segments rhs)))
(defalias sym (defalias sym
(lambda () (lambda ()
(let ((lhs (eval `(list ,@lhs-forms) t)) (let ((rhs-str (format-mode-line rhs-forms)))
(rhs (eval `(list ,@rhs-forms) t))) (list lhs-forms
(let ((rhs-str (format-mode-line rhs))) (propertize
(list lhs " " 'display
(propertize `((space :align-to (- (+ right right-fringe right-margin)
" " 'display ,(+ 1 (string-width rhs-str))))))
`((space :align-to (- (+ right right-fringe right-margin) rhs-str)))
,(+ 1 (string-width rhs-str))))))
rhs-str))))
(concat "Modeline:\n" (concat "Modeline:\n"
(format " %s\n %s" (format " %s\n %s"
(prin1-to-string lhs) (prin1-to-string lhs)
(prin1-to-string rhs)))))) (prin1-to-string rhs))))
(unless (bound-and-true-p byte-compile-current-file)
(let (byte-compile-warnings)
(byte-compile sym)))))
(defun doom-modeline (key) (defun doom-modeline (key)
"Return a mode-line configuration associated with KEY (a symbol). "Return a mode-line configuration associated with KEY (a symbol).
@ -635,7 +639,14 @@ directory, the file name, and its state (modified, read-only or non-existent)."
(doom-modeline-def-segment major-mode (doom-modeline-def-segment major-mode
"The major mode, including environment and text-scale info." "The major mode, including environment and text-scale info."
(propertize (propertize
(concat (format-mode-line mode-name) (concat (format-mode-line
`(:propertize ("" mode-name)
help-echo "Major mode\n\
mouse-1: Display major mode menu\n\
mouse-2: Show help for major mode\n\
mouse-3: Toggle minor modes"
mouse-face mode-line-highlight
local-map ,mode-line-major-mode-keymap))
(when doom-modeline-env-version (when doom-modeline-env-version
(format " %s" doom-modeline-env-version)) (format " %s" doom-modeline-env-version))
(and (boundp 'text-scale-mode-amount) (and (boundp 'text-scale-mode-amount)