mirror of
https://github.com/correl/doom-modeline.git
synced 2024-11-23 19:19:50 +00:00
Refactor debug segment.
This commit is contained in:
parent
34b23b3e25
commit
7a29c27b55
1 changed files with 62 additions and 73 deletions
|
@ -1858,91 +1858,80 @@ mouse-3: Fetch notifications"
|
||||||
:face face)
|
:face face)
|
||||||
(propertize "!" 'face face)))
|
(propertize "!" 'face face)))
|
||||||
|
|
||||||
(doom-modeline-def-segment debug
|
(defsubst doom-modeline--debug-dap ()
|
||||||
"The current debug state."
|
"The current `dap-mode' state."
|
||||||
(when (doom-modeline--active)
|
(when (and (bound-and-true-p dap-mode)
|
||||||
(concat
|
(bound-and-true-p lsp-mode)
|
||||||
(when (or (and (bound-and-true-p dap-mode)
|
(dap--cur-session))
|
||||||
(bound-and-true-p lsp-mode)
|
(propertize (doom-modeline-debug-icon 'doom-modeline-warning)
|
||||||
(dap--cur-session))
|
'help-echo (format "DAP (%s)
|
||||||
(bound-and-true-p edebug-mode)
|
|
||||||
(bound-and-true-p edebug-x-mode)
|
|
||||||
debug-on-error
|
|
||||||
debug-on-quit)
|
|
||||||
(doom-modeline-spc))
|
|
||||||
|
|
||||||
;; For `dap-mode'
|
|
||||||
(when (and (bound-and-true-p dap-mode)
|
|
||||||
(bound-and-true-p lsp-mode)
|
|
||||||
(dap--cur-session))
|
|
||||||
(concat
|
|
||||||
(propertize
|
|
||||||
(doom-modeline-debug-icon 'doom-modeline-warning)
|
|
||||||
'help-echo (format "DAP (%s)
|
|
||||||
mouse-1: Display debug hydra
|
mouse-1: Display debug hydra
|
||||||
mouse-2: Display recent configurations
|
mouse-2: Display recent configurations
|
||||||
mouse-3: Disconnect session"
|
mouse-3: Disconnect session"
|
||||||
(dap-mode-line))
|
(dap-mode-line))
|
||||||
'mouse-face '(:box 0)
|
'mouse-face '(:box 0)
|
||||||
'local-map (let ((map (make-sparse-keymap)))
|
'local-map (let ((map (make-sparse-keymap)))
|
||||||
(define-key map [mode-line mouse-1]
|
(define-key map [mode-line mouse-1]
|
||||||
#'dap-hydra)
|
#'dap-hydra)
|
||||||
(define-key map [mode-line mouse-2]
|
(define-key map [mode-line mouse-2]
|
||||||
#'dap-debug-recent)
|
#'dap-debug-recent)
|
||||||
(define-key map [mode-line mouse-3]
|
(define-key map [mode-line mouse-3]
|
||||||
#'dap-disconnect)
|
#'dap-disconnect)
|
||||||
map))
|
map))))
|
||||||
(doom-modeline-vspc)))
|
|
||||||
|
|
||||||
;; For `edebug'
|
(defsubst doom-modeline--debug-edebug ()
|
||||||
(when (or (bound-and-true-p edebug-mode)
|
"The current `edebug' state."
|
||||||
(bound-and-true-p edebug-x-mode))
|
(when (or (bound-and-true-p edebug-mode)
|
||||||
(concat
|
(bound-and-true-p edebug-x-mode))
|
||||||
(propertize
|
(propertize (doom-modeline-debug-icon 'doom-modeline-warning)
|
||||||
(doom-modeline-debug-icon 'doom-modeline-warning)
|
'help-echo (format "EDebug (%s)
|
||||||
'help-echo (format "EDebug (%s)
|
|
||||||
mouse-1: Show help
|
mouse-1: Show help
|
||||||
mouse-2: Next
|
mouse-2: Next
|
||||||
mouse-3: Stop debugging"
|
mouse-3: Stop debugging"
|
||||||
edebug-execution-mode)
|
edebug-execution-mode)
|
||||||
'mouse-face '(:box 0)
|
'mouse-face '(:box 0)
|
||||||
'local-map (let ((map (make-sparse-keymap)))
|
'local-map (let ((map (make-sparse-keymap)))
|
||||||
(define-key map [mode-line mouse-1]
|
(define-key map [mode-line mouse-1]
|
||||||
#'edebug-help)
|
#'edebug-help)
|
||||||
(define-key map [mode-line mouse-2]
|
(define-key map [mode-line mouse-2]
|
||||||
#'edebug-next-mode)
|
#'edebug-next-mode)
|
||||||
(define-key map [mode-line mouse-3]
|
(define-key map [mode-line mouse-3]
|
||||||
#'edebug-stop)
|
#'edebug-stop)
|
||||||
map))
|
map))))
|
||||||
(doom-modeline-vspc)))
|
|
||||||
|
|
||||||
;; For `debug-on-error'
|
(defsubst doom-modeline--debug-on-error ()
|
||||||
(when debug-on-error
|
"The current `debug-on-error' state."
|
||||||
(concat
|
(when debug-on-error
|
||||||
(propertize (doom-modeline-debug-icon 'doom-modeline-urgent)
|
(propertize (doom-modeline-debug-icon 'doom-modeline-urgent)
|
||||||
'help-echo "Debug on Error
|
'help-echo "Debug on Error
|
||||||
mouse-1: Toggle Debug on Error"
|
mouse-1: Toggle Debug on Error"
|
||||||
'mouse-face '(:box 0)
|
'mouse-face '(:box 0)
|
||||||
'local-map (make-mode-line-mouse-map 'mouse-1 #'toggle-debug-on-error))
|
'local-map (make-mode-line-mouse-map 'mouse-1 #'toggle-debug-on-error))))
|
||||||
(doom-modeline-vspc)))
|
|
||||||
|
|
||||||
;; For `debug-on-quit'
|
(defsubst doom-modeline--debug-on-quit ()
|
||||||
(when debug-on-quit
|
"The current `debug-on-quit' state."
|
||||||
(propertize
|
(when debug-on-quit
|
||||||
(doom-modeline-debug-icon 'doom-modeline-buffer-path)
|
(propertize (doom-modeline-debug-icon 'doom-modeline-buffer-path)
|
||||||
'help-echo "Debug on Quit
|
'help-echo "Debug on Quit
|
||||||
mouse-1: Toggle Debug on Quit"
|
mouse-1: Toggle Debug on Quit"
|
||||||
'mouse-face '(:box 0)
|
'mouse-face '(:box 0)
|
||||||
'local-map (make-mode-line-mouse-map 'mouse-1 #'toggle-debug-on-quit)))
|
'local-map (make-mode-line-mouse-map 'mouse-1 #'toggle-debug-on-quit))))
|
||||||
|
|
||||||
(when (or (and (bound-and-true-p dap-mode)
|
(doom-modeline-def-segment debug
|
||||||
(bound-and-true-p lsp-mode)
|
"The current debug state."
|
||||||
(dap--cur-session))
|
(when (doom-modeline--active)
|
||||||
(bound-and-true-p edebug-mode)
|
(let* ((dap (doom-modeline--debug-dap))
|
||||||
(bound-and-true-p edebug-x-mode)
|
(edebug (doom-modeline--debug-edebug))
|
||||||
debug-on-error
|
(on-error (doom-modeline--debug-on-error))
|
||||||
debug-on-quit)
|
(on-quit (doom-modeline--debug-on-quit))
|
||||||
(doom-modeline-spc)))))
|
(splitter (and (or dap edebug on-error on-quit) (doom-modeline-spc))))
|
||||||
|
(concat
|
||||||
|
splitter
|
||||||
|
(when dap (concat dap (doom-modeline-vspc)))
|
||||||
|
(when edebug (concat edebug (doom-modeline-vspc)))
|
||||||
|
(when on-error (concat on-error (doom-modeline-vspc)))
|
||||||
|
on-quit
|
||||||
|
splitter))))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in a new issue