From a2b76afc2b92b7706fcd5dfe4e379768c7eebd98 Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 25 Feb 2022 18:20:33 +0000 Subject: nnmaildir: another attempt at gnus as a notmuch front-end --- gnus.org | 73 ++++++++++++++++++++++------------------------------------------ 1 file changed, 25 insertions(+), 48 deletions(-) (limited to 'gnus.org') diff --git a/gnus.org b/gnus.org index 8a4bbc9..eb8dfe3 100644 --- a/gnus.org +++ b/gnus.org @@ -56,7 +56,7 @@ * Looks *** Verbosity #+begin_src emacs-lisp - (setq gnus-verbose 4) + (setq gnus-verbose 10) #+end_src *** Geometry #+begin_src emacs-lisp @@ -111,18 +111,17 @@ #+end_src *** No blue icon #+begin_src emacs-lisp - ;; (defalias 'gnus-mode-line-buffer-identification 'identity) (advice-add 'gnus-mode-line-buffer-identification :override #'identity) (setq gnus-mode-line-image-cache nil) #+end_src * Search - [[info:gnus#Searching][info:gnus#Searching]] - #+begin_src emacs-lisp + (setq gnus-search-use-parsed-queries t gnus-search-notmuch-raw-queries-p nil gnus-fetch-old-headers nil gnus-fetch-old-ephemeral-headers nil) + (with-eval-after-load "gnus-search" (add-to-list 'gnus-search-expandable-keys "list") @@ -136,6 +135,7 @@ `(gnus-search-engine gnus-search-notmuch (remove-prefix ,prefix) (config-file ,config)))) + #+end_src * News server #+begin_src emacs-lisp @@ -155,11 +155,11 @@ * Local mail *** nnml #+begin_src emacs-lisp - (setq mail-sources '((file :path "/var/mail/jao") - (maildir :path "~/var/mail/spam") - (maildir :path "~/var/mail/trash")) - gnus-message-archive-group nil - nnimap-quirks nil) + (setq mail-sources (when jao-gnus-use-nnml + '((file :path "/var/mail/jao") + (maildir :path "~/tmp/mail/spam/") + (maildir :path "~/tmp/mail/trash/"))) + gnus-message-archive-group nil) (setq nnml-get-new-mail t nnmail-treat-duplicates 'delete @@ -181,31 +181,28 @@ `(nnml "" ,(jao-gnus--notmuch-engine nnml-directory "notmuch.config")))) (defun jao-gnus-nnml--add-maildirs (dir) - (dolist (f (directory-files (concat "~/var/mail/" dir) t "[^\\.]")) - (add-to-list 'mail-sources `(maildir :path ,f)))) + (dolist (f (directory-files (concat "~/tmp/mail/" dir) t "[^\\.]")) + (add-to-list 'mail-sources `(maildir :path ,(concat f "/"))))) - (dolist (dir '("jao" "bigml" "feeds")) (jao-gnus-nnml--add-maildirs dir)) + (when jao-gnus-use-nnml + (dolist (dir '("jao" "bigml" "feeds")) + (jao-gnus-nnml--add-maildirs dir))) #+end_src *** maildirs - #+begin_src emacs-lisp - (when jao-gnus-use-maildirs - (defun jao-gnus--maildir (dir) - (let ((root (concat "/tmp/mboxes/" dir "/")) - (config (concat "~/.notmuch-config-" dir))) - (add-to-list - 'gnus-secondary-select-methods - `(nnmaildir ,dir (directory ,root) - (gnus-search-engine gnus-search-notmuch - (remove-prefix ,root) - (config-file ,config)))))) - (jao-gnus--maildir "jao") - (jao-gnus--maildir "feeds") - (jao-gnus--maildir "bigml")) - - #+end_src + #+begin_src emacs-lisp + (when jao-gnus-use-maildirs + (add-to-list + 'gnus-secondary-select-methods + `(nnmaildir "" (directory "~/var/mail/") + ,(jao-gnus--notmuch-engine "~/var/mail/" + "~/.notmuch-config")))) + + #+end_src * IMAP servers #+begin_src emacs-lisp + (setq nnimap-quirks nil) + (when jao-gnus-use-local-imap (add-to-list 'gnus-secondary-select-methods `(nnimap "" (nnimap-address "localhost")))) @@ -334,26 +331,6 @@ (with-eval-after-load "gnus-sum" (define-key gnus-summary-save-map "-" 'gnus/randomsig-summary-read-sig))) #+end_src -*** notmuch -> gnus - #+begin_src emacs-lisp - (defun jao-notmuch-goto-message-in-gnus () - "Open a summary buffer containing the current notmuch article." - (interactive) - (let ((group (jao-maildir-file-to-group (notmuch-show-get-filename) - mail-source-directory)) - (message-id (replace-regexp-in-string "^id:" - "" - (notmuch-show-get-message-id)))) - (if (and group message-id) - (org-gnus-follow-link group message-id) - (message "Couldn't get relevant infos for switching to Gnus.")))) - - (defalias 'jao-open-gnus-frame 'jao-afio--goto-mail) - - (eval-after-load "notmuch-show" - '(define-key notmuch-show-mode-map (kbd "C-c C-c") - #'jao-notmuch-goto-message-in-gnus)) - #+end_src * Groups buffer #+begin_src emacs-lisp ;; (setq gnus-group-line-format " %m%S%p%P:%~(pad-right 35)c %3y %B\n") -- cgit v1.2.3