[emacs] require use-package when debugging
[~bandali/configs] / init.org
index 60031a4..7b8e220 100644 (file)
--- a/init.org
+++ b/init.org
@@ -201,7 +201,8 @@ hacker.
 #+begin_src emacs-lisp
 ;; Main engine start...
 
-(setq straight-repository-branch "develop")
+(setq straight-repository-branch "develop"
+      straight-check-for-modifications '(check-on-save find-when-checking))
 
 (defun a/bootstrap-straight ()
   (defvar bootstrap-version)
@@ -255,11 +256,13 @@ and without compromising on performance.
 
 #+begin_src emacs-lisp
 (straight-use-package 'use-package)
-(if nil  ; set to t when need to debug init
-    (setq use-package-verbose t
-          use-package-expand-minimally nil
-          use-package-compute-statistics t
-          debug-on-error t)
+(if nil                             ; set to t when need to debug init
+    (progn
+      (setq use-package-verbose t
+            use-package-expand-minimally nil
+            use-package-compute-statistics t
+            debug-on-error t)
+      (require 'use-package))
   (setq use-package-verbose nil
         use-package-expand-minimally t))
 
@@ -346,7 +349,8 @@ in my shell.
 (use-package exec-path-from-shell
   :defer 1
   :init
-  (setq exec-path-from-shell-check-startup-files nil)
+  (setq exec-path-from-shell-arguments           nil
+        exec-path-from-shell-check-startup-files nil)
   :config
   (exec-path-from-shell-initialize)
   ;; while we're at it, let's fix access to our running ssh-agent
@@ -798,7 +802,7 @@ And here's where my actual Org configurations begin:
 
 #+begin_src emacs-lisp
 (use-feature org
-  :defer 0.5
+  :defer 2
   :config
   (setq org-src-tab-acts-natively t
         org-src-preserve-indentation nil
@@ -810,13 +814,6 @@ And here's where my actual Org configurations begin:
         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
-   'org-mode
-   '(("[ \t]*\\(#\\+\\(BEGIN\\|END\\|begin\\|end\\)_\\(\\S-+\\)\\)[ \t]*\\([^\n:]*\\)"
-      (1 '(:foreground "#5a5b5a" :background "#292b2b") t) ; directive
-      (3 '(:foreground "#81a2be" :background "#292b2b") t) ; kind
-      (4 '(:foreground "#c5c8c6") t))) ; title
-   t)
   :bind (:map org-mode-map ("M-L" . org-insert-last-stored-link))
   :hook ((org-mode . org-indent-mode)
          (org-mode . auto-fill-mode)
@@ -834,20 +831,15 @@ And here's where my actual Org configurations begin:
   (setq org-latex-listings 'listings
         ;; org-latex-prefer-user-labels t
         )
-  (add-to-list 'org-latex-packages-alist '("" "listings"))
-  (add-to-list 'org-latex-packages-alist '("" "color"))
   (add-to-list 'org-latex-classes
                '("IEEEtran" "\\documentclass[11pt]{IEEEtran}"
-                 ("\\section{%s}" . "\\section*{%s}")
-                 ("\\subsection{%s}" . "\\subsection*{%s}")
+                 ("\\section{%s}"       . "\\section*{%s}")
+                 ("\\subsection{%s}"    . "\\subsection*{%s}")
                  ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
-                 ("\\paragraph{%s}" . "\\paragraph*{%s}")
-                 ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
-               t))
-
-(use-feature ox-beamer
-  :demand
-  :after ox)
+                 ("\\paragraph{%s}"     . "\\paragraph*{%s}")
+                 ("\\subparagraph{%s}"  . "\\subparagraph*{%s}"))
+               t)
+  (require 'ox-beamer))
 #+end_src
 
 **** asynchronous tangle
@@ -886,7 +878,7 @@ file.
          `(lambda (result)
             (if result
                 (progn
-                  (setq byte-compile-warnings '(not noruntime unresolved))
+                  ;; (setq byte-compile-warnings '(not noruntime unresolved))
                   (message "Tangled %s%s"
                            ,file-nodir
                            (if a/show-async-tangle-time
@@ -915,7 +907,7 @@ Not just how I do git, but /the/ way to do git.
 
 #+begin_src emacs-lisp
 (use-package magit
-  :defer 1
+  :defer 2
   :bind (("C-x g" . magit-status)
          ("s-g s" . magit-status)
          ("s-g l" . magit-log-buffer-file))
@@ -1018,7 +1010,7 @@ There's no way I could top that, so I won't attempt to.
 
 #+begin_src emacs-lisp
 (use-feature eshell
-  :defer 1
+  :defer 2
   :commands eshell
   :bind ("C-c a s e" . eshell)
   :config
@@ -1247,9 +1239,17 @@ Highlight matching parens.
 
 #+begin_src emacs-lisp
 (use-feature paren
+  :demand
   :config (show-paren-mode))
 #+end_src
 
+** simple (for column numbers)
+
+#+begin_src emacs-lisp
+(use-feature simple
+  :config (column-number-mode))
+#+end_src
+
 ** =savehist=
 
 Save minibuffer history.
@@ -1291,7 +1291,7 @@ Automatically save place in each file.
 
 #+begin_src emacs-lisp
 (use-package company
-  :defer 1
+  :defer 3
   :bind
   (:map company-active-map
         ([tab]    . company-complete-common-or-cycle)
@@ -1378,7 +1378,7 @@ Automatically save place in each file.
 ** [[https://coq.inria.fr][Coq]] (with [[https://github.com/ProofGeneral/PG][Proof General]])
 
 #+begin_src emacs-lisp
-(use-package proof-site
+(use-package proof-site  ; Proof General
   :straight proof-general)
 #+end_src
 
@@ -1712,7 +1712,7 @@ treemacs
   :after (treemacs))
 #+end_src
 
-** COMMENT geiser
+** geiser
 
 #+begin_src emacs-lisp
 (use-package geiser)
@@ -1722,7 +1722,7 @@ treemacs
   (setq geiser-guile-load-path "~/src/git/guix"))
 #+end_src
 
-** COMMENT guix
+** guix
 
 #+begin_src emacs-lisp
 (use-package guix)
@@ -1810,6 +1810,7 @@ Emacs package that displays available keybindings in popup
 #+begin_src emacs-lisp
 (use-package smart-mode-line
   :commands (sml/apply-theme)
+  :demand
   :config
   (sml/setup))
 #+end_src
@@ -1823,19 +1824,29 @@ Emacs package that displays available keybindings in popup
 ** theme helper functions
 
 #+begin_src emacs-lisp
+(defvar a/org-mode-font-lock-keywords
+  '(("[ \t]*\\(#\\+\\(BEGIN\\|END\\|begin\\|end\\)_\\(\\S-+\\)\\)[ \t]*\\([^\n:]*\\)"
+      (1 '(:foreground "#5a5b5a" :background "#292b2b") t) ; directive
+      (3 '(:foreground "#81a2be" :background "#292b2b") t) ; kind
+      (4 '(:foreground "#c5c8c6") t))))                    ; title
+
 (defun a/lights-on ()
   "Enable my favourite light theme."
   (interactive)
   (mapc #'disable-theme custom-enabled-themes)
   (load-theme 'tangomod t)
-  (sml/apply-theme 'automatic))
+  (sml/apply-theme 'automatic)
+  (font-lock-remove-keywords
+   'org-mode a/org-mode-font-lock-keywords))
 
 (defun a/lights-off ()
   "Go dark."
   (interactive)
   (mapc #'disable-theme custom-enabled-themes)
   (load-theme 'doom-tomorrow-night t)
-  (sml/apply-theme 'automatic))
+  (sml/apply-theme 'automatic)
+  (font-lock-add-keywords
+   'org-mode a/org-mode-font-lock-keywords t))
 
 (bind-keys
  ("s-t d" . a/lights-off)
@@ -1892,7 +1903,7 @@ Emacs package that displays available keybindings in popup
 
 #+begin_src emacs-lisp
 (use-package helpful
-  :defer 1
+  :defer 3
   :bind
   (("C-S-h c" . helpful-command)
    ("C-S-h f" . helpful-callable)        ; helpful-function
@@ -1911,7 +1922,6 @@ Make =*scratch*= and =*Messages*= unkillable.
   :config
   (unkillable-scratch 1)
   :custom
-  (unkillable-scratch-behavior 'do-nothing)
   (unkillable-buffers '("^\\*scratch\\*$" "^\\*Messages\\*$")))
 #+end_src
 
@@ -1985,10 +1995,8 @@ Also see [[https://www.emacswiki.org/emacs/rebox2][rebox2]].
 #+begin_src emacs-lisp
 (use-package shrink-path
   :defer 2
+  :after eshell
   :config
-  (setq eshell-prompt-regexp "\\(.*\n\\)*λ "
-        eshell-prompt-function #'+eshell/prompt)
-
   (defun +eshell/prompt ()
     (let ((base/dir (shrink-path-prompt default-directory)))
       (concat (propertize (car base/dir)
@@ -2008,22 +2016,24 @@ Also see [[https://www.emacswiki.org/emacs/rebox2][rebox2]].
                              collect match))))
       (if (not (eq branch nil))
           (concat " " (substring branch 2))
-        ""))))
+        "")))
+  (setq eshell-prompt-regexp "\\(.*\n\\)*λ "
+                         eshell-prompt-function #'+eshell/prompt))
 #+end_src
 
 ** [[https://github.com/peterwvj/eshell-up][eshell-up]]
 
 #+begin_src emacs-lisp
 (use-package eshell-up
-  :commands eshell-up
-  :after eshell)
+  :after eshell
+  :commands eshell-up)
 #+end_src
 
 ** multi-term
 
 #+begin_src emacs-lisp
 (use-package multi-term
-  :defer 1
+  :defer 3
   :bind (("C-c a s m" . multi-term-dedicated-toggle)
          :map term-mode-map
          ("C-c C-j" . term-char-mode)
@@ -2296,6 +2306,7 @@ Convenient footnotes in =message-mode=.
 #+begin_src emacs-lisp
 (use-package ebdb
   :straight (:host github :repo "girzel/ebdb")
+  :defer 2
   :after gnus
   :bind (:map gnus-group-mode-map ("e" . ebdb))
   :config
@@ -2312,15 +2323,12 @@ Convenient footnotes in =message-mode=.
 ;;   (ebdb-complete-enable))
 
 (use-package company-ebdb
-  :after (:all company message)
+  :defer 2
   :config
-  (defun company-ebdb--post-complete (_) nil)
-  :hook
-  (message-mode . (lambda ()
-                    (add-to-list (make-local-variable 'company-backends)
-                                 'company-ebdb))))
+  (defun company-ebdb--post-complete (_) nil))
 
 (use-feature ebdb-gnus
+  :defer 3
   :after ebdb
   :demand
   :custom
@@ -2333,6 +2341,7 @@ Convenient footnotes in =message-mode=.
                            (ebdb-gnus 0.3))))))
 
 (use-feature ebdb-mua
+  :defer 3
   :after ebdb
   :demand
   ;; :custom (ebdb-mua-pop-up nil)
@@ -2413,5 +2422,5 @@ Display how long it took to load the init file.
 * COMMENT Local Variables                                           :ARCHIVE:
 # Local Variables:
 # eval: (add-hook 'after-save-hook #'a/async-babel-tangle 'append 'local)
-# eval: (typo-mode -1)
+# eval: (when (featurep 'typo (typo-mode -1)))
 # End: