From: Amin Bandali Date: Sun, 23 Dec 2018 19:44:10 +0000 (-0500) Subject: [emacs] drop after! and use with-eval-after-load X-Git-Url: https://git.shemshak.org/gitweb.cgi/~bandali/configs/commitdiff_plain/ab6781dd1f90e15d55768d63b2698d12913ab741 [emacs] drop after! and use with-eval-after-load --- diff --git a/init.org b/init.org index 3a170a3..61af647 100644 --- a/init.org +++ b/init.org @@ -447,39 +447,6 @@ buffers and/or modes. ** Useful utilities -#+begin_src emacs-lisp -(defun amin-enlist (exp) - "Return EXP wrapped in a list, or as-is if already a list." -(if (listp exp) exp (list exp))) - -; from https://github.com/hlissner/doom-emacs/commit/589108fdb270f24a98ba6209f6955fe41530b3ef -(defmacro after! (features &rest body) - "A smart wrapper around `with-eval-after-load'. Supresses warnings during -compilation." - (declare (indent defun) (debug t)) - (list (if (or (not (bound-and-true-p byte-compile-current-file)) - (dolist (next (amin-enlist features)) - (if (symbolp next) - (require next nil :no-error) - (load next :no-message :no-error)))) - #'progn - #'with-no-warnings) - (cond ((symbolp features) - `(eval-after-load ',features '(progn ,@body))) - ((and (consp features) - (memq (car features) '(:or :any))) - `(progn - ,@(cl-loop for next in (cdr features) - collect `(after! ,next ,@body)))) - ((and (consp features) - (memq (car features) '(:and :all))) - (dolist (next (cdr features)) - (setq body `(after! ,next ,@body))) - body) - ((listp features) - `(after! (:all ,@features) ,@body))))) -#+end_src - Convenience macro for =setq='ing multiple variables to the same value: #+begin_src emacs-lisp @@ -822,7 +789,7 @@ d/async-babel-tangle]] which uses [[https://github.com/jwiegley/emacs-async][asy file. #+begin_src emacs-lisp -(after! org +(with-eval-after-load 'org (defvar amin-show-async-tangle-results nil "Keep *emacs* async buffers around for later inspection.") @@ -1892,7 +1859,7 @@ Also see [[https://www.emacswiki.org/emacs/rebox2][rebox2]]. #+begin_src emacs-lisp (defvar amin-maildir (expand-file-name "~/mail/")) -(after! recentf +(with-eval-after-load 'recentf (add-to-list 'recentf-exclude amin-maildir)) #+end_src @@ -2066,7 +2033,7 @@ Also see [[https://www.emacswiki.org/emacs/rebox2][rebox2]]. ;; (message-header-cc ((t (:foreground "#333" :weight normal)))) ) -(after! mml-sec +(with-eval-after-load 'mml-sec (setq mml-secure-openpgp-encrypt-to-self t mml-secure-openpgp-sign-with-sender t)) #+end_src @@ -2103,7 +2070,7 @@ Convenient footnotes in =message-mode=. :bind (:map gnus-group-mode-map ("e" . ebdb)) :config (setq ebdb-sources (no-littering-expand-var-file-name "ebdb")) - (after! swiper + (with-eval-after-load 'swiper (add-to-list 'swiper-font-lock-exclude 'ebdb-mode t))) (use-package ebdb-com