3

In summary mode, when I press R for gnus-summary-reply-with-original or F for gnus-summary-followup-with-original, my signature gets inserted below the original message text.

How can I tell gnus to insert my signature at the very top of the message, before the quoted text of the original?

zpinter
  • 2,232
  • 2
  • 23
  • 29

2 Answers2

3

It looks as though that's not an option built into Gnus (as of v5.10.8), so you have to redefine one of the built-in functions like so:

(eval-after-load "gnus-msg"
  (defun gnus-inews-yank-articles (articles)
    (let (beg article yank-string)
      (goto-char (point-max))           ; put articles after signature
      (insert "\n")                     ; and one extra newline
                                        ; was this (message-goto-body)
      (while (setq article (pop articles))
        (when (listp article)
          (setq yank-string (nth 1 article)
                article (nth 0 article)))
        (save-window-excursion
          (set-buffer gnus-summary-buffer)
          (gnus-summary-select-article nil nil nil article)
          (gnus-summary-remove-process-mark article))
        (gnus-copy-article-buffer nil yank-string)
        (let ((message-reply-buffer gnus-article-copy)
              (message-reply-headers
               ;; The headers are decoded.
               (with-current-buffer gnus-article-copy
                 (save-restriction
                   (nnheader-narrow-to-headers)
                   (nnheader-parse-naked-head)))))
          (message-yank-original)
          (setq beg (or beg (mark t))))
        (when articles
          (insert "\n")))
      (push-mark)
      (goto-char beg))))

I wrapped the new definition of 'gnus-inews-yank-articles in an eval-after-load form so that it gets defined at the appropriate time. Obviously, if you want to allow customization, create a variable and write the appropriate if statement.

Trey Jackson
  • 73,529
  • 11
  • 197
  • 229
2

In the development version of Gnus (and GNU Emacs) you can set the variable message-cite-reply-position to `above'.

I guess you already know all about TOFU and why not, so I won't blather on about that.

asjo
  • 3,084
  • 2
  • 26
  • 20
  • @xuhdev It does when I try. – asjo Oct 25 '16 at 16:06
  • Do you mean it's still working now? Which Emacs version are you on? I looked up the code refers the variable but could not find anything related to signature (Emacs 25.1). – xuhdev Oct 25 '16 at 18:11
  • @xuhdev I mean that I just tested it, and what happens is that point _and_ signature is placed _above_ the quotation. The version of Gnus I am using ought to be older than the one in GNU Emacs 25.1. Let me try in GNU Emacs 25.1.50.3, that I have a build of lying around. Yes, works in that as well. Have you tried it? I.e. running `(setq message-cite-reply-position 'above)` and then answering an email (using R or F)? – asjo Oct 25 '16 at 18:42