Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs update-file-autoloads failing

Tags:

emacs

I'm trying to setup emacs to be my GO IDE by following this tutorial with this code . I'm running into problems when I have to have emacs generate a file

From within Emacs, run M-x update-file-autoloads, point it at the go-mode.el file and tell it to generate a go-mode-load.el file.

I get this error when I enter the path of the file (location ~/.emacs.d/go-mode/go-mode.el)

Opening output file: no such file or directory, /build/buildd/emacs23-23.3+1/debian/build-x/lisp/loaddefs.el

I did a locate on this file and see I do have it but not at the path specified path above

$ locate loaddefs.el
/usr/share/emacs/23.3/lisp/loaddefs.el
...

If I had to guess I would say some kind of path problem. Do I have to set a path variable somewhere?

I installed emacs through apt-get install emacs23

I'm on Ubuntu 12.04

Thanks

EDIT

The process I'm doing to get the error.

  1. M-x update-file-autoloads Enter

  2. Update autoloads for file: ~/.emacs.d/go-mode/go-mode.el Enter

Opening output file: no such file or directory, /build/buildd/emacs23-23.3+1/debian/build-x/lisp/loaddefs.el

like image 394
Jeff Avatar asked Aug 14 '13 21:08

Jeff


3 Answers

I had the same problem and finally got it working. Open your scratch buffer (or any other empty file) and type in the following two lines

(setq generated-autoload-file "~/.emacs.d/go-mode/go-mode-load.el")
(update-file-autoloads "~/.emacs.d/go-mode/go-mode.el")

Then evaluate both lines by putting the cursor at then of each line and type in C-x C-e to evaluate the line before the cursor. Do this for both lines. Then make sure to open go-mode-load.el and save the buffer - apparently emacs does not do this by default.

Once you've done this you can continue to follow the instructions at http://www.honnef.co/posts/2013/03/writing_go_in_emacs/

Disclaimer: I am sure there is a better way to do this and lisp experts will shriek at my answer. I have no clue about lisp and how to use lisp in emacs. I just did an informed guess :-)

like image 194
hogliux Avatar answered Nov 08 '22 18:11

hogliux


Just recently hit this while attempting to get go-mode.el set up on my raspberry pi. Luckily, I had already generated a go-mode-load.el file successfully on my Mac and was able to take a look at that.

In there I saw this comment:

;; To update this file, evaluate the following form
;;   (let ((generated-autoload-file buffer-file-name)) (update-file-autoloads "go-mode.el"))

So I cd'ed into the directory where I had downloaded go-mode.el, then touched a new file called go-mode-load.el, opened it up in emacs, pasted in that line of code, evaluated it with C-x C-e and it worked like a charm.

EDIT

Wasn't able to get the generated file working until I added these lines to the end. As of writing this I haven't taken the time to figure out why they are needed but adding them fixed the problem:

(provide 'go-mode-load)
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; go-mode-load.el ends here
like image 45
Pat McGee Avatar answered Nov 08 '22 18:11

Pat McGee


(Not an answer, but needs formatting) Is there a local definition of `generated-autoload-file' in go-mode.el? If so, it will write there, so you need to remove that line.


;; update-file-autoloads docs

update-file-autoloads is an interactive compiled Lisp function in `autoload.el'.

(update-file-autoloads FILE &optional SAVE-AFTER OUTFILE)

Update the autoloads for FILE. If prefix arg SAVE-AFTER is non-nil, save the buffer too.

If FILE binds generated-autoload-file' as a file-local variable, autoloads are written into that file. Otherwise, the autoloads file is determined by OUTFILE. If called interactively, prompt for OUTFILE; if called from Lisp with OUTFILE nil, use the existing value ofgenerated-autoload-file'.

Return FILE if there was no autoload cookie in it, else nil.

like image 1
seanmcl Avatar answered Nov 08 '22 18:11

seanmcl