Skip to content

Commit

Permalink
Guard idris company setup on the auto-completion layer
Browse files Browse the repository at this point in the history
  • Loading branch information
StreakyCobra committed Apr 11, 2016
1 parent 247d7cc commit f2f23e6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions layers/+lang/idris/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
company
popwin))

(defun idris/post-init-company ()
(spacemacs|add-company-hook idris-mode))
(when (configuration-layer/layer-usedp 'auto-completion)
(defun idris/post-init-company ()
(spacemacs|add-company-hook idris-mode)))

(defun idris/init-idris-mode ()
(use-package idris-mode
Expand Down

3 comments on commit f2f23e6

@syl20bnr
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StreakyCobra In this particular case where only company package is "augmented" the guard is redundant, idris/post-init-company won't be executed if there is no xxx/init-company function (i.e. the layer auto-completion is not used).
The guard is needed only for new package like idris-company because we don't want to install the package if the auto-completion layer is not used (a package is not installed if no init-<package> functions is declared, which is the case when the guard evaluates to false).
I took the habit to also put the post-init-company in the guard when there is one due to another company package (like idris-company), but if there is only post-init-company I don't add it.
Hum I hope I was clear enough :-)

@StreakyCobra
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@syl20bnr Yes I understand what you mean. I did the same as in the python layer. Except that I missed that the (when … included another function than the post-init-company 😅 https://github.com/syl20bnr/spacemacs/blob/develop/layers/+lang/python/packages.el#L74-L79

I'll correct this right away :-)

@StreakyCobra
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 0aafaec

Please sign in to comment.