[emacs] drop after! and use with-eval-after-load
[~bandali/configs] / init.org
index 43ae46e..61af647 100644 (file)
--- 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
@@ -659,8 +626,7 @@ Based on https://stackoverflow.com/a/17788551, with changes to use
 =cl-letf= instead of the now obsolete =flet=.
 
 #+begin_src emacs-lisp
-(use-package compile
-  :config
+(with-eval-after-load 'compile
   (defun amin--compilation-finish-function (buffer outstr)
     (unless (string-match "finished" outstr)
       (switch-to-buffer-other-window buffer))
@@ -693,6 +659,12 @@ for this.
 ;; (setq replace-char-fold t)
 #+end_src
 
+*** Cursor shape
+
+#+begin_src emacs-lisp
+(setq-default cursor-type 'bar)
+#+end_src
+
 ** Bindings
 
 #+begin_src emacs-lisp
@@ -762,6 +734,9 @@ In short, my favourite way of life.
         org-edit-src-content-indentation 0
         org-email-link-description-format "Email %c: %s" ; %.30s
         org-highlight-latex-and-related '(entities)
+        org-use-speed-commands t
+        org-startup-folded 'content
+        org-catch-invisible-edits 'show-and-error
         org-log-done 'time)
   (add-to-list 'org-structure-template-alist '("L" . "src emacs-lisp") t)
   (font-lock-add-keywords
@@ -814,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.")
 
@@ -1884,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
 
@@ -2058,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
@@ -2095,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
@@ -2139,39 +2114,6 @@ Convenient footnotes in =message-mode=.
 ;;   :after ebdb)
 #+end_src
 
-** COMMENT bbdb
-
-Manually install bbdb (=lisp/bbdb= copied from an ELPA-based setup),
-because installing it from source on Emacs 27 using the following
-submodule configuration for some reason doesn’t work and results in
-very strange errors when using any of the functions.
-
-#+begin_src conf :tangle no
-[submodule "bbdb"]
-       path = lib/bbdb
-       url = https://git.savannah.nongnu.org/git/bbdb.git
-       load-path = lisp
-       info-path = doc
-       build-step = ./autogen.sh
-       build-step = ./configure
-       build-step = make
-       build-step = make install
-#+end_src
-
-I tried using =borg-elpa= instead of doing it like this, but it added
-2 seconds to my startup time, which is unacceptable to me.
-
-#+begin_src emacs-lisp
-(use-package bbdb
-  :load-path "lisp/bbdb"
-  :init
-  (load (expand-file-name "lisp/bbdb/bbdb-autoloads.el" user-emacs-directory))
-  ;; (bbdb-mua-auto-update-init 'message)
-  (setq bbdb-mua-auto-update-p 'query
-        bbdb-complete-mail nil)
-  (bbdb-initialize 'gnus 'message))
-#+end_src
-
 ** COMMENT message-x
 
 #+begin_src emacs-lisp