Have a look at the approach taken by the logos.el
package. There’s a section in the manual called Leverage logos-focus-mode-hook.
The idea there is that when you enable the logos-focus-mode
, you’ll often want to change some other minor modes and variables too. But when you disable logos-focus-mode
, you’ll want those other minor modes to revert to their previous value. The Logos package provides a few convenience functions to remember the previous values, and they are automatically restored when logos-focus-mode
is turned off.
Perhaps the code for that could be made generic, instead of being coupled to the logos-focus-mode
?
See the paren-face package. The diagram you mention sounds like the one in the repository README. (I think the diagram has been used in longer article too, but I’m not sure where it originated.)