update site url
[~bandali/configs] / .emacs.d / init.el
index 85aeba0..21b47de 100644 (file)
@@ -17,9 +17,9 @@
 
 ;;; Commentary:
 
-;; Emacs configuration of Amin Bandali, computer scientist, functional
-;; programmer, and free software activist.  Uses straight.el for
-;; purely functional and fully reproducible package management.
+;; Emacs configuration of Amin Bandali, computer scientist, free
+;; software activist, GNU maintainer & webmaster.  Uses straight.el
+;; for purely functional and fully reproducible package management.
 
 ;; Over the years, I've taken inspiration from configurations of many
 ;; great people.  Some that I can remember off the top of my head are:
   (previous-line)
   (insert "\n\f\n;;; "))
 
-(defvar b/fill-column 47
-  "My custom `fill-column'.")
+;; (defvar b/fill-column 47
+;;   "My custom `fill-column'.")
 
 (defconst b/asterism "* * *")
 
   (insert
    (concat
     "\n\n"
-    (make-string (floor (/ (- b/fill-column (length b/asterism)) 2))
+    (make-string (floor (/ (- fill-column (length b/asterism)) 2))
                  ?\s)
     b/asterism
     "\n\n")))
@@ -313,9 +313,7 @@ For disabling the behaviour for certain buffers and/or modes."
  scroll-conservatively 10
  scroll-preserve-screen-position 1
  ;; focus follows mouse
- mouse-autoselect-window t
- ;; custom fill-column
- fill-column b/fill-column)
+ mouse-autoselect-window t)
 
 (setq-default
  ;; always use space for indentation
@@ -1328,7 +1326,8 @@ This function is intended for use with `ivy-ignore-buffers'."
 
 (use-feature text-mode
   :bind (:map text-mode-map ("C-*" . b/insert-asterism))
-  :hook (text-mode . indicate-buffer-boundaries-left))
+  :hook ((text-mode . indicate-buffer-boundaries-left)
+         (text-mode . flyspell-mode)))
 
 (use-feature conf-mode
   :mode "\\.*rc$")
@@ -1416,8 +1415,22 @@ This function is intended for use with `ivy-ignore-buffers'."
 
 (use-package alloy-mode
   :straight (:host github :repo "dwwmmn/alloy-mode")
-  :mode "\\.als\\'"
-  :config (setq alloy-basic-offset 2)
+  :mode "\\.\\(als\\|dsh\\)\\'"
+  :config
+  (setq alloy-basic-offset 2)
+  ;; (defun b/alloy-simple-indent (start end)
+  ;;   (interactive "r")
+  ;;   ;; (if (region-active-p)
+  ;;   ;;     (indent-rigidly start end alloy-basic-offset)
+  ;;   ;;   (if (bolp)
+  ;;   ;;       (indent-rigidly (line-beginning-position)
+  ;;   ;;                       (line-end-position)
+  ;;   ;;                       alloy-basic-offset)))
+  ;;   (indent-to (+ (current-column) alloy-basic-offset)))
+  :bind (:map alloy-mode-map
+              ("RET" . electric-newline-and-maybe-indent)
+              ;; ("TAB" . b/alloy-simple-indent)
+              ("TAB" . indent-for-tab-command))
   :hook (alloy-mode . (lambda () (setq-local indent-tabs-mode nil))))
 
 (eval-when-compile (defvar lean-mode-map))
@@ -1476,7 +1489,9 @@ This function is intended for use with `ivy-ignore-buffers'."
   (b/setq-every 2
     web-mode-code-indent-offset
     web-mode-css-indent-offset
-    web-mode-markup-indent-offset))
+    web-mode-markup-indent-offset)
+  :custom
+  (web-mode-enable-auto-indentation nil))
 
 (use-package emmet-mode
   :after (:any web-mode css-mode sgml-mode)
@@ -1690,10 +1705,10 @@ This function is intended for use with `ivy-ignore-buffers'."
     ;; prefixes for global prefixes and minor modes
     "C-c @"   "outline"
     "C-c !"   "flycheck"
-    "C-c 8"   "typo"
-    "C-c 8 -" "typo/dashes"
-    "C-c 8 <" "typo/left-brackets"
-    "C-c 8 >" "typo/right-brackets"
+    ;; "C-c 8"   "typo"
+    ;; "C-c 8 -" "typo/dashes"
+    ;; "C-c 8 <" "typo/left-brackets"
+    ;; "C-c 8 >" "typo/right-brackets"
     "C-x RET" "coding system"
     "C-x 8"   "unicode"
     "C-x @"   "event modifiers"
@@ -1751,7 +1766,7 @@ This function is intended for use with `ivy-ignore-buffers'."
 (use-package crux            ; results in Waiting for git... [2 times]
   :defer 0.4
   :bind (("C-c d"   . crux-duplicate-current-line-or-region)
-         ("C-c D"   . crux-duplicate-and-comment-current-line-or-region)
+         ("C-c M-d" . crux-duplicate-and-comment-current-line-or-region)
          ("C-c f C" . crux-copy-file-preserve-attributes)
          ("C-c f D" . crux-delete-file-and-buffer)
          ("C-c f R" . crux-rename-file-and-buffer)
@@ -1841,8 +1856,6 @@ This function is intended for use with `ivy-ignore-buffers'."
                ("M-w" . boxquote-kill-ring-save)))
 
 (use-package orgalist
-  ;; http://lists.gnu.org/archive/html/emacs-orgmode/2019-04/msg00007.html
-  :disabled t
   :after message
   :hook (message-mode . orgalist-mode))
 
