From 636a7eae1c78ad4951d18eb3523f76f9c097a151 Mon Sep 17 00:00:00 2001 From: SqrtMinusOne Date: Tue, 18 Jul 2023 17:32:52 +0300 Subject: [PATCH] feat(mail): warn if no subject --- .emacs.d/mail.el | 7 +++++++ Mail.org | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/.emacs.d/mail.el b/.emacs.d/mail.el index 6e20633..7115cd8 100644 --- a/.emacs.d/mail.el +++ b/.emacs.d/mail.el @@ -119,3 +119,10 @@ (with-eval-after-load 'notmuch-mua (advice-add #'notmuch-mua-reply :after #'my/message-maybe-fix-signature)) + +(defun my/message-ensure-subject () + (unless (or (message-field-value "Subject") + (y-or-n-p "No subject. Send? ")) + (user-error "Aborting."))) + +(add-hook 'notmuch-mua-send-hook #'my/message-ensure-subject) diff --git a/Mail.org b/Mail.org index 9769127..846d3be 100644 --- a/Mail.org +++ b/Mail.org @@ -589,7 +589,15 @@ Then advice the =notmuch-mua-reply= function: (with-eval-after-load 'notmuch-mua (advice-add #'notmuch-mua-reply :after #'my/message-maybe-fix-signature)) #+end_src +** Warn if no subject +#+begin_src emacs-lisp +(defun my/message-ensure-subject () + (unless (or (message-field-value "Subject") + (y-or-n-p "No subject. Send? ")) + (user-error "Aborting."))) +(add-hook 'notmuch-mua-send-hook #'my/message-ensure-subject) +#+end_src * mailcap mailcap file is a file which defines how to read to different MIME types. Notmuch also uses it, so why not keep it here.