unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Gnus: set the signing marker to the top of the new message
@ 2016-01-27  7:56 Christian Kruse
  2016-01-27 13:03 ` Teemu Likonen
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Kruse @ 2016-01-27  7:56 UTC (permalink / raw)
  To: help-gnu-emacs

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

Hi folks,

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). In notmuch I wrote this little snippet to always sign messages
with GnuPG:

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

  (mml-secure-message-sign-pgpmime))

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

This ensures that the signing marker is always the first thing in the
new message.

But since Gnus yanks the text after the message-setup-hook gets executed
I now end up with the signing marker after the 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,
-- 
Christian Kruse
https://wwwtech.de/about

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

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

* Re: Gnus: set the signing marker to the top of the new message
  2016-01-27  7:56 Gnus: set the signing marker to the top of the new message Christian Kruse
@ 2016-01-27 13:03 ` Teemu Likonen
  2016-01-27 13:27   ` Christian Kruse
  0 siblings, 1 reply; 3+ messages in thread
From: Teemu Likonen @ 2016-01-27 13:03 UTC (permalink / raw)
  To: Christian Kruse; +Cc: help-gnu-emacs

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

Christian Kruse [2016-01-27 08:56:31+01] wrote:

> (defun ck/sign-message ()
>   (interactive)
>   (goto-char (point-min))
>   (search-forward "--text follows this line--")
>   (end-of-line)
>   (insert "\n")
>
>   (mml-secure-message-sign-pgpmime))
>
> (add-hook 'message-setup-hook 'ck/sign-message)
>
> This ensures that the signing marker is always the first thing in the
> new message.

Just this does the right thing here:

    (add-hook 'gnus-message-setup-hook #'mml-secure-message-sign)

The difference is that i use gnus-...-hook, not message-...-hook. I also
have mml-secure-message-sign which, by default, uses PGP MIME method so
it's effectively the same as yours.

-- 
/// Teemu Likonen   - .-..   <https://github.com/tlikonen> //
// PGP: 4E10 55DC 84E9 DFF6 13D7 8557 719D 69D3 2453 9450 ///

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

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

* Re: Gnus: set the signing marker to the top of the new message
  2016-01-27 13:03 ` Teemu Likonen
@ 2016-01-27 13:27   ` Christian Kruse
  0 siblings, 0 replies; 3+ messages in thread
From: Christian Kruse @ 2016-01-27 13:27 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: help-gnu-emacs

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

Hi,

Teemu Likonen <tlikonen@iki.fi> writes:

> Just this does the right thing here:
>
>     (add-hook 'gnus-message-setup-hook #'mml-secure-message-sign)
>
> The difference is that i use gnus-...-hook, not message-...-hook. I also
> have mml-secure-message-sign which, by default, uses PGP MIME method so
> it's effectively the same as yours.

Thank you very much, this works nicely.

Freundliche Grüsse,
-- 
Christian Kruse
https://wwwtech.de/about

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

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

end of thread, other threads:[~2016-01-27 13:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-27  7:56 Gnus: set the signing marker to the top of the new message Christian Kruse
2016-01-27 13:03 ` Teemu Likonen
2016-01-27 13:27   ` Christian Kruse

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).