From 70026d07d0bef09468b93caabf9a1f425533a69a Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Mon, 10 Feb 2025 15:05:56 -0500 Subject: Drop use-package again I prefer my own manual approach, use-package feels too magical and at times does too much for me. --- .emacs.d/lisp/bandali-gnus.el | 506 ++++++++++++++++++++---------------------- 1 file changed, 238 insertions(+), 268 deletions(-) (limited to '.emacs.d/lisp/bandali-gnus.el') diff --git a/.emacs.d/lisp/bandali-gnus.el b/.emacs.d/lisp/bandali-gnus.el index eeeb50f..312ed6d 100644 --- a/.emacs.d/lisp/bandali-gnus.el +++ b/.emacs.d/lisp/bandali-gnus.el @@ -37,13 +37,10 @@ (declare-function article-make-date-line "gnus-art" (date type)) -(use-package gnus - :bind - ("C-c g" . gnus-plugged) - ("C-c G" . gnus-unplugged) - :custom - (gnus-select-method '(nnnil "")) - (gnus-secondary-select-methods +(with-eval-after-load 'gnus + (setopt + gnus-select-method '(nnnil "") + gnus-secondary-select-methods `((nnimap "kelar" (nnimap-stream plain) @@ -145,9 +142,9 @@ ;; spam ("X-Spam-Flag" "YES" "Junk") ;; catch-all - "INBOX"))))) - (gnus-message-archive-group "nnimap+kelar:INBOX") - (gnus-parameters + "INBOX")))) + gnus-message-archive-group "nnimap+kelar:INBOX" + gnus-parameters '(("l\\.fencepost-users" (to-address . "fencepost-users@gnu.org") (to-list . "fencepost-users@gnu.org") @@ -155,268 +152,241 @@ ("l\\.haskell-cafe" (to-address . "haskell-cafe@haskell.org") (to-list . "haskell-cafe@haskell.org") - (list-identifier . "\\[Haskell-cafe\\]")))) + (list-identifier . "\\[Haskell-cafe\\]"))) ;; (gnus-large-newsgroup 50) - (gnus-process-mark-toggle t) - (gnus-home-directory (b/emacs.d "gnus/")) - (gnus-directory - (expand-file-name - (convert-standard-filename "news/") gnus-home-directory)) - (gnus-interactive-exit nil) - (gnus-user-agent '(emacs gnus type))) - -(use-package message - :after (gnus gnus-sum) - :custom - (message-directory + gnus-process-mark-toggle t + gnus-home-directory (b/emacs.d "gnus/") + gnus-directory (expand-file-name - (convert-standard-filename "mail/") gnus-home-directory)) - (gnus-ignored-from-addresses message-dont-reply-to-names)) + (convert-standard-filename "news/") gnus-home-directory) + gnus-interactive-exit nil + gnus-user-agent '(emacs gnus type)) + + (with-eval-after-load 'message + (setopt + message-directory + (expand-file-name + (convert-standard-filename "mail/") gnus-home-directory))) + + (with-eval-after-load 'nndraft + (setopt + nndraft-directory + (expand-file-name + (convert-standard-filename "drafts/") gnus-home-directory))) + + (with-eval-after-load 'nnimap + (setq nnimap-record-commands init-file-debug)) -(use-package nndraft - :after gnus - :custom - (nndraft-directory - (expand-file-name - (convert-standard-filename "drafts/") gnus-home-directory))) - -(use-package nnimap - :after gnus - :config - (setq nnimap-record-commands init-file-debug)) - -(use-package nnmail - :if (version< emacs-version "27") - :after gnus - :config - (add-to-list - 'nnmail-split-abbrev-alist - '(list . "list-id\\|list-post\\|x-mailing-list\\|x-beenthere\\|x-loop") - 'append)) - -(use-package gnus-agent - :after gnus - :custom - (gnus-agent-synchronize-flags 'ask)) - -(use-package gnus-art ; article - :after gnus - :custom - (gnus-buttonized-mime-types - '("multipart/\\(signed\\|encrypted\\)")) - (gnus-sorted-header-list - '("^From:" - "^X-RT-Originator" - "^Newsgroups:" - "^Subject:" - "^Date:" - "^Envelope-To:" - "^Followup-To:" - "^Reply-To:" - "^Organization:" - "^Summary:" - "^Abstract:" - "^Keywords:" - "^To:" - "^[BGF]?Cc:" - "^Posted-To:" - "^Mail-Copies-To:" - "^Mail-Followup-To:" - "^Apparently-To:" - "^Resent-From:" - "^User-Agent:" - "^X-detected-operating-system:" - "^X-Spam_action:" - "^X-Spam_bar:" - "^Message-ID:" - ;; "^References:" - "^List-Id:" - "^Gnus-Warning:")) - (gnus-visible-headers - (mapconcat #'identity gnus-sorted-header-list "\\|"))) - -(use-package gnus-dired - :after (gnus dired) - :hook - (dired-mode . gnus-dired-mode)) - -(use-package gnus-group - :after gnus - :custom - (gnus-permanently-visible-groups "\\(:INBOX$\\|:gnu$\\)") - :hook - (gnus-group-mode . gnus-topic-mode) - (gnus-group-mode . gnus-agent-mode)) - -(use-package gnus-msg - :after gnus - :init - (let ((bandali "Amin Bandali%s - https://kelar.org/~bandali")) - (defvar b/csc-signature - (mapconcat - #'identity - `(,(format bandali ", MMath") - "Systems Committee " - "Computer Science Club of the University of Waterloo") - "\n"))) - :custom - (gnus-gcc-mark-as-read t) - (gnus-message-replysign t) - (gnus-posting-styles - '(("nnimap\\+kelar:.*" - (address "bandali@kelar.org") - ("X-Message-SMTP-Method" "smtp mail.kelar.org 587") - (gcc "nnimap+kelar:INBOX")) - ("nnimap\\+shemshak:.*" - (address "amin@shemshak.org") - ("X-Message-SMTP-Method" "smtp mail.shemshak.org 587") - (gcc "nnimap+shemshak:Sent")) - ("nnimap\\+debian:.*" - (address "bandali@debian.org") - ("X-Message-SMTP-Method" "smtp mail-submit.debian.org 587") - (gcc "nnimap+debian:INBOX")) - ("nnimap\\+gnu:.*" - (address "bandali@gnu.org") - ("X-Message-SMTP-Method" "smtp fencepost.gnu.org 587") - (gcc "nnimap+gnu:INBOX")) - ("nnimap\\+.*:l\\.ubuntu-.*" - (address "bandali@ubuntu.com") - ("X-Message-SMTP-Method" "smtp mail.kelar.org 587")) - ((header "list-id" ".*\\.lists.ubuntu.com") - (address "bandali@ubuntu.com") - ("X-Message-SMTP-Method" "smtp mail.kelar.org 587")) - ("nnimap\\+csc:.*" - (address "bandali@csclub.uwaterloo.ca") - ("X-Message-SMTP-Method" "smtp mail.csclub.uwaterloo.ca 587") - (signature b/csc-signature) - (gcc "nnimap+csc:Sent"))))) - -(use-package gnus-registry - :disabled - :after gnus - :custom - (gnus-registry-max-entries 2500) - (gnus-registry-ignored-groups - (append gnus-registry-ignored-groups - '(("^nnimap:gnu\\.l" t) ("webmasters$" t)))) - :config - (gnus-registry-initialize)) - -(use-package gnus-search - :after gnus - :custom - (gnus-search-use-parsed-queries t)) - -(use-package gnus-start - :after gnus - :custom - (gnus-save-newsrc-file nil) - (gnus-read-newsrc-file nil) - :hook - (gnus-after-getting-new-news . gnus-notifications)) - -(use-package gnus-sum ; summary - :after gnus - :init - (defun b/gnus-junk-article (&optional n) - (interactive "P" gnus-summary-mode) - (gnus-summary-move-article - n - (gnus-group-prefixed-name - "Junk" - (gnus-find-method-for-group gnus-newsgroup-name)))) - :custom - (gnus-thread-sort-functions - '(gnus-thread-sort-by-number - gnus-thread-sort-by-subject - gnus-thread-sort-by-date)) - :bind - (:map - gnus-summary-mode-map - :prefix-map - b/gnus-summary-prefix-map - :prefix "v" - ("r r" . gnus-summary-very-wide-reply) - ("r q" . gnus-summary-very-wide-reply-with-original) - ("R r" . gnus-summary-reply) - ("R q" . gnus-summary-reply-with-original) - ("r a w" . gnus-summary-show-raw-article) - ("s" . b/gnus-junk-article))) - -(use-package gnus-topic - :after gnus - :custom - ;; (gnus-topic-line-format "%i[ %A: %(%{%n%}%) ]%v\n") - (gnus-topic-line-format "%i[ %(%{%n%}%) (%A) ]%v\n") - :config - (setq gnus-topic-topology - `(("Gnus" visible nil nil) - (("misc" visible nil nil)) - (("csc" visible nil nil)) - (("kelar" visible nil nil)) - (("shemshak" visible nil nil)) - (("debian" visible nil nil)) - (("gnu" visible nil nil)) - ;; (("old-gnu" visible nil nil)) - ))) - -(use-package gnus-win - :after gnus - :custom - (gnus-use-full-window nil)) - -(use-package mm-archive - :after gnus - :config - (add-to-list - 'mm-archive-decoders - '("application/gzip" nil "gunzip" "-S" ".zip" "-kd" "%f" "-r"))) - -(use-package mm-decode - :after gnus - :custom - ;; (mm-attachment-override-types `("text/x-diff" "text/x-patch" - ;; ,@mm-attachment-override-types)) - (mm-discouraged-alternatives '("text/html" "text/richtext")) - (mm-decrypt-option 'known) - (mm-verify-option 'known) - :config - (add-to-list - 'mm-inline-media-tests - `("application/gzip" mm-archive-dissect-and-inline identity)) - (add-to-list 'mm-inlined-types "application/gzip" 'append)) - -(use-package mm-uu - :after gnus - :config - (when (version< "27" emacs-version) - (set-face-attribute 'mm-uu-extract nil :extend t)) (when (version< emacs-version "27") - (setopt mm-uu-diff-groups-regexp "."))) - -(use-package mml - :after gnus - :delight " mml" - :custom - (mml-attach-file-at-the-end t) - (mml-content-disposition-alist - '((text - (markdown . "attachment") - (rtf . "attachment") - (t . "inline")) - (t . "attachment")))) - -(use-package mml-sec - :after mml - :custom - (mml-secure-openpgp-encrypt-to-self t) - (mml-secure-openpgp-sign-with-sender t)) - -(use-package recentf - :after gnus - :config - (add-to-list 'recentf-exclude b/maildir) - (add-to-list 'recentf-exclude gnus-home-directory)) + (with-eval-after-load 'nnmail + (add-to-list + 'nnmail-split-abbrev-alist + '(list . "list-id\\|list-post\\|x-mailing-list\\|x-beenthere\\|x-loop") + 'append))) + + (with-eval-after-load 'gnus-agent + (setopt gnus-agent-synchronize-flags 'ask)) + + (with-eval-after-load 'gnus-art ; article + (setopt + gnus-buttonized-mime-types + '("multipart/\\(signed\\|encrypted\\)") + gnus-sorted-header-list + '("^From:" + "^X-RT-Originator" + "^Newsgroups:" + "^Subject:" + "^Date:" + "^Envelope-To:" + "^Followup-To:" + "^Reply-To:" + "^Organization:" + "^Summary:" + "^Abstract:" + "^Keywords:" + "^To:" + "^[BGF]?Cc:" + "^Posted-To:" + "^Mail-Copies-To:" + "^Mail-Followup-To:" + "^Apparently-To:" + "^Resent-From:" + "^User-Agent:" + "^X-detected-operating-system:" + "^X-Spam_action:" + "^X-Spam_bar:" + "^Message-ID:" + ;; "^References:" + "^List-Id:" + "^Gnus-Warning:") + gnus-visible-headers + (mapconcat #'identity gnus-sorted-header-list "\\|"))) + + ;; `gnus-dired' + (add-hook 'dired-mode-hook #'gnus-dired-mode) + + (with-eval-after-load 'gnus-group + (setopt + gnus-permanently-visible-groups "\\(:INBOX$\\|:gnu$\\)") + (add-hook 'gnus-group-mode-hook #'gnus-topic-mode) + (add-hook 'gnus-group-mode-hook #'gnus-agent-mode)) + + (with-eval-after-load 'gnus-msg + (let ((bandali "Amin Bandali%s - https://kelar.org/~bandali")) + (defvar b/csc-signature + (mapconcat + #'identity + `(,(format bandali ", MMath") + "Systems Committee " + "Computer Science Club of the University of Waterloo") + "\n"))) + (setopt + gnus-gcc-mark-as-read t + gnus-message-replysign t + gnus-posting-styles + '(("nnimap\\+kelar:.*" + (address "bandali@kelar.org") + ("X-Message-SMTP-Method" "smtp mail.kelar.org 587") + (gcc "nnimap+kelar:INBOX")) + ("nnimap\\+shemshak:.*" + (address "amin@shemshak.org") + ("X-Message-SMTP-Method" "smtp mail.shemshak.org 587") + (gcc "nnimap+shemshak:Sent")) + ("nnimap\\+debian:.*" + (address "bandali@debian.org") + ("X-Message-SMTP-Method" "smtp mail-submit.debian.org 587") + (gcc "nnimap+debian:INBOX")) + ("nnimap\\+gnu:.*" + (address "bandali@gnu.org") + ("X-Message-SMTP-Method" "smtp fencepost.gnu.org 587") + (gcc "nnimap+gnu:INBOX")) + ("nnimap\\+.*:l\\.ubuntu-.*" + (address "bandali@ubuntu.com") + ("X-Message-SMTP-Method" "smtp mail.kelar.org 587")) + ((header "list-id" ".*\\.lists.ubuntu.com") + (address "bandali@ubuntu.com") + ("X-Message-SMTP-Method" "smtp mail.kelar.org 587")) + ("nnimap\\+csc:.*" + (address "bandali@csclub.uwaterloo.ca") + ("X-Message-SMTP-Method" "smtp mail.csclub.uwaterloo.ca 587") + (signature b/csc-signature) + (gcc "nnimap+csc:Sent")))) + + ;; `gnus-registry' + ;; (setopt + ;; gnus-registry-max-entries 2500 + ;; gnus-registry-ignored-groups + ;; (append gnus-registry-ignored-groups + ;; '(("^nnimap:gnu\\.l" t) ("webmasters$" t)))) + ;; (require 'gnus-registry) + ;; (gnus-registry-initialize) + + (with-eval-after-load 'gnus-search + (setopt + gnus-search-use-parsed-queries t)) + + (with-eval-after-load 'gnus-start + (setopt + gnus-save-newsrc-file nil + gnus-read-newsrc-file nil) + (unless (fboundp 'gnus-notifications) + (autoload #'gnus-notifications "gnus-start" nil t)) + (add-hook + 'gnus-after-getting-new-news-hook #'gnus-notifications)) + + (with-eval-after-load 'gnus-sum ; summary + (setopt + gnus-thread-sort-functions + '(gnus-thread-sort-by-number + gnus-thread-sort-by-subject + gnus-thread-sort-by-date)) + + (with-eval-after-load 'message + (setopt + gnus-ignored-from-addresses message-dont-reply-to-names)) + + (defun b/gnus-junk-article (&optional n) + (interactive "P" gnus-summary-mode) + (gnus-summary-move-article + n + (gnus-group-prefixed-name + "Junk" + (gnus-find-method-for-group gnus-newsgroup-name)))) + + (defvar b/gnus-summary-prefix-map) + (define-prefix-command 'b/gnus-summary-prefix-map) + (b/keymap-set + gnus-summary-mode-map "v" 'b/gnus-summary-prefix-map) + (let ((m b/gnus-summary-prefix-map)) + (b/keymap-set m "r r" #'gnus-summary-very-wide-reply) + (b/keymap-set m "r q" #'gnus-summary-very-wide-reply-with-original) + (b/keymap-set m "R r" #'gnus-summary-reply) + (b/keymap-set m "R q" #'gnus-summary-reply-with-original) + (b/keymap-set m "r a w" #'gnus-summary-show-raw-article) + (b/keymap-set m "s" #'b/gnus-junk-article))) + + (with-eval-after-load 'gnus-topic + (setopt + ;; gnus-topic-line-format "%i[ %A: %(%{%n%}%) ]%v\n" + gnus-topic-line-format "%i[ %(%{%n%}%) (%A) ]%v\n") + (setq + gnus-topic-topology + `(("Gnus" visible nil nil) + (("misc" visible nil nil)) + (("csc" visible nil nil)) + (("kelar" visible nil nil)) + (("shemshak" visible nil nil)) + (("debian" visible nil nil)) + (("gnu" visible nil nil)) + ;; (("old-gnu" visible nil nil)) + ))) + + (with-eval-after-load 'gnus-win + (setopt gnus-use-full-window nil)) + + (with-eval-after-load 'mm-archive + (add-to-list + 'mm-archive-decoders + '("application/gzip" nil "gunzip" "-S" ".zip" "-kd" "%f" "-r"))) + + (with-eval-after-load 'mm-decode + (setopt + ;; mm-attachment-override-types `("text/x-diff" "text/x-patch" + ;; ,@mm-attachment-override-types) + mm-discouraged-alternatives '("text/html" "text/richtext") + mm-decrypt-option 'known + mm-verify-option 'known) + (add-to-list + 'mm-inline-media-tests + `("application/gzip" mm-archive-dissect-and-inline identity)) + (add-to-list 'mm-inlined-types "application/gzip" 'append)) + + (with-eval-after-load 'mm-uu + (when (version< "27" emacs-version) + (set-face-attribute 'mm-uu-extract nil :extend t)) + (when (version< emacs-version "27") + (setopt mm-uu-diff-groups-regexp "."))) + + (with-eval-after-load 'mml + (setopt + mml-attach-file-at-the-end t + mml-content-disposition-alist + '((text + (markdown . "attachment") + (rtf . "attachment") + (t . "inline")) + (t . "attachment")))) + + (with-eval-after-load 'mml-sec + (setopt + mml-secure-openpgp-encrypt-to-self t + mml-secure-openpgp-sign-with-sender t)) + + (with-eval-after-load 'recentf + (add-to-list 'recentf-exclude b/maildir) + (add-to-list 'recentf-exclude gnus-home-directory)))) +(b/keymap-global-set "C-c g" #'gnus-plugged) +(b/keymap-global-set "C-c G" #'gnus-unplugged) (provide 'bandali-gnus) ;;; bandali-gnus.el ends here -- cgit v1.2.3-60-g2f50