Subject: 24.3; Gnus v5.13; Only the first expired article is moved when using Gnus nnmh
From: Ben Bacarisse <[email-masked]>
To: [email-masked]
Date: Sun, 22 Mar 2015 22:54:26 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Using Gnus MH back-end, when nnmail-expiry-target is anything but
'delete, only the first expired articles gets moved to the nominated
target.

To test, mark as expired more than one old message (old enough for the
expiry to take effect) and exit the group.  Only one message gets moved
to nnmail-expiry-target and *Messages* will show only one "Deleting
article NNN in GROUP..." line.

The problem is in nnmh-request-expire-articles.  The code that does the
copy and delete changes nnmh-current-directory to that of the
nnmail-expiry-target folder.  As a result, all but the first article
number are not (usually) found.

One simple fix is save the value of nnmh-current-directory before the
loop and to use that saved value:

--- nnmh.el	2015-03-22 22:51:10.450422141 +0000
+++ nnmh-fix.el	2015-03-22 22:47:52.536939066 +0000
@@ -259,11 +259,12 @@
 					       &optional server force)
   (nnmh-possibly-change-directory newsgroup server)
   (let ((is-old t)
+        (dir nnmh-current-directory)
 	article rest mod-time)
     (nnheader-init-server-buffer)
 
     (while (and articles is-old)
-      (setq article (concat nnmh-current-directory
+      (setq article (concat dir
 			    (int-to-string (car articles))))
       (when (setq mod-time (nth 5 (file-attributes article)))
 	(if (and (nnmh-deletable-article-p newsgroup (car articles))

In GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.9)
 of 2014-06-06 on brownie, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11600000
System Description:	Ubuntu 14.10

Configured using:
 `configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu'
 '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
 '--localstatedir=/var/lib' '--infodir=/usr/share/info'
 '--mandir=/usr/share/man' '--with-pop=yes'
 '--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3/site-lisp:/usr/share/emacs/site-lisp'
 '--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=yes'
 '--with-x-toolkit=gtk3' '--with-toolkit-scroll-bars'
 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
 --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall'
 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro'
 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Summary

Minor modes in effect:
  cua-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Expiring articles...done
Opening nntp server on E.S....done
nl=9 nq= 0 pc=0
nl=23 nq= 4 pc=17
Auto-saving...done
No more unseen articles
No more unread articles
nl=21 nq= 4 pc=19
Making completion list...
call-interactively: End of buffer [12 times]

Load-path shadows:
/home/ben/.emacs.d/elpa/web-mode-20150303.645/web-mode hides /usr/local/share/emacs/site-lisp/web-mode
/usr/share/emacs24/site-lisp/css-mode/css-mode hides /usr/share/emacs/site-lisp/css-mode/css-mode
/usr/share/emacs/24.3/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs24/site-lisp/flim/hex-util hides /usr/share/emacs/24.3/lisp/hex-util
/usr/share/emacs24/site-lisp/flim/md4 hides /usr/share/emacs/24.3/lisp/md4
~/.emacs.d/loaddefs hides /usr/share/emacs/24.3/lisp/loaddefs
/usr/share/emacs24/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/24.3/lisp/textmodes/ispell
/usr/share/emacs24/site-lisp/css-mode/css-mode hides /usr/share/emacs/24.3/lisp/textmodes/css-mode
/usr/share/emacs24/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/24.3/lisp/textmodes/flyspell
/usr/share/emacs24/site-lisp/flim/hmac-def hides /usr/share/emacs/24.3/lisp/net/hmac-def
/usr/share/emacs24/site-lisp/flim/sasl hides /usr/share/emacs/24.3/lisp/net/sasl
/usr/share/emacs24/site-lisp/flim/hmac-md5 hides /usr/share/emacs/24.3/lisp/net/hmac-md5
/usr/share/emacs24/site-lisp/flim/sasl-cram hides /usr/share/emacs/24.3/lisp/net/sasl-cram
/usr/share/emacs24/site-lisp/flim/sasl-ntlm hides /usr/share/emacs/24.3/lisp/net/sasl-ntlm
/usr/share/emacs24/site-lisp/flim/ntlm hides /usr/share/emacs/24.3/lisp/net/ntlm
/usr/share/emacs24/site-lisp/flim/sasl-digest hides /usr/share/emacs/24.3/lisp/net/sasl-digest
/usr/share/emacs24/site-lisp/mh-e/mh-identity hides /usr/share/emacs/24.3/lisp/mh-e/mh-identity
/usr/share/emacs24/site-lisp/mh-e/mh-alias hides /usr/share/emacs/24.3/lisp/mh-e/mh-alias
/usr/share/emacs24/site-lisp/mh-e/mh-show hides /usr/share/emacs/24.3/lisp/mh-e/mh-show
/usr/share/emacs24/site-lisp/mh-e/mh-mime hides /usr/share/emacs/24.3/lisp/mh-e/mh-mime
/usr/share/emacs24/site-lisp/mh-e/mh-acros hides /usr/share/emacs/24.3/lisp/mh-e/mh-acros
/usr/share/emacs24/site-lisp/mh-e/mh-print hides /usr/share/emacs/24.3/lisp/mh-e/mh-print
/usr/share/emacs24/site-lisp/mh-e/mh-limit hides /usr/share/emacs/24.3/lisp/mh-e/mh-limit
/usr/share/emacs24/site-lisp/mh-e/mh-seq hides /usr/share/emacs/24.3/lisp/mh-e/mh-seq
/usr/share/emacs24/site-lisp/mh-e/mh-comp hides /usr/share/emacs/24.3/lisp/mh-e/mh-comp
/usr/share/emacs24/site-lisp/mh-e/mh-tool-bar hides /usr/share/emacs/24.3/lisp/mh-e/mh-tool-bar
/usr/share/emacs24/site-lisp/mh-e/mh-loaddefs hides /usr/share/emacs/24.3/lisp/mh-e/mh-loaddefs
/usr/share/emacs24/site-lisp/mh-e/mh-compat hides /usr/share/emacs/24.3/lisp/mh-e/mh-compat
/usr/share/emacs24/site-lisp/mh-e/mh-folder hides /usr/share/emacs/24.3/lisp/mh-e/mh-folder
/usr/share/emacs24/site-lisp/mh-e/mh-buffers hides /usr/share/emacs/24.3/lisp/mh-e/mh-buffers
/usr/share/emacs24/site-lisp/mh-e/mh-inc hides /usr/share/emacs/24.3/lisp/mh-e/mh-inc
/usr/share/emacs24/site-lisp/mh-e/mh-utils hides /usr/share/emacs/24.3/lisp/mh-e/mh-utils
/usr/share/emacs24/site-lisp/mh-e/mh-gnus hides /usr/share/emacs/24.3/lisp/mh-e/mh-gnus
/usr/share/emacs24/site-lisp/mh-e/mh-scan hides /usr/share/emacs/24.3/lisp/mh-e/mh-scan
/usr/share/emacs24/site-lisp/mh-e/mh-letter hides /usr/share/emacs/24.3/lisp/mh-e/mh-letter
/usr/share/emacs24/site-lisp/mh-e/mh-thread hides /usr/share/emacs/24.3/lisp/mh-e/mh-thread
/usr/share/emacs24/site-lisp/mh-e/mh-funcs hides /usr/share/emacs/24.3/lisp/mh-e/mh-funcs
/usr/share/emacs24/site-lisp/mh-e/mh-xface hides /usr/share/emacs/24.3/lisp/mh-e/mh-xface
/usr/share/emacs24/site-lisp/mh-e/mh-e hides /usr/share/emacs/24.3/lisp/mh-e/mh-e
/usr/share/emacs24/site-lisp/mh-e/mh-junk hides /usr/share/emacs/24.3/lisp/mh-e/mh-junk
/usr/share/emacs24/site-lisp/mh-e/mh-search hides /usr/share/emacs/24.3/lisp/mh-e/mh-search
/usr/share/emacs24/site-lisp/mh-e/mh-speed hides /usr/share/emacs/24.3/lisp/mh-e/mh-speed

Features:
(shadow emacsbug gnus-dup help-mode pp gnus-eform canlock footnote
flyspell ispell perl-mode gnus-logic flow-fill w3m-form w3m doc-view
jka-compr dired image-mode timezone w3m-hist w3m-fb bookmark-w3m w3m-ems
w3m-ccl ccl w3m-favicon w3m-image w3m-proc w3m-util mm-archive mule-util
sort smiley gnus-cite mail-extr gnus-bcklg qp gnus-async gnus-ml
gnus-topic nndraft nnfolder parse-time epa-file epa derived epg netrc
gnutls network-stream auth-source eieio byte-opt bytecomp byte-compile
cconv starttls tls gnus-agent gnus-srvr gnus-score score-mode nnvirtual
gnus-msg gnus-art mm-uu mml2015 epg-config mm-view mml-smime smime
password-cache dig mailcap nntp gnus-cache gnus-sum gnus-group gnus-undo
nnmhmrk nnmh cl-macs gv cl nnoo nnmail mail-source gnus-start gnus-spec
gnus-int gnus-range message sendmail rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums
mailabbrev gmm-utils mailheader gnus-win gnus gnus-ems nnheader
gnus-util mail-utils mm-util mail-prsvr wid-edit saveplace avoid
cua-base cus-start cus-load bbdb-autoloads gnome-calendar-autoloads
org-bullets-autoloads pandoc-mode-autoloads info smooth-scroll-autoloads
web-mode-autoloads package web-mode disp-table w3m-load mh-autoloads
haskell-mode-autoloads edmacro kmacro ido ess-toolbar ess-mouse mouseme
thingatpt browse-url ess-menu ess-swv ess-noweb ess-noweb-font-lock-mode
ess-bugs-l essd-els ess-sas-d ess-sas-l ess-sas-a shell pcomplete
ess-sta-d ess-sta-l cc-vars cc-defs make-regexp ess-sp6-d ess-sp3-d
ess-julia ess-r-d compile ess-tracebug format-spec ess-roxy advice
cl-lib advice-preload hideshow ess-help ess-developer ess-r-args eldoc
help-fns ess-s-l ess ess-inf comint ansi-color ring ess-mode
ess-noweb-mode ess-utils ess-custom executable easymenu ess-compat
ess-site time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel
x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list
newcomment lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty emacs)

-- 
Ben.