bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61281: “`(a \, b)” equals to “`(a . , b)”


From: Michael Heerdegen
Subject: bug#61281: “`(a \, b)” equals to “`(a . , b)”
Date: Mon, 06 Feb 2023 05:11:04 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Xie Shynur <one.last.kiss@outlook.com> writes:

> ELISP> `(emacs-version \, emacs-version)
> (emacs-version . "28.2")

> ```
> (custom-set-variables
>  '(var `(a . ,b)))
> ```
>
> Then change some options by GUI menu, and click `Save Options`:
>
> ```
> (custom-set-variables
>  '(var `(a \, b))
>  '(changed-option new-value))
> ```

> Is it a feature or bug?

It doesn't harm (it's not wrong), you see an implementation detail
exposed, but it's not nice either.

After discussing this and peripheral stuff with others I would suggest
(I try to give a complete summary of the useful suggestions here) to do
these things:


(1) We should try to teach the printer to prefer the syntax
(... . ,X) over (... \, X).  The latter is equivalent but in most
cases the first version will be easier to interpret.  This would fix
the above case about saving custom variables (readability).


(2) We should (in the recently added function docstrings and the manual)
explain that the reader constructs `X, ,X and ,@X are expanded to (or
equivalent to) (\` X), (\, X) and (\,@ X) respectively, where the cars
are the symbols with the names "`", "," and ",@".

While this is an implementation detail, not knowing about that fact
leaves the semantics of expressions like above unclear, which is not
good.


(3) Fix the header in backquote.el as suggested by Drew, e.g. like this:

From 7c8bc97263a1b6d009a11b32d6e62e82fe14e997 Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen@web.de>
Date: Mon, 6 Feb 2023 04:47:12 +0100
Subject: [PATCH] ; * lisp/emacs-lisp/backquote.el: Small fix in commentary

---
 lisp/emacs-lisp/backquote.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/backquote.el b/lisp/emacs-lisp/backquote.el
index 84527234207..de14b5cd42f 100644
--- a/lisp/emacs-lisp/backquote.el
+++ b/lisp/emacs-lisp/backquote.el
@@ -25,9 +25,9 @@

 ;;; Commentary:

-;; When the Lisp reader sees `(...), it generates (\` (...)).
-;; When it sees ,... inside such a backquote form, it generates (\, ...).
-;; For ,@... it generates (\,@ ...).
+;; When the Lisp reader sees `X it generates (\` X).
+;; When it sees ,X it generates (\, X).  For ,@X it generates
+;; (\,@ X).

 ;; This backquote will generate calls to the backquote-list* form.
 ;; Both a function version and a macro version are included.
--
2.30.2


Thanks,

Michael.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]