mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 02:48:08 +01:00
emacs/mua: optionally check for erroneous subjects
This works much like notmuch-mua-attachment-regexp, but for the subject instead. By default, check for empty subjects, as that seems a reasonable thing to safeguard against.
This commit is contained in:
parent
14150416dd
commit
fefc7a9474
1 changed files with 23 additions and 0 deletions
|
@ -142,6 +142,16 @@ to `notmuch-mua-send-hook'."
|
||||||
:type 'regexp
|
:type 'regexp
|
||||||
:group 'notmuch-send)
|
: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
|
;;; Various functions
|
||||||
|
|
||||||
(defun notmuch-mua-attachment-check ()
|
(defun notmuch-mua-attachment-check ()
|
||||||
|
@ -179,6 +189,19 @@ Typically this is added to `notmuch-mua-send-hook'."
|
||||||
;; ...signal an error.
|
;; ...signal an error.
|
||||||
(error "Missing attachment")))
|
(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 ()
|
(defun notmuch-mua-get-switch-function ()
|
||||||
"Get a switch function according to `notmuch-mua-compose-in'."
|
"Get a switch function according to `notmuch-mua-compose-in'."
|
||||||
(pcase notmuch-mua-compose-in
|
(pcase notmuch-mua-compose-in
|
||||||
|
|
Loading…
Reference in a new issue