Gnus development mailing list
 help / color / mirror / Atom feed
* Re: drafts and expiry-target problem and solution
       [not found] <87r6eevweh.fsf@pascal.matem.unam.mx>
@ 2008-03-18 12:53 ` Katsumi Yamaoka
  2008-03-18 18:37   ` Reiner Steib
  2008-03-19  0:27   ` Nils Ackermann
  0 siblings, 2 replies; 5+ messages in thread
From: Katsumi Yamaoka @ 2008-03-18 12:53 UTC (permalink / raw)
  To: nils-dated-1213237429.39274f; +Cc: bugs, ding

>>>>> Nils Ackermann wrote:
> This seems to be a long standing bug, I have found messages dating
> back to 2001 reporting it.

> Minimal setup:

> In a pristine environment, using the following .gnus:

> (setq gnus-select-method '(nnnil ""))

> (setq nnml-get-new-mail nil)
> (setq nnml-directory "~/Mail/nnml")
> (setq nnml-active-file "~/Mail/nnml/active")
> (setq nnml-inhibit-expiry t)
> (setq gnus-secondary-select-methods
>       '((nnml "")
> 	))

> (setq nnmail-expiry-target "nnml:archive")
> (setq gnus-message-archive-group "nnml:archive")
> (setq gnus-parameters '(("nndraft:drafts" (expiry-target . delete))))

> do the following:

> Write email, save it, send it.  Do it again.  Second time gives
> error: `nnml-save-mail: Selecting deleted buffer'.

> Expectation would be no error, because overriding expiry-target in
> drafts group parameters.

I made a temporary user account and tested that configuration
several hours.  The error seems to be triggered by changing of
the nnml server by `nnoo-change-server' (even if it remains the
same server) because `message-disassociate-draft' doesn't specify
the draft group name fully.

> Background:

> I like to archive all incoming and all outgoing email in the same nnml
> archive folder.  Therefore I set `total-expire' in the group
> parameters globally (via topics), and I set `nnmail-expiry-target' and
> `gnus-message-archive-group' to the same group, globally.

> In the drafts group a problem appears: message mode uses the internal
> expiry function `nnmh-request-expire-articles' from nnmh.el to delete
> the message, immediately.  If `nnmail-expiry-target' is set to a
> folder, the email is not deleted but moved to this folder instead.

> Of course, since the values of `nnmail-expiry-target' and
> `gnus-message-archive-group' coincide, gnus tries to save the message
> in this folder twice, but gives an error, I don't know why.  I think
> it should succeed without an error, and warn about it (with variable
> to turn the warning off).  This is one bug.

But doesn't your patch to message.el solve it?  Although I tried
modifying the `nnml-open-nov' function as follows, before applying
your patch, it is unnecessary, isn't it?

(defun nnml-open-nov (group)
  (let ((buffer (cdr (assoc group nnml-nov-buffer-alist))))
    (if (gnus-buffer-live-p buffer)
	buffer
      (setq buffer (nnml-get-nov-buffer group))
      (push (cons group buffer) nnml-nov-buffer-alist)
      buffer)))

> The second bug is that setting the group parameter `expiry-target' for
> the drafts group to 'delete doesn't change anything.  This clearly
> contradicts the manual, where it is stated that group parameters
> override global settings.  (By the way, in my real setup the parameter
> is set via the groups buffer, and not via the variable, but the result
> is the same.)  The reason is that `nnmh-request-expire-articles' does
> not honor the group parameter `expiry-target' at all.

> The following patch fixes the second bug for me, minimally.  It is not
> enough to change `nnmh-request-expire-articles', I also had to change
> `message-disassociate-draft' from message.el to use the full group
> specification "nndraft:drafts".  It seems that
> `gnus-group-find-parameter' needs this to find the parameters.

> A quick grep through source (by parameter names) showed that there are
> many places where (general) group parameters aren't honored, even if
> they should be.  Potentially this gives rise to a lot of bugs that
> seem unrelated.  Probably there are also more places where the full
> group specification is missing in using `gnus-group-find-parameter'.

Indeed.

The patches look good to me.  It is the best if you have signed
a paper to FSF, but it seems to be able to treat as a tiny change.
How do you wish to do?

> --- nnmh.el.orig	2008-01-21 11:12:29.000000000 -0600
> +++ nnmh.el	2008-01-21 12:30:29.000000000 -0600
> @@ -256,6 +256,9 @@
>  					       &optional server force)
>    (nnmh-possibly-change-directory newsgroup server)
>    (let* ((is-old t)
> +	 ;; copied and modified from gnus-group.el, def of gnus-group-expire-articles-1:
> +	 (nnmail-expiry-target
> +	  (or (gnus-group-find-parameter group 'expiry-target t) nnmail-expiry-target))
   	                                 *****
This should be the variable symbol `newsgroup'.
===============================================

