Use functions instead of lambdas for mode customizations

This commit is contained in:
2012-04-21 20:04:48 +01:00
parent 26ef3e957a
commit 61bfb8f36d
15 changed files with 178 additions and 156 deletions

View File

@@ -1,12 +1,14 @@
(add-to-list 'auto-mode-alist '("\\.coffee$" . coffee-mode))
(add-to-list 'auto-mode-alist '("Cakefile" . coffee-mode))
(add-hook 'coffee-mode-hook
(lambda ()
(flyspell-prog-mode)
(linum-mode t)
(fci-mode)
(setq tab-width 2)
(setq highlight-indentation-offset 2)
(highlight-indentation-mode)
(highlight-indentation-current-column-mode)))
(defun customizations-for-coffee-mode ()
(interactive)
(flyspell-prog-mode)
(linum-mode t)
(fci-mode)
(setq tab-width 2)
(setq highlight-indentation-offset 2)
(highlight-indentation-mode)
(highlight-indentation-current-column-mode))
(add-hook 'coffee-mode-hook 'customizations-for-coffee-mode)

View File

@@ -1,5 +1,7 @@
(add-hook 'conf-mode-hook
(lambda ()
(flyspell-prog-mode)
(linum-mode t)
(fci-mode)))
(defun customizations-for-conf-mode ()
(interactive)
(flyspell-prog-mode)
(linum-mode t)
(fci-mode))
(add-hook 'conf-mode-hook 'customizations-for-conf-mode)

View File

