diff options
author | JSDurand <mmemmew@gmail.com> | 2021-12-26 00:08:56 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2021-12-26 00:08:56 +0800 |
commit | db862fd1f045f3424a9b30990159abf7d3253e53 (patch) | |
tree | 63b7292847b66ca09a795cda7dbec7a237659416 | |
parent | cfad8d73734cfa25412947af49359d2ee64ed923 (diff) |
gnus-conf and mail: clean up formats
This commit mostly cleans up the formats.
-rw-r--r-- | gnus-conf.el | 96 | ||||
-rw-r--r-- | mail.el | 2 |
2 files changed, 76 insertions, 22 deletions
diff --git a/gnus-conf.el b/gnus-conf.el index 0005e8d..97a3d4a 100644 --- a/gnus-conf.el +++ b/gnus-conf.el @@ -1,12 +1,37 @@ ;;; gnus-conf.el --- My Gnus configurations -*- lexical-binding: t; -*- +;; Copyright (C) 2021 Durand + +;; Author: Durand;;; gnus-conf.el --- My Gnus configurations -*- lexical-binding: t; -*- <durand@jsdurand.xyz> +;; Keywords: mail, comm, hardware + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program 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 General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: + +;; This file configures my gnus setup. + +;;; Code: + +(require 'message) (require 'gnus) (require 'epa) (epa-file-enable) (setq gnus-select-method '(nnnil "")) (setq gnus-secondary-select-methods - '(;; (nntp "news.gmane.io") + '((nntp "news.gmane.io") (nnmaildir "gmail" (directory "~/.nnmaildir/gmail")) (nnmaildir "durand" (directory "~/.nnmaildir/mymail")) ;; (nnmaildir "sent" (directory "~/.nnmaildir")) @@ -18,14 +43,15 @@ ;;; Prefer TEXT than HTML mails -(with-eval-after-load "mm-decode" - (add-to-list 'mm-discouraged-alternatives "text/html") - (add-to-list 'mm-discouraged-alternatives "text/richtext")) +(require 'mm-decode) + +(add-to-list 'mm-discouraged-alternatives "text/html") +(add-to-list 'mm-discouraged-alternatives "text/richtext") ;;; display using display-buffer (defun durand-display-gnus (&rest _args) - "Display the group buffer using display-buffer." + "Display the group buffer using `display-buffer'." (cond ((null (get-buffer "*Group*")) (user-error "No group buffer!")) @@ -35,6 +61,8 @@ (advice-add #'gnus :after #'durand-display-gnus) +(autoload 'durand-member "common") + (defun durand-gnus-kill-tab (&rest _args) "Kill the tab when exiting Gnus." (cond @@ -76,6 +104,8 @@ ;;; Decryptions and signatures +(require 'gnus-art) + (setq gnus-buttonized-mime-types '("multipart/signed" "multipart/alternative")) (setq mm-decrypt-option 'known) @@ -84,7 +114,22 @@ ;;; Update by mu4e -(declare-function #'mu4e-update-mail-and-index "mu4e" (RUN-IN-BACKGROUND)) +(autoload 'mu4e-update-mail-and-index "mu4e-utils") + +;; This does not seem to be a good idea. I just keep it here as a +;; reference. + +(defun durand-update-mail (&optional arg) + "Update mails. +If ARG is non-nil, also fetch mails from emacs-devel mailing +list." + (interactive "P") + (mu4e-update-mail-and-index nil) + (cond + (arg + (gnus-agent-toggle-plugged t) + (gnus-group-get-new-news) + (gnus-agent-toggle-plugged nil)))) (define-key gnus-group-mode-map (vector 117) #'mu4e-update-mail-and-index) (define-key global-map (vector ?\C-c ?g) 'gnus) @@ -96,6 +141,8 @@ "mmemmew@gmail.com" "durand@jsdurand.xyz")) +(require 'smtpmail) + (setq send-mail-function #'smtpmail-send-it) (setq smtpmail-smtp-user "durand@jsdurand.xyz") @@ -114,7 +161,7 @@ (setq gnus-parameters `((".*" (posting-style - (gcc "nnmaildir+gmail:Sent"))))) + (gcc "nnmaildir+gmail:sent"))))) (require 'gnus-msg) @@ -146,7 +193,7 @@ "The list of SMTP servers that I use. Each server is a list of the form: -(SENDER SERVER PORT USERNAME) +\(SENDER SERVER PORT USERNAME) SENDER is a string to match the \"FROM\" field of EMails. @@ -200,12 +247,12 @@ USERNAME is used to look up passwords in ~/.authinfo.gpg.") (format "Sending message using '%s' with config '%s'" sender xmess)) (message-send-and-exit)) - (user-error - (concat - "Could not find SMTP Server for this Sender address: %s." - "You might want to correct it or add it to " - "the list 'durand-smtp-servers'.") - sender))))) + ((user-error + (concat + "Could not find SMTP Server for this Sender address: %s." + "You might want to correct it or add it to " + "the list 'durand-smtp-servers'.") + sender)))))) (define-key message-mode-map (vector 3 3) #'durand-set-smtp-server-message-send-and-exit) @@ -214,7 +261,7 @@ USERNAME is used to look up passwords in ~/.authinfo.gpg.") (defvar durand-identities (list - (list "mmew" "Durand <mmemmew@gmail.com>" "nnmaildir+gmail:Sent") + (list "mmew" "Durand <mmemmew@gmail.com>" "nnmaildir+gmail:sent") (list "durand" "Durand <durand@jsdurand.xyz>" "nnmaildir+durand:sent" "Durand")) @@ -273,7 +320,10 @@ identity named durand." ;;; Always view HTML emails in an external browser (defun durand-browse-html-mail-advice (fn &rest args) - "Browse HTML mails in an external browser." + "Browse HTML mails in an external browser. +FN is the function modified by this advice. + +ARGS is the list of arguments passed to FN." (let ((browse-url-browser-function browse-url-secondary-browser-function)) (funcall fn (car args)))) @@ -357,9 +407,11 @@ identity named durand." (define-key gnus-agent-summary-mode-map (vector ?\M-p) #'gnus-summary-prev-thread) (define-key gnus-agent-summary-mode-map (vector ?\C-\M-n) #'gnus-summary-next-group) (define-key gnus-agent-summary-mode-map (vector ?\C-\M-p) #'gnus-summary-prev-group) -(define-key gnus-agent-summary-mode-map (vector ?z ?t) #'recenter-to-top) -(define-key gnus-agent-summary-mode-map (vector ?z ?b) #'recenter-to-bottom) -(define-key gnus-agent-summary-mode-map (vector ?z ?z) #'recenter-to-middle) + +;; I do not use these functions now. +;; (define-key gnus-agent-summary-mode-map (vector ?z ?t) #'recenter-to-top) +;; (define-key gnus-agent-summary-mode-map (vector ?z ?b) #'recenter-to-bottom) +;; (define-key gnus-agent-summary-mode-map (vector ?z ?z) #'recenter-to-middle) (define-key gnus-agent-group-mode-map (vector ?n) #'gnus-group-next-group) (define-key gnus-agent-group-mode-map (vector ?p) #'gnus-group-prev-group) @@ -378,6 +430,9 @@ identity named durand." (setq gnus-article-sort-functions '((not gnus-article-sort-by-number) (not gnus-article-sort-by-date))) + +(require 'gnus-html) + (setq gnus-html-frame-width 80) (setq gnus-inhibit-images nil) (setq gnus-max-image-proportion 0.7) @@ -413,8 +468,7 @@ identity named durand." ;;; Supercite -;; This is suggested by the manual -(autoload 'sc-cite-original "supercite" nil t) +(require 'supercite) ;; This is the only thing we need to enable using Supercite (add-hook 'mail-citation-hook #'sc-cite-original) @@ -99,7 +99,7 @@ (or (mu4e-message-contact-field-matches msg :to "mmemmew@gmail.com") (mu4e-message-contact-field-matches msg :from "mmemmew@gmail.com")))) - :vars '((user-mail-address . "mmemmew@gmail.com") + :vars '((user-mail-address . "durand@jsdurand.xyz") (user-full-name . "Durand") (mu4e-compose-signature . "Sévère Durand") (mu4e-sent-folder . "/gmail/sent") |