[emacs] start configuring Gnus :)
[~bandali/configs] / init.org
index 17db595..ecf3a88 100644 (file)
--- a/init.org
+++ b/init.org
@@ -648,14 +648,20 @@ Enable =winner-mode=.
 #+begin_src emacs-lisp
 (bind-keys
  ("C-c b k" . kill-this-buffer)
- ;; ("C-c s s" . save-buffer)
  ("C-c b s" . save-buffer)
  ("C-c S"   . save-buffer)
  ("C-c o"   . other-window)
  ("C-c q q" . save-buffers-kill-terminal)
+
  ("C-c F m" . make-frame-command)
  ("C-c F d" . delete-frame)
- ("C-c F D" . delete-other-frames))
+ ("C-c F D" . delete-other-frames)
+
+ ("s-c e b" . eval-buffer)
+ ("s-c e r" . eval-region)
+
+ ("s-p"     . beginning-of-buffer)
+ ("s-n"     . end-of-buffer))
 #+end_src
 
 ** Packages
@@ -790,8 +796,7 @@ Not just how I do git, but /the/ way to do git.
 (use-package magit
   :defer t
   :bind
-  (("s-g"   . magit-dispatch-popup)
-   ("C-x g" . magit-status)
+  (("s-g" . magit-status)
    :prefix-map amin--magit-prefix-map
    :prefix "C-c g"
    ("SPC" . magit-status)
@@ -970,8 +975,8 @@ There's no way I could top that, so I won't attempt to.
   (:map
    outline-minor-mode-map
    ("<s-tab>"  . outline-toggle-children)
-   ("s-p"      . outline-previous-visible-heading)
-   ("s-n"      . outline-next-visible-heading)
+   ("M-p"      . outline-previous-visible-heading)
+   ("M-n"      . outline-next-visible-heading)
    :prefix-map amin--outline-prefix-map
    :prefix "s-o"
    ("TAB" . outline-toggle-children)
@@ -1094,6 +1099,10 @@ TODO: break this giant source block down into individual org sections.
 #+begin_src emacs-lisp
 (use-package flycheck
   :hook (prog-mode . flycheck-mode)
+  :bind
+  (:map flycheck-mode-map
+        ("M-P" . flycheck-previous-error)
+        ("M-N" . flycheck-next-error))
   :config
   ;; Use the load-path from running Emacs when checking elisp files
   (setq flycheck-emacs-lisp-load-path 'inherit)
@@ -1534,12 +1543,23 @@ Emacs package that displays available keybindings in popup
 #+begin_src emacs-lisp
 (use-package helpful
   :bind
-  (("C-h f"   . helpful-callable)
+  (;; ("C-h F"   . helpful-function)
+   ("C-h f"   . helpful-callable)
    ("C-h v"   . helpful-variable)
    ("C-h k"   . helpful-key)
    ("C-c C-d" . helpful-at-point)
-   ("C-h F"   . helpful-function)
-   ("C-h C"   . helpful-command)))
+   ("C-h C"   . helpful-command)
+   ("C-h c"   . describe-char)
+   ("C-h F"   . describe-face)))
+
+(use-package help
+  :bind
+  (("C-S-h f" . describe-function)
+   ("C-S-h v" . describe-variable)
+   ("C-S-h k" . describe-key)
+   ("C-S-h C" . describe-coding-system)
+   ("C-S-h c" . describe-key-briefly))
+  :config (setq help-window-select t))
 #+end_src
 
 ** [[https://github.com/kyagi/shell-pop-el][shell-pop]]
@@ -1683,7 +1703,8 @@ Hopefully temporary.
    :client-secret watform-client-secret
    :token watform-token
    :subscribed-channels '(general)
-   :full-and-display-names t);
+   :full-and-display-names t)
+  (add-to-list 'swiper-font-lock-exclude 'slack-message-buffer-mode t)
   :bind
   (("C-c s s" . slack-start)
    ("C-c s u" . slack-select-unread-rooms)
@@ -1703,7 +1724,7 @@ Hopefully temporary.
    ("C-c p a" . slack-message-pins-add)
    ("C-c p r" . slack-message-pins-remove)
    ("@"       . slack-message-embed-mention)
-   ("#"       . slack-message-embed-channel)));
+   ("#"       . slack-message-embed-channel)))
 
 (use-package alert
   :commands (alert)
@@ -1719,6 +1740,79 @@ Hopefully temporary.
   (add-to-list 'recentf-exclude amin-maildir))
 #+end_src
 
+** Gnus
+
+#+begin_src emacs-lisp :tangle yes
+(setq amin-gnus-init-file (no-littering-expand-etc-file-name "gnus"))
+
+(use-package gnus
+  :bind ("s-m" . gnus)
+  :init
+  (setq
+   gnus-select-method
+   '(nnimap "local"
+            (nnimap-address "localhost")
+            (nnimap-stream shell))
+   nnimap-shell-program  "/usr/lib/dovecot/imap -o mail_location=maildir:$MAILDIR/amin:LAYOUT=fs:INBOX=$MAILDIR/amin/Inbox"
+   ;; gnus-init-file        amin-gnus-init-file
+   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-save-newsrc-file nil
+   gnus-read-newsrc-file nil
+   gnus-interactive-exit nil
+   gnus-gcc-mark-as-read t))
+
+(use-package gnus-art
+  :config
+  (setq
+   gnus-visible-headers
+   (concat gnus-visible-headers "\\|^List-Id:\\|^X-RT-Originator:")
+   gnus-sorted-header-list
+   '("^From:" "^Subject:" "^Summary:" "^Keywords:"
+     "^Followup-To:" "^To:" "^Cc:" "X-RT-Originator"
+     "^Newsgroups:" "List-Id:" "^Organization:"
+     "^Date:")
+  ;; local-lapsed article dates
+  ;; from https://www.emacswiki.org/emacs/GnusFormatting#toc11
+  gnus-article-date-headers '(user-defined)
+  gnus-article-time-format
+  (lambda (time)
+    (let* ((date (format-time-string "%a, %d %b %Y %T %z" time))
+           (local (article-make-date-line date 'local))
+           (combined-lapsed (article-make-date-line date
+                                                    'combined-lapsed))
+           (lapsed (progn
+                     (string-match " (.+" combined-lapsed)
+                     (match-string 0 combined-lapsed))))
+      (concat local lapsed)))))
+
+(use-package gnus-sum
+  :config
+  (setq gnus-extra-headers (append gnus-extra-headers
+                                   '(List-Id X-RT-Originator))))
+
+(use-package nnmail
+  :config
+  (setq nnmail-extra-headers (append nnmail-extra-headers
+                                     '(List-Id X-RT-Originator))))
+
+(use-package mm-decode
+  :config
+  (setq mm-discouraged-alternatives '("text/html" "text/richtext")))
+#+end_src
+
+# #+begin_src emacs-lisp :tangle (concat gnus-init-file ".el") :mkdirp yes
+#+begin_src emacs-lisp :tangle no
+(setq
+ gnus-select-method
+ '(nnimap "local"
+          (nnimap-address "localhost")
+          (nnimap-stream shell))
+ nnimap-shell-program
+ "/usr/lib/dovecot/imap -o maildir:$MAILDIR/amin:LAYOUT=fs:INBOX=$MAILDIR/amin/Inbox")
+#+end_src
+
 ** sendmail
 
 #+begin_src emacs-lisp
@@ -1761,7 +1855,7 @@ Hopefully temporary.
 
 See [[notmuch:id:87muuqsvci.fsf@fencepost.gnu.org][bug follow-up]].
 
-#+begin_src emacs-lisp
+#+begin_src emacs-lisp :tangle no
 (defun amin/notmuch ()
   "Delete other windows, then launch `notmuch'."
   (interactive