dot-emacs: Turn on gtags mode in general.
[profile] / dot-emacs.el
index 1596f11..d24b364 100644 (file)
@@ -85,6 +85,17 @@ This may be at the expense of cool features.")
                    (concat "(" (buffer-string) ")")))))))
   (cdr (assq sym mdw-config)))
 
+;; --- Set up the load path convincingly ---
+
+(dolist (dir (append (and (boundp 'debian-emacs-flavor)
+                         (list (concat "/usr/share/"
+                                       (symbol-name debian-emacs-flavor)
+                                       "/site-lisp")))))
+  (dolist (sub (directory-files dir t))
+    (when (and (file-accessible-directory-p sub)
+              (not (member sub load-path)))
+      (setq load-path (nconc load-path (list sub))))))
+
 ;; --- Is an Emacs library available? ---
 
 (defun library-exists-p (name)
@@ -565,9 +576,15 @@ doesn't cope with anything approximating a complicated case."
   (auto-fill-mode 1)
   (setq fill-column 77)
   (setq show-trailing-whitespace t)
+  (and (fboundp 'gtags-mode)
+       (gtags-mode))
   (outline-minor-mode t)
   (mdw-set-font))
 
+(eval-after-load 'gtags
+  '(dolist (key '([mouse-2] [mouse-3]))
+     (define-key gtags-mode-map key nil)))
+
 ;; --- Set up all sorts of faces ---
 
 (defvar mdw-set-font nil)
@@ -726,6 +743,11 @@ the regular expressions in `mdw-backup-disable-regexps'."
 
 ;; --- Make C indentation nice ---
 
+(eval-after-load "cc-mode"
+  '(progn
+     (define-key c-mode-map "*" nil)
+     (define-key c-mode-map "/" nil)))
+
 (defun mdw-c-style ()
   (c-add-style "[mdw] C and C++ style"
               '((c-basic-offset . 2)
@@ -1586,6 +1608,41 @@ strip numbers instead."
           (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)"
                 '(0 mdw-punct-face))))))
 
+;;;----- Erlang configuration -----------------------------------------------
+
+(setq erlang-electric-commannds
+      '(erlang-electric-newline erlang-electric-semicolon))
+
+(defun mdw-fontify-erlang ()
+
+  ;; --- Set fill prefix ---
+
+  (mdw-standard-fill-prefix "\\([ \t]*{?%*[ \t]*\\)")
+
+  ;; --- Fiddle with fontification ---
+
+  (make-local-variable 'font-lock-keywords)
+  (let ((erlang-keywords
+        (mdw-regexps "after" "and" "andalso"
+                     "band" "begin" "bnot" "bor" "bsl" "bsr" "bxor"
+                     "case" "catch" "cond"
+                     "div" "end" "fun" "if" "let" "not"
+                     "of" "or" "orelse"
+                     "query" "receive" "rem" "try" "when" "xor")))
+
+    (setq font-lock-keywords
+         (list
+          (list "%.*$"
+                '(0 font-lock-comment-face))
+          (list (concat "\\<\\(" erlang-keywords "\\)\\>")
+                '(0 font-lock-keyword-face))
+          (list (concat "^-\\sw+\\>")
+                '(0 font-lock-keyword-face))
+          (list "\\<[0-9]+\\(\\|#[0-9a-zA-Z]+\\|[eE][+-]?[0-9]+\\)\\>"
+                '(0 mdw-number-face))
+          (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)"
+                '(0 mdw-punct-face))))))
+
 ;;;----- Texinfo configuration ----------------------------------------------
 
 (defun mdw-fontify-texinfo ()
@@ -1630,6 +1687,7 @@ strip numbers instead."
 
 (defun mdw-fontify-tex ()
   (setq ispell-parser 'tex)
+  (turn-on-reftex)
 
   ;; --- Don't make maths into a string ---