Re: [GNU ELPA] New package: caffeinate-mode
Stéphane Marks <[email protected]> Sat, 25 Jul 2026 23:44:01 +0200
| Newsgroups | gmane.emacs.devel |
|---|---|
| Message-ID | <CAN+1HbqUy6h0ooh-cStSU_7soSoS=cRtcAmLuUugKpChgJ504A@mail.gmail.com> |
On Sat, Jul 25, 2026 at 4:59 PM Lucas Christian <[email protected]> wrote: > 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. > You could call caffeinate-block-display-sleep caffeinate-block-display-sleep-default. And rather than pollute (not being impolite) the main menu with caffeinate-mode menu, consider doing what project.el does with its menu accessible via its mode-line lighter. See project-mode-line-map and the function project-mode-line-format.