[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Ensuring the subject lines contains a word?
From: |
Ted Zlatanov |
Subject: |
Re: Ensuring the subject lines contains a word? |
Date: |
Wed, 01 Apr 2009 12:40:28 -0500 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.91 (gnu/linux) |
On Tue, 31 Mar 2009 18:27:50 +0000 Johann 'Myrkraverk' Oskarsson
<johann@myrkraverk.com> wrote:
JO> Hi all,
JO> Is it possible to add a function to some pre-send hook that makes sure
JO> the subject line contains a certain word? News, not mail, if it
JO> matters. Of course, the word in question depends on the group, so
JO> some mechanism that ties posting styles (or something similar) to the
JO> mixture would be nice.
JO> For arguments sake, you can assume I want the word GNUS to appear in
JO> the subject lines of all messages to this group, gnu.emacs.gnus.
Here's an example of a hook that aborts under certain conditions:
(defun jidanni-message-confirm ()
"Confirm that we really want to send the message."
(interactive)
(or (y-or-n-p "Send?")
(keyboard-quit)))
(add-hook 'message-send-hook 'jidanni-message-confirm)
;; you may need message-send--news-hook as well
To get the Subject header, you can do
(save-restriction
(message-narrow-to-headers)
(message-fetch-field "Subject"))
I am sure integrating this with posting styles won't be too hard either.
Ted