feat(mu4e): prompt for subject when absent
Give the user a chance to set the subject when about to send a message without a subject line.
This commit is contained in:
parent
4373109721
commit
9fa122cc31
1 changed files with 15 additions and 0 deletions
|
@ -165,6 +165,21 @@
|
||||||
(when (fboundp 'make-xwidget)
|
(when (fboundp 'make-xwidget)
|
||||||
(add-to-list 'mu4e-view-actions '("xwidgets view" . mu4e-action-view-with-xwidget)))
|
(add-to-list 'mu4e-view-actions '("xwidgets view" . mu4e-action-view-with-xwidget)))
|
||||||
|
|
||||||
|
;; Detect empty subjects, and give users an opotunity to fill something in
|
||||||
|
(defun +mu4e-check-for-subject ()
|
||||||
|
"Check that a subject is present, and prompt for a subject if not."
|
||||||
|
(save-excursion
|
||||||
|
(goto-char (point-min))
|
||||||
|
(search-forward "--text follows this line--")
|
||||||
|
(re-search-backward "^Subject:") ; this should be present no matter what
|
||||||
|
(let ((subject (string-trim (substring (thing-at-point 'line) 8))))
|
||||||
|
(when (string-empty-p subject)
|
||||||
|
(end-of-line)
|
||||||
|
(insert (read-string "Subject (optional): "))
|
||||||
|
(message "Sending...")))))
|
||||||
|
|
||||||
|
(add-hook 'message-send-hook #'+mu4e-check-for-subject)
|
||||||
|
|
||||||
;; The header view needs a certain amount of horizontal space to
|
;; The header view needs a certain amount of horizontal space to
|
||||||
;; actually show you all the information you want to see
|
;; actually show you all the information you want to see
|
||||||
;; so if the header view is entered from a narrow frame,
|
;; so if the header view is entered from a narrow frame,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue