3 ms·
I personally use this (alongside an extremely high threshold): (add-function :after after-focus-change-function (lambda
by thom 3y ago
I personally use this (alongside an extremely high threshold):
(add-function :after
after-focus-change-function
(lambda () (unless (frame-focus-state) (garbage-collect))))
So Emacs GCs whenever it loses focus (i.e. I'm looking at some docs in a browser or whatever). This works great for me - it's rare that I notice it still cleaning up when I switch back.
- celeritascelery 3y agoWait… you switch away from Emacs?
- medstrom 3y agoHumoristic surprise aside, I think this trick just feels neat and does not actually solve the problem when it matters most, because even if you often switch between apps, there are still going to be times when you don't. Times when you're just staring at compiler output or something heavy like that, and now you need a different GC trigger to save the day... and if you have that, then you do not need the trick.
- thom 3y agoAll I can say is that never happens to me. I moved to this after being annoyed by other approaches, especially idle ones where I'd pause to think only for the GC to kick in. Whereas if Emacs has lost focus, I'm between thoughts anyway so my flow is never interrupted.