changeset 224:7ca719e40c58

modes: enable Go mode if it can be found
author Augie Fackler <durin42@gmail.com>
date Mon, 20 Sep 2010 07:35:29 -0500
parents 739d96003993
children cd77d083902b
files .elisp/settings/40.modes.el
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/.elisp/settings/40.modes.el
+++ b/.elisp/settings/40.modes.el
@@ -26,6 +26,21 @@ point."
 (add-hook 'rst-mode-hook 'af-no-clean-whitespace)
 (add-hook 'makefile-mode-hook 'af-no-clean-whitespace)
 
+
+(defun af-go-hook ()
+  ;; enable tabs
+  (setq tab-width 2)
+  (setq-default indent-tabs-mode t))
+
+
+(let ((go-emacs (concat (getenv "GOROOT") "/misc/emacs")))
+  (message (concat go-emacs "/go-mode.el"))
+  (if (file-exists-p (concat go-emacs "/go-mode.el"))
+      (progn (add-to-list 'load-path go-emacs)
+             (require 'go-mode-load)
+             (add-hook 'go-mode-hook 'af-go-hook))
+    (message "Go appears to not be installed, skipping go-mode.")))
+
 (autoload 'js2-mode "js2" nil t)
 (add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
 (add-hook 'js2-mode-hook 'af-tab-fix)