From f316065c9325dfd91eee68b44f82456f1a2fbc29 Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Fri, 9 Aug 2024 05:21:44 -0700 Subject: [PATCH] Make mu4e move messages to trash without marking them as such --- init.el | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/init.el b/init.el index 6e50c15..244d68d 100644 --- a/init.el +++ b/init.el @@ -924,8 +924,7 @@ COMMAND and COMINT are like `compile'." (defun my/setup-cmake-ts-mode () "Setup `cmake-ts-mode' buffers." (setq-local indent-line-function #'cmake-indent)) - (add-hook 'cmake-ts-mode-hook #'my/setup-cmake-ts-mode) - (add-hook 'cmake-ts-mode-hook #'eglot-ensure)) + (add-hook 'cmake-ts-mode-hook #'my/setup-cmake-ts-mode)) ;; kdl (require 'kdl-ts-mode) @@ -1294,7 +1293,13 @@ If no name is given, list all bookmarks instead." :bind (("C-x C-m" . mu4e) ("C-x m" . mu4e-compose-new) :map message-mode-map - ("C-c k" . khard-insert-email-contact)) + ("C-c k" . khard-insert-email-contact) + :map mu4e-headers-mode-map + ([remap mu4e-headers-mark-for-trash] . + my/mu4e-headers-mark-for-trash) + :map mu4e-view-mode-map + ([remap mu4e-view-mark-for-trash] . + my/mu4e-view-mark-for-trash)) :init (require 'mu4e) (evil-define-key '(normal motion) mu4e-main-mode-map "q" #'bury-buffer) @@ -1309,6 +1314,20 @@ If no name is given, list all bookmarks instead." "Run `mu4e-update-mail-and-index' without any messages in the background." (setq mu4e-hide-index-messages t) (mu4e-update-mail-and-index t)) + (defun my/mu4e-headers-mark-for-trash () + "Move the message a point to the trash without marking it was deleted +(trashed)." + (interactive) + (when (mu4e-thread-message-folded-p) + (mu4e-warn "Cannot mark folded messages")) + (mu4e-mark-at-point 'move mu4e-trash-folder) + (when mu4e-headers-advance-after-mark + (mu4e-headers-next))) + (defun my/mu4e-view-mark-for-trash () + "Like `my/mu4e-headers-mark-for-trash', but for `mu4e-view-mode'." + (interactive) + (mu4e--view-in-headers-context + (my/mu4e-headers-mark-for-trash))) (setq message-kill-buffer-on-exit t message-send-mail-function 'sendmail-send-it mu4e-change-filenames-when-moving t