GNU bug report logs - #72434
[PATCH] Print list-ending comma/backquote forms specially

Previous Next

Package: emacs;

Reported by: Thuna <thuna.cing <at> gmail.com>

Date: Sat, 3 Aug 2024 01:32:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 72434 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#72434; Package emacs. (Sat, 03 Aug 2024 01:32:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Thuna <thuna.cing <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 03 Aug 2024 01:32:02 GMT) Full text and rfc822 format available.

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

From: Thuna <thuna.cing <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Print list-ending comma/backquote forms specially
Date: Sat, 03 Aug 2024 03:31:28 +0200
[Message part 1 (text/plain, inline)]
(This patch follows from 72334, but that patch is not necessary for this
one to work.)

Currently something like the following (unevaluated) form:
  `(foo bar . ,baz)
prints as
  `(foo bar \, baz)
which, while technically accurate, is not helpful.  This comes up quite
often in pcase forms where a pattern like `(,head . ,_) is extremely
common.

This patch fixes that, such that if the tail of a list is a proper list
of two elements whose car is a backquote, comma, or comma-at (so ,foo
,@foo and `foo), and print-quoted is non-nil, the printed text will be
in the first form above.

Better ways to implement this are likely possible; this was simply the
easiest and quickest one.  Feel free to change the patch as needed.

[0001-Print-list-terminating-backquote-and-comma-forms-spe.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72434; Package emacs. (Sat, 03 Aug 2024 01:46:01 GMT) Full text and rfc822 format available.

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

From: Thuna <thuna.cing <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#72434: [PATCH] Print list-ending comma/backquote forms
 specially
Date: Sat, 03 Aug 2024 03:44:30 +0200
> (This patch follows from 72334, but that patch is not necessary for this
> one to work.)

Actually, that is incorrect...-ish.  The specific problem happens when
you encounter a comma or comma-at while not inside a backquote.  With
72334 this is not a problem, but without it you end up with the
(unevaluated) form
  (foo bar . ,baz)
printed as
  (foo bar . (\, baz))
which is obviously not ideal.

It /should/ be possible to lightly change the patch to have it work, by
checking `new_backquote_output' in case the car is a comma or a comma-at
but honestly I would just rather 72334 be pushed instead.





This bug report was last modified 320 days ago.

Previous Next


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