From f85d3dd18e914a0fb76ec8a42ab19aeea19c21af Mon Sep 17 00:00:00 2001 From: Swarsel Date: Sun, 15 Dec 2024 15:03:40 +0100 Subject: [PATCH] feat: make emacs gc less annoying --- SwarselSystems.org | 28 ++++++++++++++++------------ programs/emacs/init.el | 2 +- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/SwarselSystems.org b/SwarselSystems.org index ddaafa9..89ced13 100644 --- a/SwarselSystems.org +++ b/SwarselSystems.org @@ -10495,21 +10495,25 @@ When Emacs compiles stuff, it often shows a bunch of warnings that I do not need :PROPERTIES: :CUSTOM_ID: h:1667913c-2272-4010-bf3a-356455b97c83 :END: + +This sets up automatic garbage collection when the frame is unused. + #+begin_src emacs-lisp -(setq garbage-collection-messages t) -(defmacro k-time (&rest body) - "Measure and return the time it takes evaluating BODY." - `(let ((time (current-time))) - ,@body - (float-time (time-since time)))) + (setq garbage-collection-messages nil) + (defmacro k-time (&rest body) + "Measure and return the time it takes evaluating BODY." + `(let ((time (current-time))) + ,@body + (float-time (time-since time)))) -;; When idle for 15sec run the GC no matter what. -(defvar k-gc-timer - (run-with-idle-timer 15 t - (lambda () - (message "Garbage Collector has run for %.06fsec" - (k-time (garbage-collect)))))) + ;; When idle for 15sec run the GC no matter what. + (defvar k-gc-timer + (run-with-idle-timer 15 t + (lambda () + ;; (message "Garbage Collector has run for %.06fsec" + (k-time (garbage-collect))))) + ;; ) #+end_src *** Indentation diff --git a/programs/emacs/init.el b/programs/emacs/init.el index 132be0c..6d2c31a 100644 --- a/programs/emacs/init.el +++ b/programs/emacs/init.el @@ -541,7 +541,7 @@ create a new one." (setq native-comp-async-report-warnings-errors 'silent) ; Emacs 28 with native compilation (setq native-compile-prune-cache t)) ; Emacs 29 -(setq garbage-collection-messages t) +(setq garbage-collection-messages nil) (defmacro k-time (&rest body) "Measure and return the time it takes evaluating BODY." `(let ((time (current-time)))