GNU bug report logs - #75415
31.0.50; quoted-printable-en/decode-region doesn't preserve end markers

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Tue, 7 Jan 2025 04:25:02 UTC

Severity: normal

Found in version 31.0.50

To reply to this bug, email your comments to 75415 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 monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org:
bug#75415; Package emacs. (Tue, 07 Jan 2025 04:25:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
New bug report received and forwarded. Copy sent to monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org. (Tue, 07 Jan 2025 04:25:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: bug-gnu-emacs <at> gnu.org
Subject: 31.0.50; quoted-printable-en/decode-region doesn't preserve end
 markers
Date: Mon, 06 Jan 2025 23:24:15 -0500
Package: Emacs
Version: 31.0.50


In a fresh Emacs try:

       (with-temp-buffer
         (set-buffer-multibyte nil)
         (insert "\300\300")
         (encode-coding-region (point-min) (point) 'utf-8)
         (quoted-printable-encode-region (point-min) (point))
         (insert "!!")
         (buffer-string))

It will likely return "=C0!!=C0" whereas it should return "=C0=C0!!".

Found via a bug in VM: https://gitlab.com/emacs-vm/vm/-/issues/491

The same problem plagues `quoted-printable-decode-region`.

I think we really need to introduce a `replace-region` primitive which
takes care of preserving the position of markers instead of having to teach
ELisp coders the delicate art of combining `insert(-before-markers)` and
`delete` to best preserve markers.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75415; Package emacs. (Tue, 07 Jan 2025 19:46:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: 75415 <at> debbugs.gnu.org
Cc: monnier <at> iro.umontreal.ca
Subject: Re: bug#75415: 31.0.50; quoted-printable-en/decode-region doesn't
 preserve end markers
Date: Tue, 7 Jan 2025 13:45:19 -0600
Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> gnu.org> writes:

> I think we really need to introduce a `replace-region` primitive which
> takes care of preserving the position of markers instead of having to teach
> ELisp coders the delicate art of combining `insert(-before-markers)` and
> `delete` to best preserve markers.

Sounds good to me, but would this deserve a separate bug report?




This bug report was last modified 159 days ago.

Previous Next


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