;; -*- emacs-lisp -*- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; $Id: emacs_c.el,v 1.7 2006-11-06 21:02:42 rscholz Exp $ ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Einstellungen für den C-Mode & Development allgemein ;; ;; Die offizielle Quelle dieser Datei ist ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; allgemeine Einstellungen ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq-default compile-command "make ") (setq compile-auto-highlight t) (setq compilation-scroll-output t) (setq compilation-window-height 10) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Diff ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq diff-switches "-u") (setq diff-command "diff") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Einstellungen fuer den C/C++ mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq-default c-cleanup-list '(brace-else-brace empty-defun-braces defun-close-semi scope-operator)) (setq-default c-hanging-braces-alist '((brace-list-open) (brace-list-close after)(defun-open after) (class-open after) (inline-open after) (substatement-open after) (block-close . c-snug-do-while))) (add-hook 'c-mode-common-hook (function (lambda () (c-toggle-auto-hungry-state 1) (c-set-style "K&R") (setq c-basic-offset 4)))) (defun tags-generate-c-file () "generate TAGS file from *.cc and *.hh" (interactive) (shell-command "etags *.cc *.hh *.c *.h 2>/dev/null")) ;; highlight 80th character (by Kai Großjohann) (font-lock-add-keywords 'c-mode '(("................................................................................\\(.\\)" 1 font-lock-warning-face prepend))) ;; Strings besser in dunkelblau (set-face-foreground 'font-lock-string-face "MidnightBlue") ;; Special style for Linux source files (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)) (add-to-list 'auto-mode-alist '("/usr/src/linux.*/.*\\.[ch]$" . linux-c-mode)) ;; Oliver Scholz in (require 'boxquote) (add-hook 'c-mode-hook 'my-c-mode-boxquote) (defun my-c-mode-boxquote () "Adjust some variables for boxquote in c-mode." (set (make-local-variable 'boxquote-top-and-tail) "") (set (make-local-variable 'boxquote-top-corner) "/**") (set (make-local-variable 'boxquote-bottom-corner) "**/") (set (make-local-variable 'boxquote-side) " * "))