From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim Landscheidt Newsgroups: gmane.emacs.help Subject: Re: Setting gnus-message-archive-group in message-send-hook Date: Mon, 19 Sep 2011 03:41:52 +0000 Organization: Message-ID: References: <87sjnvtmzb.fsf@debian.i-did-not-set--mail-host-address--so-tickle-me> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1316403744 11863 80.91.229.12 (19 Sep 2011 03:42:24 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 19 Sep 2011 03:42:24 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 19 05:42:21 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R5UkO-0001ve-77 for geh-help-gnu-emacs@m.gmane.org; Mon, 19 Sep 2011 05:42:20 +0200 Original-Received: from localhost ([::1]:47318 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5UkI-0003J0-I9 for geh-help-gnu-emacs@m.gmane.org; Sun, 18 Sep 2011 23:42:14 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:35102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5UkE-0003Ij-Gz for help-gnu-emacs@gnu.org; Sun, 18 Sep 2011 23:42:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R5UkD-0007cq-Gb for help-gnu-emacs@gnu.org; Sun, 18 Sep 2011 23:42:10 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:35255) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5UkD-0007cL-B6 for help-gnu-emacs@gnu.org; Sun, 18 Sep 2011 23:42:09 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1R5UkB-0001rZ-FE for help-gnu-emacs@gnu.org; Mon, 19 Sep 2011 05:42:07 +0200 Original-Received: from d223051.adsl.hansenet.de ([80.171.223.51]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 19 Sep 2011 05:42:07 +0200 Original-Received: from tim by d223051.adsl.hansenet.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 19 Sep 2011 05:42:07 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Lines: 31 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: d223051.adsl.hansenet.de Mail-Copies-To: never User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:/hQSdC50285gefdYQSQLeNeKqao= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:82264 Archived-At: Marcin Wlodarczak wrote: > I'm trying to set gnus-message-archive-group depending on the From: > address, using the message-send-hook. Here is what I've got so > far: > (add-hook 'message-send-hook 'my-select-archive-group) > (defun my-select-archive-group () > (let ((from-address (mail-fetch-field "from"))) > (cond ((search "uni" from-address) > (setq gnus-message-archive-group "nnimap+uni:Sent")) > ((search "gmail" from-address) > (setq gnus-message-archive-group "nnimap+gmail:[Google Mail]/Sent Mail"))))) > The problem is, however, that this only sets the Gcc line for the > *following message* not the one being sent. What am I doing wrong > here? Either change the Gcc: header in your hook, or - probably preferable - see if the fine manual for gnus-message-archive-group can be applied in your case: | If you want to save your mail in one group and the news articles you | write in another group, you could say something like: | (setq gnus-message-archive-group | '((if (message-news-p) | "misc-news" | "misc-mail"))) Tim