hylang / hy-mode

Hy mode for Emacs
GNU General Public License v3.0
189 stars 48 forks source link

prevent company-mode Symbol's value is void errors #94

Closed tgbugs closed 3 years ago

tgbugs commented 3 years ago

Before this fix if company-mode was not loaded then hy-mode would fail to load because it would not find company-backends and company-grab-symbol.

This commit fixes the issue by checking whether those symbols are bound before executing code that depends on them.

tgbugs commented 3 years ago

Closes https://github.com/hylang/hy-mode/issues/92.

ekaschalk commented 3 years ago

Am I understanding right in that you do not use company?

If that is the underlying case, wrap the caller in hy-mode's definition instead.

tgbugs commented 3 years ago

Yes. I do not use company but it is installed (presented but unloaded). I assume your suggestion is to add it here https://github.com/hylang/hy-mode/blob/e161a0c9a2b1f55c14b72164d55d72e67f2bf1e3/hy-mode.el#L297 since that is actually the only place it is invoked during normal usage?

tgbugs commented 3 years ago

Additional note which might make a difference. I am also using hy-mode through org-babel, and if that were to trigger inferior-hy-mode-hook then my understanding of your proposed solution would not work.

ekaschalk commented 3 years ago

Yea there, thanks for contributing btw. What's the issue with calling it through org-babel? I don't think it starts up company there.

tgbugs commented 3 years ago

Happy to! After investigating I think whatever was going wrong before has resolved itself. If it comes up again I will track the issue down. I have this vague memory that the issue might have occurred when/because I did not have jedhy installed.

I wrapped both the initial call and setting the hook in a test for the company feature.

ekaschalk commented 3 years ago

Thanks! Merged.