blob: aa6176a0186843ee7525552fa1fe8994609ea342 (
plain) (
tree)
|
|
;; -*- self-compile-mode: t -*-
(setq custom-file "~/.emacs.d/emacs-custom.el")
(load custom-file)
;; load-path anpassen
(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))
;; load own color theme
(require 'color-themes-alex)
(if (not window-system)
(color-theme-alex-console)
(color-theme-alex))
(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" 'noerror)
(setq text-mode-hook 'turn-on-auto-fill)
(setq fill-column 72)
(setq semanticdb-default-save-directory "~/.emacs.d/semantic")
(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)
;; fix keys for urxvt
(if (not window-system)
(mapc (lambda (map)
(define-key function-key-map
(read-kbd-macro (cadr map))
(read-kbd-macro (car map))))
'(("<S-tab>" "M-[ Z")
("<S-up>" "<select>")
("<S-down>" "M-[ b")
("<S-right>" "M-[ c")
("<S-left>" "M-[ d")
("<M-up>" "ESC M-O A")
("<M-down>" "ESC M-O B")
("<M-right>" "ESC M-O C")
("<M-left>" "ESC M-O D")
("<C-up>" "M-O a")
("<C-down>" "M-O b")
("<C-right>" "M-O c")
("<C-left>" "M-O d")
("<C-M-up>" "ESC M-O a")
("<C-M-down>" "ESC M-O b")
("<C-M-right>" "ESC M-O c")
("<C-M-left>" "ESC M-O d")
("<M-S-up>" "ESC M-[ a")
("<M-S-down>" "ESC M-[ b")
("<M-S-right>" "ESC M-[ c")
("<M-S-left>" "ESC M-[ d")
)))
(setq auto-mode-alist (cons '("README" . text-mode) auto-mode-alist))
(setq compilation-scroll-output t)
;; css-mode
(setq cssm-indent-level 4)
(setq cssm-newline-before-closing-bracket t)
(setq cssm-indent-function #'cssm-c-style-indenter)
;; delphi-mode
(load "delphi-mode-ench.el")
;: 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)
(setq font-lock-maximum-decoration t)
(follow-mode t)
(setq vc-follow-symlinks t)
(require 'uniquify)
(setq uniquify-buffer-name-style 'reverse)
;; c/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
(define-key c-mode-base-map (kbd "M-o") 'eassist-switch-h-cpp)
(define-key c-mode-base-map (kbd "M-m") 'eassist-list-methods)
(define-key c-mode-base-map (kbd "C-o") 'semantic-complete-jump-local)))
(global-set-key [C-return] 'dabbrev-expand)
(define-key esc-map [C-return] 'dabbrev-completion)
(global-set-key [f12] 'indent-region)
;; Enable Doxygen syntax highlighting for C and C++
(when (require 'doxymacs nil 'noerror)
(add-hook 'font-lock-mode-hook
'(lambda ()
(if (or (eq major-mode 'c-mode) (eq major-mode 'c++-mode))
(doxymacs-font-lock)))))
;; flyspell (with aspell for Unicode)
(setq ispell-program-name "aspell")
(setq ispell-extra-args '("--sug-mode=ultra"))
(add-hook 'c-mode-hook 'flyspell-prog-mode)
(add-hook 'sh-mode-hook 'flyspell-prog-mode)
(add-hook 'c++-mode-hook 'flyspell-prog-mode)
(add-hook 'ruby-mode-hook 'flyspell-prog-mode)
(add-hook 'cperl-mode-hook 'flyspell-prog-mode)
(add-hook 'python-mode-hook 'flyspell-prog-mode)
(add-hook 'autoconf-mode-hook 'flyspell-prog-mode)
(add-hook 'autotest-mode-hook 'flyspell-prog-mode)
(add-hook 'makefile-mode-hook 'flyspell-prog-mode)
(add-hook 'emacs-lisp-mode-hook 'flyspell-prog-mode)
(add-hook 'tex-mode-hook (function (lambda () (setq ispell-parser 'tex))))
(add-hook 'texinfo-mode
'(lambda () (setq flyspell-generic-check-word-p
'texinfo-mode-flyspell-verify)))
(add-hook 'text-mode-hook (lambda () (flyspell-mode 1)))
(add-hook 'change-log-mode-hook (lambda () (flyspell-mode 1)))
(add-hook 'flyspell-mode-hook 'flyspell-buffer)
; ignore all #include stings
(add-hook 'flyspell-incorrect-hook
(lambda (left right undef)
(save-excursion
(goto-char left)
(beginning-of-line)
(if (looking-at "#include")
't
'nil)
)))
; change dictionary
(defun switch-dictionary()
(interactive)
(let* ((dic ispell-current-dictionary)
(change (if (string= dic "german") "english" "german")))
(ispell-change-dictionary change)
(message "Dictionary switched from %s to %s" dic change)
(if flyspell-mode (save-excursion (flyspell-buffer)))))
(global-set-key (kbd "<f8>") 'switch-dictionary)
; update flyspell after changing dictionary
(defadvice ispell-pdict-save (after advice)
(save-excursion (flyspell-buffer)))
(ad-activate 'ispell-pdict-save t)
;; auto compile files
(require 'self-compile-mode)
;; keine Abfrage wenn ein template existiert
(setq template-query nil)
(require 'template-simple nil 'noerror)
;; remember last position in file
(setq save-place-file "~/.emacs.d/saveplace")
(setq-default save-place t)
(require 'saveplace)
;; clever auto complete 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)
;; start server if not running (to edit files with emacsclient)
(when (require 'server nil 'noerror)
(if (and (fboundp 'server-running-p)
(not (server-running-p)))
(server-start)))
; emacs code browser
(when (require 'ecb nil 'noerror)
(ecb-activate))
;; smex
(setq smex-save-file "~/.emacs.d/smex.save")
(when (require 'smex nil 'noerror)
(smex-initialize)
(global-set-key (kbd "M-X") 'smex))
;; snippets
(when (require 'yasnippet nil 'noerror)
(yas/initialize)
(yas/load-directory "~/.emacs.d/snippets"))
;; html-php-multi-mode
(when (require 'html-php nil 'noerror)
(setq auto-mode-alist (cons '("\\.php" . html-php-mode) auto-mode-alist)))
;; copy/paste enhancements
;; share clipboard with other X11-Apps
(when (fboundp 'x-cut-buffer-or-selection-value)
(progn
(setq x-select-enable-clipboard t)
(setq interprogram-paste-function 'x-cut-buffer-or-selection-value)))
;; use cua-mode, but only for rectangle selections
(setq cua-enable-cua-keys nil)
(cua-mode t)
;; copy/kill whole line when no region is active
(defadvice kill-ring-save (before slick-copy activate compile)
(interactive (if mark-active (list (region-beginning) (region-end)) (message
"Copied line") (list (line-beginning-position) (line-beginning-position
2)))))
(ad-activate 'kill-ring-save)
(defadvice kill-region (before slick-cut activate compile)
(interactive
(if mark-active (list (region-beginning) (region-end))
(list (line-beginning-position)
(line-beginning-position 2)))))
(ad-activate 'kill-region)
;; 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
(when (require 'magit nil 'noerror)
;; magit-status (bind if available on <f5>)
(global-set-key (kbd "<f5>") 'magit-status))
;; linum (generic & *scratch*)
(when (require 'linum-narrow nil 'noerror)
(add-hook 'find-file-hook (lambda () (linum-mode 1)))
(add-hook 'lisp-interaction-mode-hook (lambda () (linum-mode 1))))
;; bookmarks
(setq bookmark-default-file "~/.emacs.d/bookmarks")
(setq bookmark-save-flag 1)
;; winring
(when (require 'winring nil 'noerror)
;; ecb support if ecb is available
(when (fboundp 'ecb-winman-winring-enable-support)
(ecb-winman-winring-enable-support))
(winring-initialize)
(global-set-key (kbd "C-x j") 'winring-jump-to-configuration)
(global-set-key (kbd "C-x n") 'winring-new-configuration)
;; ask before deleting winring configuration
(defun winring-ask-delete-configuration ()
(interactive)
(if (y-or-n-p "Delete winring configuration? ")
(winring-delete-configuration)))
(global-set-key (kbd "C-x K") 'winring-ask-delete-configuration))
;; etags
(require 'etags-table nil 'noerror)
; autocompletion for etags
(require 'auto-complete-etags nil 'noerror)
;; change cursor according to the mode (normal, read only, overwrite)
(when (require 'cursor-chg nil 'noerror)
(toggle-cursor-type-when-idle 1)
(change-cursor-mode 1))
;; windmove (only if available)
(when (fboundp 'windmove-default-keybindings) (windmove-default-keybindings))
;; lisp-eassist
(define-key lisp-mode-shared-map (kbd "M-m") 'eassist-list-methods)
;; dir-locals
(require 'dir-locals nil 'noerror)
;; use sml-modeline if available
(when (require 'sml-modeline nil 'noerror)
(progn
;; show buffer pos in the mode line
;; and turn off the scrollbar
(sml-modeline-mode 1)
(when (fboundp 'scroll-bar-mode) (scroll-bar-mode -1)))
(when (fboundp 'scroll-bar-mode)
(progn
;; otherwise, show a scrollbar...
;; ... on the right
(scroll-bar-mode 1)
(set-scroll-bar-mode 'right))))
;; browse-kill-ring
(when (require 'browse-kill-ring nil 'noerror)
(progn (browse-kill-ring-default-keybindings)
(global-set-key "\C-cy" '(lambda () (interactive)
(popup-menu 'yank-menu)))))
;; deft
(when (require 'deft nil 'noerror)
(setq deft-extension "org"
deft-directory "~/.org/deft/"
deft-text-mode 'org-mode)
(global-set-key (kbd "<f9>") 'deft))
|