From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Robin Templeton Newsgroups: gmane.emacs.bugs Subject: bug#19790: [PATCH] destructive splicing in backquote Date: Fri, 06 Feb 2015 01:39:02 -0500 Message-ID: <87a90r35o9.fsf@panthera.terpri.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1423205296 6779 80.91.229.3 (6 Feb 2015 06:48:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 6 Feb 2015 06:48:16 +0000 (UTC) To: 19790@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 06 07:48:15 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YJci6-0005d5-CH for geb-bug-gnu-emacs@m.gmane.org; Fri, 06 Feb 2015 07:48:14 +0100 Original-Received: from localhost ([::1]:46921 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJci5-0008B9-My for geb-bug-gnu-emacs@m.gmane.org; Fri, 06 Feb 2015 01:48:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57404) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJchz-0008AC-II for bug-gnu-emacs@gnu.org; Fri, 06 Feb 2015 01:48:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJchu-0001mN-Jc for bug-gnu-emacs@gnu.org; Fri, 06 Feb 2015 01:48:07 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43971) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJchu-0001mJ-Gx for bug-gnu-emacs@gnu.org; Fri, 06 Feb 2015 01:48:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YJchu-0003Eq-Ao for bug-gnu-emacs@gnu.org; Fri, 06 Feb 2015 01:48:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Robin Templeton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 06 Feb 2015 06:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 19790 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.142320524312377 (code B ref -1); Fri, 06 Feb 2015 06:48:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 6 Feb 2015 06:47:23 +0000 Original-Received: from localhost ([127.0.0.1]:35208 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YJchG-0003DX-JP for submit@debbugs.gnu.org; Fri, 06 Feb 2015 01:47:23 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:55190) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YJcfH-0003AE-Sp for submit@debbugs.gnu.org; Fri, 06 Feb 2015 01:45:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJcfB-0000t8-BF for submit@debbugs.gnu.org; Fri, 06 Feb 2015 01:45:14 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:41294) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJcfB-0000sz-8P for submit@debbugs.gnu.org; Fri, 06 Feb 2015 01:45:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56903) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJcf9-00082o-To for bug-gnu-emacs@gnu.org; Fri, 06 Feb 2015 01:45:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJcf4-0000pP-UY for bug-gnu-emacs@gnu.org; Fri, 06 Feb 2015 01:45:11 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:44841) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJcf4-0000ks-Ns for bug-gnu-emacs@gnu.org; Fri, 06 Feb 2015 01:45:06 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YJcf2-0004I4-Du for bug-gnu-emacs@gnu.org; Fri, 06 Feb 2015 07:45:04 +0100 Original-Received: from cpe-174-097-170-150.nc.res.rr.com ([174.97.170.150]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 06 Feb 2015 07:45:04 +0100 Original-Received: from robin by cpe-174-097-170-150.nc.res.rr.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 06 Feb 2015 07:45:04 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 65 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: cpe-174-097-170-150.nc.res.rr.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Cancel-Lock: sha1:7+q9SOkmScVqowfWCMrkx4130tQ= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Fri, 06 Feb 2015 01:47:20 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:99091 Archived-At: 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 . -- >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 + + * 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 * 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