Gnus development mailing list
 help / color / mirror / Atom feed
From: "Bjørn Mork" <bjorn@mork.no>
To: ding@gnus.org
Subject: Re: What's the best way to auto-sign some emails but not all?
Date: Mon, 02 Dec 2024 16:11:40 +0100	[thread overview]
Message-ID: <874j3mdsr7.fsf@miraculix.mork.no> (raw)
In-Reply-To: <87o71wikra.fsf@miraculix.mork.no> (=?utf-8?Q?=22Bj=C3=B8rn?= Mork"'s message of "Sat, 30 Nov 2024 20:28:41 +0100")

Thanks for all the great ideas.  I have realized that there are probably
more ways to do this than there are Gnus users :-)

The discussion made me look closer at the code in question, which I
should have done in the first place. And I believe my problem is that
there are no hooks in the appropriate places.  Yanking the original
message happens very late, long after message-setup is finished.

Most of the suggestions depend on message-setup-hook in some way, making
them work and fail similar to my existing gnus-posting-styles setup. One
exception is gnus-alias which AFAIU can apply a new identity to an
existing message buffer.  But that's an interactive choice, which is
what I'm trying to avoid. After all, I could just run
mml-secure-message-sign if I wanted to.

So what I have ended up with is this ugly hack:

#+BEGIN_SRC emacs-lisp
(defun bjorn/message--yank-original-advice (arg)
  "Leave sign/encrypt mml tags untouched when yanking original"
  (when (looking-at "<#secure")
    (forward-line 1)))
(advice-add 'message--yank-original-internal :before #'bjorn/message--yank-original-advice)
#+END_SRC


which does the job for me when combined

       (body "<#secure method=pgpmime mode=sign>")

in the appropriate posting style(s).


Bjørn


  parent reply	other threads:[~2024-12-02 15:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-29 14:49 Bjørn Mork
2024-11-30 18:29 ` Trevor Arjeski
2024-11-30 19:28   ` Bjørn Mork
2024-11-30 20:17     ` Trevor Arjeski
2024-12-02 15:11     ` Bjørn Mork [this message]
2024-12-03 10:35       ` Björn Bidar
2024-12-03 11:36         ` Bjørn Mork
2024-12-03 20:38           ` Björn Bidar
2024-12-01  3:58 ` Sean Whitton
2024-12-01 23:04 ` Björn Bidar
2024-12-01 23:43   ` Bob Newell
2024-12-08  5:05 ` James Thomas
2024-12-08 13:22   ` Bjørn Mork
2024-12-08 21:03     ` James Thomas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874j3mdsr7.fsf@miraculix.mork.no \
    --to=bjorn@mork.no \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).