Tag Archives: Golang

Emacs on Mac OSX with gocode

Emacs launched from Spotlight cannot get correct environment variables, thus gocode could not get GO pkg path.

To solve this, follow steps here:

1. Use ‘launched’ to set environment variables:
PATH as: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin:/usr/local/go/bin
GOBIN as:/usr/local/go/bin
GOROOT as: /usr/local/go

2. After environment variables set, any application launched from Term can receive right PATH, GOBIN and GOROOT.
So next launch Emacs from Terminal.App to test:

3. Create an alias in ~/.bash_profile like: alias startemacs=’/Applications/Emacs.app/Contents/MacOS/Emacs&’

see: http://emacswiki.org/emacs/EmacsApp

Emacs Server Start Failure on Win32 and Go Mode

Got an error of “make-directory creating directory no such file or directory ” when starting Emacs with windows user account path set as home path for Emacs.

There are some post (http://stackoverflow.com/questions/885793/emacs-error-when-calling-server-start and http://stackoverflow.com/questions/41300/emacs-in-windows) with solutions but don’t work on my configuration (Win7+Emacswin32 v24.2).

Finally specifyed in Reg HKCU\Software\Emacs\Home -> C:\Application\emacs-24.2\home and put _emacs file to this folder to solve the problem.

To use go-mode shipped with Go Lang installation, read comments in go-mode-load.el. For my installation (Go in C:\Applications\Go), just add the following lines to _emacs:
(add-to-list 'load-path "C:\\Applications\\Go\\misc\\emacs\\" t)
(require 'go-mode-load)