From 6b6a22a2abb645496bf7d896c0113452ca29b12d Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Wed, 7 Nov 2018 20:34:46 -0500 Subject: [PATCH] [emacs,rc] Gnus + Isync + Dovecot configs, notmuch-emacs phase out TODO: look into full-text search, using either notmuch or (c)lucene https://ericabrahamsen.net/tech/2014/oct/gnus-dovecot-lucene.html https://web.archive.org/web/20160713091633/http://roland.entierement.nu:80/blog/2010/09/08/gnus-dovecot-offlineimap-search-a-howto.html --- .gitmodules | 4 +- init.org | 156 ++++++++++++++++++++++++++++------------------------ rc.org | 85 ++++++++++++++++++++++------ 3 files changed, 155 insertions(+), 90 deletions(-) diff --git a/.gitmodules b/.gitmodules index 7e9756f..af3aedc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -204,11 +204,11 @@ url = git@code.orgmode.org:bzg/org-mode.git load-path = lisp info-path = doc - build-step = make compile autoloads info ORG_ADD_CONTRIB="org-notmuch" + build-step = make compile autoloads info # ORG_ADD_CONTRIB="org-notmuch" # setting ORG_ADD_CONTRIB results in copying of files from contrib/ # into lisp/, which git will pick up. so, let's ignore untracked files # from org's submodule; at least for now - ignore = untracked + # ignore = untracked [submodule "orgalist"] path = lib/orgalist url = git@github.com:emacsmirror/orgalist.git diff --git a/init.org b/init.org index ecf3a88..8de3fb8 100644 --- a/init.org +++ b/init.org @@ -729,9 +729,6 @@ In short, my favourite way of life. (use-package ox-beamer) -(use-package org-notmuch - :after (:any org notmuch)) - (use-package orgalist :hook (message-mode . orgalist-mode)) #+end_src @@ -1750,14 +1747,37 @@ Hopefully temporary. :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" + '(nnimap "amin" + (nnimap-stream plain) + (nnimap-address "127.0.0.1") + (nnimap-server-port 143) + (nnimap-authenticator plain) + (nnimap-user "amin@aminb.org")) + gnus-secondary-select-methods + '((nnimap "uwaterloo" + (nnimap-stream plain) + (nnimap-address "127.0.0.1") + (nnimap-server-port 143) + (nnimap-authenticator plain) + (nnimap-user "abandali@uwaterloo.ca"))) + gnus-message-archive-group "nnimap:Sent" + gnus-parameters + '(("amin" + (display . 20) + (posting-style + ((header "to" "amin@aminb.org") + (address "amin@aminb.org")) + ((header "delivered-to" "gnu@aminb.org") + (address "bandali@gnu.org")))) + ("uwaterloo" + (display . 20) + (posting-style + (address "abandali@uwaterloo.ca") + (gcc "\"nnimap+uwaterloo:Sent Items\"")))) ;; 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-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 @@ -1802,17 +1822,6 @@ Hopefully temporary. (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 @@ -1851,11 +1860,62 @@ Hopefully temporary. mml-secure-openpgp-sign-with-sender t)) #+end_src -** [[https://notmuchmail.org][notmuch]] +** supercite + +#+begin_src emacs-lisp :tangle no +(use-package supercite + :commands sc-cite-original + :init + (add-hook 'mail-citation-hook 'sc-cite-original) + + (defun sc-remove-existing-signature () + (save-excursion + (goto-char (region-beginning)) + (when (re-search-forward message-signature-separator (region-end) t) + (delete-region (match-beginning 0) (region-end))))) + + (add-hook 'mail-citation-hook 'sc-remove-existing-signature) + + (defun sc-remove-if-not-mailing-list () + (unless (assoc "list-id" sc-mail-info) + (setq attribution sc-default-attribution + citation (concat sc-citation-delimiter + sc-citation-separator)))) + + (add-hook 'sc-attribs-postselect-hook 'sc-remove-if-not-mailing-list) + + :config + (defun sc-fill-if-different (&optional prefix) + "Fill the region bounded by `sc-fill-begin' and point. +Only fill if optional PREFIX is different than +`sc-fill-line-prefix'. If `sc-auto-fill-region-p' is nil, do not +fill region. If PREFIX is not supplied, initialize fill +variables. This is useful for a regi `begin' frame-entry." + (if (not prefix) + (setq sc-fill-line-prefix "" + sc-fill-begin (line-beginning-position)) + (if (and sc-auto-fill-region-p + (not (string= prefix sc-fill-line-prefix))) + (let ((fill-prefix sc-fill-line-prefix)) + (unless (or (string= fill-prefix "") + (save-excursion + (goto-char sc-fill-begin) + (or (looking-at ">+ +") + (< (length + (buffer-substring (point) + (line-end-position))) + 65)))) + (fill-region sc-fill-begin (line-beginning-position))) + (setq sc-fill-line-prefix prefix + sc-fill-begin (line-beginning-position))))) +nil)) +#+end_src + +** COMMENT [[https://notmuchmail.org][notmuch]] :ARCHIVE: See [[notmuch:id:87muuqsvci.fsf@fencepost.gnu.org][bug follow-up]]. -#+begin_src emacs-lisp :tangle no +#+begin_src emacs-lisp (defun amin/notmuch () "Delete other windows, then launch `notmuch'." (interactive @@ -1980,57 +2040,9 @@ See [[notmuch:id:87muuqsvci.fsf@fencepost.gnu.org][bug follow-up]]. (after! notmuch-crypto (setq notmuch-crypto-process-mime t)) -#+end_src - -** supercite - -#+begin_src emacs-lisp :tangle no -(use-package supercite - :commands sc-cite-original - :init - (add-hook 'mail-citation-hook 'sc-cite-original) - - (defun sc-remove-existing-signature () - (save-excursion - (goto-char (region-beginning)) - (when (re-search-forward message-signature-separator (region-end) t) - (delete-region (match-beginning 0) (region-end))))) - - (add-hook 'mail-citation-hook 'sc-remove-existing-signature) - - (defun sc-remove-if-not-mailing-list () - (unless (assoc "list-id" sc-mail-info) - (setq attribution sc-default-attribution - citation (concat sc-citation-delimiter - sc-citation-separator)))) - - (add-hook 'sc-attribs-postselect-hook 'sc-remove-if-not-mailing-list) - :config - (defun sc-fill-if-different (&optional prefix) - "Fill the region bounded by `sc-fill-begin' and point. -Only fill if optional PREFIX is different than -`sc-fill-line-prefix'. If `sc-auto-fill-region-p' is nil, do not -fill region. If PREFIX is not supplied, initialize fill -variables. This is useful for a regi `begin' frame-entry." - (if (not prefix) - (setq sc-fill-line-prefix "" - sc-fill-begin (line-beginning-position)) - (if (and sc-auto-fill-region-p - (not (string= prefix sc-fill-line-prefix))) - (let ((fill-prefix sc-fill-line-prefix)) - (unless (or (string= fill-prefix "") - (save-excursion - (goto-char sc-fill-begin) - (or (looking-at ">+ +") - (< (length - (buffer-substring (point) - (line-end-position))) - 65)))) - (fill-region sc-fill-begin (line-beginning-position))) - (setq sc-fill-line-prefix prefix - sc-fill-begin (line-beginning-position))))) -nil)) +(use-package org-notmuch + :after (:any org notmuch)) #+end_src * Blogging diff --git a/rc.org b/rc.org index 6843791..f9c0b95 100644 --- a/rc.org +++ b/rc.org @@ -389,6 +389,52 @@ wintypes: }; #+end_src +** dovecot +:PROPERTIES: +:header-args+: :tangle "/sudo::/etc/dovecot/dovecot.conf" +:END: + +#+begin_src conf +protocols = imap + +listen = 127.0.0.1 +log_path = /var/log/dovecot.log +info_log_path = /var/log/dovecot-info.log + +ssl = no +disable_plaintext_auth = no + +auth_verbose = yes +auth_mechanisms = plain + +passdb { + driver = passwd-file + args = /etc/dovecot/passwd +} + +userdb { + driver = static + args = uid=amin gid=amin home=/home/amin/mail/%d/%n + default_fields = mail=maildir:/home/amin/mail/%d/%n/mail +} + +# mail_home = /home/amin/mail/%d/%n +# mail_location = maildir:/home/amin/mail/%d/%n/mail:LAYOUT=fs:INBOX=/home/amin/mail/%d/%n/mail/Inbox + +# namespace { +# inbox = yes +# separator = / +# } + +# mail_plugins = $mail_plugins fts fts_lucene + +# plugin { +# fts = lucene +# fts_lucene = whitespace_chars=@. +# fts_autoindex = yes +# } +#+end_src + ** Dunst :PROPERTIES: :header-args+: :tangle ~/.config/dunst/dunstrc @@ -988,6 +1034,7 @@ disk "/data" { #+begin_src conf # Global defaults CopyArrivalDate yes +Create Both ###### IMAPAccount amin @@ -999,17 +1046,20 @@ SSLType IMAPS IMAPStore amin-remote Account amin -MaildirStore amin-local -Path ~/mail/amin/ -Inbox ~/mail/amin/Inbox -SubFolders Verbatim +IMAPAccount amin-dovecot +Host 127.0.0.1 +Port 143 +User amin@aminb.org +PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/amin-dovecot.gpg" +SSLType None + +IMAPStore amin-local +Account amin-dovecot Channel amin Master :amin-remote: Slave :amin-local: -Patterns * !dovecot* -Create Both -SyncState * +Patterns * ###### IMAPAccount uwaterloo @@ -1021,17 +1071,20 @@ SSLType IMAPS IMAPStore uwaterloo-remote Account uwaterloo -MaildirStore uwaterloo-local -Path ~/mail/uwaterloo/ -Inbox ~/mail/uwaterloo/Inbox -SubFolders Verbatim +IMAPAccount uwaterloo-dovecot +Host 127.0.0.1 +Port 143 +User abandali@uwaterloo.ca +PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/uwaterloo-dovecot.gpg" +SSLType None + +IMAPStore uwaterloo-local +Account uwaterloo-dovecot Channel uwaterloo Master :uwaterloo-remote: Slave :uwaterloo-local: -Patterns * !dovecot* -Create Both -SyncState * +Patterns * #+end_src *** mbsync.service @@ -2172,7 +2225,7 @@ def_key "K" # configured here named ".notmuch". # [database] -path=/home/amin/mail +path=/home/amin/oldmail # User configuration # @@ -5389,7 +5442,7 @@ alias mv="mv -iv" alias cp="cp -iv" alias scl=systemctl alias jcl=journalctl -alias m="mbsync -a; notmuch new" +alias m="mbsync -a" alias best="youtube-dl -f best" alias sd="ssh deb" alias sf="ssh fp" -- 2.20.1