tags:

views:

129

answers:

2

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?

+2  A: 

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
A: 

Nice. By the way, don't forget to quote the eval-after-load form (else error occurs):

(eval-after-load "gnus-msg" '(defun gnus-inews-yank-articles (articles) ...))

Frédéric Ledain