Fix doom-modeline after ELPA update

This commit is contained in:
Wojciech Kozlowski 2019-12-17 11:52:56 +01:00
parent 494fcb310d
commit 22ff3a1ac4
2 changed files with 25 additions and 15 deletions

View File

@ -48,15 +48,23 @@
(after-init . doom-modeline-mode) (after-init . doom-modeline-mode)
:config :config
(setq column-number-mode t (setq column-number-mode t
doom-modeline-height 23 doom-modeline-height 25
doom-modeline-checker-simple-format nil doom-modeline-checker-simple-format nil
doom-modeline-env-python-executable "python3") doom-modeline-env-python-executable "python3")
;; Convenience function for correct active/inactive handling.
(defun x-doom-active-switch (str)
"Correctly apply active/inactive mode line face to STR."
(if (doom-modeline--active)
str
(propertize str 'face 'mode-line-inactive)))
;; Custom perspective display - display only the active perspective. ;; Custom perspective display - display only the active perspective.
(doom-modeline-def-segment perspective-name (doom-modeline-def-segment perspective-name
"Perspectives list and selection. Requires `persp-mode' to be enabled." "Perspectives list and selection. Requires `persp-mode' to be enabled."
(if (bound-and-true-p persp-mode) (if (bound-and-true-p persp-mode)
(persp-format-name (persp-name (persp-curr))) (x-doom-active-switch
(persp-format-name (persp-name (persp-curr))))
"")) ""))
;; Display active python virtualenv. ;; Display active python virtualenv.
@ -67,7 +75,8 @@
(doom-modeline-def-segment pyvenv-venv (doom-modeline-def-segment pyvenv-venv
"Active Python virtualenv. Requires `pyvenv' to be enabled." "Active Python virtualenv. Requires `pyvenv' to be enabled."
(if (bound-and-true-p pyvenv-virtual-env-name) (if (bound-and-true-p pyvenv-virtual-env-name)
(propertize pyvenv-virtual-env-name 'face 'pyvenv-active-face) (x-doom-active-switch
(propertize pyvenv-virtual-env-name 'face 'pyvenv-active-face))
"")) ""))
(doom-modeline-def-segment workspace-number (doom-modeline-def-segment workspace-number
@ -77,25 +86,26 @@
(if (bound-and-true-p eyebrowse-mode) (if (bound-and-true-p eyebrowse-mode)
(let* ((num (eyebrowse--get 'current-slot)) (let* ((num (eyebrowse--get 'current-slot))
(tag (when num (nth 2 (assoc num (eyebrowse--get 'window-configs))))) (tag (when num
(nth 2 (assoc num (eyebrowse--get 'window-configs)))))
(str (if (and tag (< 0 (length tag))) (str (if (and tag (< 0 (length tag)))
tag tag
(when num (int-to-string num))))) (when num (int-to-string num)))))
(propertize str 'face 'eyebrowse-mode-line-active)) (x-doom-active-switch
(propertize str 'face 'eyebrowse-mode-line-active)))
"")) ""))
;; Necessary to play nice with Helm. (doom-modeline-def-segment left-bracket (x-doom-active-switch "["))
(add-hook 'helm-minibuffer-set-up-hook (doom-modeline-def-segment right-bracket (x-doom-active-switch "]"))
(lambda () (doom-modeline-def-segment colon (x-doom-active-switch ":"))
(advice-add #'doom-modeline--active :override (lambda () t))))
(add-hook 'helm-cleanup-hook
(lambda ()
(advice-remove #'doom-modeline--active (lambda () t))))
;; Define custom modeline. ;; Define custom modeline.
(doom-modeline-def-modeline 'my-line (doom-modeline-def-modeline 'my-line
'(bar "[" perspective-name ":" workspace-number "]" window-number matches buffer-info remote-host buffer-position selection-info) '(bar
'(lsp debug pyvenv-venv major-mode vcs checker bar)) left-bracket perspective-name colon workspace-number right-bracket
window-number matches buffer-info remote-host
buffer-position selection-info)
'(lsp debug pyvenv-venv major-mode vcs checker))
(add-hook 'doom-modeline-mode-hook (add-hook 'doom-modeline-mode-hook
(lambda () (doom-modeline-set-modeline 'my-line 'default)))) (lambda () (doom-modeline-set-modeline 'my-line 'default))))

View File

@ -174,7 +174,7 @@
;; --------------------------------------------------------------------- ;; ---------------------------------------------------------------------
;; Doom mode line. ;; Doom mode line.
;; --------------------------------------------------------------------- ;; ---------------------------------------------------------------------
`(doom-modeline-inactive-bar ((t (:inherit mode-line-inactive)))) `(doom-modeline-bar-inactive ((t (:inherit mode-line-inactive))))
;; --------------------------------------------------------------------- ;; ---------------------------------------------------------------------
;; Perspective:eyebrowse. ;; Perspective:eyebrowse.