From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/71166 Path: news.gmane.org!not-for-mail From: Dan Christensen Newsgroups: gmane.emacs.gnus.general Subject: article editing in nnimap Date: Sun, 19 Sep 2010 21:09:26 -0400 Message-ID: <87vd6143w9.fsf@uwo.ca> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1284944998 2145 80.91.229.12 (20 Sep 2010 01:09:58 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 20 Sep 2010 01:09:58 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M19539@lists.math.uh.edu Mon Sep 20 03:09:57 2010 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 1OxUtI-0004IA-LE for ding-account@gmane.org; Mon, 20 Sep 2010 03:09:56 +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 1OxUt8-0005HE-Lo; Sun, 19 Sep 2010 20:09:46 -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 1OxUt7-0005H2-7X for ding@lists.math.uh.edu; Sun, 19 Sep 2010 20:09:45 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1OxUsx-0003uy-00 for ding@lists.math.uh.edu; Sun, 19 Sep 2010 20:09:45 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1OxUsw-0002NF-00 for ; Mon, 20 Sep 2010 03:09:34 +0200 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OxUsw-0004C6-8o for ding@gnus.org; Mon, 20 Sep 2010 03:09:34 +0200 Original-Received: from bas3-london14-1096787025.dsl.bell.ca ([65.95.164.81]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 20 Sep 2010 03:09:34 +0200 Original-Received: from jdc by bas3-london14-1096787025.dsl.bell.ca with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 20 Sep 2010 03:09:34 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 97 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: bas3-london14-1096787025.dsl.bell.ca User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.50 (gnu/linux) Cancel-Lock: sha1:DJRjBmVvM/hdJmv6LQRHT89eEaM= X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:71166 Archived-At: --=-=-= Content-Type: text/plain With the old version on nnimap, I had a hack in place that allowed article editing; but it wasn't ready for others, because it didn't update the summary buffer correctly or preserve marks. It seems to me that this shouldn't be such a hard thing to support properly, though. Gnus can already move an article between groups, and editing an article in a backend that has immutable articles is like moving it to the same group, except that the article is changed before being saved to the group. So I think it should be possible to re-use the code that is invoked when the user types `B m'. An extra argument (or a global variable) could be used to tell nnimap-request-move-article that the move isn't to be considered internal and to tell nnimap-request-accept-buffer to take the article from the editing buffer. That already would be a big step forward, but even better would be to update the summary buffer to replace the deleted article with the newly created article. Here's a crude patch against the old nnimap that illustrates the idea, but which doesn't work. But maybe something similar will work with the new nnimap (and maybe it would only be 10 or 20 lines of code)? (And maybe this can even be done independent of the backend, just assuming that the backend can create articles?) Dan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=nnimap-reuse-move.patch --- nnimap.orig.el 2009-09-30 12:56:46.000000000 -0400 +++ nnimap-nogood.el 2009-10-24 20:42:16.000000000 -0400 @@ -52,7 +52,6 @@ ;; o IMAP2BIS compatibility? (RFC2061) ;; o ACAP stuff (perhaps a different project, would be nice to ACAPify ;; .newsrc.eld) -;; o What about Gnus's article editing, can we support it? NO! ;; o Use \Draft to support the draft group?? ;; o Duplicate suppression ;; o Rewrite UID SEARCH UID X as UID FETCH X (UID) for those with slow servers @@ -1564,6 +1563,7 @@ (deffoo nnimap-request-move-article (art (nnimap-current-move-article article) (nnimap-current-move-group group) (nnimap-current-move-server nnimap-current-server) + (move-is-internal (and move-is-internal (not nnimap-request-accept-buffer))) result) (gnus-message 10 "nnimap-request-move-article: this is an %s move" (if move-is-internal @@ -1584,6 +1584,7 @@ (deffoo nnimap-request-move-article (art "\\Deleted" 'silent nnimap-server-buffer)) result)))) +(setq nnimap-request-accept-buffer nil) (deffoo nnimap-request-accept-article (group &optional server last) (when (nnimap-possibly-change-server server) (let (uid) @@ -1596,7 +1597,7 @@ (deffoo nnimap-request-accept-article (g nnimap-current-move-article) group 'dontcreate nil nnimap-server-buffer)) - (with-current-buffer (current-buffer) + (with-current-buffer (or nnimap-request-accept-buffer (current-buffer)) (goto-char (point-min)) ;; remove any 'From blabla' lines, some IMAP servers ;; reject the entire message otherwise. @@ -1619,6 +1620,16 @@ (deffoo nnimap-request-accept-article (g (cons group (nth 1 uid)) (nnheader-report 'nnimap (imap-error-text nnimap-server-buffer)))))) +(deffoo nnimap-request-replace-article (article group buffer) + (let ((nnimap-request-accept-buffer buffer) + (gnusgroup (gnus-group-prefixed-name + group (gnus-server-to-method + (format "nnimap:%s" nnimap-current-server))))) + ; With or without the next line I get a backtrace, but it changes: + ;(nnimap-request-article article group) + (message "%s" (list article group nnimap-request-accept-buffer gnusgroup)) + (gnus-summary-move-article 1 gnusgroup))) + (deffoo nnimap-request-delete-group (group force &optional server) (when (nnimap-possibly-change-server server) (when (string= group (imap-current-mailbox nnimap-server-buffer)) @@ -1789,6 +1800,7 @@ (defun nnimap-mark-permanent-p (mark &op nnimap-request-expire-articles nnimap-request-move-article nnimap-request-accept-article + nnimap-request-replace-article nnimap-request-delete-group nnimap-request-rename-group gnus-group-nnimap-expunge --=-=-=--