;; Red Hat Linux default .emacs initialization file ;; Are we running XEmacs or Emacs? (defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version)) ;; Set up the keyboard so the delete key on both the regular keyboard ;; and the keypad delete the character under the cursor and to the right ;; under X, instead of the default, backspace behavior. (global-set-key [delete] 'delete-char) (global-set-key [kp-delete] 'delete-char) ;; Nuke the damn splash screen! (setq inhibit-splash-screen t) ;; Column numbers (setq column-number-mode t) ;; Turn on font-lock mode for Emacs (cond ((not running-xemacs) (global-font-lock-mode t) )) ;; Visual feedback on selections (setq-default transient-mark-mode t) ;; Stop at the end of the file, not just add lines (setq next-line-add-newlines nil) ;; Enable wheelmouse support by default (cond (window-system (mwheel-install) )) ;; Count words (defun word-count nil "Count words in buffer" (interactive) (shell-command-on-region (point-min) (point-max) "wc -w")) ;; Display trailing whitespace at en of lines (defun toggle-trailing-whitespace-display () "Toggle the display of trailing whitespace, by changing the buffer-local variable `show-trailing-whitespace'." (interactive) (save-excursion (if show-trailing-whitespace (setq show-trailing-whitespace nil) (setq show-trailing-whitespace t)) (force-window-update (current-buffer))) (message (concat "Display of EOL spaces " (if show-trailing-whitespace "enabled" "disabled")))) (setq-default show-trailing-whitespace t) (global-set-key "\C-ce" 'toggle-trailing-whitespace-display) ;; Torvalds Linux-style from Documentation/CodingStyle (defun c-lineup-arglist-tabs-only (ignored) "Line up argument lists by tabs, not spaces" (let* ((anchor (c-langelem-pos c-syntactic-element)) (column (c-langelem-2nd-pos c-syntactic-element)) (offset (- (1+ column) anchor)) (steps (floor offset c-basic-offset))) (* (max steps 1) c-basic-offset))) (add-hook 'c-mode-common-hook (lambda () ;; Add kernel style (c-add-style "linux-tabs-only" '("linux" (c-offsets-alist (arglist-cont-nonempty c-lineup-gcc-asm-reg c-lineup-arglist-tabs-only)))))) (add-hook 'c-mode-hook (lambda () (let ((filename (buffer-file-name))) ;; Enable kernel mode for the appropriate files (when (and filename (string-match (expand-file-name "~/src/linux-trees") filename)) (setq indent-tabs-mode t) (c-set-style "linux-tabs-only"))))) (add-hook 'c-mode-hook (lambda () (let ((filename (buffer-file-name))) ;; Enable kernel mode for the appropriate files (when (and filename (string-match (expand-file-name "/var/linus") filename)) (setq indent-tabs-mode t) (c-set-style "linux-tabs-only")))))