purcell/inheritenv

global minor mode to add advice to a reasonable default set of functions?

wbolster opened this issue · 2 comments

the readme explains that

Users can modify commands like shell-command-to-string using the inheritenv-add-advice macro.

💡 perhaps it would be nice to have a global minor mode inheritenv-mode (inheritenv-global-mode?) that does this for a reasonable default set of functions, such as shell-command-to-string, so that individuals don't have to figure out the details in the common case?

Yes, that's potentially a good idea, but primarily for built-ins. Regarding other authors' packages, I think that where possible they should modify their code to do the right thing (e.g. by using inheritenv). I'd worry a little about making this package a dumping ground for workarounds. Of course, in envrc I now have a hard-coded workaround for shell-command-to-string, which is only enabled in envrc-mode, so that's kinda similar, and arguably an inheritenv-mode would be more appropriate.

If I provided such a mode, I'd do the usual thing of providing both a local minor mode and a globalized version of it, just for flexibility. envrc-mode could then unconditionally enable the local minor mode.

Thanks for the suggestion!

Maybe it suffices to provide a suggested configuration in the Readme? Then users would know upfront which commands benefit from the advice.