unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#19790: [PATCH] destructive splicing in backquote
@ 2015-02-06  6:39 Robin Templeton
  2015-02-06 15:29 ` Stefan Monnier
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Robin Templeton @ 2015-02-06  6:39 UTC (permalink / raw)
  To: 19790

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







^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2019-09-26 16:38 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-06  6:39 bug#19790: [PATCH] destructive splicing in backquote Robin Templeton
2015-02-06 15:29 ` 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

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).