GNU bug report logs -
#40180
27.0.90; cl-concatenate returns wrong result
Previous Next
Reported by: Joost Kremers <joostkremers <at> fastmail.fm>
Date: Sun, 22 Mar 2020 09:02:01 UTC
Severity: normal
Tags: fixed, patch
Found in version 27.0.90
Fixed in version 27.1
Done: Noam Postavsky <npostavs <at> gmail.com>
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 40180 in the body.
You can then email your comments to 40180 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#40180
; Package
emacs
.
(Sun, 22 Mar 2020 09:02:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Joost Kremers <joostkremers <at> fastmail.fm>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 22 Mar 2020 09:02:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
`cl-concatenate` seems to return the wrong result:
```
ELISP> (cl-concatenate 'list '(a b c) '(d e f))
((a b c)
(d e f))
```
In Emacs 26 the return value was `(a b c d e f)`, which I assume
should still be the return value in Emacs 27, given that Common
Lisp hasn't changed. :-)
In GNU Emacs 27.0.90 (build 2, x86_64-pc-linux-gnu, GTK+ Version
3.22.30)
of 2020-03-11 built on IdeaPad
Repository revision: 1bc3fa0bd02cb167ae82b65fc56f95651d2bea16
Repository branch: emacs-27
Windowing system distributor 'The X.Org Foundation', version
11.0.11906000
System Description: elementary OS 5.1.2 Hera
Recent messages:
Mark set
Auto-saving...
Mark set
Saving file
/home/joost/Mail/Fastmail/Drafts/cur/1584867450.a5b0e4c5936e9702.ideapad:2,DS...
Wrote
/home/joost/Mail/Fastmail/Drafts/cur/1584867450.a5b0e4c5936e9702.ideapad:2,DS
[mu4e] Saved (30 lines)
Detected language: English
Saving file
/home/joost/Mail/Fastmail/Drafts/cur/1584867450.a5b0e4c5936e9702.ideapad:2,DS...
Wrote
/home/joost/Mail/Fastmail/Drafts/cur/1584867450.a5b0e4c5936e9702.ideapad:2,DS
[mu4e] Saved (31 lines)
Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND DBUS GSETTINGS GLIB NOTIFY
INOTIFY GNUTLS
LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11
XDBE XIM MODULES THREADS PDUMPER LCMS2 GMP
Important settings:
value of $LC_MONETARY: en_IE.UTF-8
value of $LC_NUMERIC: en_IE.UTF-8
value of $LC_TIME: en_IE.UTF-8
value of $LANG: en_GB.UTF-8
value of $XMODIFIERS: @im=ibus
locale-coding-system: utf-8-unix
Major mode: IELM
Minor modes in effect:
global-magit-file-mode: t
magit-auto-revert-mode: t
global-git-commit-mode: t
async-bytecomp-package-mode: t
shell-dirtrack-mode: t
flycheck-indicator-mode: t
company-box-mode: t
minions-mode: t
doom-modeline-mode: t
which-key-mode: t
global-undo-tree-mode: t
undo-tree-mode: t
global-atomic-chrome-edit-mode: t
ivy-mode: t
recentf-mode: t
pyvenv-mode: t
projectile-mode: t
global-diff-hl-mode: t
electric-pair-mode: t
TeX-PDF-mode: t
TeX-source-correlate-mode: t
company-quickhelp-mode: t
company-quickhelp-local-mode: t
global-company-mode: t
company-mode: t
show-paren-mode: t
delete-selection-mode: t
override-global-mode: t
tooltip-mode: t
global-eldoc-mode: t
eldoc-mode: t
mouse-wheel-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
column-number-mode: t
line-number-mode: t
transient-mark-mode: t
auto-save-visited-mode: t
Load-path shadows:
~/.emacs.d/lisp/custom hides
/usr/local/share/emacs/27.0.90/lisp/custom
Features:
(shadow emacsbug mail-extr forge-list forge-commands forge-semi
forge-bitbucket
buck forge-gogs gogs forge-gitea gtea forge-gitlab glab
forge-github
ghub-graphql treepy gsexp ghub forge-notify forge-revnote
forge-pullreq
forge-issue forge-topic bug-reference forge-post forge-repo forge
forge-core
forge-db closql emacsql-sqlite emacsql emacsql-compiler url-http
url-auth url-gw
magit-bookmark magit-submodule magit-obsolete magit-blame
magit-stash
magit-reflog magit-bisect magit-push magit-pull magit-fetch
magit-clone
magit-remote magit-commit magit-sequence magit-notes
magit-worktree magit-tag
magit-merge magit-branch magit-reset magit-files magit-refs
magit-status magit
magit-repos magit-apply magit-wip magit-log which-func magit-diff
smerge-mode
magit-core magit-autorevert magit-margin magit-transient
magit-process
magit-mode git-commit magit-git magit-section magit-utils log-edit
pcvs-util
add-log with-editor async-bytecomp async org-mu4e gnus-dired mu4e
desktop
frameset mu4e-org org-clock org org-macro org-footnote
org-pcomplete org-list
org-faces org-entities org-version ob-scheme ob-clojure ob-python
ob ob-tangle
org-src ob-ref ob-lob ob-table ob-exp ob-comint ob-emacs-lisp
ob-core ob-eval ol
org-loaddefs mu4e-main mu4e-view cal-menu calendar cal-loaddefs
mu4e-headers
mu4e-compose mu4e-context mu4e-draft mu4e-actions ido rfc2368
smtpmail sendmail
mu4e-mark mu4e-message flow-fill mu4e-proc mu4e-utils doc-view
jka-compr
image-mode exif mu4e-lists mu4e-vars message rfc822 mml mml-sec
epa derived epg
epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies
mm-encode
mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr
mailabbrev
mail-utils gmm-utils mailheader mu4e-meta visual-fill-column
mixed-pitch
cl-print view lsp-yaml lsp-xml lsp-vhdl lsp-vetur lsp-html
lsp-verilog
lsp-terraform lsp-solargraph lsp-rust lsp-python-ms lsp-pyls
lsp-pwsh lsp-perl
lsp-metals lsp-json url url-proxy url-privacy url-expand
url-methods url-history
mailcap lsp-intelephense lsp-haxe lsp-go lsp-gdscript lsp-fsharp
lsp-eslint
lsp-erlang lsp-elm lsp-dls lsp-dart lsp-css lsp-csharp gnutls
lsp-clojure
lsp-clients py-autopep8 python-pytest magit-popup python tramp-sh
tramp
tramp-loaddefs trampver tramp-integration files-x tramp-compat
shell parse-time
iso8601 time-date ls-lisp mule-util multiple-cursors-core rect
pcmpl-unix edebug
backtrace vc-git bookmark text-property-search face-remap el-spice
list-callers
flycheck-indicator hl-line jk-input-methods quail em-unix em-term
term
disp-table ehelp em-script em-prompt em-ls em-hist em-pred em-dirs
esh-var
em-cmpl pcomplete em-basic em-banner em-alias esh-mode company-box
company-box-doc company-box-icons ielm pp minions doom-modeline
doom-modeline-segments doom-modeline-env doom-modeline-core
shrink-path
which-key undo-tree diff solarized-light-theme solarized-theme
solarized
solarized-faces atomic-chrome websocket url-cookie url-domsuf
iimage image+
image-file swiper ivy-hydra all-the-icons-ivy ivy colir
ivy-overlay recentf
poetry pyvenv transient paredit clojure-mode lisp-mnt align
eldoc-box
company-lsp lsp-ui lsp-ui-flycheck lsp-ui-doc goto-addr
lsp-ui-imenu lsp-ui-peek
lsp-ui-sideline flycheck-posframe posframe flycheck lsp-mode
url-util
tree-widget network-stream puny nsm rmc markdown-mode rx color
noutline outline
inline imenu ht f em-glob dash-functional bindat ag vc-svn
find-dired s
projectile grep ibuf-ext ibuffer ibuffer-loaddefs diff-hl vc-dir
ewoc vc
vc-dispatcher diff-mode autorevert filenotify aggressive-indent
elec-pair
nswbuff guess-language flyspell ispell find-func ace-window avy
dired
dired-loaddefs reftex reftex-loaddefs reftex-vars company-auctex
yasnippet latex
latex-flymake flymake-proc flymake compile comint ansi-color
warnings thingatpt
tex-ispell tex-style tex crm company-quickhelp pos-tip
all-the-icons
all-the-icons-faces data-material data-weathericons data-octicons
data-fileicons
data-faicons data-alltheicons memoize company-oddmuse
company-keywords
company-etags etags fileloop generator xref project company-gtags
company-dabbrev-code company-dabbrev company-files company-capf
company-cmake
company-xcode company-clang company-semantic company-template
company-css
company-bbdb company tab-jump-out adaptive-wrap bm paradox
paradox-menu
paradox-commit-list hydra ring lv cus-edit wid-edit
paradox-execute
paradox-github paradox-core spinner cl-extra help-mode
jk-functions let-alist
org-table org-keys org-compat org-macs format-spec pcase advice
eshell esh-cmd
esh-ext esh-opt esh-proc esh-io esh-arg esh-module esh-groups
esh-util
notifications dbus xml dash edmacro kmacro server paren delsel
cus-start
cus-load use-package use-package-ensure use-package-delight
use-package-diminish
use-package-bind-key bind-key easy-mmode use-package-core
finder-inf tex-site
info package easymenu browse-url url-handlers url-parse
auth-source cl-seq eieio
eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
url-vars seq
byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib tooltip
eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode
register page tab-bar menu-bar rfn-eshadow isearch timer select
scroll-bar mouse
jit-lock font-lock syntax facemenu font-core term/tty-colors frame
minibuffer
cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet
lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak
czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table
epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded
nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1
md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty
make-network-process
emacs)
Memory information:
((conses 16 667592 42193)
(symbols 48 51699 1)
(strings 32 212155 6674)
(string-bytes 1 6356856)
(vectors 16 84841)
(vector-slots 8 1171666 58618)
(floats 8 1100 424)
(intervals 56 3076 1774)
(buffers 1000 36))
--
Joost Kremers
Life has its moments
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#40180
; Package
emacs
.
(Sun, 22 Mar 2020 11:08:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 40180 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Sun, 22 Mar 2020 10:01:34 +0100 Joost Kremers <joostkremers <at> fastmail.fm> wrote:
> `cl-concatenate` seems to return the wrong result:
>
> ```
> ELISP> (cl-concatenate 'list '(a b c) '(d e f))
> ((a b c) (d e f))
> ```
>
> In Emacs 26 the return value was `(a b c d e f)`, which I assume should still
> be the return value in Emacs 27, given that Common Lisp hasn't changed. :-)
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. Hence, the following patch restores the correct
pre-27 behavior:
[Message part 2 (text/x-patch, inline)]
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el
index e3037a7190..adfb63dba8 100644
--- a/lisp/emacs-lisp/seq.el
+++ b/lisp/emacs-lisp/seq.el
@@ -289,11 +289,12 @@ seq-concatenate
TYPE must be one of following symbols: vector, string or list.
\n(fn TYPE SEQUENCE...)"
- (pcase type
- ('vector (apply #'vconcat sequences))
- ('string (apply #'concat sequences))
- ('list (apply #'append (append sequences '(nil))))
- (_ (error "Not a sequence type name: %S" type))))
+ (let ((sequences (car sequences)))
+ (pcase type
+ ('vector (apply #'vconcat sequences))
+ ('string (apply #'concat sequences))
+ ('list (apply #'append (append sequences '(nil))))
+ (_ (error "Not a sequence type name: %S" type)))))
(cl-defgeneric seq-into-sequence (sequence)
"Convert SEQUENCE into a sequence.
[Message part 3 (text/plain, inline)]
Maybe cl-defgeneric should be fixed instead, but I don't understand it
well enough to do so.
Steve Berman
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#40180
; Package
emacs
.
(Sun, 22 Mar 2020 11:54:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 40180 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
tags 40180 + patch
quit
Stephen Berman <stephen.berman <at> 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.
[0001-Fix-cl-concatenate-Bug-40180.patch (text/x-diff, inline)]
From 97642d1265984c4a22023dc3ff6e8142a325598b Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> 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.
---
lisp/emacs-lisp/cl-extra.el | 2 +-
test/lisp/emacs-lisp/cl-extra-tests.el | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --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.
diff --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
Added tag(s) patch.
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Sun, 22 Mar 2020 11:54:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#40180
; Package
emacs
.
(Sun, 22 Mar 2020 12:01:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 40180 <at> debbugs.gnu.org (full text, mbox):
On Sun, 22 Mar 2020 07:53:31 -0400 Noam Postavsky <npostavs <at> gmail.com> wrote:
> tags 40180 + patch
> quit
>
> Stephen Berman <stephen.berman <at> 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.
Oh, yes, of course.
Steve Berman
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#40180
; Package
emacs
.
(Sun, 22 Mar 2020 13:58:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 40180 <at> debbugs.gnu.org (full text, mbox):
> From: Noam Postavsky <npostavs <at> gmail.com>
> Date: Sun, 22 Mar 2020 07:53:31 -0400
> Cc: Joost Kremers <joostkremers <at> fastmail.fm>, 40180 <at> debbugs.gnu.org
>
> Stephen Berman <stephen.berman <at> 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.
Thanks, please push this to the emacs-27 branch.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#40180
; Package
emacs
.
(Mon, 23 Mar 2020 03:15:01 GMT)
Full text and
rfc822 format available.
Message #22 received at 40180 <at> debbugs.gnu.org (full text, mbox):
tags 40180 fixed
close 40180 27.1
quit
Eli Zaretskii <eliz <at> gnu.org> writes:
> Thanks, please push this to the emacs-27 branch.
Done.
[1: 9ab85f087f]: 2020-03-22 23:06:31 -0400
Fix cl-concatenate (Bug#40180)
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=9ab85f087f7db38168dcf07d24f51ecd2c583f8a
Added tag(s) fixed.
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Mon, 23 Mar 2020 03:15:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 27.1, send any further explanations to
40180 <at> debbugs.gnu.org and Joost Kremers <joostkremers <at> fastmail.fm>
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Mon, 23 Mar 2020 03:15:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 20 Apr 2020 11:24:09 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 63 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.