From f0540b8c6006cec616d77449209d28b91cfb41bf Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Tue, 3 Jul 2018 08:25:51 -0700 Subject: [emacs] A number of fixes for go-mode Set correctly go-eldoc, set the width of tab to 2, define a proper hook, etc. --- emacs.d/config/fcuny-go.el | 51 +++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/emacs.d/config/fcuny-go.el b/emacs.d/config/fcuny-go.el index 14acbe4..dc0cd8b 100644 --- a/emacs.d/config/fcuny-go.el +++ b/emacs.d/config/fcuny-go.el @@ -3,33 +3,42 @@ (use-package go-mode :ensure t - :init - (progn - (defun fcuny-go-set-tab-width () - (setq-local tab-width 2)) - (add-hook 'go-mode-hook 'fcuny-go-set-tab-width)) - + :after (company flycheck) + :preface + (defun fcuny/go-mode-setup () + (add-hook 'go-mode-hook 'flycheck-mode) + (setq-default) + (setq tab-width 2)) :config - (use-package go-eldoc - :config - (add-hook 'go-mode-hook 'go-eldoc-setup)) + (add-hook 'go-mode-hook #'fcuny/go-mode-setup)) + +(use-package go-eldoc + :after go-mode + :ensure t + :hook (go-mode . go-eldoc-setup)) - (use-package gotest :ensure t) +(use-package gotest + :ensure t) - (use-package go-guru :ensure t) +(use-package go-guru + :ensure t) - (use-package go-imports :ensure t) +(use-package go-imports + :ensure t) - (use-package golint :ensure t) +(use-package golint + :ensure t) - (use-package go-projectile :ensure t) +(use-package go-projectile + :ensure t) - (use-package company-go - :ensure t - :init - (progn - (setq company-go-show-annotation t)) - :config - (add-hook 'go-mode-hook (lambda() (add-to-list 'company-backends 'company-go))))) +(use-package company-go + :ensure t + :after (company go-mode) + :custom + (company-go-show-annotation t) + :config + (add-hook 'go-mode-hook 'company-mode) + (add-to-list 'company-backends 'company-go)) (provide 'fcuny-go) -- cgit 1.4.1