unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Obey message-cite-reply-position from Emacs' message.el
@ 2024-10-13  7:54 Kristoffer Balintona
  2024-10-17 10:31 ` Pengji Zhang
  0 siblings, 1 reply; 6+ messages in thread
From: Kristoffer Balintona @ 2024-10-13  7:54 UTC (permalink / raw)
  To: notmuch

[-- Attachment #1: Type: text/plain, Size: 997 bytes --]

Hello,

Message.el has a user option called message-cite-reply-position that
determines where a signature is placed in an email compositino buffer
when replying. Its docstring reads:

    Where the reply should be positioned.
    If ‘traditional’, reply inline.
    If ‘above’, reply above quoted text.
    If ‘below’, reply below quoted text.

    Note: Many newsgroups frown upon nontraditional reply styles.
    You probably want to set this variable only for specific groups,
    e.g. using ‘gnus-posting-styles’:

      (eval (setq-local message-cite-reply-position 'above))

The current behavior of notmuch accords with the user values of below
and traditional but not above.

The notmuch function responsible for the position of the signature (or,
rather, the position of the citations) is notmuch-mua-reply. I have
attached a patch that adds a brief snippet which obeys
message-cite-reply-position when its value is above.

-- 
Best,
Kristoffer

[-- Attachment #2: notmuch-mua-reply-respect-message-cite-reply-position.patch --]
[-- Type: text/x-patch, Size: 1339 bytes --]

 emacs/notmuch-mua.el | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index bf62b656..1d1a1591 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -295,6 +295,20 @@ 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 `above', e.g., for Gmail-like
+      ;; email replies, then before inserting the citation, put the point
+      ;; after the signature and insert a newline for spacing. Also respects
+      ;; if `message-cite-reply-position' is set via `message-cite-style'.
+      (when (or (equal message-cite-reply-position 'above)
+                (and message-cite-style
+                     (eq (eval (cadr
+                                (assoc 'message-cite-reply-position
+                                       (if (symbolp message-cite-style)
+                                           (eval message-cite-style)
+                                         message-cite-style))))
+                         'above)))
+        (goto-char (point-max))
+        (insert "\n"))
       (let ((from (plist-get original-headers :From))
 	    (date (plist-get original-headers :Date))
 	    (start (point)))

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-12-09 19:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-13  7:54 Obey message-cite-reply-position from Emacs' message.el Kristoffer Balintona
2024-10-17 10:31 ` Pengji Zhang
2024-10-17 11:34   ` David Bremner
2024-11-05  5:58     ` Kristoffer Balintona
2024-12-09 19:25       ` Kristoffer Balintona
2024-11-05  5:45   ` Kristoffer Balintona

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).