From: Robin Templeton <robin@terpri.org>
To: 19790@debbugs.gnu.org
Subject: bug#19790: [PATCH] destructive splicing in backquote
Date: Fri, 06 Feb 2015 01:39:02 -0500 [thread overview]
Message-ID: <87a90r35o9.fsf@panthera.terpri.org> (raw)
Common Lisp and MACLISP define comma-dot syntax for destructive splicing
in backquote expressions. The Elisp reader reads ",.x" as "(\,\. x)"
(like ",@"), but the resulting forms are not processed by the backquote
library. A patch follows that adds CL-compatible comma-dot support.
Originally reported by at Artur Malabarba in
<http://lists.gnu.org/archive/html/emacs-devel/2015-01/msg00624.html>.
-- >8 --
Subject: [PATCH] destructive splicing in backquote
Allow Common Lisp-compatible destructive splicing in backquote
expressions using ",." syntax.
* lisp/emacs-lisp/backquote.el (backquote-destructive-splice-symbol):
New variable.
(backquote-process): Allow backquote-destructive-splice-symbol as a
synonym for backquote-splice-symbol.
---
lisp/ChangeLog | 7 +++++++
lisp/emacs-lisp/backquote.el | 6 +++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c18a8ff..fd643ed 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2015-02-06 Robin Templeton <robin@terpri.org>
+
+ * emacs-lisp/backquote.el (backquote-destructive-splice-symbol):
+ New variable.
+ (backquote-process): Allow backquote-destructive-splice-symbol as
+ a synonym for backquote-splice-symbol.
+
2015-02-03 Artur Malabarba <bruce.connor.am@gmail.com>
* emacs-lisp/package.el (package-delete): Document NOSAVE.
diff --git a/lisp/emacs-lisp/backquote.el b/lisp/emacs-lisp/backquote.el
index d5cdca2..b6e1792 100644
--- a/lisp/emacs-lisp/backquote.el
+++ b/lisp/emacs-lisp/backquote.el
@@ -90,6 +90,9 @@ For example (backquote-list* 'a 'b 'c) => (a b . c)"
(defconst backquote-splice-symbol '\,@
"Symbol used to represent a splice inside a backquote.")
+(defconst backquote-destructive-splice-symbol '\,.
+ "Symbol used to represent a destructive splice inside a backquote.")
+
(defmacro backquote (structure)
"Argument STRUCTURE describes a template to build.
@@ -160,7 +163,8 @@ LEVEL is only used internally and indicates the nesting level:
(t (cons (if (eq (car-safe (nth 1 s)) 'quote) 0 1)
(nth 1 s))))
(backquote-delay-process s (1- level))))
- ((eq (car s) backquote-splice-symbol)
+ ((or (eq (car s) backquote-splice-symbol)
+ (eq (car s) backquote-destructive-splice-symbol))
(if (<= level 0)
(if (> (length s) 2)
;; (cons 2 `(append . ,(cdr s)))
--
2.1.4
next reply other threads:[~2015-02-06 6:39 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-06 6:39 Robin Templeton [this message]
2015-02-06 15:29 ` bug#19790: [PATCH] destructive splicing in backquote Stefan Monnier
2015-02-07 18:51 ` Robin Templeton
2015-02-07 21:46 ` Robin Templeton
2015-02-08 19:23 ` Stefan Monnier
2015-02-08 19:38 ` Artur Malabarba
2015-02-09 3:10 ` Stefan Monnier
2015-02-09 13:03 ` Artur Malabarba
2016-02-23 11:08 ` Lars Ingebrigtsen
2019-06-25 17:59 ` Lars Ingebrigtsen
2019-06-25 22:52 ` Michael Heerdegen
2019-09-13 23:59 ` Stefan Kangas
2019-09-14 7:15 ` Eli Zaretskii
2019-09-14 12:31 ` Stefan Kangas
2019-09-14 13:30 ` Eli Zaretskii
2019-09-15 14:55 ` Stefan Kangas
2019-09-15 1:46 ` Stefan Monnier
2019-09-15 14:57 ` Stefan Kangas
2019-09-26 16:38 ` Stefan Kangas
2019-09-14 12:07 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a90r35o9.fsf@panthera.terpri.org \
--to=robin@terpri.org \
--cc=19790@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).