From 05d06cc552a8408248acc5dd4ad37f6d713088fb Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 10 Sep 2022 18:24:08 +0200 Subject: [PATCH] tweak(lib): suppress GC logging in debug mode It happens so often it can overwhelm the echo area. It's still logged to *Messages* however. --- lisp/lib/debug.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lisp/lib/debug.el b/lisp/lib/debug.el index 222a682e2..a175640d6 100644 --- a/lisp/lib/debug.el +++ b/lisp/lib/debug.el @@ -14,7 +14,6 @@ ;; Emacs variables async-debug debug-on-error - garbage-collection-messages gcmh-verbose init-file-debug jka-compr-verbose @@ -73,15 +72,24 @@ symbol and CDR is the value to set it to when `doom-debug-mode' is activated.") (advice-add #'run-hooks :override #'doom-run-hooks) ;; Add time stamps to lines in *Messages* (advice-add #'message :before #'doom--timestamped-message-a) + ;; The constant debug output from GC is mostly unhelpful. I still + ;; want it logged to *Messages*, just out of the echo area. + (advice-add #'gcmh-idle-garbage-collect :around #'doom-debug-shut-up-a) (add-variable-watcher 'doom-debug-variables #'doom-debug--watch-vars-h) (add-hook 'after-load-functions #'doom-debug--watch-vars-h)) (t (advice-remove #'run-hooks #'doom-run-hooks) (advice-remove #'message #'doom--timestamped-message-a) + (advice-remove #'gcmh-idle-garbage-collect #'doom-debug-shut-up-a) (remove-variable-watcher 'doom-debug-variables #'doom-debug--watch-vars-h) (remove-hook 'after-load-functions #'doom-debug--watch-vars-h) (message "Debug mode disabled!"))))) +(defun doom-debug-shut-up-a (fn &rest args) + "Suppress output from FN, even in debug mode." + (let (init-file-debug) + (apply #'doom-shut-up-a fn args))) + ;; ;;; Custom debugger