[emacs] assimilate and use gnus-alias instead of gnus-posting-styles
authorAmin Bandali <bandali@gnu.org>
Thu, 8 Nov 2018 14:57:11 +0000 (09:57 -0500)
committerAmin Bandali <bandali@gnu.org>
Thu, 8 Nov 2018 14:57:11 +0000 (09:57 -0500)
.gitmodules
init.org
lib/gnus-alias [new submodule]

index db55daa..2469ae7 100644 (file)
 [submodule "git-modes"]
        path = lib/git-modes
        url = git@github.com:magit/git-modes.git
 [submodule "git-modes"]
        path = lib/git-modes
        url = git@github.com:magit/git-modes.git
+[submodule "gnus-alias"]
+       path = lib/gnus-alias
+       url = git@github.com:hexmode/gnus-alias.git
 [submodule "graphql"]
        path = lib/graphql
        url = git@github.com:vermiculus/graphql.el.git
 [submodule "graphql"]
        path = lib/graphql
        url = git@github.com:vermiculus/graphql.el.git
index c784100..8de259e 100644 (file)
--- a/init.org
+++ b/init.org
@@ -1756,7 +1756,7 @@ Hopefully temporary.
 
 ** Gnus
 
 
 ** Gnus
 
-#+begin_src emacs-lisp :tangle yes
+#+begin_src emacs-lisp
 (setq amin-gnus-init-file (no-littering-expand-etc-file-name "gnus"))
 
 (use-package gnus
 (setq amin-gnus-init-file (no-littering-expand-etc-file-name "gnus"))
 
 (use-package gnus
@@ -1782,10 +1782,7 @@ Hopefully temporary.
    '(("amin"
       (display . 20))
      ("uwaterloo"
    '(("amin"
       (display . 20))
      ("uwaterloo"
-      (display . 20)
-      (posting-style
-       (address "abandali@uwaterloo.ca")
-       (gcc "\"nnimap+uwaterloo:Sent Items\""))))
+      (display . 20)))
    gnus-home-directory   (no-littering-expand-var-file-name "gnus/")
    gnus-directory        (no-littering-expand-var-file-name "gnus/News/")
    message-directory     amin-maildir
    gnus-home-directory   (no-littering-expand-var-file-name "gnus/")
    gnus-directory        (no-littering-expand-var-file-name "gnus/News/")
    message-directory     amin-maildir
@@ -1842,19 +1839,55 @@ Hopefully temporary.
   (setq nnmail-extra-headers (append nnmail-extra-headers
                                      '(List-Id X-RT-Originator))))
 
   (setq nnmail-extra-headers (append nnmail-extra-headers
                                      '(List-Id X-RT-Originator))))
 
-(use-package gnus-msg
-  :config
-  (setq gnus-posting-styles
-        '(((header "delivered-to" "amin@aminb.org")
-           (address "amin@aminb.org"))
-          ((header "delivered-to" "gnu@aminb.org")
-           (address "bandali@gnu.org")))))
+(use-package gnus-group
+  :hook (gnus-group-mode . gnus-topic-mode))
 
 (use-package mm-decode
   :config
   (setq mm-discouraged-alternatives '("text/html" "text/richtext")))
 #+end_src
 
 
 (use-package mm-decode
   :config
   (setq mm-discouraged-alternatives '("text/html" "text/richtext")))
 #+end_src
 
+** gnus-alias
+
+#+begin_src emacs-lisp
+(use-package gnus-alias
+  :commands (gnus-alias-determine-identity
+             gnus-alias-select-identity)
+  :bind (:map  message-mode-map
+               ("s-i" . gnus-alias-select-identity))
+  :config
+  (setq
+   gnus-alias-default-identity "amin"
+   gnus-alias-identity-alist
+   '(("amin"
+      nil   ;; Does not refer to any other identity
+      "Amin Bandali <amin@aminb.org>"
+      nil   ;; Organization
+      nil   ;; extra headers
+      nil   ;; extra body text
+      nil)  ;; signature file
+     ("gnu"
+      nil
+      "Amin Bandali <bandali@gnu.org>"
+      nil
+      nil
+      nil
+      nil)
+     ("uw"
+      nil
+      "Amin Bandali <abandali@uwaterloo.ca>"
+      nil
+      (("Gcc" . "\"nnimap+uwaterloo:Sent Items\""))
+      nil
+      nil))
+   gnus-alias-identity-rules
+   '(("amin" ("Delivered-To" "<amin\\@aminb\\.org" both) "amin")
+     ("gnu" ("Delivered-To" "<gnu\\@aminb\\.org" both) "gnu")
+     ("uw" ("any" "<\\(.+\\)\\@uwaterloo\\.ca" both) "uw"))
+   gnus-alias-override-user-mail-address t)
+  :hook (message-setup . gnus-alias-determine-identity))
+#+end_src
+
 ** sendmail
 
 #+begin_src emacs-lisp
 ** sendmail
 
 #+begin_src emacs-lisp
diff --git a/lib/gnus-alias b/lib/gnus-alias
new file mode 160000 (submodule)
index 0000000..9447d3c
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 9447d3ccb4c0e75d0468899cccff7aa249657bac