
;; TODO:
;; * disable ugly toolbar
;; * start with linum mode enabled
;;(* color settings)
;; * c++-mode
;;     * git im Emacs einrichten
;;     * flymake oder ähnliches einrichten
;;     * bold keywords
;; * latex-mode
;;     * Rechtschreibprüfung richtig einstellen
;;     * test mathe mode
;;     * Warnungen anzeigen
;;     * preview-latex zum Laufen bringen
;;     * flymake einrichten
;;     * BibTeX
;;     * synctex???
;;     * Probleme mit Viewer beheben
;;     * keybinding für ßß
;;     * TeX-command-master ohne bestätigen
;; * konfigurieren von windows.el und revive.el
;; * setup email in emacs
;; * markierten Text bei Eingabe eines Zeichens l\"oschen, Ausnahme sind Klammern
;; * andere Maustasten zuweisen
;; * Speedbar

;; start Emacs maximized
(w32-send-sys-command 61488)

;; make searches case-sensitive
(setq-default case-fold-search nil)

;; show time and battery in mode line
(load "time" t t)
(setq display-time-24hr-format t)
(display-time)

;; zeigt zugehörigen Klammern farbig an
(show-paren-mode)

;; startet Emacs mit 2 Fenstern nebeneinander
;(split-window-horizontally) ; -> siehe windows.el

