From: Noam Postavsky <npostavs@gmail.com>
To: Stephen Berman <stephen.berman@gmx.net>
Cc: Joost Kremers <joostkremers@fastmail.fm>, 40180@debbugs.gnu.org
Subject: bug#40180: 27.0.90; cl-concatenate returns wrong result
Date: Sun, 22 Mar 2020 07:53:31 -0400 [thread overview]
Message-ID: <87v9mwk3lw.fsf@gmail.com> (raw)
In-Reply-To: <871rpksl5a.fsf@gmx.net> (Stephen Berman's message of "Sun, 22 Mar 2020 12:07:29 +0100")
[-- Attachment #1: Type: text/plain, Size: 540 bytes --]
tags 40180 + patch
quit
Stephen Berman <stephen.berman@gmx.net> writes:
> Similarly, (cl-concatenate 'vector '[a b c] '[d e f]) returns `[[a b c]
> [d e f]]' and worse, (cl-concatenate 'string "abc" "def") raises the
> error: Wrong type argument: characterp, "abc". This is because
> cl-concatenate is now defined in terms of seq-concatenate, which is
> defined by cl-defgeneric, which adds an extra pair of parens around the
> SEQUENCES argument
I think the problem is just that cl-concatenate should call
seq-concatenate with apply.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1682 bytes --]
From 97642d1265984c4a22023dc3ff6e8142a325598b Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sun, 22 Mar 2020 07:48:14 -0400
Subject: [PATCH] Fix cl-concatenate (Bug#40180)
* lisp/emacs-lisp/cl-extra.el (cl-concatenate): Use apply, to avoid
adding extra nesting of args.
* test/lisp/emacs-lisp/cl-extra-tests.el (cl-concatenate): New test.
---
| 2 +-
| 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
--git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el
index e9bfe8df5f..ce6fb625bc 100644
--- a/lisp/emacs-lisp/cl-extra.el
+++ b/lisp/emacs-lisp/cl-extra.el
@@ -556,7 +556,7 @@ cl-subseq
(defun cl-concatenate (type &rest sequences)
"Concatenate, into a sequence of type TYPE, the argument SEQUENCEs.
\n(fn TYPE SEQUENCE...)"
- (seq-concatenate type sequences))
+ (apply #'seq-concatenate type sequences))
;;; List functions.
--git a/test/lisp/emacs-lisp/cl-extra-tests.el b/test/lisp/emacs-lisp/cl-extra-tests.el
index 2d20ba75d2..7546c14937 100644
--- a/test/lisp/emacs-lisp/cl-extra-tests.el
+++ b/test/lisp/emacs-lisp/cl-extra-tests.el
@@ -99,4 +99,12 @@ cl-extra-test-cl-make-random-state
;; Test for Bug#33731.
(should-not (eq s (cl-make-random-state s)))))
+(ert-deftest cl-concatenate ()
+ (should (equal (cl-concatenate 'list '(1 2 3) '(4 5 6))
+ '(1 2 3 4 5 6)))
+ (should (equal (cl-concatenate 'vector [1 2 3] [4 5 6])
+ [1 2 3 4 5 6]))
+ (should (equal (cl-concatenate 'string "123" "456")
+ "123456")))
+
;;; cl-extra-tests.el ends here
--
2.11.0
next prev parent reply other threads:[~2020-03-22 11:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-22 9:01 bug#40180: 27.0.90; cl-concatenate returns wrong result Joost Kremers
2020-03-22 11:07 ` Stephen Berman
2020-03-22 11:53 ` Noam Postavsky [this message]
2020-03-22 12:00 ` Stephen Berman
2020-03-22 13:57 ` Eli Zaretskii
2020-03-23 3:14 ` Noam Postavsky
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87v9mwk3lw.fsf@gmail.com \
--to=npostavs@gmail.com \
--cc=40180@debbugs.gnu.org \
--cc=joostkremers@fastmail.fm \
--cc=stephen.berman@gmx.net \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.