@@ -1,9 +1,11 @@
(add-hook 'css-mode-hook
(lambda ()
(flyspell-prog-mode)
(linum-mode t)
(fci-mode)
(setq css-indent-offset 2)
(setq highlight-indentation-offset 2)
(highlight-indentation-mode)
(define-key css-mode-map (kbd "RET") 'newline-and-indent)))
(defun customizations-for-css-mode ()
(interactive)
(flyspell-prog-mode)
(linum-mode t)
(fci-mode)
(setq css-indent-offset 2)
(setq highlight-indentation-offset 2)
(highlight-indentation-mode)
(define-key css-mode-map (kbd "RET") 'newline-and-indent))
(add-hook 'css-mode-hook 'customizations-for-css-mode)

View File

@@ -1,7 +1,8 @@
;; Lisp Hook
(add-hook 'emacs-lisp-mode-hook
(lambda ()
(setq whitespace-action (quote (auto-cleanup)))
(flyspell-prog-mode)
(linum-mode t)
(fci-mode)))
(defun customizations-for-emacs-lisp-mode ()
(interactive)
(setq whitespace-action (quote (auto-cleanup)))
(flyspell-prog-mode)
(linum-mode t)
(fci-mode))
(add-hook 'emacs-lisp-mode-hook 'customizations-for-emacs-lisp-mode)

View File

@@ -8,11 +8,13 @@
(require 'erlang-start)
(require 'erlang-flymake)
(add-hook 'erlang-mode-hook
(lambda ()
(flyspell-prog-mode)
(linum-mode t)
(fci-mode)
(setq highlight-indentation-offset 2)
(highlight-indentation-mode)
(highlight-indentation-current-column-mode)))
(defun customizations-for-erlang-mode ()
(interactive)
(flyspell-prog-mode)
(linum-mode t)
(fci-mode)
(setq highlight-indentation-offset 2)
(highlight-indentation-mode)
(highlight-indentation-current-column-mode))
(add-hook 'erlang-mode-hook 'customizations-for-erlang-mode)

View File

@@ -1,11 +1,13 @@
(add-to-list 'auto-mode-alist '("\\.feature" . feature-mode))
(add-hook 'feature-mode-hook
(lambda ()
(setq whitespace-action (quote (auto-cleanup)))
(flyspell-mode)
(linum-mode t)
(fci-mode)
(setq highlight-indentation-offset 2)
(highlight-indentation-mode)
(highlight-indentation-current-column-mode)))
(defun customizations-for-feature-mode ()
(interactive)
(setq whitespace-action (quote (auto-cleanup)))
(flyspell-mode)
(linum-mode t)
(fci-mode)
(setq highlight-indentation-offset 2)
(highlight-indentation-mode)
(highlight-indentation-current-column-mode))
(add-hook 'feature-mode-hook 'customizations-for-feature-mode)

View File

@@ -1,9 +1,11 @@
(add-hook 'js-mode-hook
(lambda ()
(setq js-indent-level 2)
(flyspell-prog-mode)
(linum-mode t)
(fci-mode)
(setq tab-width 2)
(setq highlight-indentation-offset 2)
(highlight-indentation-mode)))
(defun customizations-for-js-mode ()
(interactive)
(setq js-indent-level 2)
(flyspell-prog-mode)
(linum-mode t)
(fci-mode)
(setq tab-width 2)
(setq highlight-indentation-offset 2)
(highlight-indentation-mode))
(add-hook 'js-mode-hook 'customizations-for-js-mode)

View File

@@ -1,13 +1,17 @@
;; Make Magit it look a bit prettier with my theme
(add-hook 'magit-mode-hook
(lambda ()
(linum-mode t)))
;; Make Magit look a bit prettier with my theme
(defun customizations-for-magit-mode ()
(interactive)
(linum-mode t))
(add-hook 'magit-mode-hook 'customizations-for-magit-mode)
;; Write commit messages in style
(add-hook 'magit-log-edit-mode-hook
(lambda ()
(flyspell-mode)
(linum-mode t)
(auto-fill-mode)
(setq fill-column 72)
(fci-mode)))
(defun customizations-for-magit-log-edit-mode ()
(interactive)
(flyspell-mode)
(linum-mode t)
(auto-fill-mode)
(setq fill-column 72)
(fci-mode))
(add-hook 'magit-log-edit-mode-hook 'customizations-for-magit-log-edit-mode)

View File

@@ -1,7 +1,9 @@
(add-hook 'makefile-mode-hook
(lambda ()
(flyspell-prog-mode)
(linum-mode t)
(fci-mode)
(setq tab-width 4)
(highlight-indentation-mode)))
(defun customizations-for-makefile-mode ()
(interactive)
(flyspell-prog-mode)
(linum-mode t)
(fci-mode)
(setq tab-width 4)
(highlight-indentation-mode))
(add-hook 'makefile-mode-hook 'customizations-for-makefile-mode)

View File

@@ -4,11 +4,13 @@
(setq auto-mode-alist (cons '("\\.mdown" . markdown-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.markdown" . markdown-mode) auto-mode-alist))
(add-hook 'markdown-mode-hook
(lambda ()
(setq whitespace-action nil)
(fci-mode)
(linum-mode t)
(flyspell-mode)
(auto-fill-mode)
(define-key markdown-mode-map (kbd "C-c p") 'markdown-preview)))
(defun customizations-for-markdown-mode ()
(interactive)
(setq whitespace-action nil)
(fci-mode)
(linum-mode t)
(flyspell-mode)
(auto-fill-mode)
(define-key markdown-mode-map (kbd "C-c p") 'markdown-preview))
(add-hook 'markdown-mode-hook 'customizations-for-markdown-mode)

View File

@@ -1,7 +1,9 @@
(add-hook 'php-mode-hook
(lambda ()
(setq whitespace-action (quote (auto-cleanup)))
(flyspell-prog-mode)
(linum-mode t)
(fci-mode)
(highlight-indentation-mode)))
(defun customizations-for-php-mode ()
(interactive)
(setq whitespace-action (quote (auto-cleanup)))
(flyspell-prog-mode)
(linum-mode t)
(fci-mode)
(highlight-indentation-mode))
(add-hook 'php-mode-hook 'customizations-for-php-mode)

View File

@@ -1,8 +1,10 @@
(add-hook 'python-mode-hook
(lambda ()
(flyspell-prog-mode)
(linum-mode t)
(fci-mode)
(highlight-indentation-mode)
(highlight-indentation-current-column-mode)
(define-key python-mode-map (kbd "RET") 'newline-and-indent)))
(defun customizations-for-python-mode ()
(interactive)
(flyspell-prog-mode)
(linum-mode t)
(fci-mode)
(highlight-indentation-mode)
(highlight-indentation-current-column-mode)
(define-key python-mode-map (kbd "RET") 'newline-and-indent))
(add-hook 'python-mode-hook 'customizations-for-python-mode)

View File

@@ -1,56 +1,49 @@
(autoload 'ruby-mode "ruby-mode" nil t)
(add-to-list 'auto-mode-alist '("Capfile" . ruby-mode))
(add-to-list 'auto-mode-alist '("Gemfile" . ruby-mode))
(add-to-list 'auto-mode-alist '("Rakefile" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.rb\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.ru\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.rake\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.gemspec\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.rabl\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.prawn\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("Capfile" . ruby-mode))
(add-to-list 'auto-mode-alist '("Gemfile" . ruby-mode))
(add-to-list 'auto-mode-alist '("Rakefile" . ruby-mode))
(add-hook 'ruby-mode-hook
(lambda ()
(flyspell-prog-mode)
(linum-mode t)
(fci-mode)
(require 'inf-ruby)
(require 'ruby-electric)
(require 'ruby-compilation)
(require 'flymake)
(require 'flymake-ruby)
(when (require 'rsense nil 'noerror)
(add-to-list 'ac-sources 'ac-source-rsense-method)
(add-to-list 'ac-sources 'ac-source-rsense-constant))
(flymake-ruby-load)
(highlight-indentation-mode)
(ruby-electric-mode t)
(setq ruby-deep-arglist t)
(setq ruby-deep-indent-paren nil)
(setq c-tab-always-indent nil)
(setq ruby-use-encoding-map nil)
(setq ruby-electric-expand-delimiters-list (quote (124)))
(hs-minor-mode 1)
(setq whitespace-action (quote (auto-cleanup)))
(define-key ruby-mode-map
(kbd "RET") 'reindent-then-newline-and-indent)
(define-key ruby-mode-map
(kbd "C-c C-j") 'hs-toggle-hiding)
(define-key ruby-mode-map
(kbd "s-r") 'ruby-compilation-this-buffer)
(define-key ruby-mode-map
(kbd "C-c C-r") 'ruby-compilation-this-buffer)
(define-key ruby-mode-map
(kbd "C-c C-.") 'ac-complete-rsense)
(define-key ruby-mode-map
(kbd "C-x t") 'textmate-goto-file)
(define-key ruby-mode-map
(kbd "C-x C-t") 'textmate-goto-file)
(define-key ruby-mode-map
(kbd "C-c C-l") 'goto-line)
(define-key ruby-mode-map
(kbd "C-c C-b") 'eproject-ibuffer)))
(defun customizations-for-ruby-mode ()
(interactive)
(flyspell-prog-mode)
(linum-mode t)
(fci-mode)
(require 'inf-ruby)
(require 'ruby-electric)
(require 'ruby-compilation)
(require 'flymake)
(require 'flymake-ruby)
(when (require 'rsense nil 'noerror)
(add-to-list 'ac-sources 'ac-source-rsense-method)
(add-to-list 'ac-sources 'ac-source-rsense-constant))
(flymake-ruby-load)
(highlight-indentation-mode)
(ruby-electric-mode t)
(setq ruby-deep-arglist t)
(setq ruby-deep-indent-paren nil)
(setq c-tab-always-indent nil)
(setq ruby-use-encoding-map nil)
(setq ruby-electric-expand-delimiters-list (quote (124)))
(hs-minor-mode 1)
(setq whitespace-action (quote (auto-cleanup)))
(define-key ruby-mode-map (kbd "RET") 'reindent-then-newline-and-indent)
(define-key ruby-mode-map (kbd "C-c C-j") 'hs-toggle-hiding)
(define-key ruby-mode-map (kbd "s-r") 'ruby-compilation-this-buffer)
(define-key ruby-mode-map (kbd "C-c C-r") 'ruby-compilation-this-buffer)
(define-key ruby-mode-map (kbd "C-c C-.") 'ac-complete-rsense)
(define-key ruby-mode-map (kbd "C-x t") 'textmate-goto-file)
(define-key ruby-mode-map (kbd "C-x C-t") 'textmate-goto-file)
(define-key ruby-mode-map (kbd "C-c C-l") 'goto-line)
(define-key ruby-mode-map (kbd "C-c C-b") 'eproject-ibuffer))
(add-hook 'ruby-mode-hook 'customizations-for-ruby-mode)
;; Set up hs-mode (HideShow) for Ruby
(add-to-list 'hs-special-modes-alist

View File

@@ -1,6 +1,8 @@
(add-hook 'sh-mode-hook
(lambda ()
(flyspell-prog-mode)
(linum-mode t)
(fci-mode)
(highlight-indentation-mode)))
(defun customizations-for-sh-mode ()
(interactive)
(flyspell-prog-mode)
(linum-mode t)
(fci-mode)
(highlight-indentation-mode))
(add-hook 'sh-mode-hook 'customizations-for-sh-mode)

View File

@@ -2,12 +2,14 @@
(add-to-list 'auto-mode-alist '("\\.yaml$" . yaml-mode))
(add-to-list 'auto-mode-alist '("\\.yml\\.example$" . yaml-mode))
(add-hook 'yaml-mode-hook
'(lambda ()
(flyspell-prog-mode)
(linum-mode t)
(fci-mode)
(setq highlight-indentation-offset 2)
(highlight-indentation-mode)
(highlight-indentation-current-column-mode)
(define-key yaml-mode-map (kbd "RET") 'newline-and-indent)))
(defun customizations-for-yaml-mode ()
(interactive)
(flyspell-prog-mode)
(linum-mode t)
(fci-mode)
(setq highlight-indentation-offset 2)
(highlight-indentation-mode)
(highlight-indentation-current-column-mode)
(define-key yaml-mode-map (kbd "RET") 'newline-and-indent))
(add-hook 'yaml-mode-hook 'customizations-for-yaml-mode)