summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnus-conf.el73
1 files changed, 70 insertions, 3 deletions
diff --git a/gnus-conf.el b/gnus-conf.el
index 7d0fa23..e9d6d9a 100644
--- a/gnus-conf.el
+++ b/gnus-conf.el
@@ -66,7 +66,9 @@
;;; To be able to see the encrypted mails sent by me.
-(setq mml-secure-openpgp-encrypt-to-self t)
+(setq mml-secure-openpgp-encrypt-to-self
+ (list "mmemmew@gmail.com"
+ "durand@jsdurand.xyz"))
;;; mail aliases
@@ -89,7 +91,10 @@
;;; user settings
-(setq gnus-ignored-from-addresses "mmemmew@gmail.com")
+(setq gnus-ignored-from-addresses
+ (list
+ "mmemmew@gmail.com"
+ "durand@jsdurand.xyz"))
(setq send-mail-function #'smtpmail-send-it)
(setq smtpmail-smtp-user "durand@jsdurand.xyz")
@@ -109,7 +114,7 @@
(setq gnus-parameters
`((".*"
(posting-style
- (gcc "nnmaildir+private:Sent")))))
+ (gcc "nnmaildir+gmail:Sent")))))
(require 'gnus-msg)
@@ -132,6 +137,8 @@
;;; Multiple SMTP servers
+;;;; Set the correct server on sending mails
+
(defvar durand-smtp-servers nil
"The list of SMTP servers that I use.
Each server is a list of the form:
@@ -200,6 +207,66 @@ USERNAME is used to look up passwords in ~/.authinfo.gpg.")
(define-key message-mode-map (vector 3 3)
#'durand-set-smtp-server-message-send-and-exit)
+;;;; Choose the correct identity when entering message buffers
+
+(defvar durand-identities
+ (list
+ (list "mmew" "Durand <mmemmew@gmail.com>" "nnmaildir+gmail:Sent")
+ (list "durand"
+ "Durand <durand@jsdurand.xyz>"
+ "nnmaildir+durand:sent" "Durand"))
+ "The list of identities to choose.
+Each element is of the form
+
+NICK ADDR GCC [SIG]
+
+NICK: The name to type to choose this identity.
+
+ADDR: The string that appears as the FROM field of the message.
+
+GCC: The string that appears as the GCC field of the message.
+
+SIG: Optionally include a signature.")
+
+(defun durand-choose-identity (&optional arg)
+ "Choose an identity when entering `message-mode'.
+If ARG is non-nil, ask which identity to use. Otherwise use the
+identity named durand."
+ (interactive "P")
+ (let* (choice
+ (identity-to-use
+ (cond
+ (arg
+ (setq choice
+ (completing-read
+ "Choose an identity: " durand-identities nil t))
+ (alist-get choice durand-identities nil nil #'string=))
+ ((alist-get
+ (setq choice "durand")
+ durand-identities nil nil #'string=))
+ ((user-error "No identity crisis!"))))
+ (from (car identity-to-use))
+ (gcc (cadr identity-to-use))
+ (sig (caddr identity-to-use)))
+ (message-remove-header "From")
+ (message-remove-header "Gcc")
+ (message-add-header (format "From: %s" from))
+ (message-add-header (format "Gcc: %s" gcc))
+ ;; deal with signature
+ (cond
+ (sig
+ (save-excursion
+ (goto-char (point-max))
+ (cond
+ ((re-search-backward "^-- $")
+ ;; found a pre-existing signature; let me update this.
+ (forward-line 1)
+ (delete-region (point) (point-max))))
+ (insert sig))))
+ (message "Chose %s as the identity now!" choice)))
+
+(define-key message-mode-map (vector 3 ?i) #'durand-choose-identity)
+
;;; Call me an expert.
(setq gnus-expert-user t)