(custom-set-variables
  ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 '(TeX-PDF-mode t)
 '(default-input-method "german-postfix")
 '(global-font-lock-mode t nil (font-lock))
 '(global-hl-line-mode t nil (hl-line))
 '(indent-tabs-mode nil)
 '(indicate-empty-lines t)
 '(initial-major-mode (quote text-mode))
 '(mouse-wheel-mode t nil (mwheel))
 '(show-trailing-whitespace t)
 '(transient-mark-mode t))

;; Display time
(setq display-time-24hr-format t)
(display-time)

;; Display line- / column-numbers
(setq line-number-mode t)
(setq column-number-mode t)

;; Jump to previous window
(defun other-window-backward (n)
  "Select Nth previous window."
  (interactive "p")
  (other-window (- n)))

(global-set-key [(shift down)] 'other-window)
(global-set-key [(shift up)] 'other-window-backward)

;; custom key bindings
;;========================

;; global
;;------------------------
(global-set-key [(S-iso-lefttab)] 'dabbrev-expand) ; expand dynamically
(global-set-key [C-tab] 'speedbar-get-focus)       ; open speedbar

;; TeX-mode
;;------------------------
(add-hook 'TeX-mode-hook
          '(lambda ()
             (define-key TeX-mode-map
               "\C-cc" 'TeX-command-master) ; compile entire document
             (define-key TeX-mode-map
               "\C-cr" 'TeX-command-region) ; compile region
             (define-key TeX-mode-map
               "\C-cn" 'TeX-next-error)))   ; jump to next error message

;; AUCTeX
;;------------------------
(require 'tex-site)           ; AUCTeX ggfs laden
(setq TeX-electric-escape t)  ; \ ist aktiv
(setq TeX-insert-braces t)    ; Automatisch {} anhaengen
(setq TeX-parse-self t)       ; TeX-Files analysieren
(setq TeX-auto-save t)        ; Informationen speichern
(setq tex-dvi-view-command "/usr/bin/xdvi")
(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill)
;(setq-default TeX-master nil) ; nach dem Master-File fragen

;; RefTeX
;;------------------------
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
(add-hook 'latex-mode-hook 'turn-on-reftex)   ; with Emacs latex mode
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)

(setq reftex-plug-into-AUCTeX t
      reftex-enable-partial-scans t)

(setq reftex-use-external-file-finders t)
(setq reftex-external-file-finders
      '(("tex" . "kpsewhich -format=.tex %f")
        ("bib" . "kpsewhich -format=.bib %f")))
(setq reftex-label-alist
       '((nil ?s nil nil nil ("Kapitel" "Kap." "Abschnitt" "Teil"))
         (nil ?e nil "~\\eqref{%s}" nil ("Gleichung" "Gl."))
         (nil ?t nil nil nil ("Tabelle"))
         (nil ?f nil nil nil ("Figur" "Abbildung" "Abb." "Bild"))
         (nil ?n nil nil nil ("Anmerkung" "Anm."))
         (nil ?i nil nil nil ("Punkt"))))

(custom-set-faces
  ;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 '(highlight ((t (:background "lightgreen" :foreground "black"))))
 '(region ((((class color) (background dark)) (:background "yellow4"))))
 '(trailing-whitespace ((((class color) (background light)) (:background "green4")))))
