Subject: bug#17560: 24.4.50; wrong type argument if rmail-delete-after-output set

From: Ken Olum <[email-masked]>
Date: Fri, 23 May 2014 14:48:25 -0400

OK.  Here is a patch, including NEWS and ChangeLog entries.  I made the
argument to rmail-delete-forward not optional, and fixed callers.

                                        Ken

=== modified file 'etc/NEWS'
--- etc/NEWS	2014-05-17 08:11:31 +0000
+++ etc/NEWS	2014-05-23 18:14:27 +0000
@@ -130,6 +130,9 @@
 
 ** You can access the slots of structures using `cl-struct-slot-value'.
 
+** Functions `rmail-delete-forward' and `rmail-delete-backward' take a
+repeat-count argument.
+
 
 * Changes in Emacs 24.5 on Non-Free Operating Systems

=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2014-05-23 15:54:44 +0000
+++ lisp/ChangeLog	2014-05-23 18:26:24 +0000
@@ -1,3 +1,12 @@
+2014-05-23  Ken Olum  <[email-masked]>
+
+	* mail/rmail.el: (rmail-delete-forward) make `count' arg not optional.
+	(rmail-auto-file):
+	* mail/rmailout.el: (rmail-output, rmail-output-as-seen)
+	(rmail-output-body-to-file): 
+	* mail/rmailout.el: (undigestify-rmail-message):
+	Supply `count' arg to rmail-delete-forward.
+
 2014-05-23  Stefan Monnier  <[email-masked]>
 
 	* minibuffer.el (completion--sreverse): Remove.

=== modified file 'lisp/mail/rmail.el'
--- lisp/mail/rmail.el	2014-05-05 01:08:54 +0000
+++ lisp/mail/rmail.el	2014-05-23 18:22:56 +0000
@@ -3078,7 +3078,7 @@
 	;; If there are no directives left, then it was a complete match.
 	(if (null directive-loop)
 	    (if (null folder)
-		(rmail-delete-forward)
+		(rmail-delete-forward 1)
 	      (if (string= "/dev/null" folder)
 		  (rmail-delete-message)
 		(rmail-output folder 1)
@@ -3474,7 +3474,7 @@
 		(rmail-summary-mark-undeleted msg))))))
     (rmail-maybe-display-summary)))
 
-(defun rmail-delete-forward (&optional count)
+(defun rmail-delete-forward (count)
   "Delete this message and move to next nondeleted one.
 Deleted messages stay in the file until the \\[rmail-expunge] command is given.
 A prefix argument is a repeat count;

=== modified file 'lisp/mail/rmailout.el'
--- lisp/mail/rmailout.el	2014-02-10 01:34:22 +0000
+++ lisp/mail/rmailout.el	2014-05-23 18:03:25 +0000
@@ -514,7 +514,7 @@
 	  (setq count (1- count))
 	  (let ((next-message-p
 		 (if rmail-delete-after-output
-		     (rmail-delete-forward)
+		     (rmail-delete-forward 1)
 		   (if (> count 0)
 		       (rmail-next-undeleted-message 1))))
 		(num-appended (- orig-count count)))
@@ -581,7 +581,7 @@
 	(setq count (1- count))
 	(let ((next-message-p
 	       (if rmail-delete-after-output
-		   (rmail-delete-forward)
+		   (rmail-delete-forward 1)
 		 (if (> count 0)
 		     (rmail-next-undeleted-message 1))))
 	      (num-appended (- orig-count count)))
@@ -630,6 +630,6 @@
 	 (error "Operation aborted"))
     (write-region (point) (point-max) file-name))
   (if rmail-delete-after-output
-      (rmail-delete-forward)))
+      (rmail-delete-forward 1)))
 
 ;;; rmailout.el ends here

=== modified file 'lisp/mail/undigest.el'
--- lisp/mail/undigest.el	2014-02-10 01:34:22 +0000
+++ lisp/mail/undigest.el	2014-05-23 18:02:49 +0000
@@ -217,7 +217,7 @@
 	    (rmail-set-message-counters)
 	    (set-buffer-modified-p t)
 	    (rmail-show-message current)
-	    (rmail-delete-forward)
+	    (rmail-delete-forward 1)
 	    (if (rmail-summary-exists)
 		(rmail-select-summary (rmail-update-summary))))
 	(when error