GNU bug report logs -
#15538
24.3; Incorrect Expansion of Nested Backquote
Previous Next
Reported by: 白井 彰 <okshirai <at> gmail.com>
Date: Sun, 6 Oct 2013 11:24:02 UTC
Severity: normal
Found in version 24.3
Fixed in version 24.4
Done: Glenn Morris <rgm <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15538 in the body.
You can then email your comments to 15538 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15538
; Package
emacs
.
(Sun, 06 Oct 2013 11:24:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
白井 彰 <okshirai <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 06 Oct 2013 11:24:04 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
The expansion of nested backquote like
``(,,@q)
or
``(,@,@q)
is incorrect.
Please see the following results.
; The followings are from CLtL2 Appendix C. Backquote
(require 'cl-lib)
cl-lib
(setq q '(r s))
(r s)
(defun r (x) (cl-reduce #'* x))
r
(setq r '(3 5))
(3 5)
(setq s '(4 6))
(4 6)
``(,,q)
(\` ((\, (r s))))
(24) ; Correct
``(,@,q)
(\` ((\,@ (r s))))
24 ; Correct
``(,,@q)
(\` ((\, r s)))
((3 5)) ; Incorrect: This should be
((3 5) (4 6))
``(,@,@q)
(\` ((\,@ r s)))
(3 5) ; Incorrect: This should be (3
5 4 6)
(setq x '(b c))
(b c)
(setq y '(a b))
(a b)
(setq p '(cl-union x y))
(cl-union x y)
(setq q '((cl-union x y) (list 'sqrt 9)))
((cl-union x y) (list (quote sqrt) 9))
(setq r '(cl-union x y))
(cl-union x y)
(setq s '((cl-union x y)))
((cl-union x y))
``(foo ,,p)
(\` (foo (\, (cl-union x y))))
(foo (a b c)) ; Correct
``(foo ,,@q)
(\` (foo (\, (cl-union x y) (list (quote sqrt) 9))))
(foo (a b c)) ; Incorrect: This should be
(foo (a b c) (sqrt 9))
``(foo ,',r)
(\` (foo (\, (quote (cl-union x y)))))
(foo (cl-union x y)) ; Correct
``(foo ,',@s)
(\` (foo (\, (quote (cl-union x y)))))
(foo (cl-union x y)) ; Correct
``(foo ,@,p)
(\` (foo (\,@ (cl-union x y))))
(foo a b c) ; Correct
``(foo ,@,@q)
(\` (foo (\,@ (cl-union x y) (list (quote sqrt) 9))))
(foo a b c) ; Incorrect: This should be
(foo a b c sqrt 9)
``(foo ,@',r)
(\` (foo (\,@ (quote (cl-union x y)))))
(foo cl-union x y) ; Correct
``(foo ,@',@s)
(\` (foo (\,@ (quote (cl-union x y)))))
(foo cl-union x y) ; Correct
In GNU Emacs 24.3.1 (i386-apple-darwin9.8.0, NS apple-appkit-949.54)
of 2013-04-30 on mini2.local
Windowing system distributor `Apple', version 10.3.949
Configured using:
`configure '--with-ns' '--without-x''
Important settings:
value of $LANG: ja_JP.ujis
locale-coding-system: japanese-iso-8bit-unix
default enable-multibyte-characters: t
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
<escape> x r e p o r t - e m a c s - b u g <return>
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Load-path shadows:
None found.
Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils time-date japan-util tooltip ediff-hook
vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment lisp-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process ns multi-tty emacs)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15538
; Package
emacs
.
(Tue, 08 Oct 2013 04:31:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 15538 <at> debbugs.gnu.org (full text, mbox):
> ``(,,@q)
> (\` ((\, r s)))
> ((3 5)) ; Incorrect: This should be ((3 5)
> (4 6))
Indeed, it's incorrect, but I think the intention of the current code is
to consider the above expression as invalid, so the error is to return
a value at step 2 (ignoring the second argument `s' to the unquote)
instead of signalling an error.
If you really want that result, you can do
``(,@(list ,@q))
> ``(,@,@q)
And here, you'd have to use
``(,@(append ,@q))
I installed a patch into trunk which catches the above problems and
signals an error if/when encountering such situations.
Thank you,
Stefan
bug marked as fixed in version 24.4, send any further explanations to
15538 <at> debbugs.gnu.org and 白井 彰 <okshirai <at> gmail.com>
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Thu, 10 Oct 2013 00:39:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#15538
; Package
emacs
.
(Mon, 28 Oct 2013 22:48:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 15538 <at> debbugs.gnu.org (full text, mbox):
Stefan,
Is there any reason why double unquote/unquote-splicing can't work in
Emacs? A comment in your commit seems to suggest it's doable, so may I
ask why you decided not to implement it? I suspect many macro-writing
macros would be much more readable if they could be written as they
often are in Common Lisp.
Nathan
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 26 Nov 2013 12:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 11 years and 266 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.