1

I'm trying to install go-mode in emacs (http://dominik.honnef.co/posts/2013/03/writing_go_in_emacs/) but am having trouble and I'm not sure if the problem is with my .emacs file or with the go-mode el. I've auto-generated go-mode-load.el as in http://www.pastebucket.com/58212.

I then configured my .emacs file as

(add-to-list 'load-path "/Users/<username>/Misc/emacs/go-mode.el/")
(require 'go-mode-load)

But when I start emacs I get the following error

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  expand-file-name(nil "/SourceCache/emacs/emacs-92/emacs/lisp")
  update-file-autoloads("go-mode.el")
  (let ((generated-autoload-file buffer-file-name)) (update-file-autoloads "go-mode.el"))
  eval-buffer(#<buffer  *load*<2>> nil "/Users/ygreif/Misc/emacs/go-mode.el/go-mode-load.el" nil t)  ; Reading at buffer position 143
load-with-code-conversion("/Users/ygreif/Misc/emacs/go-mode.el/go-mode-load.el"     "/Users/ygreif/Misc/emacs/go-mode.el/go-mode-load.el" nil t)
require(go-mode-load)
eval-buffer(#<buffer  *load*> nil "/Users/ygreif/.emacs" nil t)  ; Reading at buffer position 88
load-with-code-conversion("/Users/ygreif/.emacs" "/Users/ygreif/.emacs" t t)
load("~/.emacs" t t)
[globbily-bluck]
command-line()
normal-top-level()

How do I interpet the --debug-init. Is the problem in my .emacs file?

1

You can read the output topdown. The latest elisp that is being evaluated is the line just after the error, in this case

  expand-file-name(nil "/SourceCache/emacs/emacs-92/emacs/lisp")

A quick look at expand-file-name documentation reveals that the first argument is mandatory and must be a string containing a filename. Here you are somehow calling it with nil which is reflected in the error that says nil is not a string.

I took a quick look at go-mode from MELPA which points to the same github repository as source and could not find any file that provided go-mode-load as a feature. The only relavent lisp file was go-mode.el which can be loaded by (require 'go-mode). I strongly recommend installing from MELPA in this case.

  • Awesome thanks. Do you know if MELPA works for emacs22? I tried copying the packages file repo.or.cz/w/emacs.git/blob_plain/… but loading it doesn't work – ygreif Oct 10 '14 at 18:33
  • No, MELPA (and package.el in general) is for Emacs >= 23 only. It's probably unreasonable at this stage to expect that you can use modern code like go-mode with Emacs 22. Upgrading to 24.x, with its built-in package.el and many core enhancements, would be well worth the effort simply for the time saved dealing with issues like this. – sanityinc Oct 10 '14 at 18:43
  • I should add that if you're using Emacs 22 because it is the default version on your Mac, you can easily grab a newer version from emacsformacosx.com as an app bundle. The bundle contains an Emacs executable which will also work from the command line. – sanityinc Oct 10 '14 at 18:46
  • You can also install an up-to-date Emacs from Homebrew. – Sam Brightman Dec 23 '14 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.