summaryrefslogtreecommitdiffstats
path: root/emacs.d
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2011-05-23 09:43:56 +0200
committerGravatar Tom Willemsen2011-05-23 09:43:56 +0200
commit3ab0e979f8775cec44d5186b408ce3e63a136f75 (patch)
tree1d346c99d6c72e3eefbbc60aff89555160a64411 /emacs.d
parente85d1198ce2594d38a4aa608d5d61d2880488b1c (diff)
downloaddotfiles-3ab0e979f8775cec44d5186b408ce3e63a136f75.tar.gz
dotfiles-3ab0e979f8775cec44d5186b408ce3e63a136f75.zip
EMACS: Markdown settings
Load markdown-mode for .mdwn files, don't remove whitespace when markdown-mode is active and enable whitespace-mode and auto-fill-mode for markdown-mode.
Diffstat (limited to 'emacs.d')
-rw-r--r--emacs.d/10-file-associations.el2
-rw-r--r--emacs.d/10-settings.el48
-rw-r--r--emacs.d/20-markdown-mode.el6
3 files changed, 36 insertions, 20 deletions
diff --git a/emacs.d/10-file-associations.el b/emacs.d/10-file-associations.el
index 52a7e23..b82e0e3 100644
--- a/emacs.d/10-file-associations.el
+++ b/emacs.d/10-file-associations.el
@@ -5,6 +5,8 @@
(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 '("\\.mdwn$" . markdown-mode))
+(add-to-list 'auto-mode-alist '("\\.markdown$" . markdown-mode))
(add-to-list 'file-coding-system-alist '("\\.vala$" . utf-8))
(add-to-list 'file-coding-system-alist '("\\.vapi$" . utf-8))
diff --git a/emacs.d/10-settings.el b/emacs.d/10-settings.el
index d5ede72..b7e3f85 100644
--- a/emacs.d/10-settings.el
+++ b/emacs.d/10-settings.el
@@ -1,32 +1,44 @@
(add-to-list 'default-frame-alist '(font . "DejaVu Sans Mono-10:antialias=true"))
-(setq inhibit-startup-message t) ; don't show welcome screen
-(setq require-final-newline t) ; always append a newline to a
- ; file, if it doesn't have one
+(setq inhibit-startup-message t) ; don't show welcome screen
+(setq require-final-newline t) ; always append a newline to a
+ ; file, if it doesn't have one
(setq font-lock-maximum-decoration t) ; denotes my interest in maximum
- ; possible fontification
-(setq inhibit-default-init t) ; don't load default init
-(setq-default indent-tabs-mode nil) ; spaces, no tabs
+ ; possible fontification
+(setq inhibit-default-init t) ; don't load default init
+(setq-default indent-tabs-mode nil) ; spaces, no tabs
+(setq scroll-conservatively 10000) ; scroll only one line
+(setq whitespace-style '(face trailing))
-(setq backup-directory-alist `((".*" . ,temporary-file-directory)))
- ; backup file location
-(setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t)))
- ; autosave file location
+(setq backup-directory-alist ; backup file location
+ `((".*" .
+ ,temporary-file-directory)))
+(setq auto-save-file-name-transforms ; autosave file location
+ `((".*" ,temporary-file-directory
+ t)))
(fset 'yes-or-no-p 'y-or-n-p) ; switch yes or no to y or n
-(tool-bar-mode -1) ; no toolbar
-(menu-bar-mode -1) ; no menubar
-(scroll-bar-mode -1) ; no scrollbars
-(line-number-mode -1) ; don't show line number in splitter
-(global-linum-mode t) ; show them in the gutter
-(column-number-mode t) ; show column number in splitter
+(tool-bar-mode -1) ; no toolbar
+(menu-bar-mode -1) ; no menubar
+(scroll-bar-mode -1) ; no scrollbars
+(line-number-mode -1) ; don't show line number in
+ ; splitter
+(global-linum-mode t) ; show them in the gutter
+(column-number-mode t) ; show column number in splitter
(global-font-lock-mode t) ; show syntax highlighting, old
(delete-selection-mode t) ; delete selection upon typing
-(show-paren-mode t)
+(show-paren-mode t) ; show the opposite paren
+
+(defun buffer-major-mode (buffer-or-string)
+ (with-current-buffer buffer-or-string major-mode))
;; Byte-compile elisp files on save
-(add-hook 'before-save-hook 'delete-trailing-whitespace)
+(add-hook 'before-save-hook
+ (lambda ()
+ (if (not (eq (buffer-major-mode (current-buffer))
+ 'markdown-mode))
+ (delete-trailing-whitespace))))
(add-hook 'after-save-hook
(lambda ()
(let ((fname (buffer-file-name)))
diff --git a/emacs.d/20-markdown-mode.el b/emacs.d/20-markdown-mode.el
index c187307..9058bb2 100644
--- a/emacs.d/20-markdown-mode.el
+++ b/emacs.d/20-markdown-mode.el
@@ -1,4 +1,6 @@
(autoload 'markdown-mode "markdown-mode"
"Major mode for editing Markdown files" t)
-(setq auto-mode-alist
- (cons '("\\.markdown" . markdown-mode) auto-mode-alist))
+
+(add-hook 'markdown-mode-hook (lambda ()
+ (whitespace-mode)
+ (auto-fill-mode)))