feat: make emacs gc less annoying

This commit is contained in:
Swarsel 2024-12-15 15:03:40 +01:00
parent 699709c1d6
commit f85d3dd18e
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
2 changed files with 17 additions and 13 deletions

View file

@ -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)
(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
;; 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))))))
;; (message "Garbage Collector has run for %.06fsec"
(k-time (garbage-collect)))))
;; )
#+end_src
*** Indentation

View file

@ -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)))