From 5e8c95e1b79e78c6dc4d9df61e12fdc318a8f65e Mon Sep 17 00:00:00 2001 From: jao Date: Sat, 12 Jun 2021 22:37:25 +0100 Subject: notmuch: better address cleansing --- email.org | 57 +++++++++++++++++++++++---------------------------------- 1 file changed, 23 insertions(+), 34 deletions(-) diff --git a/email.org b/email.org index a4d9bce..8b18705 100644 --- a/email.org +++ b/email.org @@ -1,5 +1,4 @@ #+property: header-args:emacs-lisp :lexical t :tangle yes :comments yes :results silent :shebang ";; -*- lexical-binding: t; -*-" -#+property: header-args:bash :comments yes :shebang "#!/bin/bash" :tangle-mode (identity #o755) #+title: email handling (message mode, bbdb, notmuch) #+auto_tangle: t @@ -433,7 +432,25 @@ :config (when (eq 'notmuch jao-afio-mail-function) - (setq mm-text-html-renderer 'shr)) + (setq mm-text-html-renderer 'shr + message-directory "~/var/mail/" + message-auto-save-directory "/tmp") + (with-eval-after-load "notmuch-message" + (define-key message-mode-map (kbd "C-c C-d") + #'notmuch-draft-postpone))) + + (defun jao-mail-clean-address (fun address) + (let ((address + (if (string-match ".+ updates on arXiv.org: \\(.+\\)" address) + (with-temp-buffer + (insert (match-string 1 address)) + (let ((shr-width 1000)) + (shr-render-region (point-min) (point-max))) + (buffer-string)) + (string-replace "ElDiario.es - ElDiario.es" "D.es" address)))) + (funcall fun address))) + + (advice-add 'notmuch-clean-address :around #'jao-mail-clean-address) (defun jao-notmuch-refresh-agenda () (interactive) @@ -520,7 +537,7 @@ ("RET" . jao-notmuch-tree-show-or-scroll) ("SPC" . jao-notmuch-tree-scroll-or-next)) :map notmuch-show-mode-map - (("h" . jao-notmuch-goto-index-buffer)) + (("h" . jao-notmuch-goto-tree-buffer)) :map notmuch-common-keymap (("B" . jao-notmuch-browse-urls)))) #+end_src @@ -558,40 +575,12 @@ ("f" notmuch-tree-forward-message "forward") ("e" notmuch-tree-resume-message "edit draft")))) #+end_src -*** address clean-ups - #+begin_src emacs-lisp - (defun jao-mail-clean-address (fun address) - (let ((address (if (string-match ".+ updates on arXiv.org: \\(.+\\)" - address) - (with-temp-buffer - (insert (match-string 1 address)) - (let ((shr-width 1000)) - (shr-render-region (point-min) (point-max))) - (buffer-string)) - (replace-regexp-in-string "^ElDiario.es - ElDiario.es" - "ElDiario.es" - address)))) - (funcall fun address))) - - (with-eval-after-load "notmuch" - (advice-add 'notmuch-clean-address :around #'jao-mail-clean-address)) - #+end_src -*** mua - #+begin_src emacs-lisp - (when (eq jao-afio-mail-function 'notmuch) - (setq message-directory "~/var/mail/" - message-auto-save-directory "/tmp") - (with-eval-after-load "notmuch-message" - (define-key message-mode-map (kbd "C-c C-d") - #'notmuch-draft-postpone))) - #+end_src *** consult #+begin_src emacs-lisp (jao-load-path "consult-notmuch") - - (use-package consult-notmuch - :init (setq consult-notmuch-authors-width 30) - :config (consult-customize consult-notmuch :preview-key 'any)) + (setq consult-notmuch-authors-width 30) + (require 'consult-notmuch) + (consult-customize consult-notmuch :preview-key 'any) (defvar jao-consult-notmuch-history nil) -- cgit v1.2.3