Re: [GNU ELPA] New package: caffeinate-mode

Lucas Christian <[email protected]> Sat, 25 Jul 2026 13:59:44 -0700
Newsgroups gmane.emacs.devel
Message-ID <[email protected]>
Philip Kaludercic <[email protected]> writes:

> Here is a skeetch of what I had in mind when it came to merging the two
> minor modes.

[...]

> It also simplifies the code, since you don't need to maintain the
> invariant that the major modes are mutually exclusive.  It is a
> sub-minor-mode so to speak.

I made a few changes to this and pushed a new version of the library:
https://github.com/lucasec/emacs-caffeinate/commit/d19c1bc9031ebeffd243177eb4f1efd84fc14fd7

The net change was only about -11 lines, but I do think it reads a bit
cleaner. Will run this for a few days while I continue to deal with the
copyright assignment paperwork and see if it bothers me.

One detail I'd like feedback on: Currently I have both a customize
option caffeinate-block-display-sleep and also the function
caffeinate-toggle-display.

The customize variable defines the default behavior when caffeinate-mode
is enabled (though if you change the value through the customize
interface, it also applies to any active usage of
caffeinate-mode). caffeinate-toggle-display allows changeing the
behavior temporarily while caffeinate-mode is active, and the change
resets if you toggle caffeinate-mode off and on again.

This seems to match the behavior of other "submodes",
e.g. c-hungry-delete mode, which reset when you change the major mode.

-- 
Lucas Christian
[email protected]