[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

S.O.S. from a CPU in distress

From: Bruno Félix Rezende Ribeiro
Subject: S.O.S. from a CPU in distress
Date: Fri, 27 Mar 2020 23:49:15 -0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Hello Emacs users, developers and enthusiasts!

I’m glad to announce the first release of ‘cpu-sos.el’.  Quoting from
its commentary header:

;; ‘cpu-sos’ is a buffer-local minor-mode designed to track the
;; visibility of buffers associated with sub-processes or EXWM managed
;; windows and send a SIGSTOP signal to those processes (and their
;; related ones) as soon as their buffers become buried, eventually
;; reverting this by sending a SIGCONT signal as soon as they become
;; visible again.  This has the effect of limiting CPU consumption of
;; processes managed by Emacs at the user’s discretion.  Useful for
;; programs whose background processing the user is not interested in.
;; For example, web-browsers running JavaScript aggressively on
;; background for no good reason.  Other legitimate use is to forcibly
;; disable background app notifications while one’s attention focus is
;; elsewhere.

;; CAVEATS: Notice that the concept of "visibility" used by this
;; package is defined by the semantics of the value ‘visible’ given to
;; the parameter ‘ALL-FRAMES’ of function ‘get-buffer-window’.  This
;; is necessary, but not sufficient for actual view of the buffer at
;; hand.  For instance, if a buffer is in a window of a frame that is
;; totally occluded by another it still is regarded as "visible",
;; although one can’t actually see it.  Aside from imprecise detection
;; of visual interaction, there is no attempt to detect sound
;; interaction.  Therefore, buffers running music players or recording
;; programs should not have this mode enabled.  The same is true if
;; one wants to have asynchronous processes delivering notifications
;; at arrival.  Keep also in mind that trying to yank selection from
;; stopped processes is problematic.

This library is available from my personal ELPA[1] and is also attached
to this mail for your convenience.  I hope that soon it will be
available from MELPA as well.

Testing, ideas, criticisms and fixes are welcome.



Attachment: cpu-sos.el
Description: S.O.S. from a CPU in distress

Bruno Félix Rezende Ribeiro (oitofelix) [0x28D618AF]

reply via email to

[Prev in Thread] Current Thread [Next in Thread]