]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch-mua.el
emacs/mua: Correct autoload cookies
[notmuch] / emacs / notmuch-mua.el
index e4b7e9d17848ce08c71bf245869e85234f9ad711..a75b0f5c7a26ef0f9878d8a1c018a6323dff97e7 100644 (file)
@@ -142,6 +142,16 @@ to `notmuch-mua-send-hook'."
   :type 'regexp
   :group 'notmuch-send)
 
   :type 'regexp
   :group 'notmuch-send)
 
+(defcustom notmuch-mua-subject-regexp
+  "[[:blank:]]*$"
+  "Message subject indicating that something may be amiss.
+By default, this checks for empty subject lines.
+
+This is not used unless `notmuch-mua-subject-check' is added to
+`notmuch-mua-send-hook'."
+  :type 'regexp
+  :group 'notmuch-send)
+
 ;;; Various functions
 
 (defun notmuch-mua-attachment-check ()
 ;;; Various functions
 
 (defun notmuch-mua-attachment-check ()
@@ -179,6 +189,19 @@ Typically this is added to `notmuch-mua-send-hook'."
     ;; ...signal an error.
     (error "Missing attachment")))
 
     ;; ...signal an error.
     (error "Missing attachment")))
 
+(defun notmuch-mua-subject-check ()
+  "Signal an error if the subject seems amiss.
+More precisely, if the subject conforms to
+`notmuch-mua-subject-regexp'.
+
+Typically this is added to `notmuch-mua-send-hook'."
+  (or (save-excursion
+        (message-goto-subject)
+        (message-beginning-of-header t)
+        (not (looking-at-p notmuch-mua-subject-regexp)))
+      (y-or-n-p "Subject may be erroneous – is that okay?")
+      (error "Erroneous subject")))
+
 (defun notmuch-mua-get-switch-function ()
   "Get a switch function according to `notmuch-mua-compose-in'."
   (pcase notmuch-mua-compose-in
 (defun notmuch-mua-get-switch-function ()
   "Get a switch function according to `notmuch-mua-compose-in'."
   (pcase notmuch-mua-compose-in
@@ -401,6 +424,7 @@ instead of `message-mode' and SWITCH-FUNCTION is mandatory."
               (addr (and good-tokens (mapconcat #'identity good-tokens ", "))))
          (message-replace-header header addr))))))
 
               (addr (and good-tokens (mapconcat #'identity good-tokens ", "))))
          (message-replace-header header addr))))))
 
+;;;###autoload
 (defun notmuch-mua-mail (&optional to subject other-headers _continue
                                   switch-function yank-action send-actions
                                   return-action &rest _ignored)
 (defun notmuch-mua-mail (&optional to subject other-headers _continue
                                   switch-function yank-action send-actions
                                   return-action &rest _ignored)
@@ -622,20 +646,24 @@ unencrypted.  Really send? "))))
          (message-send-and-exit arg)
        (message-send arg)))))
 
          (message-send-and-exit arg)
        (message-send arg)))))
 
+;;;###autoload
 (defun notmuch-mua-send-and-exit (&optional arg)
   (interactive "P")
   (notmuch-mua-send-common arg t))
 
 (defun notmuch-mua-send-and-exit (&optional arg)
   (interactive "P")
   (notmuch-mua-send-common arg t))
 
+;;;###autoload
 (defun notmuch-mua-send (&optional arg)
   (interactive "P")
   (notmuch-mua-send-common arg))
 
 (defun notmuch-mua-send (&optional arg)
   (interactive "P")
   (notmuch-mua-send-common arg))
 
+;;;###autoload
 (defun notmuch-mua-kill-buffer ()
   (interactive)
   (message-kill-buffer))
 
 ;;; _
 
 (defun notmuch-mua-kill-buffer ()
   (interactive)
   (message-kill-buffer))
 
 ;;; _
 
+;;;###autoload
 (define-mail-user-agent 'notmuch-user-agent
   'notmuch-mua-mail
   'notmuch-mua-send-and-exit
 (define-mail-user-agent 'notmuch-user-agent
   'notmuch-mua-mail
   'notmuch-mua-send-and-exit