From: Kristoffer Balintona Date: Tue, 5 Nov 2024 03:22:39 +0000 (-0600) Subject: emacs: Have email reply positions respect relevant message.el options X-Git-Url: https://git.notmuchmail.org/git?a=commitdiff_plain;h=ad789ba474581619be9f25838fa3d96d38a8d0c1;p=notmuch 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'. --- 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)))