{ config, lib, pkgs, ... }: with lib; mkIf (elem "emacs::mu4e" config.machine.pkgs) { programs.emacs.init.usePackage.mu4e = { enable = true; package = epkgs: null; command = [ "mu4e" ]; diminish = [ "mu4e-mode" ]; hook = [ "('mu4e-view-mode-hook #'visual-line-mode)" "('mu4e-compose-mode-hook 'flyspell-mode)" ]; bind = { "\t" = "'company-complete-common"; }; config = '' (setq mail-user-agent 'mu4e-user-agent) (setq org-mu4e-link-query-in-headers-mode t) (setq mu4e-maildir "~/.mail/Mail") (setq mu4e-get-mail-command "${pkgs.isync}/bin/mbsync -a") (setq mu4e-context-policy 'pick-first) (setq mu4e-change-filenames-when-moving t) (setq starttls-use-gnutls t) (setq message-send-mail-function 'smtpmail-send-it) (setq mu4e-update-interval 300) (setq mu4e-use-fancy-chars t) (setq mu4e-view-show-addresses t) (setq mu4e-headers-show-threads t) (setq mu4e-headers-skip-duplicates t) (setq mail-user-agent 'mu4e-user-agent) (defvaralias 'mu4e-compose-signature 'message-signature) (setq-default mu4e-save-multiple-attachments-without-asking t) (setq-default mu4e-view-show-addresses t) (setq-default mu4e-confirm-quit nil) (setq-default mu4e-hide-index-messages t) (setq-default mu4e-index-update-in-background t) (setq mu4e-compose-in-new-frame nil) ;;rename files when moving ;;NEEDED FOR MBSYNC (setq mu4e-change-filenames-when-moving t) (setq mu4e-html2text-command "iconv -c -t utf-8 | ${pkgs.pandoc}/bin/pandoc -f html -t plain") (setq mu4e-view-show-images t) (when (fboundp 'imagemagick-register-types) (imagemagick-register-types)) (setq message-kill-buffer-on-exit t) ;; mailAcc config goes here (defun my-browse-url-firefox-privately (url &optional new-window) "Make firefox open URL in private-browsing window." (interactive (browse-url-interactive-arg "URL: ")) (let ((process-environment (browse-url-process-environment))) (apply 'start-process (concat "firefox " url) nil browse-url-firefox-program (list "-private-window" url)))) (setq browse-url-browser-function 'my-browse-url-firefox-privately) (add-to-list 'mu4e-view-actions '("ViewInBrowser" . mu4e-action-view-in-browser) t) ''; extraConfig = '' :load-path ${pkgs.mu4e}/share/emacs/site-lisp/mu4e ''; }; programs.emacs.init.usePackage.mu4e-alert = { enable = true; hook = [ "'after-init-hook #'mu4e-alert-enable-mode-line-display" ]; }; programs.emacs.init.usePackage.org-mu4e = { enable = (elem "emacs::org" config.machine.pkgs); }; environment.systemPackages = [ mu4e isync ]; }