;; show line numbers
(require 'linum)
(linum-mode t)
(global-set-key [f11] 'linum-mode)

;; color settings
(setq load-path (append load-path (list "~/.emacs.d/color-theme-6.6.0")))
(require 'color-theme)

(defun light-clear ()
  (interactive)
  (color-theme-install
   '(light-clear
      ((background-color . "#f5f7e3")
      (background-mode . light)
      (border-color . "#919191")
      (cursor-color . "#000000")
      (foreground-color . "#000000")
      (mouse-color . "black"))
     (fringe ((t (:background "#f5f7e3"))))
     (mode-line ((t (:foreground "#000000" :background "#8f8f8f"))))
     (region ((t (:background "#f5e794"))))
     (font-lock-builtin-face ((t (:foreground "#f362c6"))))
     (font-lock-comment-face ((t (:foreground "#999999"))))
     (font-lock-function-name-face ((t (:foreground "#9d1587"))))
     (font-lock-keyword-face ((t (:foreground "#3010da"))))
     (font-lock-string-face ((t (:foreground "#c77429"))))
     (font-lock-type-face ((t (:foreground"#199915"))))
     (font-lock-constant-face ((t (:foreground "#e6a00f"))))
     (font-lock-variable-name-face ((t (:foreground "#e6a00f"))))
     (minibuffer-prompt ((t (:foreground "#000000" :bold t))))
     (font-lock-warning-face ((t (:foreground "red" :bold t))))
     )))
(provide 'light-clear)

(color-theme-initialize)
(light-clear)



;; show line and column position of point
(column-number-mode)

;; open emacs with last session
;(desktop-save-mode 1)


;; restore windows and buffers
(require 'windows)
(win:startup-with-window)
;(define-key ctl-x-map "c" 'see-you-again)
(global-set-key (kbd "C-x C-c") 'see-you-again)
;(global-set-key (kbd "C-x C") 'resume-windows)


;; automatically pair braces and quotes
(require 'autopair)
(autopair-global-mode)

;; mit Crtl-TAB zum nächsten Window springen
(global-set-key [C-tab] 'other-window)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; c++ mode                           ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; .h-Dateien als C++-Header erkennen
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))

;; custom compile command
(setq compile-command "mingw32-make")

(defun cpp-bindings-my ()
  (define-key c++-mode-map [f5] 'compile)
  (define-key c++-mode-map (kbd "C-c C-c") 'comment-or-uncomment-region)
  )
(add-hook 'c++-mode-hook 'cpp-bindings-my)





;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; text mode                          ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; sets autofill on in text mode automatically
(setq text-mode-hook 'turn-on-auto-fill)



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; LaTeX mode                         ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; deutsche Umlaute als LaTeX-Äquivalent einfügen
(defun latex-ae () (interactive) (insert "\\\"a"))
(defun latex-oe () (interactive) (insert "\\\"o"))
(defun latex-ue () (interactive) (insert "\\\"u"))
(defun latex-AE () (interactive) (insert "\\\"A"))
(defun latex-OE () (interactive) (insert "\\\"O"))
(defun latex-UE () (interactive) (insert "\\\"U"))
(defun latex-ss () (interactive) (insert "{\\ss}"))
(defun latex-div() (interactive) (insert " \\div "))

(defun latex-bindings-my ()
  (define-key LaTeX-mode-map (kbd "ä") 'latex-ae)
  (define-key LaTeX-mode-map (kbd "ö") 'latex-oe)
  (define-key LaTeX-mode-map (kbd "ü") 'latex-ue)
  (define-key LaTeX-mode-map (kbd "Ä") 'latex-AE)
  (define-key LaTeX-mode-map (kbd "Ö") 'latex-OE)
  (define-key LaTeX-mode-map (kbd "Ü") 'latex-UE)
  (define-key LaTeX-mode-map (kbd "ß") 'latex-ss)
  (define-key LaTeX-mode-map (kbd "<kp-divide>") 'latex-div)
  (define-key LaTeX-mode-map (kbd "<f5>") 'TeX-command-master)
  (define-key LaTeX-mode-map (kbd "<f6>") 'TeX-next-error)
  (define-key LaTeX-mode-map (kbd "C-ö") 'self-insert-command)
  (define-key LaTeX-mode-map (kbd "C-ä") 'self-insert-command)
  (define-key LaTeX-mode-map (kbd "C-ü") 'self-insert-command)
  (define-key LaTeX-mode-map (kbd "C-Ö") 'self-insert-command)
  (define-key LaTeX-mode-map (kbd "C-Ä") 'self-insert-command)
  (define-key LaTeX-mode-map (kbd "C-Ü") 'self-insert-command)
  (define-key LaTeX-mode-map (kbd "C-c C-c") 'TeX-comment-or-uncomment-region)
  )

(add-hook 'LaTeX-mode-hook     'latex-bindings-my)

;; AUCTeX einrichten (ich habe Version 11.86)
(load "auctex.el" nil t t)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
(setq TeX-PDF-mode t) ; PDF statt DVI per default
(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill) ; Zeilenumbruch
(add-hook 'LaTeX-mode-hook 'turn-on-font-lock) ; Syntax Highlight
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode) ; Mathe Modus
(setq reftex-plug-into-AUCTeX t)            ; RefTeX einbinden
(add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; RefTeX einbinden
;----------
; will ich das ?
(setq sentence-end "[.?!][]\"’)}]*\\($\\| \\| \\)[;;]*") ; Satzende ". " statt ".  ". " für M-k: löschen bis Satzende usw.
(setq sentence-end-double-space nil) ; Da ist ein "Newline in der Zeile!"
;----------
(add-hook 'LaTeX-mode-hook 'flyspell-mode) ; direkte Rechtschreibkorrektur
(load "preview-latex.el" nil t t) ; preview-latex mit AUCTeX > 11.81

;; aspell ist besser als ispell.
;; Zeile kommentieren, falls nicht installiert:
(setq-default ispell-program-name "aspell")
;; Deutsche Rechtschreibung falls \usepackage{ngerman}
;; oder german benutzt wird
(add-hook 'TeX-language-de-hook
(function (lambda () (ispell-change-dictionary "german8"))))

;; Prefix um Mathesymole einzugeben:
(setq LaTeX-math-abbrev-prefix "<f12>")

;;;;;;; funktioniert noch nicht :(
;; ;; damit preview-latex funktioniert
;; (setq preview-image-type 'pnm)
;; pnm soll man wohl nicht nehmen, sondern eher emacs mit libpng zum Laufen bringen









;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Customizations added automatically ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; von linux-init-datei -> brauch ich das?
;; (custom-set-variables
;;   ;; custom-set-variables was added by Custom.
;;   ;; If you edit it by hand, you could mess it up, so be careful.
;;   ;; Your init file should contain only one such instance.
;;   ;; If there is more than one, they won't work right.
;;  '(TeX-electric-sub-and-superscript t)
;;  '(TeX-view-program-selection (quote (((output-dvi style-pstricks) "dvips and gv") (output-dvi "xdvi") (output-pdf "Evince") (output-html "xdg-open"))))
;;  '(compile-command "make -k --directory=../")
;;  '(display-time-24hr-format t)
;;  '(tab-width 4))
;; (custom-set-faces
;;   ;; custom-set-faces was added by Custom.
;;   ;; If you edit it by hand, you could mess it up, so be careful.
;;   ;; Your init file should contain only one such instance.
;;   ;; If there is more than one, they won't work right.
;;  )









;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; muss ganz am Ende stehen           ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(resume-windows)
;; falls danach noch customizations kommen,
;; m\"ussen sie verschoben werden!

