From d8d37483ddfdf589c309acd0b3e1c897f9749307 Mon Sep 17 00:00:00 2001 From: David Miguel Susano Pinto Date: Mon, 6 Nov 2023 17:03:51 +0000 Subject: [PATCH] emacstips: add code to check for empty subject --- emacstips.mdwn | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/emacstips.mdwn b/emacstips.mdwn index 19c354a..288690c 100644 --- a/emacstips.mdwn +++ b/emacstips.mdwn @@ -936,6 +936,21 @@ it recognise English and Portuguese terms: "\\b\\(attach\\|attachment\\|attached\\|anexo\\|anexado\\)\\b") +## Avoid forgetting the subject + +It happens that we forget to enter the Subject line, particularly when +we leave that to the end. It's easy to write a function that checks +whether the Subject is empty, and add it to `message-send-hook` to get +confirmation: + + (defun my-notmuch-mua-empty-subject-check () + "Request confirmation before sending a message with empty subject" + (when (and (null (message-field-value "Subject")) + (not (y-or-n-p "Subject is empty, send anyway? "))) + (error "Sending message cancelled: empty subject."))) + (add-hook 'message-send-hook 'my-notmuch-mua-empty-subject-check) + + ## Applying patches to git repositories The `notmuch-extract-thread-patches` and -- 2.43.0