annotate .elisp/settings/80.go.el @ 377:117e3c11d953

zprofile: introduce zprofile use El Capitan (OS X 10.11) introduces a system-level /etc/zprofile which uses a path_helper thing to mangle $PATH. Unfortunately, the way path_helper works, it forces /usr/local/bin and /usr/bin to the *start* of the PATH variable, which means that any PATH mutations I want have to run after /etc/zprofile calls path_helper. As such, move my path insertions into .zprofile{,-machine} rather than .zshenv{,-machine} so that I can still ensure my path entries are at the start of PATH rather than the end. This works because: > Commands are then read from $ZDOTDIR/.zshenv. If the shell is a > login shell, commands are read from /etc/zprofile and then > $ZDOTDIR/.zprofile. Then, if the shell is interactive, commands > are read from /etc/zshrc and then $ZDOTDIR/.zshrc. Finally, if the > shell is a login shell, /etc/zlogin and $ZDOTDIR/.zlogin are read. This means that non-login shells no longer pick up my custom PATH entries, but as I only use OS X as a desktop OS that seems like a workable tradeoff for now.
author Augie Fackler <raf@durin42.com>
date Sun, 31 Jan 2016 20:46:29 -0500
parents ec41fb19c4c8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
277
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
1 ;; completions for go
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
2 (defun af-go-hook ()
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
3 ;; enable tabs
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
4 (setq tab-width 2)
294
a8caf664abdc go emacs: fix bug in enabling tabs for go files
Augie Fackler <raf@durin42.com>
parents: 288
diff changeset
5 (setq indent-tabs-mode t)
277
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
6 (make-variable-buffer-local 'whitespace-style)
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
7 (setq whitespace-style '(trailing lines-tail indentation trailing empty))
332
ec41fb19c4c8 go-eldoc: try and fix go-eldoc
Augie Fackler <raf@durin42.com>
parents: 323
diff changeset
8 (go-eldoc-setup)
277
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
9 )
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
10
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
11 (defun af-get-go-elisp-location ()
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
12 (let* ((gobinary (shell-command-to-string "which go"))
288
e00b19603472 go.el: Fix some bugs exposed on a new machine.
Augie Fackler <raf@durin42.com>
parents: 285
diff changeset
13 (gobin (substring (let ((x (file-name-directory gobinary)))
e00b19603472 go.el: Fix some bugs exposed on a new machine.
Augie Fackler <raf@durin42.com>
parents: 285
diff changeset
14 (if x x "z")) 0 -1))
277
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
15 (goroot (file-name-directory gobin)))
288
e00b19603472 go.el: Fix some bugs exposed on a new machine.
Augie Fackler <raf@durin42.com>
parents: 285
diff changeset
16 (if goroot (concat goroot "misc/emacs") "")))
277
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
17
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
18 (defun af-get-gocode-elisp-location ()
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
19 (let* ((binary (shell-command-to-string "which gocode"))
288
e00b19603472 go.el: Fix some bugs exposed on a new machine.
Augie Fackler <raf@durin42.com>
parents: 285
diff changeset
20 (bin (substring (let ((x (file-name-directory binary)))
e00b19603472 go.el: Fix some bugs exposed on a new machine.
Augie Fackler <raf@durin42.com>
parents: 285
diff changeset
21 (if x x "z")) 0 -1))
277
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
22 (basedir (file-name-directory bin)))
288
e00b19603472 go.el: Fix some bugs exposed on a new machine.
Augie Fackler <raf@durin42.com>
parents: 285
diff changeset
23 (if basedir
e00b19603472 go.el: Fix some bugs exposed on a new machine.
Augie Fackler <raf@durin42.com>
parents: 285
diff changeset
24 (concat basedir "src/github.com/nsf/gocode/emacs-company/")
e00b19603472 go.el: Fix some bugs exposed on a new machine.
Augie Fackler <raf@durin42.com>
parents: 285
diff changeset
25 "")))
277
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
26
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
27 (let* ((goloc (af-get-go-elisp-location))
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
28 (goel (concat goloc "/go-mode.el")))
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
29 (if (file-exists-p goel)
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
30 (progn
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
31 (message "Go is installed, loading go-mode")
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
32 (add-to-list 'load-path goloc)
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
33 (require 'go-mode)
323
aa5afa13e12c emacs: add go-eldoc for better go programming
Augie Fackler <raf@durin42.com>
parents: 294
diff changeset
34 (add-hook 'go-mode-hook 'af-go-hook)
277
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
35 (let* ((loc (af-get-gocode-elisp-location))
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
36 (el (concat loc "/company-go.el")))
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
37 (if (file-exists-p el)
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
38 (progn
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
39 (message "Found gocode, loading company-mode support...")
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
40 (add-to-list 'load-path loc)
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
41 (require 'company-go))
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
42 (message "gocode missing, skipping company-mode support."))))
884f7f932a83 emacs go: move go config to a new file
Augie Fackler <raf@durin42.com>
parents:
diff changeset
43 (message "Go appears to not be installed, skipping Go setup.")))