diff --git a/bindings.el b/bindings.el index db14db1..77eb13c 100644 --- a/bindings.el +++ b/bindings.el @@ -211,12 +211,8 @@ (:when (modulep! :lang org +present) :desc "org-tree-slide mode" "p" #'org-tree-slide-mode) :desc "Read-only mode" "r" #'read-only-mode - (:when (and (modulep! :checkers spell) (not (modulep! :checkers spell +flyspell))) - :desc "Spell checker" "s" #'spell-fu-mode) (:when (modulep! :checkers spell +flyspell) :desc "Spell checker" "s" #'flyspell-mode) - (:when (modulep! :lang org +pomodoro) - :desc "Pomodoro timer" "t" #'org-pomodoro) :desc "Visible mode" "v" #'visible-mode :desc "Soft line wrapping" "w" #'visual-line-mode (:when (modulep! :editor word-wrap) @@ -243,8 +239,6 @@ :desc "Reveal project in Finder" "O" #'+macos/reveal-project-in-finder :desc "Open in Kitty" "k" #'terminal-here :desc "Open project root in Kitty" "K" #'terminal-here-project-launch) - (:when (modulep! :tools docker) - :desc "Docker" "D" #'docker) (:when (modulep! :email mu4e) :desc "mu4e" "m" #'=mu4e)) @@ -471,12 +465,14 @@ (map! :map mu4e-main-mode-map :localleader - :desc "Compose" "c" #'compose-mail) + :desc "Compose" "c" #'compose-mail + :desc "Search (consult)" "s" #'consult-mu) (map! :map mu4e-compose-mode-map :localleader - :desc "Send message and exit" "s" #'message-send-and-exit) + :desc "Send message and exit" "s" #'message-send-and-exit + :desc "Update All" "s" #'mu4e-update-mail-and-index) (map! :map dired-mode-map diff --git a/config.el b/config.el index 9f18555..46e9801 100644 --- a/config.el +++ b/config.el @@ -258,10 +258,56 @@ (user-mail-address . "matt@emenel.ca") ;; only needed for mu < 1.4 (smtpmail-default-smtp-server . "smtp.fastmail.com") (smtpmail-smtp-server . "smtp.fastmail.com") - (smtpmail-local-domain . "fastmail.com") - (mu4e-compose-signature . "---")) - t) + (smtpmail-local-domain . "fastmail.com")) + t) +(defun message-insert-signature-at-point () + "Insert signature at point." + (interactive) + (setq message-signature "Matt Nish-Lapidus\nhttps://emenel.ca") + (save-restriction + (narrow-to-region (point) (point)) + (message-insert-signature) + (newline)) + (setq message-signature nil)) + +(use-package! consult-mu + :custom + ;;maximum number of results shown in minibuffer + (consult-mu-maxnum 200) + ;;show preview when pressing any keys + (consult-mu-preview-key 'any) + ;;do not mark email as read when previewed. If you turn this to t, be aware that the auto-loaded preview if the preview-key above is 'any would also get marked as read! + (consult-mu-mark-previewed-as-read nil) + ;;mark email as read when selected. + ;; (consult-mu-mark-viewed-as-read t) + ;;use reply to all when composing reply emails + (consult-mu-use-wide-reply t) + ;; define a template for headers view in minibuffer. The example below adjusts the width based on the width of the screen. + (consult-mu-headers-template (lambda () (concat "%f" (number-to-string (floor (* (frame-width) 0.15))) "%s" (number-to-string (floor (* (frame-width) 0.5))) "%d13" "%g" "%x"))) + (consult-mu-action #'consult-mu--view-action) + + :config + ;;create a list of saved searches for quick access using `histroy-next-element' with `M-n' in minibuffer. Note the "#" character at the beginning of each query! Change these according to + (setq consult-mu-saved-searches-dynamics '("#flag:unread")) + (setq consult-mu-saved-searches-async '("#flag:unread")) + ;; require embark actions for marking, replying, forwarding, etc. directly from minibuffer + (require 'consult-mu-embark) + ;; require extra module for composing (e.g. for interactive attachment) as well as embark actions + (require 'consult-mu-compose) + (require 'consult-mu-compose-embark) + ;; require extra module for searching contacts and runing embark actions on contacts + (require 'consult-mu-contacts) + (require 'consult-mu-contacts-embark) + ;; change the prefiew key for compose so you don't open a preview of every file when selecting files to attach + (setq consult-mu-compose-preview-key "M-o") + ;; pick a key to bind to consult-mu-compose-attach in embark-file-map + (setq consult-mu-embark-attach-file-key "C-a") + (setq consult-mu-contacts-ignore-list '("^.*no.*reply.*")) + (setq consult-mu-contacts-ignore-case-fold-search t) + (consult-mu-compose-embark-bind-attach-file-key) + ;; choose if you want to use dired for attaching files (choice of 'always, 'in-dired, or nil) + (setq consult-mu-compose-use-dired-attachment 'in-dired)) (after! mu4e @@ -269,7 +315,14 @@ mu4e-index-cleanup t mu4e-index-lazy-check nil mu4e-show-images t - message-kill-buffer-on-exit t) + message-kill-buffer-on-exit t + mu4e-enable-async-operations t) + + (setq message-citation-line-format "On %e %B %Y at %R %Z, %f wrote:\n") + (setq message-citation-line-function 'message-insert-formatted-citation-line) + + (setq message-signature nil) + (setq mu4e-bookmarks nil) (setq sendmail-program "/opt/homebrew/bin/msmtp" @@ -278,19 +331,27 @@ message-sendmail-extra-arguments '("--read-envelope-from") message-send-mail-function 'message-send-mail-with-sendmail) - ;; spam + (setq mu4e-compose-format-flowed t) + + (add-hook! 'mu4e-compose-mode-hook + (use-hard-newlines -1) + (message-goto-body) + (message-insert-signature-at-point) + (message-goto-body)) + + ;; spam (mu4e-bookmark-define "maildir:/matt@emenel.ca/Spam" "Spam mail" ?S) - ;; sent + ;; sent (mu4e-bookmark-define "maildir:/matt@emenel.ca/Sent" "Sent mail" ?s) - ;; unread + ;; unread (mu4e-bookmark-define (concat "flag:unread" " and not maildir:/matt@emenel.ca/Spam" @@ -298,7 +359,7 @@ "All Unread" ?u) - ;; inboxes + ;; inboxes (mu4e-bookmark-define "maildir:/matt@emenel.ca/Inbox" "All Inboxes" diff --git a/init.el b/init.el index b436f28..01f77ad 100644 --- a/init.el +++ b/init.el @@ -49,7 +49,7 @@ unicode ; extended unicode support for various languages (vc-gutter +pretty) ; vcs diff in the fringe vi-tilde-fringe ; fringe tildes to mark beyond EOB - ;;window-select ; visually switch windows + window-select ; visually switch windows workspaces ; tab emulation, persistence & separate workspaces ;;zen ; distraction-free coding or writing @@ -112,7 +112,7 @@ :os (:if IS-MAC macos) ; improve compatibility with macOS - ;;tty ; improve the terminal Emacs experience + ;; tty ; improve the terminal Emacs experience :lang ;;agda ; types of types of types of types... diff --git a/packages.el b/packages.el index cd17843..1053290 100644 --- a/packages.el +++ b/packages.el @@ -36,12 +36,13 @@ :host github :repo "kmonad/kbd-mode")) +(package! consult-mu + :recipe (:host nil :type git :repo "https://gt.emenel.ca/emenel/consult-mu.git" :files (:defaults "extras/*.el"))) + (package! just-mode) (package! justl) - (package! fennel-mode) (package! systemd) - (package! nerd-icons-completion) (package! nerd-icons-dired) (package! treemacs-nerd-icons)