My usual .emacs file, not that exciting i dont mess with things too much, i have some other .el files like my crules.el for hacking on crule code etc but here it is:
-
-
(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.
-
’(inhibit-startup-screen t)
-
’(initial-scratch-message ";; Hapy Hacking")
-
’(scroll-bar-mode nil)
-
’(show-paren-mode t))
-
(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 (:inherit nil :stipple nil :background "grey20" :foreground "white" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 123 :width normal :foundry "unknown" :family "DejaVu Sans Mono"))))
-
’(cursor ((t (:background "red")))))
-
-
(defun fc-turn-on-show-trailing-whitespace ()
-
"Set `show-trailing-whitespace’ to t."
-
(setq show-trailing-whitespace t))
-
-
(mapc (lambda (hook)
-
(add-hook hook ‘fc-turn-on-show-trailing-whitespace))
-
‘(c-mode-hook))
-
-
(setq-default tab-width 2) ; or any other preferred value
-
(setq cua-auto-tabify-rectangles nil)
-
-
(defadvice align (around smart-tabs activate)
-
(let ((indent-tabs-mode nil)) ad-do-it))
-
-
(defadvice align-regexp (around smart-tabs activate)
-
(let ((indent-tabs-mode nil)) ad-do-it))
-
-
(defadvice indent-relative (around smart-tabs activate)
-
(let ((indent-tabs-mode nil)) ad-do-it))
-
-
(defadvice indent-according-to-mode (around smart-tabs activate)
-
(let ((indent-tabs-mode indent-tabs-mode))
-
(if (memq indent-line-function
-
‘(indent-relative
-
indent-relative-maybe))
-
(setq indent-tabs-mode nil))
-
ad-do-it))
-
-
(defmacro smart-tabs-advice (function offset)
-
(defvaralias offset ‘tab-width)
-
`(defadvice ,function (around smart-tabs activate)
-
(cond
-
(indent-tabs-mode
-
(save-excursion
-
(beginning-of-line)
-
(while (looking-at "\t*\\( +\\)\t+")
-
(replace-match "" nil nil nil 1)))
-
(setq tab-width tab-width)
-
(let ((tab-width fill-column)
-
(,offset fill-column))
-
ad-do-it))
-
(t
-
ad-do-it))))
-
-
(smart-tabs-advice c-indent-line c-basic-offset)
-
(smart-tabs-advice c-indent-region c-basic-offset)
-
-
(smart-tabs-advice cperl-indent-line cperl-indent-level)
-
-
(smart-tabs-advice python-indent-line-1 python-indent)
-
(add-hook ‘python-mode-hook
-
(lambda ()
-
(setq indent-tabs-mode t)
-
(setq tab-width (default-value ‘tab-width))))
-
-
(setq-default indent-tabs-mode nil)
-
-
(add-hook ‘c-mode-common-hook
-
(lambda () (setq indent-tabs-mode t)))
-
-
(define-generic-mode ‘crules-mode
-
‘("#")
-
‘("workflow" "class" "rule" "defun" "each" "break" "where"
-
"continue" "return" "in" "for" "while" "until" "import"
-
"from" "if" "elif" "else" "print" "true" "false" "eval"
-
"let" "null" "this" "at" "defre")
-
‘(("[a-zA-Z_][a-zA-Z0-9_]+" . font-lock-variable-name-face)
-
("[0-9]+" "true" "false" . font-lock-constant-face)
-
("\\[.*\\]" . font-lock-type-face))
-
‘(".crl\\‘")
-
nil
-
"Generic Major mode for the Crules programming language!")
-
-
(defun set-newline-and-indent ()
-
(local-set-key (kbd "RET") ‘newline-and-indent))
-
(add-hook ‘crules-mode-hook ‘set-newline-and-indent)
-
-


