Optimize debug segment.

This commit is contained in:
Vincent Zhang 2019-06-23 23:48:24 +08:00
parent 1a77ba0690
commit 34b23b3e25

View file

@ -1862,15 +1862,20 @@ mouse-3: Fetch notifications"
"The current debug state."
(when (doom-modeline--active)
(concat
(and (or debug-on-error debug-on-quit
(when (or (and (bound-and-true-p dap-mode)
(bound-and-true-p lsp-mode)
(dap--cur-session))
(bound-and-true-p edebug-mode)
(bound-and-true-p edebug-x-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)
@ -1886,11 +1891,13 @@ mouse-3: Disconnect session"
#'dap-debug-recent)
(define-key map [mode-line mouse-3]
#'dap-disconnect)
map)))
map))
(doom-modeline-vspc)))
;; For `edebug'
(when (or (bound-and-true-p edebug-mode)
(bound-and-true-p edebug-x-mode))
(concat
(propertize
(doom-modeline-debug-icon 'doom-modeline-warning)
'help-echo (format "EDebug (%s)
@ -1906,15 +1913,18 @@ mouse-3: Stop debugging"
#'edebug-next-mode)
(define-key map [mode-line mouse-3]
#'edebug-stop)
map)))
map))
(doom-modeline-vspc)))
;; For `debug-on-error'
(when debug-on-error
(concat
(propertize (doom-modeline-debug-icon 'doom-modeline-urgent)
'help-echo "Debug on Error
mouse-1: Toggle Debug on Error"
'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'
(when debug-on-quit
@ -1925,9 +1935,13 @@ mouse-1: Toggle Debug on Quit"
'mouse-face '(:box 0)
'local-map (make-mode-line-mouse-map 'mouse-1 #'toggle-debug-on-quit)))
(and (or debug-on-error debug-on-quit
(when (or (and (bound-and-true-p dap-mode)
(bound-and-true-p lsp-mode)
(dap--cur-session))
(bound-and-true-p edebug-mode)
(bound-and-true-p edebug-x-mode))
(bound-and-true-p edebug-x-mode)
debug-on-error
debug-on-quit)
(doom-modeline-spc)))))