EMACS: autoload gtags and use different hooks for version <24

This commit is contained in:
Tom Willemsen 2011-08-06 00:39:35 +02:00
parent ba3827f6d4
commit 8db229fa48

View file

@ -104,6 +104,20 @@
(autoload 'xmodmap-mode "xmodmap-mode" "Major mode for xmodmap" t)
(add-to-list 'auto-mode-alist '("\\.[xX]modmap\\(rc\\)?$" . xmodmap-mode))
;;; Gtags
(autoload 'gtags-mode "gtags" "Minor mode for using gtags" t)
(add-hook 'gtags-mode-hook
(lambda ()
(local-set-key (kbd "M-,") 'gtags-find-tag) ; find a tag,
; also M-.
(local-set-key (kbd "M-.") 'gtags-find-rtag))) ; reverse
; tag
(add-hook 'c-mode-common-hook
(lambda ()
(gtags-mode t)
(djcb-gtags-create-or-update)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; REQUIRES ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -227,9 +241,16 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; HOOKS ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-hook 'before-save-hook 'on-before-save)
(add-hook 'after-save-hook 'on-after-save)
(add-hook 'prog-mode-hook 'on-prog-mode)
(add-hook 'before-save-hook 'on-before-save)
(add-hook 'after-save-hook 'on-after-save)
(if (>= emacs-major-version 24)
(add-hook 'prog-mode-hook 'on-prog-mode)
(progn
(add-hook 'c-mode-common-hook 'on-prog-mode)
(add-hook 'go-mode-hook 'on-prog-mode)
(add-hook 'emacs-lisp-mode-hook 'on-prog-mode)))
(add-hook 'c-mode-hook 'on-c-mode)
(add-hook 'html-mode-hook 'on-html-mode)
(add-hook 'php-mode-hook 'on-php-mode)
@ -238,19 +259,6 @@
(add-hook 'css-mode-hook 'rainbow-mode)
(add-hook 'after-make-frame-functions 'setup-system-frame-colours t)
(add-hook 'gtags-mode-hook
(lambda ()
(local-set-key (kbd "M-,") 'gtags-find-tag) ; find a tag,
; also M-.
(local-set-key (kbd "M-.") 'gtags-find-rtag))) ; reverse
; tag
(add-hook 'c-mode-common-hook
(lambda ()
(require 'gtags)
(gtags-mode t)
(djcb-gtags-create-or-update)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; SKELETONS ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;