[emacs] remove some unused packages
[~bandali/configs] / init.org
index 79dbbd2..b144736 100644 (file)
--- a/init.org
+++ b/init.org
@@ -65,7 +65,7 @@ make build
 ** First line
 
 #+begin_src emacs-lisp :comments none
-;;; init.el --- Amin Bandali's Emacs config -*- lexical-binding: t -*-
+;;; init.el --- Amin Bandali's Emacs config -*- lexical-binding: t; eval: (view-mode 1) -*-
 #+end_src
 
 Enable =view-mode=, which both makes the file read-only (as a reminder
@@ -124,13 +124,6 @@ The conventions below were inspired by [[https://github.com/hlissner/doom-emacs]
 :CUSTOM_ID: initial-setup
 :END:
 
-#+begin_src emacs-lisp :comments none
-;;; Code:
-
-\f
-;; * Initial setup
-#+end_src
-
 ** Emacs initialization
 
 I'd like to do a couple of measurements of Emacs' startup time. First,
@@ -352,14 +345,12 @@ in my shell.
   (exec-path-from-shell-copy-env "SSH_AUTH_SOCK"))
 #+end_src
 
-** Only one custom theme at a time
+** COMMENT Only one custom theme at a time
 
 #+begin_src emacs-lisp
-;; only one custom theme at a time
-;;
-;; (defadvice load-theme (before clear-previous-themes activate)
-;;   "Clear existing theme settings instead of layering them"
-;;   (mapc #'disable-theme custom-enabled-themes))
+(defadvice load-theme (before clear-previous-themes activate)
+  "Clear existing theme settings instead of layering them"
+  (mapc #'disable-theme custom-enabled-themes))
 #+end_src
 
 ** Server
@@ -378,44 +369,42 @@ See [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.htm
   :config (or (server-running-p) (server-mode)))
 #+end_src
 
-** Unicode support
+** COMMENT Unicode support
 
 Font stack with better unicode support, around =Ubuntu Mono= and
 =Hack=.
 
 #+begin_src emacs-lisp
-;; unicode support
-;;
-;; (dolist (ft (fontset-list))
-;;   (set-fontset-font
-;;    ft
-;;    'unicode
-;;    (font-spec :name "Source Code Pro" :size 14))
-;;   (set-fontset-font
-;;    ft
-;;    'unicode
-;;    (font-spec :name "DejaVu Sans Mono")
-;;    nil
-;;    'append)
-;;   ;; (set-fontset-font
-;;   ;;  ft
-;;   ;;  'unicode
-;;   ;;  (font-spec
-;;   ;;   :name "Symbola monospacified for DejaVu Sans Mono")
-;;   ;;  nil
-;;   ;;  'append)
-;;   ;; (set-fontset-font
-;;   ;;  ft
-;;   ;;  #x2115  ; ℕ
-;;   ;;  (font-spec :name "DejaVu Sans Mono")
-;;   ;;  nil
-;;   ;;  'append)
-;;   (set-fontset-font
-;;    ft
-;;    (cons ?Α ?ω)
-;;    (font-spec :name "DejaVu Sans Mono" :size 14)
-;;    nil
-;;    'prepend))
+(dolist (ft (fontset-list))
+  (set-fontset-font
+   ft
+   'unicode
+   (font-spec :name "Source Code Pro" :size 14))
+  (set-fontset-font
+   ft
+   'unicode
+   (font-spec :name "DejaVu Sans Mono")
+   nil
+   'append)
+  ;; (set-fontset-font
+  ;;  ft
+  ;;  'unicode
+  ;;  (font-spec
+  ;;   :name "Symbola monospacified for DejaVu Sans Mono")
+  ;;  nil
+  ;;  'append)
+  ;; (set-fontset-font
+  ;;  ft
+  ;;  #x2115  ; ℕ
+  ;;  (font-spec :name "DejaVu Sans Mono")
+  ;;  nil
+  ;;  'append)
+  (set-fontset-font
+   ft
+   (cons ?Α ?ω)
+   (font-spec :name "DejaVu Sans Mono" :size 14)
+   nil
+   'prepend))
 #+end_src
 
 ** Gentler font resizing
@@ -498,11 +487,6 @@ Convenience macro for =setq='ing multiple variables to the same value:
 :CUSTOM_ID: core
 :END:
 
-#+begin_src emacs-lisp :comments none
-\f
-;; * Core
-#+end_src
-
 ** Defaults
 
 *** Time and battery in mode-line
@@ -662,18 +646,35 @@ Enable =winner-mode=.
 (winner-mode 1)
 #+end_src
 
-*** Close =*compilation*= on success
+*** Don’t display =*compilation*= on success
+
+From https://stackoverflow.com/a/17788551.
 
 #+begin_src emacs-lisp
-(setq compilation-exit-message-function
-      (lambda (status code msg)
-        "Close the compilation window if successful."
-        ;; if M-x compile exits with 0
-         (when (and (eq status 'exit) (zerop code))
-           (bury-buffer)
-           (delete-window (get-buffer-window (get-buffer "*compilation*"))))
-         ;; return the result of compilation-exit-message-function
-         (cons msg code)))
+(defun amin--compilation-finish-function (buffer outstr)
+  (unless (string-match "finished" outstr)
+    (switch-to-buffer-other-window buffer))
+  t)
+
+(setq compilation-finish-functions #'amin--compilation-finish-function)
+
+(require 'cl)
+
+(defadvice compilation-start
+    (around inhibit-display
+            (command &optional mode name-function highlight-regexp))
+  (if (not (string-match "^\\(find\\|grep\\)" command))
+      (flet ((display-buffer)
+             (set-window-point)
+             (goto-char))
+        (fset 'display-buffer   'ignore)
+        (fset 'goto-char        'ignore)
+        (fset 'set-window-point 'ignore)
+        (save-window-excursion
+          ad-do-it))
+    ad-do-it))
+
+(ad-activate 'compilation-start)
 #+end_src
 
 *** Search for non-ASCII characters
@@ -1056,11 +1057,6 @@ There's no way I could top that, so I won't attempt to.
 
 * Borg's =layer/essentials=
 
-#+begin_src emacs-lisp :comments none
-\f
-;; * Borg's `layer/essentials'
-#+end_src
-
 TODO: break this giant source block down into individual org sections.
 
 #+begin_src emacs-lisp
@@ -1139,24 +1135,10 @@ TODO: break this giant source block down into individual org sections.
   (add-to-list 'tramp-default-proxies-alist
                (list (regexp-quote (system-name)) nil nil)))
 
-(use-package undo-tree
-  :config
-  (global-undo-tree-mode -1))
-  ;; :bind (("C-?" . undo-tree-undo)
-  ;;        ("M-_" . undo-tree-redo))
-  ;; :config
-  ;; (global-undo-tree-mode)
-  ;; (setq undo-tree-mode-lighter ""
-  ;;       undo-tree-auto-save-history t))
 #+end_src
 
 * Editing
 
-#+begin_src emacs-lisp :comments none
-\f
-;; * Editing
-#+end_src
-
 ** Company
 
 #+begin_src emacs-lisp
@@ -1178,11 +1160,6 @@ TODO: break this giant source block down into individual org sections.
 
 * Syntax and spell checking
 
-#+begin_src emacs-lisp :comments none
-\f
-;; * Syntax and spell checking
-#+end_src
-
 #+begin_src emacs-lisp
 (use-package flycheck
   :defer 3
@@ -1226,11 +1203,6 @@ TODO: break this giant source block down into individual org sections.
 #+end_src
 * Programming modes
 
-#+begin_src emacs-lisp :comments none
-\f
-;; * Programming modes
-#+end_src
-
 ** [[http://alloytools.org][Alloy]] (with [[https://github.com/dwwmmn/alloy-mode][alloy-mode]])
 
 #+begin_src emacs-lisp
@@ -1500,19 +1472,11 @@ instead.
   :hook (web-mode css-mode html-mode sgml-mode))
 #+end_src
 
-** Nix
-
-#+begin_src emacs-lisp
-(use-package nix-mode
-  :defer t
-  :mode "\\.nix\\'")
-#+end_src
-
-** Java
+** COMMENT Java
 
 *** meghanada
 
-#+begin_src emacs-lisp :tangle no
+#+begin_src emacs-lisp
 (use-package meghanada
   :bind
   (:map meghanada-mode-map
@@ -1539,7 +1503,7 @@ tree-mode
 treemacs
 #+end_comment
 
-#+begin_src emacs-lisp :tangle no
+#+begin_src emacs-lisp
 (use-package treemacs
   :config (setq treemacs-never-persist t))
 
@@ -1591,11 +1555,6 @@ treemacs
 
 * Emacs Enhancements
 
-#+begin_src emacs-lisp :comments none
-\f
-;; * Emacs Enhancements
-#+end_src
-
 ** [[https://github.com/justbur/emacs-which-key][which-key]]
 
 #+begin_quote
@@ -1615,13 +1574,12 @@ Emacs package that displays available keybindings in popup
 (load-theme 'tangomod t)
 #+end_src
 
-** doom-modeline
+** smart-mode-line
 
 #+begin_src emacs-lisp
-(use-package doom-modeline
-  :demand t
-  :config (setq doom-modeline-height 32)
-  :hook (after-init . doom-modeline-init))
+(use-package smart-mode-line
+  :config
+  (sml/setup))
 #+end_src
 
 ** doom-themes
@@ -1636,16 +1594,16 @@ Emacs package that displays available keybindings in popup
 (defun amin/lights-on ()
   "Enable my favourite light theme."
   (interactive)
-  (progn
-    (mapc #'disable-theme custom-enabled-themes)
-    (load-theme 'tangomod t)))
+  (mapc #'disable-theme custom-enabled-themes)
+  (load-theme 'tangomod t)
+  (sml/apply-theme 'automatic))
 
 (defun amin/lights-off ()
   "Go dark."
   (interactive)
-  (progn
-    (mapc #'disable-theme custom-enabled-themes)
-    (load-theme 'doom-tomorrow-night t)))
+  (mapc #'disable-theme custom-enabled-themes)
+  (load-theme 'doom-tomorrow-night t)
+  (sml/apply-theme 'automatic))
 
 (bind-keys
  ("s-t d" . amin/lights-off)
@@ -1810,11 +1768,10 @@ Make =*scratch*= and =*Messages*= unkillable.
 
 Also see [[https://www.emacswiki.org/emacs/rebox2][rebox2]].
 
-** [[https://github.com/DarthFennec/highlight-indent-guides][highlight-indent-guides]]
+** COMMENT [[https://github.com/DarthFennec/highlight-indent-guides][highlight-indent-guides]]
 
 #+begin_src emacs-lisp
 (use-package highlight-indent-guides
-  :disabled t
   :defer 3
   :hook ((prog-mode . highlight-indent-guides-mode)
          ;; (org-mode  . highlight-indent-guides-mode)
@@ -1847,12 +1804,6 @@ Also see [[https://www.emacswiki.org/emacs/rebox2][rebox2]].
         ("l"   . image-forward-hscroll)))
 #+end_src
 
-** anzu
-
-#+begin_src emacs-lisp
-(use-package anzu)
-#+end_src
-
 ** typo.el
 
 #+begin_src emacs-lisp
@@ -1903,13 +1854,12 @@ Also see [[https://www.emacswiki.org/emacs/rebox2][rebox2]].
         ""))))
 #+end_src
 
-** slack
+** COMMENT slack
 
 Hopefully temporary.
 
 #+begin_src emacs-lisp
 (use-package slack
-  :disabled t
   :commands (slack-start)
   :init
   (eval-when-compile                    ; silence the byte-compiler
@@ -2019,11 +1969,6 @@ Hopefully temporary.
 
 * Email
 
-#+begin_src emacs-lisp :comments none
-\f
-;; * Email
-#+end_src
-
 #+begin_src emacs-lisp
 (defvar amin-maildir (expand-file-name "~/mail/"))
 (after! recentf
@@ -2260,11 +2205,10 @@ I tried using =borg-elpa= instead of doing it like this, but it added
   (bbdb-initialize 'gnus 'message))
 #+end_src
 
-** message-x
+** COMMENT message-x
 
 #+begin_src emacs-lisp
 (use-package message-x
-  :disabled t
   :custom
   (message-x-completion-alist
    (quote
@@ -2276,11 +2220,10 @@ I tried using =borg-elpa= instead of doing it like this, but it added
       . message-expand-group)))))
 #+end_src
 
-** gnus-harvest
+** COMMENT gnus-harvest
 
 #+begin_src emacs-lisp
 (use-package gnus-harvest
-  :disabled t
   :commands gnus-harvest-install
   :demand t
   :config
@@ -2291,11 +2234,6 @@ I tried using =borg-elpa= instead of doing it like this, but it added
 
 * Blogging
 
-#+begin_src emacs-lisp :comments none
-\f
-;; * Blogging
-#+end_src
-
 ** [[https://ox-hugo.scripter.co][ox-hugo]]
 
 #+begin_src emacs-lisp
@@ -2311,11 +2249,6 @@ I tried using =borg-elpa= instead of doing it like this, but it added
 :CUSTOM_ID: post-initialization
 :END:
 
-#+begin_src emacs-lisp :comments none
-\f
-;; * Post initialization
-#+end_src
-
 Display how long it took to load the init file.
 
 #+begin_src emacs-lisp