;;..v....x....v....x....v....x....v....x....v....x....v....x....v....x....v....
;;
;; convert utf-8/iso-8859-15: Cx RET f utf-8 RET
;;
;; Wed Dec  6 20:21:32 CET 2006
;; http://www.pro-linux.de/news/2003/5550.html
(require 'autoinsert)
(auto-insert-mode 1)
(setq auto-insert t)
;; (setq auto-insert-query nil)
(add-hook 'find-file-hooks 'auto-insert)
(setq auto-insert-directory "~/src/skel/")
;; (setq auto-insert-alist
;;  '((scheme-mode . "template.scm")
;;  (texinfo-mode . "template.texi")
;;  ("\\.\\(c\\|h\\)$" . "template.c")))
(setq auto-insert-alist
  '(("\\.h" . "template.h")
    ("\\.html" . "template.html")))

;;
;; Fri Mar 18 17:00:35 CET 2005
;; http://www.webweavertech.com/ovidiu/emacs.html
;;; MacOS X specific stuff
;; (setq mac-command-key-is-meta nil)

;; Sun Apr  9 23:08:24 CEST 2006
;; (require 'mmm-auto)
;; (setq mmm-global-mode 'maybe)
;; (mmm-add-mode-ext-class 'html-mode nil 'mason)

;; Fri May  6 00:08:11 CEST 2005 (neither \C-/ nor \C-\ work)
(global-set-key "\C-ci" 'indent-region)
(global-set-key "\M-." 'find-tag-other-window)

;; Fri Apr  1 23:18:58 CEST 2005
;; (setq explicit-bash-args `("--login"))
;; tramp (succ. of ange-ftp) defaults to ssh
;; e.g.: /scp:hwais@195.234.187.87:/home/hwais/src/er/buslay
(require 'tramp)
(setq tramp-default-method "ftp")

;; Thu Mar 31 22:13:49 CEST 2005
(global-set-key [C-kp-home] 'beginning-of-buffer)
(global-set-key [C-kp-end] 'end-of-buffer)

;; junisphere:
(setq default-tab-width 8)

;;Mon Mar 24 21:22:34 WET 2003
(setq default-tab-width 4)

;; Sat Feb 15 20:46:56 WET 2003
(set-frame-name "emacs")

;; Wed Dec  4 20:56:27 CET 2002
;; http://koala.ilog.fr/colas/mouse-wheel-scroll/
;; make wheelmouse work
(defun up-slightly () (interactive) (scroll-up 5))
(defun down-slightly () (interactive) (scroll-down 5))
(global-set-key [mouse-4] 'down-slightly)
(global-set-key [mouse-5] 'up-slightly)
(defun up-one () (interactive) (scroll-up 1))
(defun down-one () (interactive) (scroll-down 1))
(global-set-key [S-mouse-4] 'down-one)
(global-set-key [S-mouse-5] 'up-one)
(defun up-a-lot () (interactive) (scroll-up))
(defun down-a-lot () (interactive) (scroll-down))
(global-set-key [C-mouse-4] 'down-a-lot)
(global-set-key [C-mouse-5] 'up-a-lot)

;;
;; this gives SEGV in *scratch* under X:
;;  (x-popup-dialog t (list "hallo" nil))
;;

(setq default-major-mode 'text-mode)
(global-unset-key "\C-x\C-u")
;; (setq explicit-shell-file-name "/bin/bash")
(setq explicit-bash-args (list "--noediting" "--login" "-i"))
(setq-default shell-cd-regexp nil)
(setq-default shell-pushd-regexp nil)
(setq-default shell-popd-regexp nil)
(add-hook 'comint-output-filter-functions
          'comint-watch-for-password-prompt)

(add-hook 'gnus-article-mode-hook
		  '(lambda ()
			 (global-set-key "u" 'message "Hallo")
			 ))

(add-hook 'c-mode-hook 'turn-on-font-lock)

;; junisphere:
(add-hook 'c-mode-hook
		  '(lambda ()
			 (c-set-style "k&r")
			 (turn-on-font-lock)
			 (setq c-basic-offset 8)
			 (setq c-brace-imaginary-offset 0)
			 (setq c-brace-offset -8)
			 (c-toggle-hungry-state 1)
			 (c-toggle-auto-state -1)))


(add-hook 'c++-mode-hook
		  '(lambda ()
			 (c-set-style "k&r")
			 (turn-on-font-lock)
			 (setq c-basic-offset 8)
			 (setq c-brace-imaginary-offset 0)
			 (setq c-brace-offset -8)
			 (c-set-offset 'inline-open 0) ;; first brace in method
			 (c-set-offset 'innamespace 0) ;; use C-c C-s to see what indents
			 (c-toggle-auto-state -1)))

;; (add-hook 'c-mode-hook
;; 		  '(lambda ()
;; 			 (c-set-style "k&r")
;; 			 (turn-on-font-lock)
;; 			 (setq c-basic-offset 4)
;; 			 (setq indent-tabs-mode nil)
;; 			 (c-toggle-hungry-state 1)
;; 			 (c-toggle-auto-state -1)))
;; 
;; (add-hook 'c++-mode-hook
;; 		  '(lambda ()
;; 			 (c-set-style "k&r")
;; 			 (turn-on-font-lock)
;; 			 (setq c-basic-offset 4)
;; 			 (setq indent-tabs-mode nil)
;; 			 (c-toggle-hungry-state 1)
;; 			 (c-toggle-auto-state -1)))
 
(add-hook 'perl
		  '(lambda ()
			 (turn-on-font-lock)
			 (setq indent-tabs-mode nil)))

(add-hook 'python-mode-hook
		  '(lambda ()
			 (turn-on-font-lock)
			 (setq indent-tabs-mode nil)))

(add-hook 'java-mode-hook
		  '(lambda ()
			 (turn-on-font-lock)
			 (setq indent-tabs-mode nil)))

(add-hook 'tex-mode-hook 'turn-on-font-lock)
(add-hook 'html-mode-hook 'turn-on-font-lock)
(add-hook 'sgml-mode-hook 'turn-on-font-lock)
(add-hook 'shell-mode-hook 'turn-on-font-lock)
(add-hook 'Shell-scrip-mode-hook 'turn-on-font-lock)
(add-hook 'makefile-mode-hook 'turn-on-font-lock)
(add-hook 'emacs-lisp-mode-hook 'turn-on-font-lock)
(setq font-lock-maximum-decoration t)

;; (set-face-attribute-internal 'font-lock-comment-face 'foreground "blue" nil)

;; umlaute
;; Warning (i18n): `standard-display-european' is semi-obsolete
;; (standard-display-european t)

;; display time in modeline
(display-time)

(load "desktop")

;; from /usr/local/share/emacs/20.2/lisp/desktop.el
(desktop-load-default)
(desktop-read)
(add-hook 'kill-emacs-hook
     '(lambda ()
        (desktop-truncate search-ring 3)
        (desktop-truncate regexp-search-ring 3)))

;; make % match parentheses (from FAQ: ^H F)
(global-set-key "%" 'match-paren)
(defun match-paren (arg)
  "Go to the matching parenthesis if on parenthesis otherwise insert %."
  (interactive "p")
  (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
	((looking-at "\\s\)") (forward-char 1) (backward-list 1))
	(t (self-insert-command (or arg 1)))))

(global-set-key "\C-cc" 'compile)
(global-set-key "\C-cl" 'goto-line)

;; find all info-pages:
(setq Info-default-directory-list
      (list  "/usr/share/info/emacs-20" "/usr/share/info" "/usr/local/info"))

;; no bell please
(setq ring-bell-function '(lambda ()))

;; laptop setting:
;; This disables auto-saving based on time, and makes the auto-saving be
;; done every 2500 keyboard actions.

(setq auto-save-interval 2500)
(setq auto-save-timeout nil)
(setq-default transient-mark-mode t)
(server-start)
;;(gnuserv-start)
;;(global-set-key "\e." 'tags-search)

;;for JDE
;;(load "jde")
;;(add-hook 'jde-mode-hook
;;     '(lambda ()
;;	(setq jde-compiler "jikes")
;;	(jde-set-global-classpath "/usr/share/kaffe/Klasses.jar")))
(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.
 '(canlock-password "2115e963320140ab412357fd89316e856a76456a"))

(setq browse-url-browser-function 'browse-url-w3)
(setq w3-default-homepage "http://localhost/~helmut/")

;; message-id in gnus
;; (setq message-required-mail-headers (remove 'Message-ID message-required-mail-headers))

;; message-id:
(setq system-name "wais.org")

;; Thu May  6 19:38:48 CEST 2004
;; from /usr/src/linux/Documentation/CodingStyle:
;;   ..if you put the string -*- linux-c -*- somewhere on the first
;;   two lines, this mode will be automatically invoked. Also, you may want
;;   to add
;; (setq auto-mode-alist (cons '("/usr/src/linux.*/.*\\.[ch]$" . linux-c-mode)
;;                       auto-mode-alist))

(defun linux-c-mode ()
  "C mode with adjusted defaults for use with the Linux kernel."
  (interactive)
  (c-mode)
  (c-set-style "K&R")
  (setq c-basic-offset 8))
(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.
 '(default ((t (:stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 96 :width normal :family "apple-monaco")))))

;; Sun Mar 20 16:40:46 CET 2005
(tool-bar-mode -1)
;; two buffers a 79 + scrollbars
(set-frame-width (selected-frame) 164)
(set-frame-height (selected-frame) 50)
(set-frame-position (selected-frame) 2 30)
(split-window-horizontally)
