diff options
| author | Kristoffer Balintona <krisbalintona@gmail.com> | 2024-11-04 21:22:39 -0600 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2026-01-25 08:29:27 +0900 |
| commit | ad789ba474581619be9f25838fa3d96d38a8d0c1 (patch) | |
| tree | 9ef17fedc36425d8f6a90b118f4c6c25b828216a /emacs | |
| parent | 07bb294049e786d1cf6fe07c6bef589826edb973 (diff) | |
emacs: Have email reply positions respect relevant message.el options
Previously, when composing email replies with `notmuch-mua-new-mail',
the email signature would always be placed below the email citation.
However, there are two message.el user options that affect the
position of the signature and email body:
`message-cite-reply-position` and `message-cite-style-gmail'.
Previously, neither of these user options were respected.
Respect these user options. If `message-cite-reply-position' is
'traditional or 'below, place the email signature below the citation
(the previous behavior is retained). If `message-cite-reply-position'
is 'above, place the email signature above the citation (like in
Gmail-style email replies).
`message-cite-style-gmail' may specify a value for
`message-cite-reply-position'. If it does, that value takes precedence
over `message-cite-reply-position'.
Diffstat (limited to 'emacs')
| -rw-r--r-- | emacs/notmuch-mua.el | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 74c62aaf..74bb559a 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -318,6 +318,29 @@ Typically this is added to `notmuch-mua-send-hook'." (when message-signature-insert-empty-line (forward-line -1)) (goto-char (point-max)))) + ;; If `message-cite-reply-position' is the symbol 'above, then + ;; before inserting the citation, put the point after the + ;; signature and insert a newline for spacing. This emulates + ;; the Gmail-style of email replies, where the signature and + ;; email reply body are above the email citation. If + ;; `message-cite-style'is non-nil and specifies a value for + ;; `message-cite-reply-position', then use that value instead. + ;; + ;; Regarding the use of `cadadr' instead of `cdr' on the result + ;; of `assoc' below: the value stored in `message-cite-style' is + ;; itself a quoted form, e.g., (quote above). Using `cdr' once + ;; returns that entire quoted form. Using `cadadr' skips the + ;; `quote' symbol and returns the underlying symbol + ;; (e.g. `above'). (We do this to avoid a call to `eval' + ;; because of security concerns.) + (when (eq (or (cadadr (assoc 'message-cite-reply-position + (if (symbolp message-cite-style) + (symbol-value message-cite-style) + message-cite-style))) + message-cite-reply-position) + 'above) + (goto-char (point-max)) + (insert "\n")) (let ((from (plist-get original-headers :From)) (date (plist-get original-headers :Date)) (start (point))) |
