summaryrefslogblamecommitdiffstats
path: root/emacs
blob: e1305303049add97f5111c66d4ae015434ea50be (plain) (tree)


































                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
                              
                                                                                                                                                                                                                                                                                                             
                               
                                                      




                                                                                                                                                                                               
                              


                                                                
                                                                                                                                                                                                                                                                                                                                             








                                                                                         






                                           
                                                                                                                                                                                                                                





                                                  



                             


















                                                                                                                                                                                                
                              












                                                                                                                                                                                                                              
                   






                                                                          

























                                                                                                        





































































                                                                                                                                                                                                                                    
                    
                                                                 






                                             
 

















                                                                                                                                            














































































































































































                                                                                                                                                                                                                 



                                
                                 



                                    
                                     
               
                           

















































                                                                                            




                              

                                                                              
                                               

                                        



                                           
















                                                                           




                                             







                                            
                    
                
                                          



                                                                         
































                                                                                     







                                                  


                
(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.
 '(Buffer-menu-use-frame-buffer-list nil)
 '(abbrev-mode t)
 '(all-christian-calendar-holidays t)
 '(auto-compression-mode t nil (jka-compr))
 '(auto-insert-mode t)
 '(auto-insert-query nil)
 '(backward-delete-char-untabify-method nil)
 '(bubblet-high-score 286 t)
 '(bubblet-high-stats (quote (47 131)) t)
 '(bubblet-num-games 1 t)
 '(bubblet-total-score 286 t)
 '(bubblet-total-stats (quote (47 131)) t)
 '(c-basic-offset 8)
 '(c-syntactic-indentation t)
 '(c-syntactic-indentation-in-macros nil)
 '(c-tab-always-indent nil)
 '(calendar-week-start-day 1)
 '(case-fold-search t)
 '(column-number-mode t)
 '(compilation-skip-threshold 2)
 '(confirm-kill-emacs (quote y-or-n-p))
 '(current-language-environment "English")
 '(delphi-case-label-indent 2)
 '(delphi-indent-level 2)
 '(delphi-tab-always-indents nil)
 '(display-time-24hr-format t)
 '(display-time-day-and-date t)
 '(display-time-interval 60)
 '(display-time-mail-file (quote none))
 '(display-time-string-forms (quote ((if (and (not display-time-format) display-time-day-and-date) (format-time-string "---%a %b %e " now) "") (propertize (format-time-string (or display-time-format (if display-time-24hr-format "%H:%M" "%-I:%M%p")) now) (quote help-echo) (format-time-string "%a %b %e, %Y" now)) load (if mail (concat " " (propertize display-time-mail-string (quote display) (\` (when (and display-time-use-mail-icon (display-graphic-p)) (\,@ display-time-mail-icon) (\,@ (if (and display-time-mail-face (memq (plist-get (cdr display-time-mail-icon) :type) (quote (pbm xbm)))) (let ((bg (face-attribute display-time-mail-face :background))) (if (stringp bg) (list :background bg))))))) (quote face) display-time-mail-face (quote help-echo) "You have new mail; mouse-2: Read mail" (quote mouse-face) (quote mode-line-highlight) (quote local-map) (make-mode-line-mouse-map (quote mouse-2) read-mail-command))) ""))))
 '(double-mode nil t (double))
 '(ecb-compilation-buffer-names (quote (("*Calculator*") ("*vc*") ("*vc-diff*") ("*Apropos*") ("*Occur*") ("*shell*") ("\\*[cC]ompilation.*\\*" . t) ("\\*i?grep.*\\*" . t) ("*JDEE Compile Server*") ("*Help*") ("\\*.*[Cc]ompletions\\*" . t) ("*Backtrace*") ("*Compile-log*") ("*bsh*") ("*Messages*"))))
 '(ecb-compile-window-height 6)
 '(ecb-compile-window-temporally-enlarge (quote both))
 '(ecb-compile-window-width (quote frame))
 '(ecb-directories-menu-user-extension (quote (("Version Control" (ecb-dir-popup-cvs-status "CVS Status") (ecb-dir-popup-cvs-examine "CVS Examine") (ecb-dir-popup-cvs-update "CVS Update")))))
 '(ecb-history-sort-method nil)
 '(ecb-layout-name "left7")
 '(ecb-layout-window-sizes (quote (("left7" (0.21844660194174756 . 0.5873015873015873) (0.21844660194174756 . 0.15873015873015872) (0.21844660194174756 . 0.23809523809523808)))))
 '(ecb-options-version "2.40")
 '(ecb-primary-secondary-mouse-buttons (quote mouse-1--mouse-2))
 '(ecb-process-non-semantic-files t)
 '(ecb-show-help-format (quote info))
 '(ecb-source-path (quote (("/" "/") ("/home/alex/" "~/") #("/home/alex/chat" 0 15 (help-echo "Mouse-2 toggles maximizing, mouse-3 displays a popup-menu")) ("/home/alex/projects/uni/ti3" "ti3") ("/home/alex/projects/c/antispam" "antispamm") ("/home/alex/projects/c/antispam" "antispam") ("/home/alex/projects/todolist" "todolist"))))
 '(ecb-stealthy-tasks-delay 0.5)
 '(ecb-tag-display-function (quote ((default . ecb--semantic-format-tag-uml-prototype))))
 '(ecb-tip-of-the-day nil)
 '(ecb-use-speedbar-instead-native-tree-buffer nil)
 '(fill-individual-varying-indent t)
 '(focus-follows-mouse t)
 '(font-lock-support-mode (quote jit-lock-mode))
 '(frame-background-mode nil)
 '(fringe-mode nil nil (fringe))
 '(global-font-lock-mode t nil (font-lock))
 '(global-hl-line-mode t nil (hl-line))
 '(gnus-audio-au-player "/usr/bin/aplay")
 '(gnus-audio-wav-player "/usr/bin/aplay")
 '(grep-command "grep --color -nH -e ")
 '(gud-tooltip-mode nil)
 '(hl-line-face (quote highlight))
 '(holiday-general-holidays (quote ((holiday-fixed 1 1 "New Year's Day") (holiday-fixed 2 14 "Valentine's Day") (holiday-fixed 4 1 "April Fools' Day") (holiday-float 5 0 2 "Mother's Day") (holiday-fixed 10 31 "Halloween"))))
 '(indicate-buffer-boundaries (quote left))
 '(indicate-empty-lines t)
 '(inhibit-eol-conversion nil)
 '(inhibit-startup-screen t)
 '(inverse-video nil)
 '(jde-run-option-application-args (quote ("10")))
 '(jit-lock-chunk-size 1024)
 '(jit-lock-context-time 0.1)
 '(jit-lock-defer-time 0.1)
 '(jit-lock-stealth-nice 0.1)
 '(jit-lock-stealth-time nil)
 '(make-backup-files nil)
 '(mark-holidays-in-calendar t)
 '(mouse-1-click-in-non-selected-windows nil)
 '(mouse-autoselect-window t)
 '(mouse-avoidance-mode (quote jump) nil (avoid))
 '(mouse-sel-mode nil)
 '(mouse-wheel-follow-mouse nil)
 '(mouse-wheel-mode t nil (mwheel))
 '(msb-mode t nil (msb))
 '(newsticker-url-list-defaults (quote (("Debian Security Advisories" "http://www.debian.org/security/dsa.en.rdf") ("Heise News (german)" "http://www.heise.de/newsticker/heise.rdf"))))
 '(org-modules (quote (org-bbdb org-bibtex org-gnus org-info org-jsinfo org-irc org-mew org-mhe org-rmail org-vm org-wl org-mouse org-bookmark org-depend org-eval org-man org-screen org-toc)))
 '(pcomplete-autolist t)
 '(require-final-newline t)
 '(ruler-mode-show-tab-stops nil)
 '(savehist-mode t nil (savehist))
 '(scalable-fonts-allowed t)
 '(scroll-bar-mode (quote right))
 '(server-mode t)
 '(show-trailing-whitespace t)
 '(speedbar-directory-button-trim-method (quote trim))
 '(speedbar-frame-parameters (quote ((minibuffer) (width . 30) (height . 60) (border-width . 0) (menu-bar-lines . 0) (tool-bar-lines . 0) (unsplittable . t) (left-fringe . 0))))
 '(speedbar-frame-plist (quote (minibuffer nil width 30 height 60 border-width 0 internal-border-width 0 unsplittable t default-toolbar-visible-p nil has-modeline-p nil menubar-visible-p nil default-gutter-visible-p nil)))
 '(speedbar-indentation-width 2)
 '(speedbar-show-unknown-files t)
 '(speedbar-track-mouse-flag t)
 '(speedbar-use-images nil)
 '(speedbar-visiting-tag-hook (quote (speedbar-highlight-one-tag-line speedbar-recenter-to-top)))
 '(sql-product (quote mysql))
 '(sql-server "")
 '(sql-user "")
 '(standard-indent 8)
 '(tab-always-indent nil)
 '(tab-bar-mode -1)
 '(tab-stop-list (quote (8 16 24 32 40 48 56 64 72 80 88 96 104 112 120)))
 '(tab-width 8)
 '(tabkey2-mode nil)
 '(timeclock-modeline-display t nil (timeclock))
 '(timeclock-relative nil)
 '(timeclock-workday 0)
 '(tls-process-connection-type t)
 '(tooltip-delay 0.5)
 '(tooltip-frame-parameters (quote ((name . "tooltip") (internal-border-width . 1) (border-width . 1))))
 '(tooltip-use-echo-area nil)
 '(tooltip-x-offset 10)
 '(tooltip-y-offset 10)
 '(transient-mark-mode t)
 '(truncate-lines nil)
 '(truncate-partial-width-windows nil)
 '(uniquify-buffer-name-style (quote post-forward-angle-brackets) nil (uniquify))
 '(user-mail-address "alexander@sulfrian.net")
 '(view-calendar-holidays-initially t)
 '(view-read-only t)
 '(visible-bell nil)
 '(whitespace-auto-cleanup nil)
 '(whitespace-check-ateol-whitespace nil)
 '(whitespace-check-indent-whitespace nil)
 '(whitespace-check-leading-whitespace nil)
 '(whitespace-check-spacetab-whitespace nil)
 '(whitespace-check-trailing-whitespace nil)
 '(whitespace-display-in-modeline nil)
 '(whitespace-display-spaces-in-color t)
 '(whitespace-global-mode nil)
 '(whitespace-indent-regexp "^	*\\(    \\)+")
 '(whitespace-rescan-timer-time 0)
 '(windmove-wrap-around nil)
 '(x-gtk-whole-detached-tool-bar nil)
 '(x-stretch-cursor nil))

(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 "black" :foreground "grey90" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 92 :width normal :family "xos4-terminus"))))
 '(border ((t (:background "gray50"))))
 '(custom-face-tag ((t (:weight bold))))
 '(custom-group-tag ((((min-colors 88) (class color) (background light)) (:foreground "blue1" :weight bold))))
 '(custom-group-tag-1 ((((min-colors 88) (class color) (background light)) (:foreground "red1" :weight bold :height 1.2))))
 '(custom-variable-tag ((((min-colors 88) (class color) (background light)) (:foreground "blue1" :weight bold))))
 '(fixed-pitch ((t (:family "terminus"))))
 '(font-lock-comment-face ((nil (:foreground "green3"))))
 '(font-lock-constant-face ((nil (:weight bold))))
 '(font-lock-negation-char-face ((t (:foreground "red" :weight bold))))
 '(font-lock-preprocessor-face ((t (:inherit font-lock-builtin-face :foreground "magenta"))))
 '(font-lock-string-face ((nil (:foreground "red2"))))
 '(font-lock-warning-face ((t (:foreground "Red" :weight bold))))
 '(fringe ((((class color) (background light)) (:background "gray80"))))
 '(highlight ((nil (:background "grey10"))))
 '(isearch ((((class color) (min-colors 88) (background dark)) (:background "yellow3" :foreground "black" :weight bold))))
 '(italic ((((supports :underline t)) (:underline t))))
 '(link ((((class color) (min-colors 88) (background dark)) (:foreground "cyan1" :underline t))))
 '(menu ((t nil)))
 '(mode-line ((t (:box (:line-width 1 :color "grey75")))))
 '(mode-line-highlight ((((class color) (min-colors 88)) (:box (:line-width 2 :color "grey40" :style released-button)))))
 '(mode-line-inactive ((default (:inherit mode-line :foreground "gray60")) (nil nil)))
 '(mumamo-background-chunk-major ((((class color) (min-colors 88) (background light)) nil)))
 '(mumamo-background-chunk-submode ((((class color) (min-colors 88) (background light)) nil)))
 '(newsticker-immortal-item-face ((t (:foreground "blue" :slant italic :weight bold))))
 '(newsticker-new-item-face ((t (:weight bold))))
 '(newsticker-obsolete-item-face ((t (:strike-through t :weight bold))))
 '(newsticker-old-item-face ((t (:foreground "red4" :weight bold))))
 '(region ((((class color) (min-colors 88) (background dark)) (:inverse-video t))))
 '(scroll-bar ((t (:background "black" :foreground "gray25"))))
 '(shadow ((((class color grayscale) (min-colors 88) (background dark)) (:foreground "grey50"))))
 '(tooltip ((((class color)) (:background "lightyellow" :foreground "black" :height 0.5))))
 '(variable-pitch ((t (:family "terminus"))))
 '(vhdl-font-lock-attribute-face ((((class color) (background light)) (:foreground "Orchid"))))
 '(vhdl-font-lock-directive-face ((((class color) (background light)) (:foreground "cyan3"))))
 '(vhdl-font-lock-prompt-face ((t (:foreground "Red"))))
 '(widget-button ((t (:background "grey75" :foreground "black" :box (:line-width 2 :color "grey75" :style released-button)))))
 '(widget-button-face ((t (:box (:line-width 2 :color "grey75" :style released-button)))) t)
 '(widget-field ((t (:background "grey10" :box (:line-width 1 :color "grey75" :style pressed-button)))))
 '(widget-field-face ((t (:background "gray85"))) t)
 '(widget-single-line-field-face ((t (:background "gray85"))) t))

