summaryrefslogtreecommitdiffstats
path: root/emacs.el
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2011-06-15 12:19:30 +0200
committerGravatar Tom Willemsen2011-06-15 12:19:30 +0200
commit9df6bb4922d08a9db2233f738b691eebc6e3120a (patch)
tree4f4a39aa28b1eb5c3afcbf5c941bc7dbfdc3cf1f /emacs.el
parentc608291b013290b80f6aaf71ec6d0abc4b13c87f (diff)
downloaddotfiles-9df6bb4922d08a9db2233f738b691eebc6e3120a.tar.gz
dotfiles-9df6bb4922d08a9db2233f738b691eebc6e3120a.zip
EMACS: compile, htmlize, js, stumpwm
* install.sh tries to compile emacs.el before linking the emacs.elc to ~/. This is to always have a compiled .emacs.elc for speediest startup. * I removed a little bit of code from htmlize.el that was causing trouble with the naquadah theme. * I removed javascript-mode, because the built-in js-mode is better. * I Added stumpwm mode * When I save a file and it is in html-mode it will try and replace all occurrences of é with é before continueing.
Diffstat (limited to 'emacs.el')
-rw-r--r--emacs.el80
1 files changed, 51 insertions, 29 deletions
diff --git a/emacs.el b/emacs.el
index 91c2cb2..f6a590e 100644
--- a/emacs.el
+++ b/emacs.el
@@ -19,32 +19,33 @@
(require 'uniquify)
(require 'server)
(require 'org-publish)
+(require 'htmlize)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; AUTOLOADS ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(autoload 'vala-mode "vala-mode"
- "A Major mode for editing Vala files" t)
+ "A Major mode for editing Vala files" t)
(autoload 'csharp-mode "csharp-mode"
- "A Major mode for editing C# files" t)
-(autoload 'javascript-mode "javascript"
- "A Major mode for editing JavaScript files" t)
+ "A Major mode for editing C# files" t)
(autoload 'sqlplus-mode "sqlplus"
- "A Major mode for communicating with Oracle" t)
+ "A Major mode for communicating with Oracle" t)
(autoload 'batch-mode "batch-mode"
- "A Major mode for editing Batch files" t)
+ "A Major mode for editing Batch files" t)
(autoload 'lua-mode "lua-mode"
- "A Major mode for editing Lua files" t)
+ "A Major mode for editing Lua files" t)
(autoload 'php-mode "php-mode-improved"
- "A Major mode for editing PHP files" t)
+ "A Major mode for editing PHP files" t)
(autoload 'graphviz-dot-mode "graphviz-dot-mode"
- "A Major mode for editing graphviz dot files" t)
+ "A Major mode for editing graphviz dot files" t)
(autoload 'cmake-mode "cmake-mode"
- "A major-mode for editing CMake sources" t)
+ "A major-mode for editing CMake sources" t)
(autoload 'markdown-mode "markdown-mode"
- "Major mode for editing Markdown files" t)
+ "Major mode for editing Markdown files" t)
(autoload 'rainbow-mode "rainbow-mode"
- "A Minor mode for showing colors inline" t)
+ "A Minor mode for showing colors inline" t)
+(autoload 'stumpwm-mode "stumpwm-mode"
+ "Special lisp mode for evaluating code into running stumpwm" t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; DEFUNS ;;
@@ -168,7 +169,18 @@ Currently adds | & ! . + = - / % * , < > ? : ->"
"Add a space to the linum column"
(setq linum-format "%d "))
+(defun replace-occurrences (from to)
+ (save-excursion
+ (goto-char (point-min))
+ (while (search-forward from nil t)
+ (replace-match to))))
+
+(defun replace-html-special-chars ()
+ (replace-occurrences "é" "&eacute;"))
+
(defun on-before-save ()
+ (if (eq (buffer-major-mode (current-buffer)) 'html-mode)
+ (replace-html-special-chars))
(if (not (eq (buffer-major-mode (current-buffer)) 'markdown-mode))
(delete-trailing-whitespace)))
@@ -212,6 +224,10 @@ Currently adds | & ! . + = - / % * , < > ? : ->"
(column-marker-2 81)
(local-set-key [f6] 'comment-line))
+(defun on-mail-mode ()
+ (turn-on-auto-fill)
+ (search-forward "\n\n"))
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; VARIABLES ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -233,12 +249,13 @@ Currently adds | & ! . + = - / % * , < > ? : ->"
(add-to-list 'auto-mode-alist '("\\.bat$" . batch-mode))
(add-to-list 'auto-mode-alist '("\\.lua$" . lua-mode))
(add-to-list 'auto-mode-alist '("\\.php[345]?$" . php-mode))
-(add-to-list 'auto-mode-alist '("\\.js\\(on\\)?$" . javascript-mode))
+(add-to-list 'auto-mode-alist '("\\.js\\(on\\)?$" . js-mode))
(add-to-list 'auto-mode-alist '("\\.m\\(ark\\)?do?wn$". markdown-mode))
(add-to-list 'auto-mode-alist '("CMakeLists\\.txt$" . cmake-mode))
(add-to-list 'auto-mode-alist '("\\.cmake$" . cmake-mode))
(add-to-list 'auto-mode-alist '("\\.css$" . css-mode))
-(add-to-list 'auto-mode-alist '("mutt-cloud-" . message-mode))
+(add-to-list 'auto-mode-alist '("mutt-cloud-" . mail-mode))
+(add-to-list 'auto-mode-alist '("stumpwmrc" . stumpwm-mode))
(add-to-list 'file-coding-system-alist '("\\.vala$" . utf-8))
(add-to-list 'file-coding-system-alist '("\\.vapi$" . utf-8))
@@ -251,6 +268,9 @@ Currently adds | & ! . + = - / % * , < > ? : ->"
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-ca" 'org-agenda)
+(global-set-key [f5] '(lambda ()
+ (interactive)
+ (revert-buffer nil t nil)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; THEME SETTINGS ;;
@@ -273,21 +293,22 @@ Currently adds | & ! . + = - / % * , < > ? : ->"
(setq-default indent-tabs-mode nil) ; spaces, no tabs
(setq
- inhibit-startup-message t
- require-final-newline t
- inhibit-default-init t
- scroll-conservatively 101 ; scroll only one line
- browse-url-browser-function 'browse-url-generic
- browse-url-generic-program "conkeror"
- whitespace-style '(face trailing)
- uniquify-buffer-name-style 'reverse
- org-confirm-babel-evaluate nil
+ inhibit-startup-message t
+ require-final-newline t
+ inhibit-default-init t
+ scroll-conservatively 101 ; scroll only one line
+ browse-url-browser-function 'browse-url-generic
+ browse-url-generic-program "conkeror"
+ whitespace-style '(face trailing)
+ uniquify-buffer-name-style 'reverse
+ org-confirm-babel-evaluate nil
org-tags-exclude-from-inheritance '("crypt")
- org-crypt-key "33E8CC1CC4"
- org-use-fast-todo-selection t
- org-default-notes-file (concat org-directory "/notes.org")
- org-ditaa-jar-path "/usr/share/java/ditaa/ditaa-0_9.jar"
- jit-lock-defer-time 0.2
+ org-crypt-key "33E8CC1CC4"
+ org-use-fast-todo-selection t
+ org-default-notes-file (concat org-directory "/notes.org")
+ org-ditaa-jar-path "/usr/share/java/ditaa/ditaa-0_9.jar"
+ jit-lock-defer-time 0.2
+ htmlize-output-type 'inline-css
frame-title-format
'(:eval
@@ -367,10 +388,11 @@ Currently adds | & ! . + = - / % * , < > ? : ->"
(add-hook 'markdown-mode-hook 'on-markdown-mode)
(add-hook 'org-mode-hook 'on-org-mode)
(add-hook 'php-mode-hook 'on-php-mode)
+(add-hook 'mail-mode-hook 'on-mail-mode)
(add-hook 'git-commit-mode-hook 'auto-fill-mode)
(add-hook 'emacs-startup-hook 'fullscreen)
(add-hook 'css-mode-hook 'rainbow-mode)
-(add-hook 'javascript-mode-hook 'rainbow-delimiters-mode)
+(add-hook 'js-mode-hook 'rainbow-delimiters-mode)
(add-hook 'python-mode-hook 'rainbow-delimiters-mode)
(add-hook 'after-make-frame-functions 'setup-system-frame-colours t)
(add-hook 'lisp-mode-hook 'rainbow-delimiters-mode)