Feature: An indicator for debug state.

This commit is contained in:
Vincent Zhang 2018-12-21 00:35:59 +08:00
parent f71f16a3eb
commit cbd86384fe
2 changed files with 35 additions and 5 deletions

View file

@ -30,6 +30,7 @@ The `doom-modeline` was designed for minimalism, and offers:
- An indicator for `ryo-modal` state - An indicator for `ryo-modal` state
- An indicator for `xah-fly-keys` state - An indicator for `xah-fly-keys` state
- An indicator for remote host - An indicator for remote host
- An indicator for debug state
- An indicator for current input method - An indicator for current input method
- An indicator for `LSP` state - An indicator for `LSP` state
- An indicator for github notifications - An indicator for github notifications

View file

@ -50,6 +50,7 @@
;; - An indicator for xah-fly-keys state ;; - An indicator for xah-fly-keys state
;; - An indicator for remote host ;; - An indicator for remote host
;; - An indicator for current input method ;; - An indicator for current input method
;; - An indicator for debug state
;; - An indicator for LSP state ;; - An indicator for LSP state
;; - An indicator for github notifications ;; - An indicator for github notifications
;; - Truncated file names, file icon, buffer state and project name in buffer ;; - Truncated file names, file icon, buffer state and project name in buffer
@ -820,9 +821,8 @@ Uses `all-the-icons-material' to fetch the icon."
(doom-modeline-buffer-file-name) (doom-modeline-buffer-file-name)
(propertize "%b" (propertize "%b"
'face (if (doom-modeline--active) 'doom-modeline-buffer-file) 'face (if (doom-modeline--active) 'doom-modeline-buffer-file)
'help-echo 'help-echo "Buffer name
(purecopy "Buffer name mouse-1: Previous buffer\nmouse-3: Next buffer"
mouse-1: Previous buffer\nmouse-3: Next buffer")
'local-map mode-line-buffer-identification-keymap)))) 'local-map mode-line-buffer-identification-keymap))))
(add-hook 'find-file-hook 'doom-modeline-update-buffer-file-name) (add-hook 'find-file-hook 'doom-modeline-update-buffer-file-name)
(add-hook 'after-save-hook 'doom-modeline-update-buffer-file-name) (add-hook 'after-save-hook 'doom-modeline-update-buffer-file-name)
@ -1569,13 +1569,42 @@ mouse-3: Describe current input method")
'mouse-1 'mouse-1
#'github-open-notifications-participating)))) #'github-open-notifications-participating))))
;;
;; debug state
;;
(doom-modeline-def-segment debug
"The current debug state."
(when (doom-modeline--active)
(concat
(when debug-on-error
(propertize
(if doom-modeline-icon
(doom-modeline-icon-faicon "bug" :v-adjust -0.125 :face 'doom-modeline-urgent)
(propertize "!" 'face 'doom-modeline-urgent))
'help-echo "Debug on Error
mouse-1: Toggle Debug on Error"
'mouse-face '(:box 1)
'local-map (make-mode-line-mouse-map 'mouse-1 #'toggle-debug-on-error)))
(when debug-on-quit
(propertize
(if doom-modeline-icon
(doom-modeline-icon-faicon "bug" :v-adjust -0.125 :face 'doom-modeline-warning)
(propertize "!" 'face 'doom-modeline-warning))
'help-echo "Debug on Quit
mouse-1: Toggle Debug on Quit"
'mouse-face '(:box 1)
'local-map (make-mode-line-mouse-map 'mouse-1 #'toggle-debug-on-quit)))
(and (or debug-on-error debug-on-quit) " "))))
;; ;;
;; Mode lines ;; Mode lines
;; ;;
(doom-modeline-def-modeline 'main (doom-modeline-def-modeline 'main
'(bar workspace-number window-number evil-state god-state ryo-modal xah-fly-keys matches " " buffer-info remote-host buffer-position " " selection-info) '(bar workspace-number window-number evil-state god-state ryo-modal xah-fly-keys matches " " buffer-info remote-host buffer-position " " selection-info)
'(misc-info persp-name lsp github minor-modes input-method buffer-encoding major-mode process vcs flycheck)) '(misc-info persp-name lsp github debug minor-modes input-method buffer-encoding major-mode process vcs flycheck))
(doom-modeline-def-modeline 'minimal (doom-modeline-def-modeline 'minimal
'(bar matches " " buffer-info) '(bar matches " " buffer-info)
@ -1583,7 +1612,7 @@ mouse-3: Describe current input method")
(doom-modeline-def-modeline 'special (doom-modeline-def-modeline 'special
'(bar window-number evil-state god-state ryo-modal xah-fly-keys matches " " buffer-info-simple buffer-position " " selection-info) '(bar window-number evil-state god-state ryo-modal xah-fly-keys matches " " buffer-info-simple buffer-position " " selection-info)
'(misc-info lsp minor-modes input-method buffer-encoding major-mode process flycheck)) '(misc-info lsp debug minor-modes input-method buffer-encoding major-mode process flycheck))
(doom-modeline-def-modeline 'project (doom-modeline-def-modeline 'project
'(bar window-number buffer-default-directory) '(bar window-number buffer-default-directory)