diff --git a/modules/app/email/autoload.el b/modules/app/email/autoload.el index cbace6e4e..eb7ce9177 100644 --- a/modules/app/email/autoload.el +++ b/modules/app/email/autoload.el @@ -10,3 +10,18 @@ (interactive) (call-interactively 'mu4e-compose-new)) +;;;###autoload +(defun +email/mark-multiple (beg end) + "Mark all messages within the current selection in mu4e's header view. Uses +`this-command-keys' to see what flag you mean." + (interactive "r") + (let ((command (lookup-key mu4e-headers-mode-map (this-command-keys))) + (lines (count-lines beg end))) + (unless command + (error "No valid command")) + (when (featurep 'evil) + (evil-normal-state)) + (save-excursion + (goto-char beg) + (dotimes (_ lines) + (call-interactively command))))) diff --git a/modules/app/email/config.el b/modules/app/email/config.el index 99410ccbc..d39a871fb 100644 --- a/modules/app/email/config.el +++ b/modules/app/email/config.el @@ -160,7 +160,32 @@ (def-package! evil-mu4e - :after mu4e) + :after mu4e + :when (featurep! :feature evil) + :init (defvar evil-mu4e-state 'normal) + :config + (defun +email|headers-keybinds () + (map! :Ln "-" 'mu4e-headers-mark-for-unflag + :Ln "+" 'mu4e-headers-mark-for-flag + :Ln "v" 'evil-visual-line + :Ln "q" 'mu4e~headers-quit-buffer + ;; Enable multiple markings via visual mode + :Lv "d" '+email/mark-multiple + :Lv "-" '+email/mark-multiple + :Lv "+" '+email/mark-multiple + :Lv "!" '+email/mark-multiple + :Lv "?" '+email/mark-multiple + :Lv "r" '+email/mark-multiple)) + (add-hook 'mu4e-headers-mode-hook '+email|headers-keybinds) + + ;; (defun +email|view-keybinds ()) + ;; (add-hook 'mu4e-view-mode-hook '+email|view-keybinds) + + (defun +email|main-keybinds () + (map! :Ln "q" 'mu4e-quit + :Ln "u" 'mu4e-update-index + :Ln "U" 'mu4e-update-mail-and-index)) + (add-hook 'mu4e-main-mode-hook '+email|main-keybinds)) (def-package! mu4e-maildirs-extension