(global-set-key [mouse-3] 'imenu)

;; define F1 to display man page of the current word
(global-set-key [(f1)] (lambda () (interactive) (manual-entry (current-word))))

(load "/usr/share/emacs/site-lisp/site-gentoo")

(setq text-mode-hook 'turn-on-auto-fill)
(setq fill-column 72)

(setq semanticdb-default-save-directory "~/.emacs.d/semantic")
(setq ispell-extra-args '("-Tlatin15"
			  "-d" "/usr/lib/ispell/german"
			  "-w" "�������"))

(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)

; load-path anpassen
(setq load-path (cons "/usr/share/maxima/5.9.0/emacs" load-path))
(let* ((my-lisp-dir "~/.emacs.d/lisp")
       (default-directory my-lisp-dir)
       (orig-load-path load-path))
  (setq load-path (cons my-lisp-dir nil))
  (normal-top-level-add-subdirs-to-load-path)
  (nconc load-path orig-load-path))


(autoload 'maxima-mode "maxima" "Maxima mode" t)
(autoload 'maxima "maxima" "Maxima interactive" t)
(setq auto-mode-alist (cons '("\.max" . maxima-mode) auto-mode-alist))
(autoload 'emaxima-mode "emaxima" "EMaxima" t)
(add-hook 'emaxima-mode-hook 'emaxima-mark-file-as-emaxima)

(setq auto-mode-alist (cons '("README" . text-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.pas" . delphi-mode) auto-mode-alist))
(setq compilation-scroll-output t)

(require 'compile)
(pushnew '("^\\([-a-zA-Z0-9\\.\\/_~]+\\)(\\([0-9]+\\),\\([0-9]+\\))\s\\([Ff]atal:\\|[Nn]ote:\\|[Ww]arning:\\|[Ee]rror:\\)\s\\(.*$\\)" 1 2 3)
	 compilation-error-regexp-alist)

(setq cssm-indent-level 4)
(setq cssm-newline-before-closing-bracket t)
(setq cssm-indent-function #'cssm-c-style-indenter)

; delphi-mode
(setq delphi-unit-sections
      '(implementation program library package))

(defconst delphi-method-types-regexp
  "\\(procedure\\|function\\|constructor\\|destructor\\)"
  "Regular expression for delphi method types")

(defconst delphi-method-signature-regexp
  ;;like mymethod(myvar1:varType; myvar2:varType=defaultvalue):TReturnType
  (concat
   "\\("
   (concat
    "[_a-zA-Z][_a-zA-Z0-9]*"                ;;mymethod
    "\\((.*)\\)?"         ;;(myvar1:varType; myvar2:varType=defaultvalue)
    "\\( *: *[_a-zA-Z][_a-zA-Z0-9]*\\)?")   ;; : TReturnType
   "\\)")
  "Signature of a delphi method")


(defconst delphi-class-declaration-regexp
  ;;like TMyClass = class(TParentClass)
  "^ *\\([_a-zA-Z][_a-zA-Z0-9]*\\) *= *class"
  "Class declaration regexp")

(defvar imenu--function-name-regexp-delphi
  (concat
   "^[ \t]*\\(function\\|procedure\\|constructor\\|destructor\\)[ \t]+"
   "\\([_a-zA-Z][_a-zA-Z0-9]*\\.\\)?"
   "\\([_a-zA-Z][_a-zA-Z0-9]*\\)")
  "Re to get function/procedure names in Delphi.")

(defun delphi-in-string (&optional pos)
  (delphi-is (delphi-token-kind (delphi-token-at (point))) delphi-strings))

(defun delphi-in-comment (&optional pos)
  (delphi-is (delphi-token-kind (delphi-token-at (point))) delphi-comments))

(defun delphi-in-class-definition (&optional pos)
  (if pos (goto-char pos))

  (let ((break 't) (class nil) (open-blocks 0) (max-negative 0))
    (while (and break (re-search-backward "\\(?:\\(?:^\\|[^_a-zA-Z0-9]\\)\\(end\\|record\\|case\\|begin\\)\\(?:$\\|[^_a-zA-Z0-9]\\)\\|\\(?:^\\|[ \t]\\)\\([_a-zA-Z][_a-zA-Z0-9]*\\)[ \t]*=[ \t]*class\\)" nil t))
      (let ((result (match-string-no-properties 1)))
	(if (not (or (delphi-in-string) (delphi-in-comment)))
	    (cond ((equal result "end") (setq open-blocks (+ open-blocks 1)))
		  ((or (or (equal result "record") (equal result "case")) (equal result "begin")) (setq open-blocks (- open-blocks 1)) (setq max-negative (min open-blocks max-negative)))
		  ('t  (setq break nil) (if (= open-blocks max-negative) (setq class (match-string-no-properties 2))))))
		 ))
    class)
)

(defun imenu--create-delphi-index (&optional regexp)
  (let ((index-alist '())
	(progress-prev-pos 0)
	(case-fold-search t))
    (goto-char (point-min))
    (imenu-progress-message progress-prev-pos 0)
    (save-match-data
      (while (re-search-forward
	      (or regexp imenu--function-name-regexp-delphi)
	      nil t)
	(imenu-progress-message progress-prev-pos)
	(let ((pos (save-excursion
		     (beginning-of-line)
		     (if imenu-use-markers (point-marker) (point))))
	      (function-name (match-string-no-properties 3))
	      (class-name (match-string-no-properties 2)))
	  (let ((class-def (save-excursion (delphi-in-class-definition pos))))
	    (let ((class-name (if class-name (substring class-name 0 -1) class-def))
		  (content (if class-def (cond ((assoc "Definition" (assoc class-def index-alist))
						(let ((alist (reverse (assoc "Definition" (assoc class-def index-alist)))))
						  (setcdr (assoc "Definition" (assoc class-def index-alist))
							  (cdr (reverse (push (cons function-name pos) alist)))))
						nil)
					       (t
						(list "Definition" (cons function-name pos))))
			     (cons function-name pos))))
	      (message "%s" class-name)
	      (if content (cond
			   (class-name
			    (cond ((assoc class-name index-alist)
				   (let ((alist (reverse (assoc class-name index-alist))))
				     (setcdr (assoc class-name index-alist)
					     (cdr (reverse (push content alist))))))
				  (t
				   (push (list class-name content) index-alist))
				  ))
			   (t
			    (push content index-alist))))
	      )))))
      (imenu-progress-message progress-prev-pos 100)
      (nreverse index-alist)))

(add-hook 'delphi-mode-hook
	  '(lambda ()
	     (setq comment-start "// ")
	     (require 'imenu)
	     (setq imenu-create-index-function
		   'imenu--create-delphi-index)
	     (imenu-add-menubar-index)))

(defun delphi-go-to-method-definition ()
  "Move cursor to method definition of current edited method"
  (interactive)
  (re-search-backward (concat
		      delphi-method-types-regexp
		      " *"
		      "\\([_a-zA-Z][_a-zA-Z0-9]*\\)\\."
		      delphi-method-signature-regexp))
  (let
      ((class (match-string 2))
       (method (match-string 3)))
       (re-search-backward (concat class " *= *class"))
       (re-search-forward method)))


(defun delphi-go-to-method-implementation ()
  "Move cursor to method implementation of method on current line"
  (interactive)
  (beginning-of-line)
  (let (methodtype methodname class)
    (re-search-forward (concat
			delphi-method-types-regexp
			" *"
			delphi-method-signature-regexp))
    (setq methodtype (match-string 1)
	  methodname (match-string 2))
    (re-search-backward delphi-class-declaration-regexp)
    (setq class (match-string 1))
    (re-search-forward (concat methodtype " +" class "\\." methodname))))


(defun delphi-complete-method ()
  "Create the method skeleton for method definition under cursor"
  (interactive)
  (beginning-of-line)
  (let (methodtype methodname class)
    (re-search-forward (concat
			delphi-method-types-regexp
			" *"
			delphi-method-signature-regexp))
    (setq methodtype (match-string 1)
	  methoddef (match-string 2))
    (re-search-backward delphi-class-declaration-regexp)
    (setq class (match-string 1))
    (end-of-buffer)
    (re-search-backward (concat
			 "\\("
			 delphi-method-types-regexp
			 " *"
			 class
			 "\\)\\|implementation"))
    (next-line)
    (re-search-forward (concat
			delphi-method-types-regexp
			"\\|\\(initialization\\|finalization\\|end\\.\\)"))
    (previous-line)
    (newline 2)
    (previous-line 2)
    (insert (concat methodtype " " class "." methoddef ";"))
    (newline)
    (insert "begin")
    (newline 2)
    (insert "end;")
    (previous-line)))


;;key binding
(add-hook 'delphi-mode-hook
	  '(lambda ()
	     (define-key delphi-mode-map "\C-c\C-mi" 'delphi-go-to-method-implementation)
	     (define-key delphi-mode-map "\C-c\C-md" 'delphi-go-to-method-definition)
	     (define-key delphi-mode-map "\C-c\C-mc" 'delphi-complete-method)))

; removing annoyances
(setq inhibit-startup-message t)
(setq require-final-newline t)
(fset 'yes-or-no-p 'y-or-n-p)
(setq next-line-add-newlines nil)

; general settings
(require 'paren) (show-paren-mode t)
(global-font-lock-mode t t)
(setq font-lock-maximum-decoration t)
(follow-mode t)
(setq vc-follow-symlinks t)

(require 'uniquify)
(setq uniquify-buffer-name-style 'reverse)

; c-mode stuff
(setq indent-tabs-mode t)
(setq tab-width 8)
(setq c-default-style "linux")
(c-set-offset 'arglist-cont-nonempty '(c-lineup-arglist-tabs-only c-lineup-gcc-asm-reg))

(add-hook 'c-mode-common-hook
          '(lambda ()
             (turn-on-auto-fill)
             (setq fill-column 80)
             (setq comment-column 60)
             (modify-syntax-entry ?_ "w")       ; now '_' is not considered a word-delimiter
	     (c-set-style "linux")              ; set indentation style
	     ))

(global-set-key [C-return]         'dabbrev-expand)
(define-key esc-map [C-return]     'dabbrev-completion)

(global-set-key [f12] 'indent-region)

; Ctrl(+Shift)+Tab to (un)indent a line with a full tab
(defun indent-region-with-tab ()
  (interactive)
  (save-excursion
	(if (< (point) (mark)) (exchange-point-and-mark))
	(let ((save-mark (mark)))
	  (if (= (point) (line-beginning-position)) (previous-line 1))
	  (goto-char (line-beginning-position))
	  (while (>= (point) save-mark)
		(goto-char (line-beginning-position))
		(insert "\t")
		(previous-line 1)))))
(defun unindent-region-with-tab ()
  (interactive)
  (save-excursion
	(if (< (point) (mark)) (exchange-point-and-mark))
	(let ((save-mark (mark)))
	  (if (= (point) (line-beginning-position)) (previous-line 1))
	  (goto-char (line-beginning-position))
	  (while (>= (point) save-mark)
		(goto-char (line-beginning-position))
		(if (= (string-to-char "\t") (char-after (point))) (delete-char 1))
		(previous-line 1)))))
(global-set-key [C-tab] 'indent-region-with-tab)
(global-set-key [C-S-iso-lefttab] 'unindent-region-with-tab)

; byte-compile .emacs
(defun autocompile nil
  "compile itself if ~/.emacs"
  (interactive)
  (require 'bytecomp)
  (if (or (string= (buffer-file-name) (expand-file-name "~/.emacs"))
          (string= (buffer-file-name) (expand-file-name "~/.dotfiles/emacs")))
      (byte-compile-file "~/.dotfiles/emacs")))
(add-hook 'after-save-hook 'autocompile)

; keine Abfrage wenn ein template existiert
(setq template-query nil)
(require 'template-simple)

; remember last position in file
(setq save-place-file "~/.emacs.d/saveplace")
(setq-default save-place t)
(require 'saveplace)

; clever autocomplete mode
(require 'ido)
(ido-mode t)
(setq
   ido-ignore-buffers '("\\` " "^\*Mess" "^\*Back" ".*Completion" "^\*Ido")
   ido-case-fold  t
   ido-use-filename-at-point nil
   ido-use-url-at-point nil
   ido-enable-flex-matching t
   ido-max-prospects 6
   ido-confirm-unique-completion t)

; servermode (to edit files with emacsclient)
(server-start)

; emacs code browser
(ecb-activate)

; smex
(setq smex-save-file "~/.emacs.d/smex.save")
(require 'smex)
(smex-initialize)
(global-set-key (kbd "M-X") 'smex)

; snippets
(require 'yasnippet)
(yas/initialize)
(yas/load-directory "~/.emacs.d/snippets")

; html-php-multi-mode
(require 'html-php)
(setq auto-mode-alist (cons '("\\.php" . html-php-mode) auto-mode-alist))

;; copy/paste enhancements
; share clipboard with other X11-Apps
(setq x-select-enable-clipboard t)
(setq interprogram-paste-function 'x-cut-buffer-or-selection-value)

; rectangle selection
(require 'rect-mark)
(global-set-key (kbd "C-x r SPC") 'rm-set-mark)
(global-set-key (kbd "C-S-y") 'yank-rectangle)

(global-set-key (kbd "C-x C-x")
  '(lambda(p) (interactive
     (if rm-mark-active
       (rm-exchange-point-and-mark p) (exchange-point-and-mark p)))))

; if rectangle mark active, copy/cut/ rectangle and
; if not copy whole line when no region is active
(global-set-key (kbd "C-w")
  '(lambda(b a) (interactive "r")
     (if rm-mark-active
       (rm-kill-region b a)
        (if mark-active
	   (kill-region b a)
	   (kill-region (line-beginning-position) (line-beginning-position 2))))))

(global-set-key (kbd "M-w")
  '(lambda(b a) (interactive "r")
     (if rm-mark-active
       (rm-kill-ring-save b a)
        (if mark-active
	   (kill-ring-save b a)
	   (kill-ring-save (line-beginning-position) (line-beginning-position 2))))))


;; rudel (obby/... connection)
;(add-to-list 'load-path "SOMEDIR/rudel/")
;(add-to-list 'load-path "SOMEDIR/rudel/jupiter/")
;(add-to-list 'load-path "SOMEDIR/rudel/obby/")

(load "rudel-loaddefs.el")

; magit
(require 'magit)