Gnus development mailing list
 help / color / mirror / Atom feed
From: Dan Christensen <jdc@uwo.ca>
To: ding@gnus.org
Subject: article editing in nnimap
Date: Sun, 19 Sep 2010 21:09:26 -0400	[thread overview]
Message-ID: <87vd6143w9.fsf@uwo.ca> (raw)

[-- Attachment #1: Type: text/plain, Size: 1303 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: nnimap-reuse-move.patch --]
[-- Type: text/x-diff, Size: 2754 bytes --]

--- 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

             reply	other threads:[~2010-09-20  1:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-20  1:09 Dan Christensen [this message]
2010-09-21 21:30 ` Lars Magne Ingebrigtsen
2010-09-21 22:24   ` Dan Christensen
2010-09-21 22:52     ` Lars Magne Ingebrigtsen
2010-09-21 23:01       ` Dan Christensen
2010-09-22 13:37       ` Ted Zlatanov
2010-09-22 16:49         ` Lars Magne Ingebrigtsen
2010-09-22 17:45         ` Dan Christensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vd6143w9.fsf@uwo.ca \
    --to=jdc@uwo.ca \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).