purcell / envrc

Emacs support for direnv which operates buffer-locally
379 stars 35 forks source link

Add envrc-mode-hook #1

Closed manuel-uberti closed 4 years ago

manuel-uberti commented 4 years ago

Hi,

first of all thanks for this package, it addresses exactly what I think was missing from direnv.el.

Do you think it would be possible to add a envrc-mode-hook to set up other per-user stuff after the mode is enabled? More importantly, do you think it would be something useful?

I have a font-lock related function for .envrc files that I'd like to run after envrc-global-mode. Of course I can wrap the call to envrc-global-mode in a defun where I call my font-lock utility as well, and use that.

So, basically, it's your call. :)

purcell commented 4 years ago

There will already be an envrc-mode-hook for each buffer and an envrc-global-mode-hook globally. Does that give you what you need?

manuel-uberti commented 4 years ago

Absolutely, thank you.

purcell commented 4 years ago

I can imagine it being helpful to have a global and/or local hook that is triggered when the state changes for a direnv, for example: the existing hook doesn't really give you that.

purcell commented 4 years ago

BTW, in reading your issue description, I couldn't really tell how the font-lock functionality would be related: this minor mode isn't really related to editing those files. (direnv.el does have a simple major mode for .envrc files, and I might add something similar, perhaps.)

manuel-uberti commented 4 years ago

Yes, my font-locking trick isn't actually working at the moment with your package, but I can live without it because of what this package addresses.

If you think a mode for .envrc files can be useful, I'll be using it, but it's not a blocking issue at all.