From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/84644 Path: news.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.gnus.general Subject: Re: send reply email from gnus and archive original Date: Thu, 19 Jun 2014 16:36:24 -0700 Message-ID: <874mzgzd3b.fsf@ericabrahamsen.net> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1403220822 15450 80.91.229.3 (19 Jun 2014 23:33:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Jun 2014 23:33:42 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M32887@lists.math.uh.edu Fri Jun 20 01:33:35 2014 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Wxlpn-0006fu-03 for ding-account@gmane.org; Fri, 20 Jun 2014 01:33:35 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1Wxlp9-0000B7-UO; Thu, 19 Jun 2014 18:32:56 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1Wxlp8-0000Au-5x for ding@lists.math.uh.edu; Thu, 19 Jun 2014 18:32:54 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtps (TLSv1:AES128-SHA:128) (Exim 4.76) (envelope-from ) id 1Wxlp6-00019c-Ev for ding@lists.math.uh.edu; Thu, 19 Jun 2014 18:32:53 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]) by quimby.gnus.org with esmtp (Exim 4.80) (envelope-from ) id 1Wxlp4-00025F-GB for ding@gnus.org; Fri, 20 Jun 2014 01:32:50 +0200 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Wxlp3-0005fr-6O for ding@gnus.org; Fri, 20 Jun 2014 01:32:49 +0200 Original-Received: from c-76-28-195-250.hsd1.wa.comcast.net ([76.28.195.250]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 20 Jun 2014 01:32:49 +0200 Original-Received: from eric by c-76-28-195-250.hsd1.wa.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 20 Jun 2014 01:32:49 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 49 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: c-76-28-195-250.hsd1.wa.comcast.net User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4.50 (gnu/linux) Cancel-Lock: sha1:9sGYwSXqh6dfB4+WEC6ITyuaLGU= X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:84644 Archived-At: John Kitchin writes: > Hi everyone, > > I am trying to switch from the web interface of gmail to gnus. I have > succeeded in getting gnus to read my mail! > > ("nnimap gmail:INBOX") > > A feature of the web interface I really liked was the ability to reply > to an email, and upon sending it, archive the original email. Is there a > way to do that in gnus? Using a hook or something? Basically I want to > move the replied to email from the INBOX to the [Gmail]/All Mail folder > after I repply to it. > > Thanks! I guess I'd recommend using the message-sent-hook: that way you know the message has successfully sent, but you're still in the message buffer. In the message buffer, you can get the X-Draft-From header, which tells you how to find the message you're replying to (there's also the message-reply-headers variable, but that doesn't have the group information). Then you can ask gnus to move the article. My guess is you could call `nnimap-request-move-article' directly, but it would probably be safer to visit the original in its summary buffer and then use `gnus-summary-move-article'. The following is very, very lightly tested: (defun archive-original-gmail (&optional to-group) (save-window-excursion (save-restriction (message-narrow-to-headers-or-head) (let ((draft-from (read (message-fetch-field "X-Draft-From"))) group article-number) (when draft-from (setq group (car draft-from) article-number (cadr draft-from)) (gnus-activate-group group) (when (member (cadr (gnus-find-method-for-group group)) ;; only activate for some servers '("Applicable" "Server" "Names")) (gnus-group-read-group t nil group (list article-number)) (gnus-summary-move-article nil "\[Gmail\]/All Mail"))))))) You'd put that in the message-sent-hook. I'd love to hear if anyone had a better solution! E