Make use of the new prog-mode/prog-mode-hook functionality in Emacs 24
This commit is contained in:
parent
1800908443
commit
6e31729ba9
9 changed files with 11 additions and 11 deletions
|
@ -33,8 +33,7 @@
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
(defun prelude-c-mode-common-hook ()
|
(defun prelude-c-mode-common-hook ()
|
||||||
(setq c-basic-offset 4)
|
(setq c-basic-offset 4))
|
||||||
(prelude-coding-hook))
|
|
||||||
|
|
||||||
;; this will affect all modes derived from cc-mode, like
|
;; this will affect all modes derived from cc-mode, like
|
||||||
;; java-mode, php-mode, etc
|
;; java-mode, php-mode, etc
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
(require 'clojure-mode)
|
(require 'clojure-mode)
|
||||||
|
|
||||||
(defun prelude-clojure-mode-hook ()
|
(defun prelude-clojure-mode-hook ()
|
||||||
(prelude-list-coding-hook))
|
(prelude-lisp-coding-hook))
|
||||||
|
|
||||||
(add-hook 'clojure-mode-hook 'prelude-clojure-mode-hook)
|
(add-hook 'clojure-mode-hook 'prelude-clojure-mode-hook)
|
||||||
|
|
||||||
|
|
|
@ -318,7 +318,7 @@ there's a region, all lines that region covers will be duplicated."
|
||||||
nil '(("\\<\\(FIX\\|TODO\\|FIXME\\|HACK\\|REFACTOR\\):"
|
nil '(("\\<\\(FIX\\|TODO\\|FIXME\\|HACK\\|REFACTOR\\):"
|
||||||
1 font-lock-warning-face t))))
|
1 font-lock-warning-face t))))
|
||||||
|
|
||||||
(defun prelude-coding-hook ()
|
(defun prelude-prog-mode-hook ()
|
||||||
"Default coding hook, useful with any programming language."
|
"Default coding hook, useful with any programming language."
|
||||||
(flyspell-prog-mode)
|
(flyspell-prog-mode)
|
||||||
(prelude-local-comment-auto-fill)
|
(prelude-local-comment-auto-fill)
|
||||||
|
@ -328,6 +328,10 @@ there's a region, all lines that region covers will be duplicated."
|
||||||
;; keep the whitespace decent all the time
|
;; keep the whitespace decent all the time
|
||||||
(add-hook 'before-save-hook 'whitespace-cleanup nil t))
|
(add-hook 'before-save-hook 'whitespace-cleanup nil t))
|
||||||
|
|
||||||
|
;; in Emacs 24 programming major modes generally derive
|
||||||
|
;; from a common mode named prog-mode
|
||||||
|
(add-hook 'prog-mode-hook 'prelude-prog-mode-hook)
|
||||||
|
|
||||||
(defun prelude-untabify-buffer ()
|
(defun prelude-untabify-buffer ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(untabify (point-min) (point-max)))
|
(untabify (point-min) (point-max)))
|
||||||
|
|
|
@ -43,12 +43,13 @@
|
||||||
(delete-file (concat buffer-file-name "c"))))))
|
(delete-file (concat buffer-file-name "c"))))))
|
||||||
|
|
||||||
(defun prelude-emacs-lisp-mode-hook ()
|
(defun prelude-emacs-lisp-mode-hook ()
|
||||||
|
(prelude-lisp-coding-hook)
|
||||||
(turn-on-eldoc-mode)
|
(turn-on-eldoc-mode)
|
||||||
(prelude-remove-elc-on-save)
|
(prelude-remove-elc-on-save))
|
||||||
(prelude-lisp-coding-hook))
|
|
||||||
|
|
||||||
(add-hook 'emacs-lisp-mode-hook 'prelude-emacs-lisp-mode-hook)
|
(add-hook 'emacs-lisp-mode-hook 'prelude-emacs-lisp-mode-hook)
|
||||||
|
|
||||||
|
;; ielm is an interactive Emacs Lisp shell
|
||||||
(defun prelude-ielm-mode-hook ()
|
(defun prelude-ielm-mode-hook ()
|
||||||
(prelude-interactive-lisp-coding-hook)
|
(prelude-interactive-lisp-coding-hook)
|
||||||
(turn-on-eldoc-mode))
|
(turn-on-eldoc-mode))
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
(defun prelude-js-mode-hook ()
|
(defun prelude-js-mode-hook ()
|
||||||
(prelude-coding-hook)
|
|
||||||
;; electric-layout-mode doesn't play nice with js-mode
|
;; electric-layout-mode doesn't play nice with js-mode
|
||||||
(electric-layout-mode -1))
|
(electric-layout-mode -1))
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
|
|
||||||
;; a great lisp coding hook
|
;; a great lisp coding hook
|
||||||
(defun prelude-lisp-coding-hook ()
|
(defun prelude-lisp-coding-hook ()
|
||||||
(prelude-coding-hook)
|
|
||||||
(paredit-mode +1))
|
(paredit-mode +1))
|
||||||
|
|
||||||
;; interactive modes don't need whitespace checks
|
;; interactive modes don't need whitespace checks
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
(defalias 'perl-mode 'cperl-mode)
|
(defalias 'perl-mode 'cperl-mode)
|
||||||
|
|
||||||
(defun prelude-cperl-mode-hook ()
|
(defun prelude-cperl-mode-hook ()
|
||||||
(prelude-coding-hook)
|
|
||||||
(setq cperl-indent-level 4)
|
(setq cperl-indent-level 4)
|
||||||
(setq cperl-continued-statement-offset 8)
|
(setq cperl-continued-statement-offset 8)
|
||||||
;; cperl-hairy affects all those variables, but I prefer
|
;; cperl-hairy affects all those variables, but I prefer
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
(require 'python)
|
(require 'python)
|
||||||
|
|
||||||
(defun prelude-python-mode-hook ()
|
(defun prelude-python-mode-hook ()
|
||||||
(prelude-coding-hook)
|
(prelude-prog-mode-hook)
|
||||||
(electric-indent-mode -1))
|
(electric-indent-mode -1))
|
||||||
|
|
||||||
(add-hook 'python-mode-hook 'prelude-python-mode-hook)
|
(add-hook 'python-mode-hook 'prelude-python-mode-hook)
|
||||||
|
|
|
@ -60,7 +60,6 @@
|
||||||
(require 'ruby-end)
|
(require 'ruby-end)
|
||||||
|
|
||||||
(defun prelude-ruby-mode-hook ()
|
(defun prelude-ruby-mode-hook ()
|
||||||
(prelude-coding-hook)
|
|
||||||
(inf-ruby-keys)
|
(inf-ruby-keys)
|
||||||
;; turn off the annoying input echo in irb
|
;; turn off the annoying input echo in irb
|
||||||
(setq comint-process-echoes t)
|
(setq comint-process-echoes t)
|
||||||
|
|
Loading…
Add table
Reference in a new issue