From: Eli Zaretskii Date: Fri, 5 Feb 2021 14:27:51 +0000 (+0200) Subject: Fix 'C-d' on the first line in Rmail summary buffer X-Git-Tag: emacs-28.0.90~3916 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0484879d3b0f81222bacbc3c9655d1cfcdb5d321;p=emacs.git Fix 'C-d' on the first line in Rmail summary buffer * lisp/mail/rmailsum.el (rmail-summary-delete-forward): Fix deleting backward past the beginning of the summary buffer. (Bug#46325) --- diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el index 7f99ecdcf2c..f53e6e768f8 100644 --- a/lisp/mail/rmailsum.el +++ b/lisp/mail/rmailsum.el @@ -930,10 +930,11 @@ a negative argument means to delete and move backward." (unless (numberp count) (setq count 1)) (let (del-msg (backward (< count 0))) - (while (and (/= count 0) - ;; Don't waste time if we are at the beginning - ;; and trying to go backward. - (not (and backward (bobp)))) + (while (/= count 0) + ;; Don't waste time counting down without doing anything if we + ;; are at the beginning and trying to go backward. + (if (and backward (bobp)) + (setq count -1)) (rmail-summary-goto-msg) (with-current-buffer rmail-buffer (setq del-msg rmail-current-message)