From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/79312 Path: news.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.gnus.general Subject: Re: Cannot subscribe or see nndrafts folder upon startup Date: Fri, 01 Jul 2011 19:34:01 +0900 Organization: Emacsen advocacy group Message-ID: References: <2a8vsjwqeb.fsf@news.eternal-september.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1309516504 20380 80.91.229.12 (1 Jul 2011 10:35:04 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 1 Jul 2011 10:35:04 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M27608@lists.math.uh.edu Fri Jul 01 12:35:00 2011 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Qcb3s-0001SG-AU for ding-account@gmane.org; Fri, 01 Jul 2011 12:35:00 +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 1Qcb3T-0006na-Nd; Fri, 01 Jul 2011 05:34:35 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1Qcb3R-0006nM-TY for ding@lists.math.uh.edu; Fri, 01 Jul 2011 05:34:33 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1Qcb3Q-0003BU-JL for ding@lists.math.uh.edu; Fri, 01 Jul 2011 05:34:33 -0500 Original-Received: from orlando.hostforweb.net ([216.246.45.90]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1Qcb3O-0001rM-KN for ding@gnus.org; Fri, 01 Jul 2011 12:34:30 +0200 Original-Received: from localhost ([127.0.0.1]:51099) by orlando.hostforweb.net with smtp (Exim 4.69) (envelope-from ) id 1Qcb39-0006YW-PL for ding@gnus.org; Fri, 01 Jul 2011 05:34:16 -0500 X-Face: #kKnN,xUnmKia.'[pp`;Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu;B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (cygwin) Cancel-Lock: sha1:JBti+tGGDda0ycW/yRuj18YxxfA= X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - orlando.hostforweb.net X-AntiAbuse: Original Domain - gnus.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - jpl.org X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:79312 Archived-At: --=-=-= Katsumi Yamaoka wrote: > Katsumi Yamaoka wrote: >> Lars Magne Ingebrigtsen wrote: >>> However, the drafts group could update itself when you delete a message >>> from it, for instance. That would only be slightly inconsistent. [...] >> I've installed a fix. > Er, the fix was incomplete. It doesn't work properly if there're > sparse draft messages. [...] I found the easiest way to fix it. Installed. Lars Magne Ingebrigtsen wrote: > The drafts group doesn't update until you hit `g', like other normal > groups. It's somewhat difficult to have the group buffer update itself > when a message lands in the draft buffer -- it lands there by you just > saving the message you're composing. And I don't want any Gnus stuff to > run off of `save-buffer-hook' or the like. I tried this. A patch is below. Not tested fully, though. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-Description: Patch for nndraft.el --- nndraft.el~ 2011-04-05 05:00:10.178750000 +0000 +++ nndraft.el 2011-07-01 10:31:26.218750000 +0000 @@ -161,6 +161,13 @@ (message-headers-to-generate nndraft-required-headers message-draft-headers nil)))) +(defun nndraft-update-unread-articles (group) + "Return a function that updates unread articles of GROUP." + `(lambda nil + (with-current-buffer gnus-group-buffer + (let ((gnus-group-marked (list ,(concat "nndraft:" group)))) + (gnus-group-get-new-news-this-group nil t))))) + (deffoo nndraft-request-associate-buffer (group) "Associate the current buffer with some article in the draft group." (nndraft-open-server "") @@ -182,6 +189,10 @@ 'write-contents-hooks))) (gnus-make-local-hook hook) (add-hook hook 'nndraft-generate-headers nil t)) + (let ((fn (nndraft-update-unread-articles group))) + (gnus-make-local-hook 'after-save-hook) + (add-hook 'after-save-hook fn nil t) + (message-add-action (caddr fn) 'exit 'postpone 'kill)) article)) (deffoo nndraft-request-group (group &optional server dont-check info) --=-=-=--