My .emacs configuration

Last week I really tried to minimize my .emacs. The result is a list of customizations that I really can not live without.

(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. ‘(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 “#ffffff” :foreground “#1a1a1a” :inverse-video nil :box nil :strike-through nil : overline nil :underline nil :slant normal :weight normal :height 97 :width normal :foundry “unknown” :family “DejaVu Sans Mono”)))) ‘(Info-title-1-face ((t (:foreground “blue” :weight bold))) t) ‘(compilation-info ((((class color)) (:foreground “blue” :weight bold)))) ‘(font-lock-constant-face ((((class color) (min-colors 88) (background light)) (:foreground “blue”)))) ‘(font-lock-keyword-face ((((class color) (min-colors 8)) (:foreground “black” :weight bold)))) ‘(font-lock-preprocessor-face ((t (:foreground “red”)))) ‘(font-lock-string-face ((nil (:foreground “red”)))) ‘(font-lock-type-face ((((class color) (min-colors 8)) (:foreground “purple”)))) ‘(font-lock-variable-name-face ((((class color) (min-colors 88) (background light)) (:foreground “black”)))))

;;;; Global key bindings ;;;;

(global-set-key [?§] ‘buffer-menu)

(global-set-key [(meta ?s)] ‘query-replace-regexp)

;;;; C/C++ ;;;;

(defun c-hooks()

(local-set-key [(meta ?7)] ‘c-insert-brac)

(c-set-style “linux”)

(c-set-offset ‘case-label ‘+)

)

(defun c++-hooks()

(c-hooks)

(c-set-style “stroustrup”)

(setq indent-tabs-mode nil)

(c-set-offset ‘case-label ‘+)

;(c-set-offset ‘innamespace 0)

)

(add-hook ‘c-mode-hook ‘c-hooks)

(add-hook ‘c++-mode-hook ‘c++-hooks)

;;;; Global commands ;;;;

(defun close-all-buffers ()

(interactive)

(mapc ‘kill-buffer (buffer-list))

)

;; Autocomplete/indent

(defun indent-or-complete ()

“Complete if point is at end of a word, otherwise indent line.” (interactive)

(if (or (looking-at “\\>”)

(looking-at “\\w”))

(dabbrev-expand nil)

(indent-for-tab-command) )

)

; Tab completion

(let (modelist it)

(setq modelist ‘(‘c-mode-common-hook ‘lisp-mode-common-hook ‘text-mode-hook ‘java-mode-hook ’emacs-lisp-mode-hook ‘lisp-mode-hook ‘LaTex-mode-hook ‘Tex-Mode-hook ‘python-mode-hook ‘octave-mode-hook ‘lua-mode-hook ‘cmake-mode-hook ‘xml-mode-hook))

(mapc ‘(lambda(mode) (add-hook (eval mode) ‘(lambda () (local-set-key (kbd “TAB”) ‘indent-or-complete) ))) modelist))

;; The order that different completes are tested.

(setq hippie-expand-try-functions-list ‘(try-expand-dabbrev-visible try-expand-dabbrev try-expand-dabbrev-all-buffers try-expand-dabbrev-from-kill) )

(setq compile-command “cd ~/development/project_path/bin && make -j3”)

This entry was posted in Uncategorized and tagged . Bookmark the permalink.

One Response to My .emacs configuration

  1. David Holm says:

    What’s up with the big unformatted blob before your global key bindings?

    I tried locating these changes in your dotemacs repo but I couldn’t find them.😦

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s