>  	 article rest mod-time)
>      (nnheader-init-server-buffer)

> --- message.el.orig	2008-03-13 20:44:50.000000000 -0600
> +++ message.el	2008-01-21 12:34:19.000000000 -0600
> @@ -5797,7 +5797,7 @@
>    "Disassociate the message buffer from the drafts directory."
>    (when message-draft-article
>      (nndraft-request-expire-articles
> -     (list message-draft-article) "drafts" nil t)))
> +     (list message-draft-article) "nndraft:drafts" nil t)))

>  (defun message-insert-headers ()
>    "Generate the headers for the article."

> Gnus v5.11
> GNU Emacs 22.1.1 (i486-pc-linux-gnu, GTK+ Version 2.12.0)
>  of 2007-11-06 on terranova, modified by Ubuntu

> ------------------ Environment follows ------------------

[...]

Regards,



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: drafts and expiry-target problem and solution
  2008-03-18 12:53 ` drafts and expiry-target problem and solution Katsumi Yamaoka
@ 2008-03-18 18:37   ` Reiner Steib
  2008-03-18 22:59     ` Katsumi Yamaoka
  2008-03-19  0:27   ` Nils Ackermann
  1 sibling, 1 reply; 5+ messages in thread
From: Reiner Steib @ 2008-03-18 18:37 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: nils-dated, bugs, ding

On Tue, Mar 18 2008, Katsumi Yamaoka wrote:

[ Patches by Nils Ackermann ]
> The patches look good to me.  It is the best if you have signed a
> paper to FSF,

He hasn't.

> but it seems to be able to treat as a tiny change.

The patches are sufficiently small to be installed without papers.

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: drafts and expiry-target problem and solution
  2008-03-18 18:37   ` Reiner Steib
@ 2008-03-18 22:59     ` Katsumi Yamaoka
  0 siblings, 0 replies; 5+ messages in thread
From: Katsumi Yamaoka @ 2008-03-18 22:59 UTC (permalink / raw)
  To: nils-dated-1213237429.39274f; +Cc: bugs, ding

>>>>> Reiner Steib wrote:
> On Tue, Mar 18 2008, Katsumi Yamaoka wrote:

> [ Patches by Nils Ackermann ]
>> The patches look good to me.  It is the best if you have signed a
>> paper to FSF,

> He hasn't.

>> but it seems to be able to treat as a tiny change.

> The patches are sufficiently small to be installed without papers.

Ok, I've installed Nils Ackermann's patch in the Gnus trunk and
the v5-10 branch.

>>>>> Katsumi Yamaoka wrote:

>> error: `nnml-save-mail: Selecting deleted buffer'.

> But doesn't your patch to message.el solve it?  Although I tried
> modifying the `nnml-open-nov' function as follows, before applying
> your patch, it is unnecessary, isn't it?

> (defun nnml-open-nov (group)
>   (let ((buffer (cdr (assoc group nnml-nov-buffer-alist))))
>     (if (gnus-buffer-live-p buffer)
>         buffer
>       (setq buffer (nnml-get-nov-buffer group))
>       (push (cons group buffer) nnml-nov-buffer-alist)
>       buffer)))

I didn't install it for the moment, since it may be no more than
a workaround to hide another nnoo-related bug.

Regards,



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: drafts and expiry-target problem and solution
  2008-03-18 12:53 ` drafts and expiry-target problem and solution Katsumi Yamaoka
  2008-03-18 18:37   ` Reiner Steib
@ 2008-03-19  0:27   ` Nils Ackermann
  2008-03-19  5:33     ` Katsumi Yamaoka
  1 sibling, 1 reply; 5+ messages in thread
From: Nils Ackermann @ 2008-03-19  0:27 UTC (permalink / raw)
  To: ding

Katsumi Yamaoka <yamaoka@jpl.org> writes:

>>>>>> Nils Ackermann wrote:
>> I like to archive all incoming and all outgoing email in the same nnml
>> archive folder.  Therefore I set `total-expire' in the group
>> parameters globally (via topics), and I set `nnmail-expiry-target' and
>> `gnus-message-archive-group' to the same group, globally.
>
>> In the drafts group a problem appears: message mode uses the internal
>> expiry function `nnmh-request-expire-articles' from nnmh.el to delete
>> the message, immediately.  If `nnmail-expiry-target' is set to a
>> folder, the email is not deleted but moved to this folder instead.
>
>> Of course, since the values of `nnmail-expiry-target' and
>> `gnus-message-archive-group' coincide, gnus tries to save the message
>> in this folder twice, but gives an error, I don't know why.  I think
>> it should succeed without an error, and warn about it (with variable
>> to turn the warning off).  This is one bug.
>
> But doesn't your patch to message.el solve it?  Although I tried
> modifying the `nnml-open-nov' function as follows, before applying
> your patch, it is unnecessary, isn't it?

You're right, with respect to this bug it would probably be enough to
call `message-disassociate-draft' with the full group specification.
On second thought it appears to me that `message-disassociate-draft'
shouldn't rely on `nnmh-request-expire-articles' to delete the mail
from the drafts group.  It should just delete it.  Is there any deep
reason for this choice?

[snip]

>> The second bug is that setting the group parameter `expiry-target' for
>> the drafts group to 'delete doesn't change anything.  This clearly
>> contradicts the manual, where it is stated that group parameters
>> override global settings.  (By the way, in my real setup the parameter
>> is set via the groups buffer, and not via the variable, but the result
>> is the same.)  The reason is that `nnmh-request-expire-articles' does
>> not honor the group parameter `expiry-target' at all.

[snip]

>> A quick grep through source (by parameter names) showed that there are
>> many places where (general) group parameters aren't honored, even if
>> they should be.  Potentially this gives rise to a lot of bugs that
>> seem unrelated.  Probably there are also more places where the full
>> group specification is missing in using `gnus-group-find-parameter'.

This seems much more serious to me.  I am considering helping to
rectify this.  Please instruct me about signing the papers.

Regards,
Nils

-- 
Info: http://www.ackermath.info/




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: drafts and expiry-target problem and solution
  2008-03-19  0:27   ` Nils Ackermann
@ 2008-03-19  5:33     ` Katsumi Yamaoka
  0 siblings, 0 replies; 5+ messages in thread
From: Katsumi Yamaoka @ 2008-03-19  5:33 UTC (permalink / raw)
  To: nils-dated-1213237429.39274f; +Cc: ding

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

>>>>> Nils Ackermann wrote:

> On second thought it appears to me that `message-disassociate-draft'
> shouldn't rely on `nnmh-request-expire-articles' to delete the mail
> from the drafts group.  It should just delete it.  Is there any deep
> reason for this choice?

I agree that `message-disassociate-draft' always deletes a draft
backup since it differs from a normal message, i.e., it has a
header separator, etc.  But `nndraft-request-expire-articles',
that uses `nnmh-request-expire-articles', is easy to use because
it knows what draft to be deleted, I think.  A corner-cutting way
is:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 510 bytes --]

--- nnmh.el~	2008-03-18 22:47:32 +0000
+++ nnmh.el	2008-03-19 05:29:22 +0000
@@ -257,8 +257,10 @@
   (nnmh-possibly-change-directory newsgroup server)
   (let ((is-old t)
 	(nnmail-expiry-target
-	 (or (gnus-group-find-parameter newsgroup 'expiry-target t)
-	     nnmail-expiry-target))
+	 (if (string-equal newsgroup "nndraft:drafts")
+	     'delete
+	   (or (gnus-group-find-parameter newsgroup 'expiry-target t)
+	       nnmail-expiry-target)))
 	article rest mod-time)
     (nnheader-init-server-buffer)
 

[-- Attachment #3: Type: text/plain, Size: 528 bytes --]

>>> A quick grep through source (by parameter names) showed that there are
>>> many places where (general) group parameters aren't honored, even if
>>> they should be.  Potentially this gives rise to a lot of bugs that
>>> seem unrelated.  Probably there are also more places where the full
>>> group specification is missing in using `gnus-group-find-parameter'.

> This seems much more serious to me.  I am considering helping to
> rectify this.  Please instruct me about signing the papers.

Thanks.  I sent a recipe to you.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-03-19  5:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87r6eevweh.fsf@pascal.matem.unam.mx>
2008-03-18 12:53 ` drafts and expiry-target problem and solution Katsumi Yamaoka
2008-03-18 18:37   ` Reiner Steib
2008-03-18 22:59     ` Katsumi Yamaoka
2008-03-19  0:27   ` Nils Ackermann
2008-03-19  5:33     ` Katsumi Yamaoka

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