(setq user-full-name "Pablo Rauzy")
(setq user-mail-address "pablo rauzy gmail com")
(setq x-super-keysym 'alt)
(setq frame-title-format
(concat "%b - " invocation-name "@" system-name))
(setq emacs-dir "/home/p4bl0/.emacs.d/")
(setq load-path (cons emacs-dir load-path))
(set-language-environment 'utf-8)
(prefer-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(setq locale-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(set-input-method nil)
(blink-cursor-mode -1)
(setq x-stretch-cursor t)
(delete-selection-mode t)
(setq default-fill-column 79)
(setq sentence-end-double-space nil)
(global-set-key (kbd "RET") 'newline-and-indent)
(global-set-key (kbd "C-;") 'kill-whole-line)
(global-set-key (kbd "C-c s") 'replace-string)
(global-set-key (kbd "C-c r") 'replace-regexp)
(global-set-key (kbd "C-x r a") 'string-insert-rectangle)
(load "rect-missing-features")
(global-set-key (kbd "C-x r z") 'string-insert-after-rectangle)
(global-set-key (kbd "C-x r e") 'string-insert-rectangle-eol)
(global-set-key (kbd "C-c w") 'delete-trailing-whitespace)
(global-set-key (kbd "C-c a") 'align-entire)
(global-set-key (kbd "C-c A") 'align-string)
(global-set-key (kbd "C-c f") 'font-lock-fontify-buffer)
(global-set-key (kbd "C-c b") 'revert-buffer)
(put 'narrow-to-region 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
(autoload 'twitter-get-friends-timeline "twitter" nil t)
(autoload 'twitter-status-edit "twitter" nil t)
(setq twitter-username "p4bl0")
(add-hook 'twitter-timeline-view-mode-hook
(lambda ()
(set-face-foreground 'twitter-user-name-face "#dddddd")
(set-face-background 'twitter-user-name-face "#1D73C8")
(set-face-foreground 'twitter-time-stamp-face "#dddddd")
(set-face-background 'twitter-time-stamp-face "#1D73C8")))
(global-set-key (kbd "C-x t t") 'twitter-get-friends-timeline)
(global-set-key (kbd "C-x t s") 'twitter-status-edit)
(require 'identica-mode)
(setq identica-username "p4bl0")
(setq identica-status-format "%i %s (%S), %@, from %f:\n %t")
(setq identica-timer-interval 120)
(global-set-key (kbd "C-x t i") 'identica-mode)
(global-set-key (kbd "C-x t p") 'identica-update-status-interactive)
(setq tetris-score-file (concat emacs-dir "tetris"))
(setq default-major-mode 'text-mode)
(add-hook 'css-mode-hook
(lambda ()
(font-lock-add-keywords nil
'(("\\(#\\([0-9a-fA-F]\\{3\\}\\)\\{1,2\\}\\)" 1
font-lock-type-face)))))
(defun font-lock-fontify-numbers ()
"Use this function as a hook to fontify numbers as constant"
(font-lock-add-keywords nil
'(("[^a-zA-Z_]\\(0x[0-9a-fA-F]+\\)" 1 font-lock-constant-face) ("[^a-zA-Z_]\\(-?[0-9]+\\.[0-9]+\\)" 1 font-lock-constant-face) ("[^a-zA-Z_1-9]\\(-?[0-9]+L?\\)" 1 font-lock-constant-face)))) (add-hook 'php-mode-hook 'font-lock-fontify-numbers)
(add-hook 'c-mode-hook 'font-lock-fontify-numbers)
(add-hook 'c++-mode-hook 'font-lock-fontify-numbers)
(add-hook 'perl-mode-hook 'font-lock-fontify-numbers)
(add-hook 'css-mode-hook 'font-lock-fontify-numbers)
(add-hook 'emacs-lisp-mode-hook 'font-lock-fontify-numbers)
(add-hook 'tuareg-mode-hook 'font-lock-fontify-numbers)
(add-hook 'js2-mode-hook 'font-lock-fontify-numbers)
(if (>= emacs-major-version 23)
(set-default-font "DejaVu Sans Mono-7.5")) (global-font-lock-mode t)
(show-paren-mode t)
(transient-mark-mode t)
(set-face-background 'default "#333333") (set-face-foreground 'default "#cccccc") (set-face-background 'cursor "#ffaa00") (set-face-foreground 'cursor "#333333") (setq x-pointer-foreground-color "#aaaaaa") (set-face-background 'region "#33aaff")
(set-face-foreground 'region "#eeeeee")
(set-face-background 'show-paren-match-face "#666666")
(set-face-foreground 'show-paren-match-face "#ffffff")
(set-face-background 'show-paren-mismatch-face "#dd0000")
(set-face-foreground 'show-paren-mismatch-face "#333333")
(set-face-foreground 'font-lock-warning-face "#dd0000")
(set-face-foreground 'font-lock-preprocessor-face "#99cc33")
(set-face-foreground 'font-lock-constant-face "#dd00dd")
(set-face-foreground 'font-lock-comment-face "#888888")
(set-face-foreground 'font-lock-keyword-face "#dddd00")
(set-face-foreground 'font-lock-type-face "#ffaa00")
(set-face-foreground 'font-lock-function-name-face "#2277dd")
(set-face-foreground 'font-lock-string-face "#33aaff")
(set-face-foreground 'font-lock-variable-name-face "#00bb00")
(set-face-foreground 'highlight "#333333")
(set-face-background 'highlight "#dddd00")
(set-face-foreground 'isearch "#333333")
(set-face-background 'isearch "#bbbb22")
(set-face-foreground 'isearch-lazy-highlight-face "#333333")
(set-face-background 'isearch-lazy-highlight-face "#bbbb66")
(set-face-background 'modeline "#aaaaaa")
(set-face-foreground 'modeline "#333333")
(set-face-foreground 'link "#4466ff")
(set-face-foreground 'link-visited "#aa33bb")
(set-face-foreground 'minibuffer-prompt "#bababa")
(set-face-foreground 'escape-glyph "#ccaa11")
(setq default-tab-width 2)
(setq-default tab-width 2)
(setq-default indent-tabs-mode nil)
(setq css-indent-offset 2)
(setq-default sh-basic-offset 2)
(setq-default sh-indentation 2)
(setq-default perl-indent-level 2)
(random t)
(setq inhibit-splash-screen t)
(tool-bar-mode -1) (menu-bar-mode -1)
(setq initial-frame-alist '((width . 90) (height . 42)))
(set-scroll-bar-mode 'right)
(setq column-number-mode t)
(require 'linum)
(global-linum-mode t)
(global-set-key (kbd "C-x C-c")
(function
(lambda () (interactive)
(cond ((y-or-n-p "Delete this frame? ")
(delete-frame))))))
(global-set-key (kbd "C-x w") 'delete-frame)
(fset 'yes-or-no-p 'y-or-n-p)
(setq use-dialog-box nil)
(setq window-min-height 3)
(setq mouse-yank-at-point t)
(global-set-key (kbd "C-x C-b") 'electric-buffer-list)
(global-set-key [C-tab] 'next-buffer)
(global-set-key [C-S-iso-lefttab] 'previous-buffer)
(windmove-default-keybindings 'meta)
(add-hook 'server-switch-hook
(lambda ()
(local-set-key (kbd "C-x k") '(lambda ()
(interactive)
(if server-buffer-clients
(server-edit)
(ido-kill-buffer))))))
(defun revert-all-buffers ()
"Revert all opened buffers from their respective files"
(interactive)
(let* ((list (buffer-list))
(buffer (car list)))
(while buffer
(when (buffer-file-name buffer)
(progn
(set-buffer buffer)
(revert-buffer t t t)))
(setq list (cdr list))
(setq buffer (car list))))
(message "All buffers reverted"))
(global-set-key (kbd "C-c B") 'revert-all-buffers)
(require 'browse-kill-ring)
(global-set-key (kbd "C-x y") 'browse-kill-ring)
(savehist-mode t)
(global-set-key (kbd "ESC ESC") 'dabbrev-expand) (setq skeleton-pair t)
(global-set-key (kbd "(") 'skeleton-pair-insert-maybe)
(global-set-key (kbd "{") 'skeleton-pair-insert-maybe)
(global-set-key (kbd "[") 'skeleton-pair-insert-maybe)
(global-set-key (kbd "\"") 'skeleton-pair-insert-maybe)
(global-set-key (kbd "'") 'skeleton-pair-insert-maybe)
(defun textmate-next-line ()
"Go to next line and indent wherever you are in a line"
(interactive)
(end-of-line)
(newline-and-indent))
(global-set-key [C-return] 'textmate-next-line)
(defun textmate-semicolon-and-next-line ()
"Put a semicolon at the end of the line where you are then
go to next line and indent wherever you are in a line"
(interactive)
(end-of-line)
(insert ";")
(newline-and-indent))
(global-set-key [M-return] 'textmate-semicolon-and-next-line)
(defun comment-or-uncomment-region-or-line ()
"Like comment-or-uncomment-region, but if there's no mark \(that means no
region\) apply comment-or-uncomment to the current line"
(interactive)
(if (not mark-active)
(comment-or-uncomment-region
(line-beginning-position) (line-end-position))
(if (< (point) (mark))
(comment-or-uncomment-region (point) (mark))
(comment-or-uncomment-region (mark) (point)))))
(global-set-key (kbd "C-/") 'comment-or-uncomment-region-or-line)
(defun personal-layout ()
"Arrange windows to my personal layout."
(interactive)
(split-window-horizontally)
(windmove-right)
(split-window-vertically)
(enlarge-window-vertically 10))
(global-set-key (kbd "C-c l") 'personal-layout)
(defun toggle-php-and-xml-mode ()
"Toggle between php-mode and xml-mode"
(interactive)
(if (eq major-mode 'php-mode)
(xml-mode)
(php-mode)))
(global-set-key (kbd "C-c h") 'toggle-php-and-xml-mode)
(defun artist-mode-toggle ()
"Toggle artist-mode"
(interactive)
(if (eq major-mode 'artist-mode)
(artist-mode-off)
(artist-mode)))
(global-set-key (kbd "C-c d") 'artist-mode-toggle)
(require 'uniquify)
(setq uniquify-buffer-name-style 'reverse)
(setq uniquify-separator "|")
(setq uniquify-after-kill-buffer-p t)
(setq uniquify-ignore-buffers-re "^\\*")
(require 'dropdown-list)
(setq yas/prompt-functions '(yas/dropdown-prompt
yas/ido-prompt
yas/completing-prompt))
(require 'yasnippet)
(yas/initialize)
(yas/load-directory (concat emacs-dir "snippets/"))
(require 'ido)
(ido-mode t)
(setq ido-enable-flex-matching t)
(setq scroll-preserve-screen-position t)
(setq scroll-margin 2)
(setq scroll-step 1)
(setq require-final-newline t)
(setq auto-save-default nil)
(setq tramp-default-method "scp")
(require 'php-mode)
(add-to-list 'auto-mode-alist
'("\\.php[345]?\\'\\|\\.inc\\'" . php-mode))
(require 'js2-mode)
(add-to-list 'auto-mode-alist
'("\\.js\\'\\|\\.json\\'" . js2-mode))
(add-to-list 'auto-mode-alist
'("\\.html\\'\\|\\.xml\\'\\|\\.phtml\\'" . xml-mode))
(add-to-list 'auto-mode-alist
'("\\.list\\'" . outline-mode))
(setq custom-file (concat emacs-dir "custom.el"))
(load custom-file 'noerror)
(server-start)
(find-file "~/.todo")
(rename-buffer "*todo*")