GNU bug report logs - #67180
30.0.50; 'pp-to-string' emits extra newline

Previous Next

Package: emacs;

Reported by: Eshel Yaron <me <at> eshelyaron.com>

Date: Tue, 14 Nov 2023 20:14:02 UTC

Severity: normal

Found in version 30.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Eshel Yaron <me <at> eshelyaron.com>
Subject: bug#67180: closed (Re: bug#67180: 30.0.50; 'pp-to-string' emits
 extra newline)
Date: Thu, 16 Nov 2023 16:21:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#67180: 30.0.50; 'pp-to-string' emits extra newline

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 67180 <at> debbugs.gnu.org.

-- 
67180: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=67180
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eshel Yaron <me <at> eshelyaron.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 67180-done <at> debbugs.gnu.org
Subject: Re: bug#67180: 30.0.50; 'pp-to-string' emits extra newline
Date: Thu, 16 Nov 2023 11:20:44 -0500
>> Like this?
>>
>>     diff --git a/etc/NEWS b/etc/NEWS
>>     index 23f4a8b5311..2dcb2f5664e 100644
>>     --- a/etc/NEWS
>>     +++ b/etc/NEWS
>>     @@ -1099,6 +1099,9 @@ showcases all their customization options.
>>      
>>      * Incompatible Lisp Changes in Emacs 30.1
>>      
>>     +** 'pp' and 'pp-to-string' now always include a terminating newline.
>>     +In the past they included a terminating newline in most cases but not all.
>>     +
>>      ** 'buffer-match-p' and 'match-buffers' take '&rest args'.
>>      They used to take a single '&optional arg' and were documented to use
>>      an unreliable hack to try and support condition predicates that
>>
>
> Exactly, yes.  Thanks!

Thanks, pushed to `master`.
Closing,


        Stefan


[Message part 3 (message/rfc822, inline)]
From: Eshel Yaron <me <at> eshelyaron.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; 'pp-to-string' emits extra newline
Date: Tue, 14 Nov 2023 21:12:34 +0100
On Emacs 29 and earlier, with `-Q`, we have:

(pp-to-string "foo")
  => "\"foo\""

On master with `-Q`, we get an extra newline at the end of the string:

(pp-to-string "foo")
  => "\"foo\"
"

AFAICT this change in behavior breaks `agda2-mode` completely on master.
This happens because apparently `agda2-mode` uses `pp-to-string` to
quote strings before sending them to a REPL (that doesn't expect the
newline the middle of a command):

--8<---------------cut here---------------start------------->8---
(defun agda2-string-quote (s)
  "..."
  (let ((pp-escape-newlines t)
        (s2 (copy-sequence s)))
    (set-text-properties 0 (length s2) nil s2)
    (mapconcat 'agda2-char-quote (pp-to-string s2) "")))
                                 ^^^^^^^^^^^^^^^^^
--8<---------------cut here---------------end--------------->8---


In GNU Emacs 30.0.50 (build 24, x86_64-apple-darwin23.0.0, NS
 appkit-2487.00 Version 14.0 (Build 23A344)) of 2023-11-13



This bug report was last modified 1 year and 191 days ago.

Previous Next


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