From 0ceb6b46a657c312d58e886fbfe105110bfbe774 Mon Sep 17 00:00:00 2001 From: Oscar Najera Date: Sun, 21 Jul 2024 21:26:49 +0200 Subject: fetch mail emacs --- config/doom/config.org | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/config/doom/config.org b/config/doom/config.org index 322ae98..5569a8c 100644 --- a/config/doom/config.org +++ b/config/doom/config.org @@ -434,12 +434,9 @@ this new window. "Read mbsync config to extract IMAPAccounts." (with-temp-buffer (insert-file-contents (expand-file-name "~/.mbsyncrc")) - (let ((pick (thread-last - (cl-loop while (search-forward-regexp (rx bol "IMAPAccount " (group (+ any)) eol) nil t) - collect (match-string 1)) - (cons "all") - (completing-read "Which mailbox")))) - (if (string= pick "all") nil (list pick))))) + (cl-loop while (search-forward-regexp (rx bol "IMAPAccount " (group (+ any)) eol) nil t) + collect (match-string 1)))) + (define-derived-mode mail-sync-log-mode comint-mode "mail-sync-log" "Major mode for reading mail sync." @@ -448,16 +445,21 @@ this new window. (,(rx bol " [mv]") . font-lock-constant-face) (,(rx bol " [rm]") . font-lock-keyword-face))))) -(defun on/fetch-all-email () - "Start tagmail fetch on a subprocess." - (interactive) +(defun on/fetch-all-email (mailbox) + "Start tagmail fetch on a subprocess for MAILBOX." + (interactive (list (completing-read + "Which mailbox?" + (on/registered-mail-accounts) + nil nil nil nil "all"))) (with-current-buffer (get-buffer-create "*E-mail fetch*") (pop-to-buffer (current-buffer)) (mail-sync-log-mode) (make-process :name "E-mail fetch" :buffer (current-buffer) - :command (cons "tagmail" (on/registered-mail-accounts)) + :command (thread-last + (if (string= mailbox "all") nil (list mailbox)) + (cons "tagmail")) :filter #'comint-output-filter))) #+END_SRC ** Sending email -- cgit v1.2.3