Gnus development mailing list
 help / color / mirror / Atom feed
From: Katsumi Yamaoka <yamaoka@jpl.org>
To: nils-dated-1213237429.39274f@ackermath.info
Cc: bugs@gnus.org, ding@gnus.org
Subject: Re: drafts and expiry-target problem and solution
Date: Tue, 18 Mar 2008 21:53:33 +0900	[thread overview]
Message-ID: <b4mhcf4jir6.fsf@jpl.org> (raw)
In-Reply-To: <87r6eevweh.fsf@pascal.matem.unam.mx>

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



       reply	other threads:[~2008-03-18 12:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87r6eevweh.fsf@pascal.matem.unam.mx>
2008-03-18 12:53 ` Katsumi Yamaoka [this message]
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

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=b4mhcf4jir6.fsf@jpl.org \
    --to=yamaoka@jpl.org \
    --cc=bugs@gnus.org \
    --cc=ding@gnus.org \
    --cc=nils-dated-1213237429.39274f@ackermath.info \
    /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).