GNU bug report logs - #80097
[PATCH] 31.0.50; Rmail auto-file deletion can mark "D" at wrong column

Previous Next

Package: emacs;

Reported by: "Paul D. Nelson" <ultrono <at> gmail.com>

Date: Mon, 29 Dec 2025 18:48:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 80097 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#80097; Package emacs. (Mon, 29 Dec 2025 18:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Paul D. Nelson" <ultrono <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 29 Dec 2025 18:48:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Paul D. Nelson" <ultrono <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] 31.0.50; Rmail auto-file deletion can mark "D" at wrong column
Date: Tue, 30 Dec 2025 02:46:35 +0800
[Message part 1 (text/plain, inline)]
Auto-filing via rmail-automatic-folder-directives may corrupt the Rmail
summary line, with the deletion mark inserted in the wrong place: like

    1  23DDec         ...

rather than as intended, like

    1D 23-Dec         ...

Besides cosmetics, this makes some follow-up commands (like "u")
unavailable.

To reproduce, download the attachment (an mbox file with two messages)
and evaluate the following (modified to contain the actual path to the
downloaded file):

(let* ((inbox "/path/to/repro.txt")
       (dest (expand-file-name "dest.mbox" temporary-file-directory)))
  (setq rmail-file-name inbox)
  (setq rmail-default-file dest)
  (setq rmail-delete-after-output t)
  (setq rmail-automatic-folder-directives
        `((,rmail-default-file "subject" "math daily Subj-class mailing")))
  (rmail inbox)
  (rmail-summary)
  (rmail-summary-previous-msg))

This will show a summary corrupted as above.

The issue is that rmail-summary-mark-deleted assumes point is at the
beginning of the summary line, but it need not be.  In the example, it's
called after rmail-summary-rmail-update has moved point, during the same
call to rmail-summary-rmail-update: parsing msg-num leaves point at the
status column, rmail-summary-mark-seen advances it just past that
column, and rmail-show-message -> rmail-auto-file -> ... ->
rmail-summary-mark-deleted attempts to update the summary starting from
that point.

Specifically, in rmail-summary-mark-deleted, the code

	(skip-chars-forward " ")
	(skip-chars-forward "0-9")

assumes point is at the beginning of the line, so that it skips past the
message number ("1" in the example).  But in the example, this code is
executed with point just past the "1", so that it instead skips past the
date "23".

We can fix this by calling (beginning-of-line) first, as happens
elsewhere in rmailsum.el.

In GNU Emacs 31.0.50 (build 1, aarch64-apple-darwin24.6.0, NS
 appkit-2575.70 Version 15.7.2 (Build 24G325)) of 2025-12-18 built on
 d51735
Repository revision: 08bd8fdbb4cafda8604b062903618724d2aeb973
Repository branch: multi-occur-nlines
Windowing system distributor 'Apple', version 10.3.2575
System Description:  macOS 15.7.2

Configured using:
 'configure --with-ns --with-native-compilation --with-tree-sitter
 --with-gif --with-png --with-jpeg --with-rsvg --with-tiff
 --with-imagemagick --with-x-toolkit=gtk3 --with-xwidgets'

Configured features:
ACL DBUS GLIB GNUTLS IMAGEMAGICK LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP XIM XWIDGETS ZLIB

Important settings:
  value of $LC_CTYPE: UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-nonselected-mode: t
  minibuffer-regexp-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr compile comint ansi-osc ansi-color ring emacsbug
lisp-mnt rmailout rmailsum textsec uni-scripts url url-proxy url-privacy
url-expand url-methods url-history url-cookie generate-lisp-file
url-domsuf url-util url-parse url-vars idna-mapping uni-confusable
textsec-check vc-git diff-mode track-changes easy-mmode files-x
vc-dispatcher rmailmm message sendmail mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec epa derived epg epg-config gnus-util
text-property-search mm-decode mm-bodies mm-encode mailabbrev gmm-utils
mailheader mail-parse rfc2231 rmail rfc6068 auth-source cl-seq eieio
eieio-core cl-macs icons password-cache json map rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils misearch multi-isearch help-fns
radix-tree cl-print byte-opt gv debug backtrace help-mode find-func
comp-run bytecomp byte-compile comp-common rx time-date subr-x
cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads xwidget-internal dbusbind
kqueue cocoa ns lcms2 multi-tty make-network-process tty-child-frames
native-compile emacs)

Memory information:
((conses 16 161407 20081) (symbols 48 22136 0) (strings 32 66059 3102)
 (string-bytes 1 1230411) (vectors 16 18453)
 (vector-slots 8 301882 12065) (floats 8 37 85) (intervals 56 1188 2)
 (buffers 1064 15))

[repro.txt (text/plain, attachment)]
[0001-Rmail-fix-misplaced-D-after-auto-file.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#80097; Package emacs. (Tue, 30 Dec 2025 00:00:03 GMT) Full text and rfc822 format available.

Message #8 received at 80097 <at> debbugs.gnu.org (full text, mbox):

From: Francesco Potortì <pot <at> potorti.it>
To: "Paul D. Nelson" <ultrono <at> gmail.com>
Cc: 80097 <at> debbugs.gnu.org
Subject: Re: bug#80097: [PATCH] 31.0.50;
 Rmail auto-file deletion can mark "D" at wrong column
Date: Tue, 30 Dec 2025 00:59:20 +0100
>Auto-filing via rmail-automatic-folder-directives may corrupt the Rmail
>summary line, with the deletion mark inserted in the wrong place: like
>
>    1  23DDec         ...
>
>rather than as intended, like
>
>    1D 23-Dec         ...
...
>We can fix this by calling (beginning-of-line) first, as happens
>elsewhere in rmailsum.el.

I have never used Rmail automatic folders, but this patch may fix a problem with the "D" in the Rmail summary that I have observed for years but have never had the time to investigate.

I'll apply it and try to observe more carefully and possibly report




This bug report was last modified today.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.