I try to switch from notmuch mail to Gnus (since the notmuch setup is too komplex; keeping the tags synchronized across three devices is very hard; and due to work requirements I have to move messages with a specific tag to a specific folder; much too complex). In notmuch I wrote this little snippet to always sign messages with GnuPG:

(defun ck/sign-message ()
  (goto-char (point-min))
  (search-forward "--text follows this line--")
  (insert "\n")


(add-hook 'message-setup-hook 'ck/sign-message)

This ensures that the signing marker is always the first thing in the new message since mml-secure-message-sign-pgpmime searches for the first newline and then inserts the marker.

But since Gnus yanks the text after the message-setup-hook gets executed. I now end up with the signing marker after the quoted message.

Is there a hook that gets executed after the yanking? I could not find one, but maybe I’ve been overseeing it? If not: is there a different solution for this problem?

I’d like to have the marker directly below the --text follows this line-- marker and the quoted text below.

Best regards,


Turns out: there is another hook, the gnus-message-setup-hook. Documentation says:

Hook run after setting up a message buffer.

And this is also after the quoted message has been yanked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.