Emacs: Add go-eldoc and go-guru

master
Pierre Neidhardt 2016-10-06 18:07:53 +05:30
parent 274b5fbc59
commit a7ff1ee133
3 changed files with 13 additions and 1 deletions

View File

@ -118,6 +118,8 @@ To view where the bindings are set in your config files, lookup
(load-external "\\.vert\\'\\|\\.frag\\'\\|\\.glsl\\'" 'glsl-mode nil 'c-mode)
(add-to-list 'favorite-packages 'go-mode)
(add-to-list 'favorite-packages 'go-eldoc)
(add-to-list 'favorite-packages 'go-guru)
(add-to-list 'favorite-packages 'go-rename)
(add-to-list 'favorite-packages 'helm-go-package)
(load-external "\\.go\\'" 'go-mode)

View File

@ -347,6 +347,8 @@
;; Replace not-so-useful comment-dwim binding.
(define-key mickey-minor-mode-map "\M-;" 'comment-line)
; In case you find eldoc too distracting.
;; (global-eldoc-mode 0)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(provide 'main)

View File

@ -1,7 +1,6 @@
;;==============================================================================
;; Go
;;==============================================================================
;; Optional packages: go-autocomplete?, go-complete?, go-guru
(defun go-eval-buffer ()
"Eval buffer with `go run'."
@ -21,6 +20,13 @@
(and looping (not (string= dir "/")))))
(if (string= dir "/") nil t))))
(when (require 'go-guru nil t)
(unless (executable-find "guru")
; Requires `call-process-to-string' from `functions'."
(require 'functions)
(setq go-guru-command
(concat (replace-regexp-in-string "\n$" "" (call-process-to-string "go" "env" "GOTOOLDIR")) "/guru"))))
(add-hook
'godoc-mode-hook
(lambda ()
@ -29,6 +35,8 @@
(add-hook-and-eval
'go-mode-hook
(lambda ()
(when (require 'go-eldoc nil t)
(go-eldoc-setup))
(setq gofmt-command "goimports")
(setq godoc-command "godoc -ex")
(setq godoc-and-godef-command "godoc -ex")