...
 
Commits (2)
......@@ -84,12 +84,38 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Go Stuff
; What GOPATH was on startup.
(defvar dotemacs-original-gopath (getenv "GOPATH"))
; Reads the ".gopath" dir in the current dir and finds the absolute path.
(defun dotemacs-dotgopath-resolve (projdir)
(let ((dgp-path (expand-file-name ".gopath" projdir)))
(if (file-exists-p dgp-path)
(with-temp-buffer
(insert-file-contents-literally dgp-path)
(goto-char (point-min))
(expand-file-name (string-trim (thing-at-point 'line))
projdir))
nil)))
(use-package go-mode
:ensure t
:hook ((before-save . gofmt-before-save))
:hook ((before-save . gofmt-before-save)
(go-mode . company-lsp)
(lsp-before-initialize
. (lambda ()
(let ((newgopath (dotemacs-dotgopath-resolve
(lsp--workspace-root lsp--cur-workspace))))
(when (not (null newgopath))
(message "Temporarily setting GOPATH to %s" newgopath)
(setenv "GOPATH" newgopath)))))
(lsp-after-initialize
. (lambda () (setenv "GOPATH" dotemacs-original-gopath))))
:config
(define-key go-mode-map (kbd "TAB") #'company-indent-or-complete-common))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; C stuff
(use-package cc-mode
:ensure t
......@@ -114,7 +140,6 @@
:ensure t)
(which-key-mode)
; Column numbers!
(setq column-number-mode t)
......