From 9c3eda5edb5b4ea64af48d9a0492413b0271c643 Mon Sep 17 00:00:00 2001 From: Oscar Najera Date: Fri, 25 Aug 2023 12:18:40 +0200 Subject: pick IMAP account --- config/doom/config.org | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/config/doom/config.org b/config/doom/config.org index cf4e74e..7c07d7d 100644 --- a/config/doom/config.org +++ b/config/doom/config.org @@ -372,18 +372,15 @@ this new window. (defun on/registered-mail-accounts () "Read mbsync config to extract IMAPAccounts." - (let ((buffer (find-file-noselect - (expand-file-name - "~/dev/dotfiles/mail/dot-mbsyncrc.personal")))) - (with-current-buffer buffer - (goto-char (point-min)) - (let ((pick (prog1 (->> - (cl-loop while (search-forward-regexp (rx bol "IMAPAccount " (group (+ any)) eol) nil t) - collect (match-string 1)) - (cons "all") - (completing-read "Which mailbox"))))) - (kill-buffer buffer) - (if (string= pick "all") nil (list pick)))))) + (with-temp-buffer + (insert-file-contents (expand-file-name + "~/dev/dotfiles/mail/dot-mbsyncrc.personal")) + (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))))) (define-derived-mode mail-sync-log-mode comint-mode "mail-sync-log" "Major mode for reading mail sync." -- cgit v1.2.3