English 中文(简体)
Enabling go mode for emacs
原标题:
  • 时间:2009-11-11 14:22:45
  •  标签:
  • emacs

I don t seem to be able to enable a go mode for emacs. C mode doesn t work without semicolons. The best I have found is the JavaScript mode by Karl Landstrom, since JavaScript also doesn t require semicolons.

最佳回答

Try misc/emacs/go-mode.el (web link) in the Go distribution.

If you are using Emacs 24 and marmalade repo, use M-x package-install <RET> go-mode to install it directly.

问题回答

If your Go installs to /usr/local/go then add the following to your .emacs file.

;; go mode                                                                                           
(setq load-path (cons "/usr/local/go/misc/emacs" load-path))                                         
(require  go-mode-load)

Update from 2014 for Linux users

You can now download the golang-mode for Emacs from your package manager:

  • Fedora: yum install emacs-golang
  • Debian: apt-get install golang-mode
  • Ubuntu: apt-get install golang-mode

I only checked on Fedora, but the package is automatically installed and you have nothing to do except enjoying your new golang mode! And it is also updated as any other package of your system.

There are probably packages on other Linux distributions too.

Read Writing Go in Emacs and its follow-up, written by Dominik Honnef, the author of the official go-mode.

There he explains the story of go-mode and ways to install it, how to read Go documentation from inside Emacs, how to manage import statements of Go files in Emacs, how to setup autocomplete, on-the-fly syntax checking, snippets, and a lot of other super useful features for developing Go in Emacs.

Yes, there is. It is in the source code, inside the misc/emacs dir.





相关问题
suppress additional braces in emacs electric mode

I started using ruby-electric-mode. I like it except that I am used to closing open brackets myself (the other pairing are still useful to me). How can I make emacs suppress additional brackets when ...

Setting up an emacs environment in windows?

I am currently constrained to a windows dev box and I want to migrate my projects from eclipse to emacs. What are some good references on setting up an emacs dev environment for windows? Anything ...

Emacs Setting which-function-mode

I would like to have which-function-mode on by default when I open up Emacs. I ve added the following lines to my .emacs file. (setq which-func-mode t) (setq which-function-mode t) When I open ...

Enabling go mode for emacs

I don t seem to be able to enable a go mode for emacs. C mode doesn t work without semicolons. The best I have found is the JavaScript mode by Karl Landstrom, since JavaScript also doesn t require ...

Custom Emacs key bindings are not working

The key bindings I ve defined in my .emacs file aren t working. Here s the file: ;init modes (menu-bar-mode 0) (tool-bar-mode 0) (cua-mode) (column-number-mode) (fset perl-mode cperl-mode) (cperl-...

eval during emacs lisp macro expansion

How can I fix the simple macro foo in (elisp)Eval During Expansion? None of the followings work: (defmacro foo1 (a) `(setq (eval ,a) t)) (defmacro foo2 (a) `(setq ,(eval a) t)) (defmacro foo3 (...

Get local cvs comment history when committing file/s in emacs

I often commit files with similar cvs comment but not in a single operation. I would like to able to bring up previous comments I ve used in a previous commit when I am in the process of writing a ...

热门标签