From a9627518a51f5dc536fa22629a2da680dbc052d1 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Mon, 12 Jun 2023 19:37:49 +1000 Subject: first commit --- .emacs.d/init/ycp-gnus.el | 214 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 214 insertions(+) create mode 100644 .emacs.d/init/ycp-gnus.el (limited to '.emacs.d/init/ycp-gnus.el') diff --git a/.emacs.d/init/ycp-gnus.el b/.emacs.d/init/ycp-gnus.el new file mode 100644 index 0000000..7a03703 --- /dev/null +++ b/.emacs.d/init/ycp-gnus.el @@ -0,0 +1,214 @@ +;;; ycp-gnus.el -- My config for email etc -*- lexical-binding: t -*- + +;; Copyright (C) 2023 Free Software Foundation. + +;; Author: Yuchen Pei +;; Protesilaos Stavrou +;; Maintainer: Yuchen Pei +;; Package-Requires: ((emacs "28.2")) + +;; This file is part of dotfiles. + +;; dotfiles is free software: you can redistribute it and/or modify it under +;; the terms of the GNU Affero General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; dotfiles is distributed in the hope that it will be useful, but WITHOUT +;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General +;; Public License for more details. + +;; You should have received a copy of the GNU Affero General Public +;; License along with dotfiles. If not, see . + +;;; Commentary: + +;; My config for email etc. Covers gnus, bbdb, message mode etc. + +;;; Code: + + +(my-setq-from-local user-mail-address user-full-name) +(setq mail-user-agent 'message-user-agent) +(setq auth-sources '("~/.authinfo.gpg")) + +;;;; `mm-encode' +(my-package mm-encode + (setq mm-encrypt-option nil ; use 'guided if you need more control + mm-sign-option nil)) ; same + +;;;; `mml-sec' +(my-package mml-sec + (setq mml-secure-openpgp-encrypt-to-self t + mml-secure-openpgp-sign-with-sender t + mml-secure-smime-encrypt-to-self t + mml-secure-smime-sign-with-sender t)) + +;;;; `message' +(my-package message + (setq mail-user-agent 'message-user-agent + message-elide-ellipsis "\n> [... %l lines elided]\n" + compose-mail-user-agent-warnings nil + message-mail-user-agent t ; use `mail-user-agent' + message-citation-line-function #'message-insert-formatted-citation-line + message-ignored-cited-headers "" ; default is "." for all headers + message-confirm-send nil + message-kill-buffer-on-exit t + message-wide-reply-confirm-recipients t + message-citation-line-format + "On %a %Y-%m-%d %H:%M:%S %z, %N wrote:\n") + (add-hook 'message-setup-hook #'message-sort-headers) + ) + +(my-package smtpmail + (my-setq-from-local smtpmail-default-smtp-server + smtpmail-smtp-server smtpmail-stream-type) + (setq smtpmail-smtp-service 587 + smtpmail-queue-mail nil)) + +;;;; `sendmail' (mail transfer agent) +(setq send-mail-function 'smtpmail-send-it) + +;;; gnus +(my-package gnus + (setq gnus-select-method '(nnnil "")) + (setq gnus-group-line-format "%M%S%p%P%5y:%B%(%G%) +") + (setq gnus-secondary-select-methods + '( + ;; "fastdove" is just a name given to gnus + (nnimap "fastdove" + (nnimap-address "localhost") + (nnimap-stream plain) + (nnimap-server-port "imap")) + )) + (setq gnus-agent t) + (dolist (mode '(gnus-group-mode-hook + gnus-summary-mode-hook + gnus-browse-mode-hook)) + (add-hook mode #'hl-line-mode)) + (require 'my-gnus) + (my-setq-from-local my-gnus-inbox-group + my-gnus-group-alist) + (my-keybind global-map + "C-c n i" #'my-gnus-open-inbox + "C-c n n" #'my-gnus-start + "C-c n u" #'gnus-group-get-new-news) + (my-server-timer my-gnus-new-news-timer nil 300 + 'my-gnus-group-get-new-news-quietly) + ) + +(my-configure + (:delay 10) + (org-link-set-parameters "gnus" :follow #'my-org-open-gnus-link)) + +(my-package gnus-dired + (add-hook 'dired-mode-hook #'turn-on-gnus-dired-mode)) + +(my-package gnus-msg + (setq gnus-gcc-mark-as-read t) + (setq gnus-message-replysign t) + (my-setq-from-local gnus-posting-styles) + (my-override mm-display-external) + ) + +;; checking sources +(my-package gnus-start + (setq gnus-check-new-newsgroups 'ask-server) + (setq gnus-read-active-file 'some) + (setq gnus-use-dribble-file t) + (setq gnus-always-read-dribble-file t)) + +(my-package gnus-search + (setq gnus-search-use-parsed-queries t)) + +(my-package gnus-win + (setq gnus-use-full-window nil)) + +(my-package gnus-topic + (require 'my-gnus) + (my-keybind gnus-topic-mode-map + "u" #'my-gnus-topic-up + "" #'my-gnus-topic-select-group) + ) + +(my-package gnus-group + (require 'my-gnus) + (my-keybind gnus-group-mode-map + "n" #'next-line + "p" #'previous-line + "m" #'my-gnus-group-compose + "M-&" nil + "" #'my-gnus-topic-select-group) + (add-hook 'gnus-group-mode-hook 'gnus-topic-mode) + ) + +(my-package gnus-sum + (require 'my-gnus) + (setq gnus-ignored-from-addresses user-full-name) + (my-keybind gnus-summary-mode-map + "n" #'my-gnus-summary-next-article-like-mu4e + "p" #'my-gnus-summary-prev-article-like-mu4e + "q" #'my-gnus-summary-exit-like-mu4e + "M-u" nil + "M-&" nil + "m" #'my-gnus-move-article-like-mu4e + "r" #'my-gnus-archive-article-like-mu4e + "d" #'my-gnus-trash-article-like-mu4e + "." #'gnus-summary-show-raw-article) + (setq gnus-sum-thread-tree-root "" + gnus-sum-thread-tree-single-leaf "└>" + gnus-sum-thread-tree-leaf-with-other "├>" + gnus-sum-thread-tree-indent " ") + (setq gnus-summary-line-format "%*%U%R%z %d %(%-20,20f%) %B%S +") + (setq gnus-thread-sort-functions + '(gnus-thread-sort-by-most-recent-date)) + ) + +(my-package nnrss + (:delay 60) + (setq nnrss-use-local t)) + +(my-package gnus-art + (setq gnus-inhibit-images t) + (setq gnus-treat-display-smileys nil) + (setq gnus-article-x-face-too-ugly ".*")) ; all images in headers are outright + ; annoying---disabled! +;; gnus-desktop-notify +(my-package gnus-desktop-notify + (:delay 30) + (gnus-desktop-notify-mode) + (setq gnus-desktop-notify-groups 'gnus-desktop-notify-explicit) + ) + +(my-package gnus-demon + (gnus-demon-add-scanmail)) + +;;; bbdb +(my-package bbdb + (:delay 60) + (bbdb-initialize) + (setq bbdb-mail-user-agent 'gnus-user-agent) + (require 'my-bbdb) + (my-keybind bbdb-mode-map "C-c C-c" #'my-bbdb-done) + (setq bbdb-phone-style nil + bbdb-default-country nil) + (my-override bbdb-read-record) + (my-override bbdb-create) + (my-keybind global-map + "C-c b a" #'my-bbdb-all + "C-c b b" #'bbdb + "C-c b c" #'bbdb-create) + ) + +(my-package bbdb-anniv (:delay 60)) + +;; bbdb-vcard +(my-package bbdb-vcard + (:delay 60) + (bbdb-vcard-default-keybindings) + (my-setq-from-local bbdb-vcard-default-dir)) + +(provide 'ycp-gnus) -- cgit v1.2.3