comparison .elisp/settings/40.modes.el @ 277:884f7f932a83

emacs go: move go config to a new file This uses some clever shell tricks to identify the location (if any) of the go installation and gocode and load their supporting packages if available.
author Augie Fackler <raf@durin42.com>
date Fri, 27 Apr 2012 16:50:05 -0500
parents 8109c1d949c8
children 7a99481ab888
comparison
equal deleted inserted replaced
276:46979cef73b6 277:884f7f932a83
24 (interactive) 24 (interactive)
25 (make-variable-buffer-local 'af-cleanup-whitespace) 25 (make-variable-buffer-local 'af-cleanup-whitespace)
26 (set-variable 'af-cleanup-whitespace nil)) 26 (set-variable 'af-cleanup-whitespace nil))
27 (add-hook 'rst-mode-hook 'af-no-clean-whitespace) 27 (add-hook 'rst-mode-hook 'af-no-clean-whitespace)
28 (add-hook 'makefile-mode-hook 'af-no-clean-whitespace) 28 (add-hook 'makefile-mode-hook 'af-no-clean-whitespace)
29
30
31 (defun af-go-hook ()
32 ;; enable tabs
33 (setq tab-width 2)
34 (setq-default indent-tabs-mode t)
35 (make-variable-buffer-local 'whitespace-style)
36 (setq whitespace-style '(trailing lines-tail indentation trailing empty))
37 (message "Fixed whitespace style")
38 )
39
40
41 (let ((go-emacs (concat (getenv "GOROOT") "/misc/emacs")))
42 (message (concat go-emacs "/go-mode.el"))
43 (if (file-exists-p (concat go-emacs "/go-mode.el"))
44 (progn (add-to-list 'load-path go-emacs)
45 (require 'go-mode-load)
46 (add-hook 'go-mode-hook 'af-go-hook))
47 (message "Go appears to not be installed, skipping go-mode.")))
48 29
49 (autoload 'js2-mode "js2" nil t) 30 (autoload 'js2-mode "js2" nil t)
50 (add-to-list 'auto-mode-alist '("\\.js$" . js2-mode)) 31 (add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
51 (add-hook 'js2-mode-hook 'af-tab-fix) 32 (add-hook 'js2-mode-hook 'af-tab-fix)
52 33