[emacs] drop after! and use with-eval-after-load
[~bandali/configs] / init.org
index 91d70f0..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.")
 
@@ -1700,7 +1675,8 @@ Emacs package that displays available keybindings in popup
        (advice-add 'magit-checkout
                    :after #'my-projectile-invalidate-cache)
        (advice-add 'magit-branch-and-checkout
-                   :after #'my-projectile-invalidate-cache))))
+                   :after #'my-projectile-invalidate-cache)))
+  :custom (projectile-completion-system 'ivy))
 #+end_src
 
 ** [[https://github.com/Wilfred/helpful][helpful]]
@@ -1768,23 +1744,6 @@ Make =*scratch*= and =*Messages*= unkillable.
 
 Also see [[https://www.emacswiki.org/emacs/rebox2][rebox2]].
 
-** COMMENT [[https://github.com/DarthFennec/highlight-indent-guides][highlight-indent-guides]]
-
-#+begin_src emacs-lisp
-(use-package highlight-indent-guides
-  :defer 3
-  :hook ((prog-mode . highlight-indent-guides-mode)
-         ;; (org-mode  . highlight-indent-guides-mode)
-         )
-  :config
-  (setq highlight-indent-guides-character ?\|)
-  (setq highlight-indent-guides-auto-enabled nil)
-  (setq highlight-indent-guides-method 'character)
-  (setq highlight-indent-guides-responsive 'top)
-  (set-face-foreground 'highlight-indent-guides-character-face "gainsboro")
-  (set-face-foreground 'highlight-indent-guides-top-character-face "grey40")) ; grey13 is nice too
-#+end_src
-
 ** typo.el
 
 #+begin_src emacs-lisp
@@ -1835,71 +1794,6 @@ Also see [[https://www.emacswiki.org/emacs/rebox2][rebox2]].
         ""))))
 #+end_src
 
-** COMMENT slack
-
-Hopefully temporary.
-
-#+begin_src emacs-lisp
-(use-package slack
-  :commands (slack-start)
-  :init
-  (eval-when-compile                    ; silence the byte-compiler
-    (defvar url-http-data nil)
-    (defvar url-http-extra-headers nil)
-    (defvar url-http-method nil)
-    (defvar url-callback-function nil)
-    (defvar url-callback-arguments nil)
-    (defvar oauth--token-data nil))
-  (setq slack-buffer-emojify t
-        slack-prefer-current-team t)
-  :config
-  (slack-register-team
-   :name "uw-apv"
-   :default t
-   :client-id uw-apv-client-id
-   :client-secret uw-apv-client-secret
-   :token uw-apv-token
-   :subscribed-channels '(general)
-   :full-and-display-names t)
-  (slack-register-team
-   :name "watform"
-   :default nil
-   :client-id watform-client-id
-   :client-secret watform-client-secret
-   :token watform-token
-   :subscribed-channels '(general)
-   :full-and-display-names t)
-  (add-to-list 'swiper-font-lock-exclude 'slack-message-buffer-mode t)
-  (setq lui-time-stamp-format "[%Y-%m-%d %H:%M:%S]"
-        lui-time-stamp-only-when-changed-p t
-        lui-time-stamp-position 'right)
-  :bind
-  (("C-c s s" . slack-start)
-   ("C-c s u" . slack-select-unread-rooms)
-   ("C-c s b" . slack-select-rooms)
-   ("C-c s t" . slack-change-current-team)
-   ("C-c s c" . slack-ws-close)
-   :map slack-mode-map
-   ("M-p"     . slack-buffer-goto-prev-message)
-   ("M-n"     . slack-buffer-goto-next-message)
-   ("C-c e"   . slack-message-edit)
-   ("C-c k"   . slack-message-delete)
-   ("C-c C-k" . slack-channel-leave)
-   ("C-c r a" . slack-message-add-reaction)
-   ("C-c r r" . slack-message-remove-reaction)
-   ("C-c r s" . slack-message-show-reaction-users)
-   ("C-c p l" . slack-room-pins-list)
-   ("C-c p a" . slack-message-pins-add)
-   ("C-c p r" . slack-message-pins-remove)
-   ("@"       . slack-message-embed-mention)
-   ("#"       . slack-message-embed-channel)))
-
-(use-package alert
-  :commands (alert)
-  :init
-  (setq alert-default-style 'notifier))
-#+end_src
-
 ** [[https://github.com/peterwvj/eshell-up][eshell-up]]
 
 #+begin_src emacs-lisp
@@ -1965,7 +1859,7 @@ Hopefully temporary.
 
 #+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
 
@@ -2139,7 +2033,7 @@ Hopefully temporary.
   ;; (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
@@ -2176,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
@@ -2220,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