Created
January 31, 2012 00:08
-
-
Save pietercolpaert/1707704 to your computer and use it in GitHub Desktop.
My .emacs file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(load "~/elisp/autoloads" 'install) | |
(add-to-list 'load-path "~/elisp/") | |
(set-frame-height (selected-frame) 48) | |
(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. | |
'(csv-separators (quote (";"))) | |
'(cua-mode t nil (cua-base)) | |
'(global-font-lock-mode t nil (font-lock)) | |
'(inhibit-startup-screen t) | |
'(show-paren-mode t) | |
'(tool-bar-mode nil) | |
'(tooltip-mode nil) | |
'(truncate-lines nil) | |
'(truncate-partial-width-windows t)) | |
(setq cua-auto-tabify-rectangles nil) | |
(pc-selection-mode) | |
(setq c-default-style "k&r") | |
(add-hook 'c-mode-hook (lambda () (c-toggle-auto-hungry-state 1))) | |
(transient-mark-mode t) | |
(show-paren-mode 1) | |
(setq show-paren-style 'parenthesis) | |
(add-hook 'c++-mode-hook 'c-toggle-auto-hungry-state) | |
(setq c-hanging-braces-alist '((brace-list-open)(brace-entry-open)(substatement-open after)(block-close . c-snug-do-while)(extern-lang-open after)(inexpr-class-open after)(inexpr-class-close before)(defun-open after))) | |
;perl mode additions | |
(load-library "cperl-mode") | |
(add-to-list 'auto-mode-alist '("\\\\.[Pp][LlMm][Cc]?$" . cperl-mode)) | |
(while (let ((orig (rassoc 'perl-mode auto-mode-alist))) | |
(if orig (setcdr orig 'cperl-mode)))) | |
(while (let ((orig (rassoc 'perl-mode interpreter-mode-alist))) | |
(if orig (setcdr orig 'cperl-mode)))) | |
(dolist (interpreter '("perl" "perl5" "miniperl" "pugs")) | |
(unless (assoc interpreter interpreter-mode-alist) | |
(add-to-list 'interpreter-mode-alist (cons interpreter 'cperl-mode)))) | |
(defun perl-eval (beg end) | |
"Run selected region as Perl code" | |
(interactive "r") | |
(shell-command-on-region beg end "perl") | |
; feeds the region to perl on STDIN | |
) | |
(defmacro mark-active () | |
"Xemacs/emacs compatibility macro" | |
(if (boundp 'mark-active) | |
'mark-active | |
'(mark))) | |
(defun perltidy ( ) | |
"Run perltidy on the current region or buffer." | |
(interactive) | |
; Inexplicably, save-excursion doesn't work here. | |
(let ((orig-point (point))) | |
(unless (mark-active) (mark-defun)) | |
(shell-command-on-region (point) (mark) "perltidy -q" nil t) | |
(goto-char orig-point))) | |
(defun bash-eval (beg end) | |
"Run selected region as Bash code" | |
(interactive "r") | |
(shell-command-on-region beg end "bash") | |
; feeds the region to bash on STDIN | |
) | |
(setq visible-bell t) ;; visible bell instead of annoying sound | |
(setq cperl-electric-parens t) ;; electric parens | |
(global-linum-mode 1) ;; line number modus: always display line numbers on the right | |
(add-to-list 'load-path "~/elisp/ecb-snap") | |
;;Something I needed a lot: | |
;;select a calculation and it will replace the calculation with its result | |
(defun calc-on-region(start end) | |
(interactive "r") | |
(insert (calc-eval (delete-and-extract-region start end)))) | |
;;smaller font: | |
(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 "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 90 :width normal :foundry "unknown" :family "DejaVu Sans Mono"))))) | |
;; Put autosave files (ie #foo#) in one place, *not* | |
;; scattered all over the file system! | |
(defvar autosave-dir "~/.emacs_backups/") | |
(defun auto-save-file-name-p (filename) | |
(string-match "^#.*#$" (file-name-nondirectory filename))) | |
(defun make-auto-save-file-name () | |
(concat autosave-dir | |
(if buffer-file-name | |
(concat "#" (file-name-nondirectory buffer-file-name) "#") | |
(expand-file-name | |
(concat "#%" (buffer-name) "#"))))) | |
;; Put backup files (ie foo~) in one place too. (The backup-directory-alist | |
;; list contains regexp=>directory mappings; filenames matching a regexp are | |
;; backed up in the corresponding directory. Emacs will mkdir it if necessary.) | |
(defvar backup-dir "~/.emacs_backups") | |
(setq backup-directory-alist (list (cons "." backup-dir))) | |
;;install | |
(add-to-list 'load-path "~/elisp") | |
(require 'install) | |
;; Orgmode - creating presentations in orgmode | |
;; allow for export=>beamer by placing | |
;; #+LaTeX_CLASS: beamer in org files | |
(unless (boundp 'org-export-latex-classes) | |
(setq org-export-latex-classes nil)) | |
(add-to-list 'org-export-latex-classes | |
;; beamer class, for presentations | |
'("beamer" | |
"\\documentclass[11pt]{beamer}\n | |
\\mode<{{{beamermode}}}>\n | |
\\usetheme{{{{beamertheme}}}}\n | |
\\usecolortheme{{{{beamercolortheme}}}}\n | |
\\beamertemplateballitem\n | |
\\setbeameroption{show notes} | |
\\usepackage[utf8]{inputenc}\n | |
\\usepackage[T1]{fontenc}\n | |
\\usepackage{hyperref}\n | |
\\usepackage{color} | |
\\usepackage{listings} | |
\\lstset{numbers=none,language=[ISO]C++,tabsize=4, | |
frame=single, | |
basicstyle=\\small, | |
showspaces=false,showstringspaces=false, | |
showtabs=false, | |
keywordstyle=\\color{blue}\\bfseries, | |
commentstyle=\\color{red}, | |
}\n | |
\\usepackage{verbatim}\n | |
\\institute{{{{beamerinstitute}}}}\n | |
\\subject{{{{beamersubject}}}}\n" | |
("\\section{%s}" . "\\section*{%s}") | |
("\\begin{frame}[fragile]\\frametitle{%s}" | |
"\\end{frame}" | |
"\\begin{frame}[fragile]\\frametitle{%s}" | |
"\\end{frame}"))) | |
;; letter class, for formal letters | |
(add-to-list 'org-export-latex-classes | |
'("letter" | |
"\\documentclass[11pt]{letter}\n | |
\\usepackage[utf8]{inputenc}\n | |
\\usepackage[T1]{fontenc}\n | |
\\usepackage{color}" | |
("\\section{%s}" . "\\section*{%s}") | |
("\\subsection{%s}" . "\\subsection*{%s}") | |
("\\subsubsection{%s}" . "\\subsubsection*{%s}") | |
("\\paragraph{%s}" . "\\paragraph*{%s}") | |
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))) | |
;; yasnipet | |
(add-to-list 'load-path | |
"~/.emacs.d/plugins") | |
(require 'yasnippet-bundle) | |
(add-to-list 'auto-mode-alist '("\\.php$" . php-mode)) | |
(add-to-list 'auto-mode-alist '("\\.inc$" . php-mode)) | |
(add-to-list 'auto-mode-alist '("\\.h$" . c++-mode)) | |
(defun wicked/php-mode-init () | |
"Set some buffer-local variables." | |
(setq case-fold-search t) | |
(setq fill-column 78) | |
(setq c-basic-offset 4) | |
(c-set-offset 'arglist-cont 0) | |
(c-set-offset 'arglist-intro '+) | |
(c-set-offset 'case-label 4) | |
(setq-default indent-tabs-mode nil) | |
(c-set-offset 'arglist-close 0)) | |
(add-hook 'php-mode-hook 'wicked/php-mode-init) | |
(add-to-list 'load-path "/home/pieterc/.emacs.d/") | |
(require 'auto-complete-config) | |
(add-to-list 'ac-dictionary-directories "/home/pieterc/.emacs.d//ac-dict") | |
(ac-config-default) | |
;; Define the keywords to shuffle through with shift | |
(setq org-todo-keywords | |
(quote ((sequence "TODO(t)" "ACTIVE(a)" "|" "DONE(d!/!)") | |
))) | |
(defun toggle-fullscreen (&optional f) | |
(interactive) | |
(let ((current-value (frame-parameter nil 'fullscreen))) | |
(set-frame-parameter nil 'fullscreen | |
(if (equal 'fullboth current-value) | |
(if (boundp 'old-fullscreen) old-fullscreen nil) | |
(progn (setq old-fullscreen current-value) | |
'fullboth))))) | |
;; Short-cuts! | |
(global-set-key (kbd "C-<f4>") 'php-indent-buffer) | |
(global-set-key (kbd "<f5>") 'perl-eval) | |
(global-set-key (kbd "C-<f5>") 'perltidy) | |
(global-set-key (kbd "<f6>") 'calc-on-region) | |
(global-set-key (kbd "<f7>") 'bash-eval) | |
(global-set-key (kbd "<f8>") 'mark-whole-buffer) | |
(global-set-key (kbd "<f11>") 'toggle-fullscreen) | |
(global-set-key (kbd "M-s") 'occur) | |
(global-set-key (kbd "M-i") 'erc) ;; irc in emacs | |
(global-set-key (kbd "M-q") 'quick-calc) | |
(global-set-key (kbd "M-F") 'indent-region) ;; same as netbeans |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment