* bug#75415: 31.0.50; quoted-printable-en/decode-region doesn't preserve end markers
@ 2025-01-07 4:24 Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-07 19:45 ` Stefan Kangas
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2025-01-07 4:24 UTC (permalink / raw)
To: 75415; +Cc: monnier
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#75415: 31.0.50; quoted-printable-en/decode-region doesn't preserve end markers
2025-01-07 4:24 bug#75415: 31.0.50; quoted-printable-en/decode-region doesn't preserve end markers Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2025-01-07 19:45 ` Stefan Kangas
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Kangas @ 2025-01-07 19:45 UTC (permalink / raw)
To: 75415; +Cc: monnier
Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@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?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-01-07 19:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-07 4:24 bug#75415: 31.0.50; quoted-printable-en/decode-region doesn't preserve end markers Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-07 19:45 ` Stefan Kangas
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).