GNU bug report logs -
#61281
“`(a \, b)” equals to “`(a . ,b)”
Previous Next
Full log
Message #62 received at 61281 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Xie Shynur <one.last.kiss <at> 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:
[0001-lisp-emacs-lisp-backquote.el-Small-fix-in-commentary.patch (text/x-diff, inline)]
From 7c8bc97263a1b6d009a11b32d6e62e82fe14e997 Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen <at> 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
[Message part 3 (text/plain, inline)]
Thanks,
Michael.
This bug report was last modified 2 years and 127 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.