@@ -1850,10 +1863,15 @@ This function is intended for use with `ivy-ignore-buffers'."
 (use-package typo
   :defer 0.5
   :config
-  (typo-global-mode 1)
   :hook (((text-mode erc-mode web-mode) . typo-mode)
          (tex-mode                      . (lambda ()(typo-mode -1)))))
 
+(use-feature electric
+  :disabled
+  :demand
+  :config
+  (electric-quote-mode))
+
 ;; highlight TODOs in buffers
 (use-package hl-todo
   :defer 0.5
@@ -1982,7 +2000,24 @@ This function is intended for use with `ivy-ignore-buffers'."
   :straight (debbugs
              :host github
              :repo "emacs-straight/debbugs"
-             :files (:defaults "Debbugs.wsdl")))
+             :files (:defaults "Debbugs.wsdl"))
+  :bind
+  (("C-c D d" . debbugs-gnu)
+   ("C-c D e" .
+    (lambda ()
+      (interactive)
+      (setq debbugs-gnu-current-suppress t)
+      (debbugs-gnu debbugs-gnu-default-severities '("emacs"))))
+   ("C-c D g" .
+    (lambda ()
+      (interactive)
+      (setq debbugs-gnu-current-suppress t)
+      (debbugs-gnu debbugs-gnu-default-severities '("gnuzilla"))))
+   ("C-c D G" .
+    (lambda ()
+      (interactive)
+      (setq debbugs-gnu-current-suppress t)
+      (debbugs-gnu debbugs-gnu-default-severities '("guix"))))))
 
 (use-package org-ref
   :init
@@ -2130,6 +2165,12 @@ This function is intended for use with `ivy-ignore-buffers'."
   :custom
   (debpaste-paste-is-hidden t))
 
+(use-package scpaste
+  :disabled
+  :config
+  (setq scpaste-http-destination "https://p.bndl.org"
+        scpaste-scp-destination "nix:/var/www/p.bndl.org"))
+
 \f
 ;;; Email (with Gnus)
 
@@ -2172,6 +2213,8 @@ This function is intended for use with `ivy-ignore-buffers'."
                                   (list ".*<\\(.*\\)\\.\\(non\\)?gnu\\.org>.*" "l.\\1")
                                   ;; gnus
                                   (list ".*<\\(.*\\)\\.gnus\\.org>.*" "l.\\1")
+                                  ;; libreplanet
+                                  (list ".*<\\(.*\\)\\.libreplanet\\.org>.*" "l.\\1")
                                   ;; *.lists.sr.ht, omitting one dot if present
                                   ;;    add more \\.?\\([^.]*\\) if needed
                                   (list ".*<~\\(.*\\)/\\([^.]*\\)\\.?\\([^.]*\\)\\.lists.sr.ht>.*" "l.~\\1.\\2\\3")
@@ -2344,7 +2387,7 @@ This function is intended for use with `ivy-ignore-buffers'."
       (to-list    . "webmasters@gnu.org"))
      ("gnu.*"
       (gcc-self . t))
-     ("gnu\\."
+     ("l\\."
       (subscribed . t))
      ("nnimap\\+uw:.*"
       (gcc-self . t)))
@@ -2437,16 +2480,12 @@ This function is intended for use with `ivy-ignore-buffers'."
 
 (use-feature gnus-msg
   :config
-  (defvar b/gnu-signature "Amin Bandali
-Free Software Activist | GNU Maintainer & Webmaster
-GPG: BE62 7373 8E61 6D6D 1B3A  08E8 A21A 0202 4881 6103
-https://bandali.eu.org")
   (defvar b/shemshak-signature "Amin Bandali
 https://shemshak.org/~amin")
   (defvar b/uw-signature "Amin Bandali, MMath Student
 Cheriton School of Computer Science
 University of Waterloo
-https://bandali.eu.org")
+https://bndl.org")
   (defvar b/csc-signature "Amin Bandali
 Systems Committee
 Computer Science Club, University of Waterloo
@@ -2454,8 +2493,7 @@ https://csclub.uwaterloo.ca/~abandali")
   (setq gnus-message-replysign t
         gnus-posting-styles
         '((".*"
-           (address "bandali@gnu.org")
-           (signature b/gnu-signature))
+           (address "bandali@gnu.org"))
           ("nnimap\\+gnu:l\\..*"
            (signature nil))
           ((header "subject" "ThankCRM")
@@ -2478,8 +2516,9 @@ https://csclub.uwaterloo.ca/~abandali")
            (address "bandali@csclub.uwaterloo.ca")
            (signature b/csc-signature)
            (gcc "nnimap+csc:Sent"))))
-  ;; :hook (gnus-message-setup . mml-secure-message-sign)
-  )
+  :hook (gnus-message-setup . (lambda ()
+                                (unless (mml-secure-is-encrypted-p)
+                                  (mml-secure-message-sign)))))
 
 (use-feature gnus-topic
   :hook (gnus-group-mode . gnus-topic-mode)
@@ -2517,6 +2556,8 @@ https://csclub.uwaterloo.ca/~abandali")
         mm-verify-option 'known))
 
 (use-feature mm-uu
+  :config
+  (set-face-attribute 'mm-uu-extract nil :extend t)
   :custom
   (mm-uu-diff-groups-regexp
    "\\(gmane\\|gnu\\|l\\)\\..*\\(diff\\|commit\\|cvs\\|bug\\|dev\\)"))
@@ -2566,8 +2607,8 @@ https://csclub.uwaterloo.ca/~abandali")
   :hook (;; (message-setup . mml-secure-message-sign-pgpmime)
          (message-mode . flyspell-mode)
          (message-mode . (lambda ()
-                           (setq-local fill-column b/fill-column
-                                       message-fill-column b/fill-column)
+                           ;; (setq-local fill-column b/fill-column
+                           ;;             message-fill-column b/fill-column)
                            (make-local-variable 'company-idle-delay)
                            (setq company-idle-delay 0.2))))
   ;; :custom-face
@@ -2603,6 +2644,7 @@ https://csclub.uwaterloo.ca/~abandali")
         ("s" . footnote-set-style)))
 
 (use-package bbdb
+  :disabled
   :demand
   :after gnus
   :bind (:map gnus-group-mode-map ("e" . bbdb))
@@ -2612,49 +2654,47 @@ https://csclub.uwaterloo.ca/~abandali")
   (bbdb-complete-mail-allow-cycling t)
   (bbdb-user-mail-address-re message-dont-reply-to-names))
 
-(comment
-  (use-package ebdb
-    :demand
-    :after gnus
-    :bind (:map gnus-group-mode-map ("e" . ebdb))
-    :config
-    (setq ebdb-sources (b/var "ebdb"))
-    (with-eval-after-load 'swiper
-      (add-to-list 'swiper-font-lock-exclude 'ebdb-mode t)))
+(use-package ebdb
+  :demand
+  :after gnus
+  :bind (:map gnus-group-mode-map ("e" . ebdb))
+  :config
+  (setq ebdb-sources (b/var "ebdb"))
+  (with-eval-after-load 'swiper
+    (add-to-list 'swiper-font-lock-exclude 'ebdb-mode t)))
 
-  (use-feature ebdb-com
-    :after ebdb)
+(use-feature ebdb-com
+  :after ebdb)
 
-  (use-feature ebdb-complete
-    :after ebdb
-    :config
-    ;; (setq ebdb-complete-mail 'capf)
-    (ebdb-complete-enable))
+(use-feature ebdb-complete
+  :after ebdb
+  :config
+  ;; (setq ebdb-complete-mail 'capf)
+  (ebdb-complete-enable))
 
-  (use-feature ebdb-message
-    :demand
-    :after ebdb)
+(use-feature ebdb-message
+  :demand
+  :after ebdb)
 
-  ;; (use-package company-ebdb
-  ;;   :config
-  ;;   (defun company-ebdb--post-complete (_) nil))
+;; (use-package company-ebdb
+;;   :config
+;;   (defun company-ebdb--post-complete (_) nil))
 
-  (use-feature ebdb-gnus
-    :after ebdb
-    :custom
-    (ebdb-gnus-window-size 0.3))
+(use-feature ebdb-gnus
+  :after ebdb
+  :custom
+  (ebdb-gnus-window-size 0.3))
 
-  (use-feature ebdb-mua
-    :demand
-    :after ebdb
-    :custom (ebdb-mua-pop-up t))
+(use-feature ebdb-mua
+  :demand
+  :after ebdb
+  :custom (ebdb-mua-pop-up t))
 
-  ;; (use-package ebdb-message
-  ;;   :after ebdb)
+;; (use-package ebdb-message
+;;   :after ebdb)
 
-  ;; (use-package ebdb-vcard
-  ;;   :after ebdb)
-  )
+;; (use-package ebdb-vcard
+;;   :after ebdb)
 
 (use-package message-x)