From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/87420 Path: news.gmane.org!.POSTED!not-for-mail From: Bob Newell Newsgroups: gmane.emacs.gnus.general Subject: gnus and Gmail: saving drafts to Gmail draft folder Date: Sun, 05 Mar 2017 09:45:20 -1000 Organization: Avi Gobbler Publishing Message-ID: <87mvczcxtb.fsf@bobnewell.net> References: <86y3x8ssi7.fsf@reader.local.lan> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1488743197 25631 195.159.176.226 (5 Mar 2017 19:46:37 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 5 Mar 2017 19:46:37 +0000 (UTC) User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.1 (gnu/linux) To: ding@gnus.org Original-X-From: ding-owner+m35641@lists.math.uh.edu Sun Mar 05 20:46:32 2017 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from mxfilter-048034.atla03.us.yomura.com ([107.189.48.34]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ckc6v-0005ms-CN for ding-account@gmane.org; Sun, 05 Mar 2017 20:46:29 +0100 X-Yomura-MXScrub: 1.0 Original-Received: from lists1.math.uh.edu (unknown [129.7.128.208]) by mxfilter-048034.atla03.us.yomura.com (Halon) with ESMTPS id 6f4144b7-01dc-11e7-b719-b499baa2b07a; Sun, 05 Mar 2017 19:46:33 +0000 (UTC) Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by lists1.math.uh.edu with smtp (Exim 4.87) (envelope-from ) id 1ckc68-0001u2-7v; Sun, 05 Mar 2017 13:45:40 -0600 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by lists1.math.uh.edu with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1ckc65-0001tN-Dr for ding@lists.math.uh.edu; Sun, 05 Mar 2017 13:45:37 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1.2:DHE-RSA-AES128-SHA:128) (Exim 4.87) (envelope-from ) id 1ckc63-0001P1-V6 for ding@lists.math.uh.edu; Sun, 05 Mar 2017 13:45:37 -0600 Original-Received: from mail-pf0-f173.google.com ([209.85.192.173]) by quimby.gnus.org with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1ckc5z-0002kM-Bv for ding@gnus.org; Sun, 05 Mar 2017 20:45:31 +0100 Original-Received: by mail-pf0-f173.google.com with SMTP id w189so51440332pfb.0 for ; Sun, 05 Mar 2017 11:45:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bobnewell-net.20150623.gappssmtp.com; s=20150623; h=from:to:subject:organization:references:date:in-reply-to:message-id :user-agent:mime-version; bh=8PCnjzy0E23JHdZHGLLBoLZyKUFtbg3k3qWWYyItZq8=; b=TmGIZ7X6xSrHYUVq1ZxYkgpSJ52bTdHhZ6FpRAPNopmvnQxpTflzqqVdqahpZZ9f5E Ndepgr+n1cs6TOrs42KGolgH/w9FArXdURld47JNWCRL/5PTyrLrxRmLI9yN8GImRA64 f/loKcgms72uQcASr+1m+AacZtJay1UFpng9STExt4RfUcnGoCVLIwzb4IYWDQd/nme0 VxBpDOb1pr7ia5adkfBfzM8wzUau5No1v4JE3mccyW/x81REv87uyzQ8f+KPEY3XzkIL NMO88QIVvIQWUhreSDGm444X+7Sco9VhiAfi/JXsByQp3Be0RcC8Lav/5C6daMRauC1R K0Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:organization:references:date :in-reply-to:message-id:user-agent:mime-version; bh=8PCnjzy0E23JHdZHGLLBoLZyKUFtbg3k3qWWYyItZq8=; b=pHsig6ocIQYjBPmCkivDGky/w36Pr7mzb1W76/0N1kmCj6lYhqY6rw2ElQ+RVCjAnz N7rdwkl3aSDWjwe2r0JTMcaTmlOMHBGnIG+LbJG7r0ythcegseinkCRyRsip1AYabdBT ZhB9WcbB2axBIPXvFtsL4owkMeGdCH2jFCtCcjaJ/esmk/cICY1MfEQkB09I7gooJPbw ZRV0e57C/dpVGj+HKz32cECTHR0C1l3hxQ5ht7ZVlxO6Piwt/xfQ9lk5jZVKgXRv4QOu BZ7tOZEfoXykBWCLHLQ7u8CA0XSf/7W1e8N5CanGUZ6hTlrxCsKPe+wWM+wIId/9aSTj d9QQ== X-Gm-Message-State: AMke39lIHB7xPzZuHLEO+wZ54cBR/7E8izwqwPODvOb5YyKdAgA38EOB6K6p2oEtZkKQLg== X-Received: by 10.84.202.163 with SMTP id x32mr20386584pld.67.1488743123055; Sun, 05 Mar 2017 11:45:23 -0800 (PST) Original-Received: from localhost (udp226603uds.hawaiiantel.net. [72.235.47.4]) by smtp.gmail.com with ESMTPSA id b14sm3145089pfh.114.2017.03.05.11.45.22 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Sun, 05 Mar 2017 11:45:22 -0800 (PST) In-Reply-To: <86y3x8ssi7.fsf@reader.local.lan> (Harry Putnam's message of "Tue, 14 Feb 2017 10:26:40 -0500") List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:87420 Archived-At: I don't want to save drafts (with C-c C-d) to a local draft folder; I want them to go to the [Gmail]/Drafts folder. Everything I found on the net said that this wasn't an option. So I kludged up a workaround. It undoubtedly has downsides and could be done better, so any constructive feedback is welcome. ---- ;; Move drafts to the gmail draft folder. (defun gmail-move-drafts () "Move all local drafts to Gmail draft folder" (interactive) ;; Better than 'let' for debugging. (defvar gmail-draft-saved-hooks) ;; This avoids an error when using the gnus registry. ;; It is not ideal. Is there a better way? (setq gmail-draft-saved-hooks gnus-summary-article-move-hook) (setq gnus-summary-article-move-hook nil) ;; The long way around. If there is a group buffer go there. ;; If there is a draft folder, go there. (There ought to be but...) ;; Mark all the draft messages. ;; Move them to Gmail. ;; Be /sure/ to exit the summary buffer! ;; Return to the buffer from whence we came. ;; Restore the hooks. (if (get-buffer "*Group*") (with-current-buffer "*Group*" (if (gnus-group-goto-group "nndraft:drafts" t) (if (or (gnus-group-select-group) (gnus-topic-select-group)) (progn (gnus-uu-mark-buffer) (gnus-summary-move-article nil "nnimap+gmail:[Gmail]/Drafts" nil) (gnus-summary-exit)))))) (setq gnus-summary-article-move-hook gmail-draft-saved-hooks)) ;; Make our function run after saving a draft. (advice-add 'message-dont-send :after #'gmail-move-drafts) -- Bob Newell Honolulu, Hawai`i * Via Gnus/BBDB/Org/Emacs/Linux *