Replace usages of eval-after-load with with-eval-after-load
`with-eval-after-load` was introduced in Emacs 24.4 and its usage results in a cleaner code. `eval-after-load` is considered ill-behaved because it is a function, not a macro, and thus requires the code inside it to be quoted, which means that it cannot be byte-compiled. It also accepts only one form, so if you have more than one, you need to use `progn`. More details - https://stackoverflow.com/questions/21880139/what-is-with-eval-after-load-in-emacs-lisp
This commit is contained in:
parent
0ce648b699
commit
cecae9ca19
15 changed files with 145 additions and 160 deletions
4
init.el
4
init.el
|
@ -137,8 +137,8 @@ by Prelude.")
|
||||||
|
|
||||||
;; Patch security vulnerability in Emacs versions older than 25.3
|
;; Patch security vulnerability in Emacs versions older than 25.3
|
||||||
(when (version< emacs-version "25.3")
|
(when (version< emacs-version "25.3")
|
||||||
(eval-after-load "enriched"
|
(with-eval-after-load "enriched"
|
||||||
'(defun enriched-decode-display-prop (start end &optional param)
|
(defun enriched-decode-display-prop (start end &optional param)
|
||||||
(list start end))))
|
(list start end))))
|
||||||
|
|
||||||
(prelude-eval-after-init
|
(prelude-eval-after-init
|
||||||
|
|
|
@ -35,8 +35,7 @@
|
||||||
(require 'prelude-lisp)
|
(require 'prelude-lisp)
|
||||||
(prelude-require-packages '(clojure-mode cider))
|
(prelude-require-packages '(clojure-mode cider))
|
||||||
|
|
||||||
(eval-after-load 'clojure-mode
|
(with-eval-after-load 'clojure-mode
|
||||||
'(progn
|
|
||||||
(defun prelude-clojure-mode-defaults ()
|
(defun prelude-clojure-mode-defaults ()
|
||||||
(subword-mode +1)
|
(subword-mode +1)
|
||||||
(run-hooks 'prelude-lisp-coding-hook))
|
(run-hooks 'prelude-lisp-coding-hook))
|
||||||
|
@ -44,10 +43,9 @@
|
||||||
(setq prelude-clojure-mode-hook 'prelude-clojure-mode-defaults)
|
(setq prelude-clojure-mode-hook 'prelude-clojure-mode-defaults)
|
||||||
|
|
||||||
(add-hook 'clojure-mode-hook (lambda ()
|
(add-hook 'clojure-mode-hook (lambda ()
|
||||||
(run-hooks 'prelude-clojure-mode-hook)))))
|
(run-hooks 'prelude-clojure-mode-hook))))
|
||||||
|
|
||||||
(eval-after-load 'cider
|
(with-eval-after-load 'cider
|
||||||
'(progn
|
|
||||||
(setq nrepl-log-messages t)
|
(setq nrepl-log-messages t)
|
||||||
|
|
||||||
(add-hook 'cider-mode-hook 'eldoc-mode)
|
(add-hook 'cider-mode-hook 'eldoc-mode)
|
||||||
|
@ -59,7 +57,7 @@
|
||||||
(setq prelude-cider-repl-mode-hook 'prelude-cider-repl-mode-defaults)
|
(setq prelude-cider-repl-mode-hook 'prelude-cider-repl-mode-defaults)
|
||||||
|
|
||||||
(add-hook 'cider-repl-mode-hook (lambda ()
|
(add-hook 'cider-repl-mode-hook (lambda ()
|
||||||
(run-hooks 'prelude-cider-repl-mode-hook)))))
|
(run-hooks 'prelude-cider-repl-mode-hook))))
|
||||||
|
|
||||||
(provide 'prelude-clojure)
|
(provide 'prelude-clojure)
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,7 @@
|
||||||
(require 'prelude-programming)
|
(require 'prelude-programming)
|
||||||
(prelude-require-package 'coffee-mode)
|
(prelude-require-package 'coffee-mode)
|
||||||
|
|
||||||
(eval-after-load 'coffee-mode
|
(with-eval-after-load 'coffee-mode
|
||||||
'(progn
|
|
||||||
;; CoffeeScript uses two spaces.
|
;; CoffeeScript uses two spaces.
|
||||||
(setq coffee-tab-width 2)
|
(setq coffee-tab-width 2)
|
||||||
|
|
||||||
|
@ -54,7 +53,7 @@
|
||||||
(setq prelude-coffee-mode-hook 'prelude-coffee-mode-defaults)
|
(setq prelude-coffee-mode-hook 'prelude-coffee-mode-defaults)
|
||||||
|
|
||||||
(add-hook 'coffee-mode-hook (lambda ()
|
(add-hook 'coffee-mode-hook (lambda ()
|
||||||
(run-hooks 'prelude-coffee-mode-hook)))))
|
(run-hooks 'prelude-coffee-mode-hook))))
|
||||||
(provide 'prelude-coffee)
|
(provide 'prelude-coffee)
|
||||||
|
|
||||||
;;; prelude-coffee.el ends here
|
;;; prelude-coffee.el ends here
|
||||||
|
|
|
@ -71,14 +71,13 @@
|
||||||
(smartparens-strict-mode +1)
|
(smartparens-strict-mode +1)
|
||||||
(whitespace-mode -1)))
|
(whitespace-mode -1)))
|
||||||
|
|
||||||
(eval-after-load "slime"
|
(with-eval-after-load "slime"
|
||||||
'(progn
|
|
||||||
(setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol
|
(setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol
|
||||||
slime-fuzzy-completion-in-place t
|
slime-fuzzy-completion-in-place t
|
||||||
slime-enable-evaluate-in-emacs t
|
slime-enable-evaluate-in-emacs t
|
||||||
slime-autodoc-use-multiline-p t
|
slime-autodoc-use-multiline-p t
|
||||||
slime-auto-start 'always)
|
slime-auto-start 'always)
|
||||||
(define-key slime-mode-map (kbd "C-c C-s") 'slime-selector)))
|
(define-key slime-mode-map (kbd "C-c C-s") 'slime-selector))
|
||||||
|
|
||||||
(provide 'prelude-common-lisp)
|
(provide 'prelude-common-lisp)
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,7 @@
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
(eval-after-load 'css-mode
|
(with-eval-after-load 'css-mode
|
||||||
'(progn
|
|
||||||
(prelude-require-packages '(rainbow-mode))
|
(prelude-require-packages '(rainbow-mode))
|
||||||
|
|
||||||
(setq css-indent-offset 2)
|
(setq css-indent-offset 2)
|
||||||
|
@ -45,7 +44,7 @@
|
||||||
(setq prelude-css-mode-hook 'prelude-css-mode-defaults)
|
(setq prelude-css-mode-hook 'prelude-css-mode-defaults)
|
||||||
|
|
||||||
(add-hook 'css-mode-hook (lambda ()
|
(add-hook 'css-mode-hook (lambda ()
|
||||||
(run-hooks 'prelude-css-mode-hook)))))
|
(run-hooks 'prelude-css-mode-hook))))
|
||||||
|
|
||||||
(provide 'prelude-css)
|
(provide 'prelude-css)
|
||||||
;;; prelude-css.el ends here
|
;;; prelude-css.el ends here
|
||||||
|
|
|
@ -92,17 +92,16 @@ Start `ielm' if it's not already running."
|
||||||
(add-hook 'ielm-mode-hook (lambda ()
|
(add-hook 'ielm-mode-hook (lambda ()
|
||||||
(run-hooks 'prelude-ielm-mode-hook)))
|
(run-hooks 'prelude-ielm-mode-hook)))
|
||||||
|
|
||||||
(eval-after-load "elisp-slime-nav"
|
(with-eval-after-load "elisp-slime-nav"
|
||||||
'(diminish 'elisp-slime-nav-mode))
|
(diminish 'elisp-slime-nav-mode))
|
||||||
(eval-after-load "rainbow-mode"
|
(with-eval-after-load "rainbow-mode"
|
||||||
'(diminish 'rainbow-mode))
|
(diminish 'rainbow-mode))
|
||||||
(eval-after-load "eldoc"
|
(with-eval-after-load "eldoc"
|
||||||
'(diminish 'eldoc-mode))
|
(diminish 'eldoc-mode))
|
||||||
|
|
||||||
(eval-after-load "ielm"
|
(with-eval-after-load "ielm"
|
||||||
'(progn
|
|
||||||
(define-key ielm-map (kbd "M-(") (prelude-wrap-with "("))
|
(define-key ielm-map (kbd "M-(") (prelude-wrap-with "("))
|
||||||
(define-key ielm-map (kbd "M-\"") (prelude-wrap-with "\""))))
|
(define-key ielm-map (kbd "M-\"") (prelude-wrap-with "\"")))
|
||||||
|
|
||||||
;; enable elisp-slime-nav-mode
|
;; enable elisp-slime-nav-mode
|
||||||
(dolist (hook '(emacs-lisp-mode-hook ielm-mode-hook))
|
(dolist (hook '(emacs-lisp-mode-hook ielm-mode-hook))
|
||||||
|
|
|
@ -44,9 +44,8 @@
|
||||||
|
|
||||||
(when (require 'erlang-start nil t)
|
(when (require 'erlang-start nil t)
|
||||||
|
|
||||||
(eval-after-load 'erlang-mode
|
(with-eval-after-load 'erlang-mode
|
||||||
'(progn
|
(flymake-mode))
|
||||||
(flymake-mode)))
|
|
||||||
|
|
||||||
(when (not (null wrangler-path))
|
(when (not (null wrangler-path))
|
||||||
(add-to-list 'load-path wrangler-path)
|
(add-to-list 'load-path wrangler-path)
|
||||||
|
|
|
@ -44,8 +44,7 @@
|
||||||
|
|
||||||
(define-key 'help-command (kbd "G") 'godoc)
|
(define-key 'help-command (kbd "G") 'godoc)
|
||||||
|
|
||||||
(eval-after-load 'go-mode
|
(with-eval-after-load 'go-mode
|
||||||
'(progn
|
|
||||||
(defun prelude-go-mode-defaults ()
|
(defun prelude-go-mode-defaults ()
|
||||||
;; Add to default go-mode key bindings
|
;; Add to default go-mode key bindings
|
||||||
(let ((map go-mode-map))
|
(let ((map go-mode-map))
|
||||||
|
@ -78,7 +77,7 @@
|
||||||
(setq prelude-go-mode-hook 'prelude-go-mode-defaults)
|
(setq prelude-go-mode-hook 'prelude-go-mode-defaults)
|
||||||
|
|
||||||
(add-hook 'go-mode-hook (lambda ()
|
(add-hook 'go-mode-hook (lambda ()
|
||||||
(run-hooks 'prelude-go-mode-hook)))))
|
(run-hooks 'prelude-go-mode-hook))))
|
||||||
|
|
||||||
(provide 'prelude-go)
|
(provide 'prelude-go)
|
||||||
;;; prelude-go.el ends here
|
;;; prelude-go.el ends here
|
||||||
|
|
|
@ -35,8 +35,7 @@
|
||||||
(require 'prelude-programming)
|
(require 'prelude-programming)
|
||||||
(prelude-require-packages '(haskell-mode))
|
(prelude-require-packages '(haskell-mode))
|
||||||
|
|
||||||
(eval-after-load 'haskell-mode
|
(with-eval-after-load 'haskell-mode
|
||||||
'(progn
|
|
||||||
(defun prelude-haskell-mode-defaults ()
|
(defun prelude-haskell-mode-defaults ()
|
||||||
(subword-mode +1)
|
(subword-mode +1)
|
||||||
(eldoc-mode +1)
|
(eldoc-mode +1)
|
||||||
|
@ -46,7 +45,7 @@
|
||||||
(setq prelude-haskell-mode-hook 'prelude-haskell-mode-defaults)
|
(setq prelude-haskell-mode-hook 'prelude-haskell-mode-defaults)
|
||||||
|
|
||||||
(add-hook 'haskell-mode-hook (lambda ()
|
(add-hook 'haskell-mode-hook (lambda ()
|
||||||
(run-hooks 'prelude-haskell-mode-hook)))))
|
(run-hooks 'prelude-haskell-mode-hook))))
|
||||||
|
|
||||||
(provide 'prelude-haskell)
|
(provide 'prelude-haskell)
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,7 @@
|
||||||
(add-to-list 'auto-mode-alist '("\\.pac\\'" . js2-mode))
|
(add-to-list 'auto-mode-alist '("\\.pac\\'" . js2-mode))
|
||||||
(add-to-list 'interpreter-mode-alist '("node" . js2-mode))
|
(add-to-list 'interpreter-mode-alist '("node" . js2-mode))
|
||||||
|
|
||||||
(eval-after-load 'js2-mode
|
(with-eval-after-load 'js2-mode
|
||||||
'(progn
|
|
||||||
(defun prelude-js-mode-defaults ()
|
(defun prelude-js-mode-defaults ()
|
||||||
;; electric-layout-mode doesn't play nice with smartparens
|
;; electric-layout-mode doesn't play nice with smartparens
|
||||||
(setq-local electric-layout-rules '((?\; . after)))
|
(setq-local electric-layout-rules '((?\; . after)))
|
||||||
|
@ -51,7 +50,7 @@
|
||||||
|
|
||||||
(setq prelude-js-mode-hook 'prelude-js-mode-defaults)
|
(setq prelude-js-mode-hook 'prelude-js-mode-defaults)
|
||||||
|
|
||||||
(add-hook 'js2-mode-hook (lambda () (run-hooks 'prelude-js-mode-hook)))))
|
(add-hook 'js2-mode-hook (lambda () (run-hooks 'prelude-js-mode-hook))))
|
||||||
|
|
||||||
(provide 'prelude-js)
|
(provide 'prelude-js)
|
||||||
|
|
||||||
|
|
|
@ -37,10 +37,9 @@
|
||||||
;; for case
|
;; for case
|
||||||
(require 'cl)
|
(require 'cl)
|
||||||
|
|
||||||
(eval-after-load "company"
|
(with-eval-after-load "company"
|
||||||
'(progn
|
|
||||||
(prelude-require-packages '(company-auctex))
|
(prelude-require-packages '(company-auctex))
|
||||||
(company-auctex-init)))
|
(company-auctex-init))
|
||||||
|
|
||||||
(defcustom prelude-latex-fast-math-entry 'LaTeX-math-mode
|
(defcustom prelude-latex-fast-math-entry 'LaTeX-math-mode
|
||||||
"Method used for fast math symbol entry in LaTeX."
|
"Method used for fast math symbol entry in LaTeX."
|
||||||
|
|
|
@ -41,8 +41,7 @@
|
||||||
|
|
||||||
(define-key 'help-command (kbd "R") 'yari)
|
(define-key 'help-command (kbd "R") 'yari)
|
||||||
|
|
||||||
(eval-after-load 'ruby-mode
|
(with-eval-after-load 'ruby-mode
|
||||||
'(progn
|
|
||||||
(defun prelude-ruby-mode-defaults ()
|
(defun prelude-ruby-mode-defaults ()
|
||||||
(inf-ruby-minor-mode +1)
|
(inf-ruby-minor-mode +1)
|
||||||
;; CamelCase aware editing operations
|
;; CamelCase aware editing operations
|
||||||
|
@ -51,7 +50,7 @@
|
||||||
(setq prelude-ruby-mode-hook 'prelude-ruby-mode-defaults)
|
(setq prelude-ruby-mode-hook 'prelude-ruby-mode-defaults)
|
||||||
|
|
||||||
(add-hook 'ruby-mode-hook (lambda ()
|
(add-hook 'ruby-mode-hook (lambda ()
|
||||||
(run-hooks 'prelude-ruby-mode-hook)))))
|
(run-hooks 'prelude-ruby-mode-hook))))
|
||||||
|
|
||||||
(provide 'prelude-ruby)
|
(provide 'prelude-ruby)
|
||||||
;;; prelude-ruby.el ends here
|
;;; prelude-ruby.el ends here
|
||||||
|
|
|
@ -44,8 +44,7 @@
|
||||||
|
|
||||||
(setq rust-format-on-save t)
|
(setq rust-format-on-save t)
|
||||||
|
|
||||||
(eval-after-load 'rust-mode
|
(with-eval-after-load 'rust-mode
|
||||||
'(progn
|
|
||||||
(add-hook 'rust-mode-hook 'racer-mode)
|
(add-hook 'rust-mode-hook 'racer-mode)
|
||||||
(add-hook 'racer-mode-hook 'eldoc-mode)
|
(add-hook 'racer-mode-hook 'eldoc-mode)
|
||||||
(add-hook 'rust-mode-hook 'cargo-minor-mode)
|
(add-hook 'rust-mode-hook 'cargo-minor-mode)
|
||||||
|
@ -60,7 +59,7 @@
|
||||||
(setq prelude-rust-mode-hook 'prelude-rust-mode-defaults)
|
(setq prelude-rust-mode-hook 'prelude-rust-mode-defaults)
|
||||||
|
|
||||||
(add-hook 'rust-mode-hook (lambda ()
|
(add-hook 'rust-mode-hook (lambda ()
|
||||||
(run-hooks 'prelude-rust-mode-hook)))))
|
(run-hooks 'prelude-rust-mode-hook))))
|
||||||
|
|
||||||
(provide 'prelude-rust)
|
(provide 'prelude-rust)
|
||||||
;;; prelude-rust.el ends here
|
;;; prelude-rust.el ends here
|
||||||
|
|
|
@ -38,8 +38,7 @@
|
||||||
|
|
||||||
(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-mode))
|
(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-mode))
|
||||||
|
|
||||||
(eval-after-load 'typescript-mode
|
(with-eval-after-load 'typescript-mode
|
||||||
'(progn
|
|
||||||
(defun prelude-ts-mode-defaults ()
|
(defun prelude-ts-mode-defaults ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(tide-setup)
|
(tide-setup)
|
||||||
|
@ -53,7 +52,7 @@
|
||||||
|
|
||||||
(setq prelude-ts-mode-hook 'prelude-ts-mode-defaults)
|
(setq prelude-ts-mode-hook 'prelude-ts-mode-defaults)
|
||||||
|
|
||||||
(add-hook 'typescript-mode-hook (lambda () (run-hooks 'prelude-ts-mode-hook)))))
|
(add-hook 'typescript-mode-hook (lambda () (run-hooks 'prelude-ts-mode-hook))))
|
||||||
|
|
||||||
(provide 'prelude-ts)
|
(provide 'prelude-ts)
|
||||||
|
|
||||||
|
|
|
@ -61,13 +61,12 @@
|
||||||
(sp-local-tag "=" "<%= " " %>")
|
(sp-local-tag "=" "<%= " " %>")
|
||||||
(sp-local-tag "#" "<%# " " %>"))
|
(sp-local-tag "#" "<%# " " %>"))
|
||||||
|
|
||||||
(eval-after-load 'web-mode
|
(with-eval-after-load 'web-mode
|
||||||
'(progn
|
|
||||||
(defun prelude-web-mode-defaults ())
|
(defun prelude-web-mode-defaults ())
|
||||||
(setq prelude-web-mode-hook 'prelude-web-mode-defaults)
|
(setq prelude-web-mode-hook 'prelude-web-mode-defaults)
|
||||||
|
|
||||||
(add-hook 'web-mode-hook (lambda ()
|
(add-hook 'web-mode-hook (lambda ()
|
||||||
(run-hooks 'prelude-web-mode-hook)))))
|
(run-hooks 'prelude-web-mode-hook))))
|
||||||
|
|
||||||
(provide 'prelude-web)
|
(provide 'prelude-web)
|
||||||
;;; prelude-web.el ends here
|
;;; prelude-web.el ends here
|
||||||
|
|
Loading…
Reference in a new issue