make heavier use of autogenerated autoloads and eval-after-load to

optimize the load time
This commit is contained in:
Bozhidar Batsov 2012-04-12 18:21:19 +03:00
parent 5b2ef06840
commit 66bc6f0809
11 changed files with 83 additions and 2222 deletions

View file

@ -32,11 +32,6 @@
;;; Code: ;;; Code:
(autoload 'ack-and-a-half-same "ack-and-a-half" nil t)
(autoload 'ack-and-a-half "ack-and-a-half" nil t)
(autoload 'ack-and-a-half-find-file-same "ack-and-a-half" nil t)
(autoload 'ack-and-a-half-find-file "ack-and-a-half" nil t)
;; create shorter aliases ;; create shorter aliases
(defalias 'ack 'ack-and-a-half) (defalias 'ack 'ack-and-a-half)
(defalias 'ack-same 'ack-and-a-half-same) (defalias 'ack-same 'ack-and-a-half-same)

View file

@ -35,16 +35,18 @@
(require 'prelude-lisp) (require 'prelude-lisp)
;; To start SLIME in your Clojure project: ;; To start SLIME in your Clojure project:
;; 1. lein plugin install swank-clojure 1.3.1 ;; 1. lein plugin install swank-clojure 1.3.1 (or newer)
;; 2. Invoke M-x clojure-jack-in from a project ;; 2. Invoke M-x clojure-jack-in from a project
(require 'clojure-mode)
(defun prelude-clojure-mode-defaults () (eval-after-load 'clojure-mode
(run-hooks 'prelude-lisp-coding-hook)) '(progn
(defun prelude-clojure-mode-defaults ()
(run-hooks 'prelude-lisp-coding-hook))
(setq prelude-clojure-mode-hook 'prelude-clojure-mode-defaults) (setq prelude-clojure-mode-hook 'prelude-clojure-mode-defaults)
(add-hook 'clojure-mode-hook (lambda () (run-hooks 'prelude-clojure-mode-hook))) (add-hook 'clojure-mode-hook (lambda ()
(run-hooks 'prelude-clojure-mode-hook)))))
(provide 'prelude-clojure) (provide 'prelude-clojure)

View file

@ -32,41 +32,42 @@
;;; Code: ;;; Code:
(require 'coffee-mode) (eval-after-load 'coffee-mode
'(progn
(defun prelude-coffee-mode-defaults ()
"coffee-mode-defaults"
(defun prelude-coffee-mode-defaults () ;; CoffeeScript uses two spaces.
"coffee-mode-defaults" (set (make-local-variable 'tab-width) 2)
;; CoffeeScript uses two spaces. ;; If you don't have js2-mode
(set (make-local-variable 'tab-width) 2) (setq coffee-js-mode 'javascript-mode)
;; If you don't have js2-mode ;; If you don't want your compiled files to be wrapped
(setq coffee-js-mode 'javascript-mode) (setq coffee-args-compile '("-c" "--bare"))
;; If you don't want your compiled files to be wrapped ;; *Messages* spam
(setq coffee-args-compile '("-c" "--bare")) (setq coffee-debug-mode t)
;; *Messages* spam ;; electric-indent doesn't play nice with coffee-mode's "smart"
(setq coffee-debug-mode t) ;; indent
(electric-indent-mode -1)
;; electric-indent doesn't play nice with coffee-mode's "smart" ;; Emacs key binding
;; indent (define-key coffee-mode-map [(meta r)] 'coffee-compile-buffer)
(electric-indent-mode -1)
;; Emacs key binding ;; Riding edge.
(define-key coffee-mode-map [(meta r)] 'coffee-compile-buffer) (setq coffee-command "~/dev/coffee")
;; Riding edge. ;; Compile '.coffee' files on every save
(setq coffee-command "~/dev/coffee") (and (file-exists-p (buffer-file-name))
(file-exists-p (coffee-compiled-file-name))
(coffee-cos-mode t)))
;; Compile '.coffee' files on every save (setq prelude-coffee-mode-hook 'prelude-coffee-mode-defaults)
(and (file-exists-p (buffer-file-name))
(file-exists-p (coffee-compiled-file-name))
(coffee-cos-mode t)))
(setq prelude-coffee-mode-hook 'prelude-coffee-mode-defaults) (add-hook 'coffee-mode-hook (lambda ()
(run-hooks 'prelude-coffee-mode-hook)))))
(add-hook 'coffee-mode-hook (lambda () (run-hooks 'prelude-coffee-mode-hook)))
(provide 'prelude-coffee) (provide 'prelude-coffee)

View file

@ -1,9 +1,11 @@
(defun prelude-css-mode-defaults () (eval-after-load 'css-mode
(setq css-indent-offset 2) '(progn
(rainbow-mode +1)) (defun prelude-css-mode-defaults ()
(setq css-indent-offset 2)
(rainbow-mode +1))
(setq prelude-css-mode-hook 'prelude-css-mode-defaults) (setq prelude-css-mode-hook 'prelude-css-mode-defaults)
(add-hook 'css-mode-hook (lambda () (run-hooks 'prelude-css-mode-hook))) (add-hook 'css-mode-hook (lambda () (run-hooks 'prelude-css-mode-hook)))))
(provide 'prelude-css) (provide 'prelude-css)

View file

@ -32,15 +32,19 @@
;;; Code: ;;; Code:
(defun prelude-haskell-mode-defaults () (eval-after-load 'haskell-mode
(run-hooks 'prelude-prog-mode-hook) ;; run manually; not derived from prog-mode '(progn
(subword-mode +1) (defun prelude-haskell-mode-defaults ()
(turn-on-haskell-doc-mode) ;; run manually since haskell-mode is not derived from prog-mode
(turn-on-haskell-indentation)) (run-hooks 'prelude-prog-mode-hook)
(subword-mode +1)
(turn-on-haskell-doc-mode)
(turn-on-haskell-indentation))
(setq prelude-haskell-mode-hook 'prelude-haskell-mode-defaults) (setq prelude-haskell-mode-hook 'prelude-haskell-mode-defaults)
(add-hook 'haskell-mode-hook (lambda () (run-hooks 'prelude-haskell-mode-hook))) (add-hook 'haskell-mode-hook (lambda ()
(run-hooks 'prelude-haskell-mode-hook)))))
(provide 'prelude-haskell) (provide 'prelude-haskell)

View file

@ -32,13 +32,15 @@
;;; Code: ;;; Code:
(defun prelude-js-mode-defaults () (eval-after-load 'js-mode
;; electric-layout-mode doesn't play nice with js-mode '(progn
(electric-layout-mode -1)) (defun prelude-js-mode-defaults ()
;; electric-layout-mode doesn't play nice with js-mode
(electric-layout-mode -1))
(setq prelude-js-mode-hook 'prelude-js-mode-defaults) (setq prelude-js-mode-hook 'prelude-js-mode-defaults)
(add-hook 'js-mode-hook (lambda () (run-hooks 'prelude-js-mode-hook))) (add-hook 'js-mode-hook (lambda () (run-hooks 'prelude-js-mode-hook)))))
(provide 'prelude-js) (provide 'prelude-js)

View file

@ -32,11 +32,8 @@
;;; Code: ;;; Code:
(autoload 'markdown-mode "markdown-mode.el" (add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode))
"Major mode for editing Markdown files" t) (add-to-list 'auto-mode-alist '("\\.markdown$" . markdown-mode))
(setq auto-mode-alist
(cons '("\\.markdown$" . markdown-mode)
(cons '("\\.md$" . markdown-mode) auto-mode-alist)))
(provide 'prelude-markdown) (provide 'prelude-markdown)

View file

@ -32,13 +32,13 @@
;;; Code: ;;; Code:
(require 'mediawiki) (eval-after-load 'mediawiki
'(progn
(setq mediawiki-site-alist '(("Wikipedia" "http://en.wikipedia.org/w" "" "" "Main Page")
("WikEmacs" "http://wikemacs.org/w/" "" "" "Main Page")))
(setq mediawiki-site-alist '(("Wikipedia" "http://en.wikipedia.org/w" "" "" "Main Page") ;; Emacs users care more for WikEmacs than Wikipedia :-)
("WikEmacs" "http://wikemacs.org/w/" "" "" "Main Page"))) (setq mediawiki-site-default "WikEmacs")))
;; Emacs users care more for WikEmacs than Wikipedia :-)
(setq mediawiki-site-default "WikEmacs")
(provide 'prelude-mediawiki) (provide 'prelude-mediawiki)

View file

@ -43,8 +43,8 @@
(defvar prelude-packages (defvar prelude-packages
'(ack-and-a-half auctex clojure-mode coffee-mode deft expand-region '(ack-and-a-half auctex clojure-mode coffee-mode deft expand-region
gist haml-mode haskell-mode helm helm-projectile inf-ruby gist groovy-mode haml-mode haskell-mode helm helm-projectile inf-ruby
magit magithub markdown-mode paredit projectile magit magithub markdown-mode mediawiki paredit projectile
python sass-mode rainbow-mode scss-mode solarized-theme python sass-mode rainbow-mode scss-mode solarized-theme
volatile-highlights yaml-mode yari yasnippet zenburn-theme) volatile-highlights yaml-mode yari yasnippet zenburn-theme)
"A list of packages to ensure are installed at launch.") "A list of packages to ensure are installed at launch.")

View file

@ -47,19 +47,23 @@
"Run an inferior Ruby process") "Run an inferior Ruby process")
(autoload 'inf-ruby-keys "inf-ruby" (autoload 'inf-ruby-keys "inf-ruby"
"Set local key defs for inf-ruby in ruby-mode") "Set local key defs for inf-ruby in ruby-mode")
(autoload 'ruby-block-mode "ruby-block")
(require 'ruby-end)
(defun prelude-ruby-mode-defaults () (eval-after-load 'ruby-mode
(inf-ruby-setup-keybindings) '(progn
;; turn off the annoying input echo in irb (defun prelude-ruby-mode-defaults ()
(setq comint-process-echoes t) (inf-ruby-setup-keybindings)
(ruby-block-mode t) ;; turn off the annoying input echo in irb
;; bind yari in the local keymap (setq comint-process-echoes t)
(local-set-key (kbd "C-h r") 'yari)) (ruby-block-mode t)
;; bind yari in the local keymap
(local-set-key (kbd "C-h r") 'yari))
(setq prelude-ruby-mode-hook 'prelude-ruby-mode-defaults) (setq prelude-ruby-mode-hook 'prelude-ruby-mode-defaults)
(add-hook 'ruby-mode-hook (lambda () (run-hooks 'prelude-ruby-mode-hook)))
(add-hook 'ruby-mode-hook (lambda ()
(run-hooks 'prelude-ruby-mode-hook)))))
(provide 'prelude-ruby) (provide 'prelude-ruby)
;;; prelude-ruby.el ends here ;;; prelude-ruby.el ends here

2146
vendor/mediawiki.el vendored

File diff suppressed because it is too large Load diff