Make helm-mu able to filter addresses effectively

master
Jacopo De Simoi 2 years ago
parent 130ca621ca
commit 0ef8865723
  1. 50
      global.org

@ -4,8 +4,12 @@
#+options: *:t ::t
* TODO Tasks that need attention
** DONE focus on calling agenda from cli
** DONE find a way to store org-links to magit
** TODO improve helm-mu-contacs
- [ ] Manage ignore list
We can advise ~ helm-mu-contacts-transformer~ and remove the
candidates
- [ ] Implement action for ignoring contacts
** TODO Autosort token for some subtrees
** TODO fix the issue with highlighting bleeding over the margin for
~ace-window~
@ -14,7 +18,7 @@
instance
** TODO revert org-files on frame activation.
What was the deal with auto-revert-mode again?
What was the deal with auto-revert-mode again?
** TODO explore [[https://blog.modelworks.ch/managing-papers-with-org-mode-and-reftex/][this possibility]] about org-mode paper managing
@ -735,6 +739,7 @@
mu4e-compose-format-flowed t
fill-flowed-encode-column 998
mm-text-html-renderer 'gnus-w3m
mu4e-read-option-use-builtin nil
mu4e-completing-read-function 'completing-read
mu4e-modeline-support nil)
@ -858,6 +863,10 @@
'( :name "to capture"
:query "maildir:/math/to-capture or maildir:/proton/Labels.capture"
:key ?c))
(add-to-list 'mu4e-bookmarks
'( :name "action-needed"
:query "maildir:/math/action-needed"
:key ?n))
(add-to-list 'mu4e-bookmarks
'( :name "inbox"
:query "maildir:/math/INBOX"
@ -927,7 +936,7 @@
;; Get mail
(setq mu4e-get-mail-command "mbsync math-fast; mbsync proton-capture"
(setq mu4e-get-mail-command " mbsync math-fast; mbsync proton-capture"
mu4e-change-filenames-when-moving t ; needed for mbsync
mu4e-headers-include-related nil ;do not include threaded
;sent messages in inbox queries
@ -968,17 +977,38 @@
one of the addresses in the list.
#+begin_src emacs-lisp
(load-file "~/.emacs.d/filtered-emails.el")
(defun wilder/save-filter-addresses ()
"Saves my projects in my home folder."
(interactive)
(with-temp-buffer
(insert (prin1-to-string filter-addresses))
(write-region (point-min)
(point-max)
"~/.emacs.d/filter-addresses.eld")))
(setq filter-addresses (car (read-from-string (with-temp-buffer
(insert-file-contents "~/.emacs.d/filter-addresses.eld")
(buffer-string)))))
(defun wilder/filter--from-list (address list)
(if (not list) address
(and (not (string-equal address (car list)))
(wilder/filter--from-list address (cdr list)))))
(defun wilder/update-fiter-addresses-regex ()
(setq filter-addresses-regex
(mapconcat #'regexp-quote filter-addresses "\\\|")
helm-mu-contacts-ignore-candidates-regexp filter-addresses-regex))
(wilder/update-fiter-addresses-regex)
(defun my-mu4e-contact-filter-function (addr)
(wilder/filter--from-list addr filter-addresses))
(unless (string-match-p filter-addresses-regex addr)
addr))
(setq mu4e-contact-process-function 'my-mu4e-contact-filter-function)
(defun wilder/add-address-to-filter (address)
(add-to-list 'filter-addresses address)
(wilder/save-filter-addresses)
(wilder/update-fiter-addresses-regex))
#+end_src
This snippet improves handling of links that span several lines.
It piggy-backs on ~gnus~ doing all the heavy lifting

Loading…
Cancel
Save